You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepositoryContentConsumersTest.java 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. package org.apache.archiva.repository.scanner;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import junit.framework.TestCase;
  21. import org.apache.archiva.configuration.ArchivaConfiguration;
  22. import org.apache.archiva.consumers.InvalidRepositoryContentConsumer;
  23. import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
  24. import org.apache.archiva.repository.base.managed.BasicManagedRepository;
  25. import org.apache.archiva.repository.base.remote.BasicRemoteRepository;
  26. import org.apache.archiva.repository.ManagedRepository;
  27. import org.apache.archiva.repository.RemoteRepository;
  28. import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
  29. import org.apache.commons.lang3.SystemUtils;
  30. import org.easymock.IMocksControl;
  31. import org.junit.Test;
  32. import org.junit.runner.RunWith;
  33. import org.springframework.beans.BeansException;
  34. import org.springframework.beans.factory.BeanFactory;
  35. import org.springframework.beans.factory.NoSuchBeanDefinitionException;
  36. import org.springframework.beans.factory.ObjectProvider;
  37. import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
  38. import org.springframework.context.ApplicationContext;
  39. import org.springframework.context.ApplicationEvent;
  40. import org.springframework.context.MessageSourceResolvable;
  41. import org.springframework.context.NoSuchMessageException;
  42. import org.springframework.core.ResolvableType;
  43. import org.springframework.core.env.Environment;
  44. import org.springframework.core.io.Resource;
  45. import org.springframework.test.context.ContextConfiguration;
  46. import javax.inject.Inject;
  47. import java.io.IOException;
  48. import java.lang.annotation.Annotation;
  49. import java.net.URI;
  50. import java.net.URISyntaxException;
  51. import java.nio.file.Path;
  52. import java.nio.file.Paths;
  53. import java.util.Arrays;
  54. import java.util.Collections;
  55. import java.util.Date;
  56. import java.util.HashMap;
  57. import java.util.List;
  58. import java.util.Locale;
  59. import java.util.Map;
  60. import java.util.function.Function;
  61. import static org.easymock.EasyMock.*;
  62. /**
  63. * RepositoryContentConsumersTest
  64. */
  65. @RunWith( ArchivaSpringJUnit4ClassRunner.class )
  66. @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
  67. public class RepositoryContentConsumersTest
  68. extends TestCase
  69. {
  70. @Inject
  71. ApplicationContext applicationContext;
  72. protected ManagedRepository createRepository( String id, String name, Path location ) throws IOException {
  73. BasicManagedRepository repo = BasicManagedRepository.newFilesystemInstance(id, name, location.getParent().resolve(id));
  74. repo.setLocation( location.toAbsolutePath().toUri() );
  75. return repo;
  76. }
  77. protected RemoteRepository createRemoteRepository( String id, String name, String url ) throws URISyntaxException, IOException {
  78. BasicRemoteRepository repo = BasicRemoteRepository.newFilesystemInstance(id, name, Paths.get("remotes"));
  79. repo.setLocation( new URI( url ) );
  80. return repo;
  81. }
  82. private RepositoryContentConsumers lookupRepositoryConsumers()
  83. throws Exception
  84. {
  85. ArchivaConfiguration configuration =
  86. applicationContext.getBean( "archivaConfiguration#test-conf", ArchivaConfiguration.class );
  87. ArchivaAdministrationStub administrationStub = new ArchivaAdministrationStub( configuration );
  88. RepositoryContentConsumers consumerUtilStub = new RepositoryContentConsumersStub( administrationStub );
  89. RepositoryContentConsumers consumerUtil =
  90. applicationContext.getBean( "repositoryContentConsumers#test", RepositoryContentConsumers.class );
  91. ApplicationContext context = new MockApplicationContext( consumerUtil.getAvailableKnownConsumers(), //
  92. consumerUtil.getAvailableInvalidConsumers() );
  93. consumerUtilStub.setApplicationContext( context );
  94. consumerUtilStub.setSelectedInvalidConsumers( consumerUtil.getSelectedInvalidConsumers() );
  95. consumerUtilStub.setSelectedKnownConsumers( consumerUtil.getSelectedKnownConsumers() );
  96. consumerUtilStub.setArchivaAdministration( administrationStub );
  97. assertNotNull( "RepositoryContentConsumers should not be null.", consumerUtilStub );
  98. return consumerUtilStub;
  99. }
  100. @Test
  101. public void testGetSelectedKnownIds()
  102. throws Exception
  103. {
  104. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  105. String expectedKnownIds[] =
  106. new String[]{ "create-missing-checksums", "validate-checksum", "validate-signature", "index-content",
  107. "auto-remove", "auto-rename", "create-archiva-metadata", "duplicate-artifacts" };
  108. //update-db-artifact, create-missing-checksums, update-db-repository-metadata,
  109. //validate-checksum, validate-signature, index-content, auto-remove, auto-rename,
  110. //metadata-updater
  111. List<String> knownConsumers = consumerutil.getSelectedKnownConsumerIds();
  112. assertNotNull( "Known Consumer IDs should not be null", knownConsumers );
  113. assertEquals( "Known Consumer IDs.size " + knownConsumers, expectedKnownIds.length, knownConsumers.size() );
  114. for ( String expectedId : expectedKnownIds )
  115. {
  116. assertTrue( "Known id [" + expectedId + "] exists.", knownConsumers.contains( expectedId ) );
  117. }
  118. }
  119. @Test
  120. public void testGetSelectedInvalidIds()
  121. throws Exception
  122. {
  123. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  124. String expectedInvalidIds[] = new String[]{ "update-db-bad-content" };
  125. List<String> invalidConsumers = consumerutil.getSelectedInvalidConsumerIds();
  126. assertNotNull( "Invalid Consumer IDs should not be null", invalidConsumers );
  127. assertEquals( "Invalid Consumer IDs.size", expectedInvalidIds.length, invalidConsumers.size() );
  128. for ( String expectedId : expectedInvalidIds )
  129. {
  130. assertTrue( "Invalid id [" + expectedId + "] exists.", invalidConsumers.contains( expectedId ) );
  131. }
  132. }
  133. @Test
  134. public void testGetSelectedKnownConsumerMap()
  135. throws Exception
  136. {
  137. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  138. String expectedSelectedKnownIds[] =
  139. new String[]{ "create-missing-checksums", "validate-checksum", "index-content", "auto-remove",
  140. "auto-rename" };
  141. Map<String, KnownRepositoryContentConsumer> knownConsumerMap = consumerutil.getSelectedKnownConsumersMap();
  142. assertNotNull( "Known Consumer Map should not be null", knownConsumerMap );
  143. assertEquals( "Known Consumer Map.size but " + knownConsumerMap, expectedSelectedKnownIds.length,
  144. knownConsumerMap.size() );
  145. for ( String expectedId : expectedSelectedKnownIds )
  146. {
  147. KnownRepositoryContentConsumer consumer = knownConsumerMap.get( expectedId );
  148. assertNotNull( "Known[" + expectedId + "] should not be null.", consumer );
  149. assertEquals( "Known[" + expectedId + "].id", expectedId, consumer.getId() );
  150. }
  151. }
  152. @Test
  153. public void testGetSelectedInvalidConsumerMap()
  154. throws Exception
  155. {
  156. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  157. String expectedSelectedInvalidIds[] = new String[]{ "update-db-bad-content" };
  158. Map<String, InvalidRepositoryContentConsumer> invalidConsumerMap =
  159. consumerutil.getSelectedInvalidConsumersMap();
  160. assertNotNull( "Invalid Consumer Map should not be null", invalidConsumerMap );
  161. assertEquals( "Invalid Consumer Map.size", expectedSelectedInvalidIds.length, invalidConsumerMap.size() );
  162. for ( String expectedId : expectedSelectedInvalidIds )
  163. {
  164. InvalidRepositoryContentConsumer consumer = invalidConsumerMap.get( expectedId );
  165. assertNotNull( "Known[" + expectedId + "] should not be null.", consumer );
  166. assertEquals( "Known[" + expectedId + "].id", expectedId, consumer.getId() );
  167. }
  168. }
  169. @Test
  170. public void testGetAvailableKnownList()
  171. throws Exception
  172. {
  173. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  174. String expectedKnownIds[] =
  175. new String[]{ "update-db-artifact", "create-missing-checksums", "update-db-repository-metadata",
  176. "validate-checksum", "index-content", "auto-remove", "auto-rename", "available-but-unselected" };
  177. List<KnownRepositoryContentConsumer> knownConsumers = consumerutil.getAvailableKnownConsumers();
  178. assertNotNull( "known consumers should not be null.", knownConsumers );
  179. assertEquals( "known consumers", expectedKnownIds.length, knownConsumers.size() );
  180. List<String> expectedIds = Arrays.asList( expectedKnownIds );
  181. for ( KnownRepositoryContentConsumer consumer : knownConsumers )
  182. {
  183. assertTrue( "Consumer [" + consumer.getId() + "] returned by .getAvailableKnownConsumers() is unexpected.",
  184. expectedIds.contains( consumer.getId() ) );
  185. }
  186. }
  187. @Test
  188. public void testGetAvailableInvalidList()
  189. throws Exception
  190. {
  191. RepositoryContentConsumers consumerutil = lookupRepositoryConsumers();
  192. String expectedInvalidIds[] = new String[]{ "update-db-bad-content", "move-to-trash-then-notify" };
  193. List<InvalidRepositoryContentConsumer> invalidConsumers = consumerutil.getAvailableInvalidConsumers();
  194. assertNotNull( "invalid consumers should not be null.", invalidConsumers );
  195. assertEquals( "invalid consumers", expectedInvalidIds.length, invalidConsumers.size() );
  196. List<String> expectedIds = Arrays.asList( expectedInvalidIds );
  197. for ( InvalidRepositoryContentConsumer consumer : invalidConsumers )
  198. {
  199. assertTrue(
  200. "Consumer [" + consumer.getId() + "] returned by .getAvailableInvalidConsumers() is unexpected.",
  201. expectedIds.contains( consumer.getId() ) );
  202. }
  203. }
  204. @Test
  205. public void testExecution()
  206. throws Exception
  207. {
  208. IMocksControl knownControl = createNiceControl();
  209. RepositoryContentConsumers consumers = lookupRepositoryConsumers();
  210. KnownRepositoryContentConsumer selectedKnownConsumer =
  211. knownControl.createMock( KnownRepositoryContentConsumer.class );
  212. KnownRepositoryContentConsumer unselectedKnownConsumer =
  213. createNiceControl().createMock( KnownRepositoryContentConsumer.class );
  214. consumers.setApplicationContext(
  215. new MockApplicationContext( Arrays.asList( selectedKnownConsumer, unselectedKnownConsumer ), null ) );
  216. consumers.setSelectedKnownConsumers( Collections.singletonList( selectedKnownConsumer ) );
  217. IMocksControl invalidControl = createControl();
  218. InvalidRepositoryContentConsumer selectedInvalidConsumer =
  219. invalidControl.createMock( InvalidRepositoryContentConsumer.class );
  220. InvalidRepositoryContentConsumer unselectedInvalidConsumer =
  221. createControl().createMock( InvalidRepositoryContentConsumer.class );
  222. consumers.setApplicationContext(
  223. new MockApplicationContext( null, Arrays.asList( selectedInvalidConsumer, unselectedInvalidConsumer ) ) );
  224. consumers.setSelectedInvalidConsumers( Collections.singletonList( selectedInvalidConsumer ) );
  225. ManagedRepository repo = createRepository( "id", "name", Paths.get( "target/test-repo" ) );
  226. Path testFile = Paths.get( "target/test-repo/path/to/test-file.txt" );
  227. Date startTime = new Date( System.currentTimeMillis() );
  228. startTime.setTime( 12345678 );
  229. selectedKnownConsumer.beginScan( repo, startTime, false );
  230. expect( selectedKnownConsumer.getIncludes() ).andReturn( Collections.singletonList( "**/*.txt" ) );
  231. selectedKnownConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
  232. knownControl.replay();
  233. selectedInvalidConsumer.beginScan( repo, startTime, false );
  234. invalidControl.replay();
  235. consumers.executeConsumers( repo, testFile, true );
  236. knownControl.verify();
  237. invalidControl.verify();
  238. knownControl.reset();
  239. invalidControl.reset();
  240. Path notIncludedTestFile = Paths.get( "target/test-repo/path/to/test-file.xml" );
  241. selectedKnownConsumer.beginScan( repo, startTime, false );
  242. expect( selectedKnownConsumer.getExcludes() ).andReturn( Collections.<String>emptyList() );
  243. expect( selectedKnownConsumer.getIncludes() ).andReturn( Collections.singletonList( "**/*.txt" ) );
  244. knownControl.replay();
  245. selectedInvalidConsumer.beginScan( repo, startTime, false );
  246. selectedInvalidConsumer.processFile( _OS( "path/to/test-file.xml" ), false );
  247. expect( selectedInvalidConsumer.getId() ).andReturn( "invalid" );
  248. invalidControl.replay();
  249. consumers.executeConsumers( repo, notIncludedTestFile, true );
  250. knownControl.verify();
  251. invalidControl.verify();
  252. knownControl.reset();
  253. invalidControl.reset();
  254. Path excludedTestFile = Paths.get( "target/test-repo/path/to/test-file.txt" );
  255. selectedKnownConsumer.beginScan( repo, startTime, false );
  256. expect( selectedKnownConsumer.getExcludes() ).andReturn( Collections.singletonList( "**/test-file.txt" ) );
  257. knownControl.replay();
  258. selectedInvalidConsumer.beginScan( repo, startTime, false );
  259. selectedInvalidConsumer.processFile( _OS( "path/to/test-file.txt" ), false );
  260. expect( selectedInvalidConsumer.getId() ).andReturn( "invalid" );
  261. invalidControl.replay();
  262. consumers.executeConsumers( repo, excludedTestFile, true );
  263. knownControl.verify();
  264. invalidControl.verify();
  265. }
  266. /**
  267. * Create an OS specific version of the filepath.
  268. * Provide path in unix "/" format.
  269. */
  270. private String _OS( String path )
  271. {
  272. if ( SystemUtils.IS_OS_WINDOWS )
  273. {
  274. return path.replace( '/', '\\' );
  275. }
  276. return path;
  277. }
  278. private static <T> Map<String, T> convertToMap( List<T> objects)
  279. {
  280. HashMap<String,T> map = new HashMap<>();
  281. for ( T o : objects )
  282. {
  283. map.put( o.toString(), o );
  284. }
  285. return map;
  286. }
  287. private static <T> Function<List<T>,Map<String,T>> getConversionFunction(Class<T> type) {
  288. return ts -> convertToMap( ts );
  289. }
  290. public class MockApplicationContext
  291. implements ApplicationContext
  292. {
  293. private List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer;
  294. private List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers;
  295. public MockApplicationContext( List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer,
  296. List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers )
  297. {
  298. this.knownRepositoryContentConsumer = knownRepositoryContentConsumer;
  299. this.invalidRepositoryContentConsumers = invalidRepositoryContentConsumers;
  300. }
  301. @Override
  302. public String getApplicationName()
  303. {
  304. return "foo";
  305. }
  306. @Override
  307. public AutowireCapableBeanFactory getAutowireCapableBeanFactory()
  308. throws IllegalStateException
  309. {
  310. throw new UnsupportedOperationException( "Not supported yet." );
  311. }
  312. @Override
  313. public String getDisplayName()
  314. {
  315. throw new UnsupportedOperationException( "Not supported yet." );
  316. }
  317. @Override
  318. public String getId()
  319. {
  320. throw new UnsupportedOperationException( "Not supported yet." );
  321. }
  322. @Override
  323. public ApplicationContext getParent()
  324. {
  325. throw new UnsupportedOperationException( "Not supported yet." );
  326. }
  327. @Override
  328. public long getStartupDate()
  329. {
  330. throw new UnsupportedOperationException( "Not supported yet." );
  331. }
  332. @Override
  333. public boolean containsBeanDefinition( String beanName )
  334. {
  335. throw new UnsupportedOperationException( "Not supported yet." );
  336. }
  337. @Override
  338. public int getBeanDefinitionCount()
  339. {
  340. throw new UnsupportedOperationException( "Not supported yet." );
  341. }
  342. @Override
  343. public String[] getBeanDefinitionNames()
  344. {
  345. throw new UnsupportedOperationException( "Not supported yet." );
  346. }
  347. @Override
  348. public <T> ObjectProvider<T> getBeanProvider( Class<T> aClass, boolean b )
  349. {
  350. return null;
  351. }
  352. @Override
  353. public <T> ObjectProvider<T> getBeanProvider( ResolvableType resolvableType, boolean b )
  354. {
  355. return null;
  356. }
  357. @Override
  358. public String[] getBeanNamesForType( Class type )
  359. {
  360. throw new UnsupportedOperationException( "Not supported yet." );
  361. }
  362. @Override
  363. public String[] getBeanNamesForType( Class type, boolean includeNonSingletons, boolean allowEagerInit )
  364. {
  365. throw new UnsupportedOperationException( "Not supported yet." );
  366. }
  367. @Override
  368. public <T> T getBean( Class<T> aClass, Object... objects )
  369. throws BeansException
  370. {
  371. throw new UnsupportedOperationException( "Not supported yet." );
  372. }
  373. @Override
  374. public <T> ObjectProvider<T> getBeanProvider( Class<T> aClass )
  375. {
  376. return null;
  377. }
  378. @Override
  379. public <T> ObjectProvider<T> getBeanProvider( ResolvableType resolvableType )
  380. {
  381. return null;
  382. }
  383. @SuppressWarnings( "unchecked" )
  384. @Override
  385. public <T> Map<String, T> getBeansOfType( Class<T> type )
  386. throws BeansException
  387. {
  388. List<T> list = null;
  389. if (type == KnownRepositoryContentConsumer.class) {
  390. list = (List<T>) knownRepositoryContentConsumer;
  391. } else if (type == InvalidRepositoryContentConsumer.class) {
  392. list = (List<T>) invalidRepositoryContentConsumers;
  393. }
  394. if (list!=null) {
  395. return getConversionFunction( type ).apply( list );
  396. }
  397. throw new UnsupportedOperationException( "Should not have been called" );
  398. }
  399. @Override
  400. public <T> Map<String, T> getBeansOfType( Class<T> type, boolean includeNonSingletons, boolean allowEagerInit )
  401. throws BeansException
  402. {
  403. throw new UnsupportedOperationException( "Not supported yet." );
  404. }
  405. @Override
  406. public boolean containsBean( String name )
  407. {
  408. throw new UnsupportedOperationException( "Not supported yet." );
  409. }
  410. @Override
  411. public String[] getAliases( String name )
  412. {
  413. throw new UnsupportedOperationException( "Not supported yet." );
  414. }
  415. @Override
  416. public Object getBean( String name )
  417. throws BeansException
  418. {
  419. throw new UnsupportedOperationException( "Not supported yet." );
  420. }
  421. @Override
  422. public <T> T getBean( String name, Class<T> requiredType )
  423. throws BeansException
  424. {
  425. throw new UnsupportedOperationException( "Not supported yet." );
  426. }
  427. @Override
  428. public Object getBean( String name, Object[] args )
  429. throws BeansException
  430. {
  431. throw new UnsupportedOperationException( "Not supported yet." );
  432. }
  433. @Override
  434. public Class getType( String name )
  435. throws NoSuchBeanDefinitionException
  436. {
  437. throw new UnsupportedOperationException( "Not supported yet." );
  438. }
  439. @Override
  440. public Class<?> getType( String s, boolean b ) throws NoSuchBeanDefinitionException
  441. {
  442. return null;
  443. }
  444. @Override
  445. public boolean isPrototype( String name )
  446. throws NoSuchBeanDefinitionException
  447. {
  448. throw new UnsupportedOperationException( "Not supported yet." );
  449. }
  450. @Override
  451. public boolean isSingleton( String name )
  452. throws NoSuchBeanDefinitionException
  453. {
  454. throw new UnsupportedOperationException( "Not supported yet." );
  455. }
  456. @Override
  457. public boolean isTypeMatch( String name, Class targetType )
  458. throws NoSuchBeanDefinitionException
  459. {
  460. throw new UnsupportedOperationException( "Not supported yet." );
  461. }
  462. @Override
  463. public boolean containsLocalBean( String name )
  464. {
  465. throw new UnsupportedOperationException( "Not supported yet." );
  466. }
  467. @Override
  468. public BeanFactory getParentBeanFactory()
  469. {
  470. throw new UnsupportedOperationException( "Not supported yet." );
  471. }
  472. @Override
  473. public String getMessage( String code, Object[] args, String defaultMessage, Locale locale )
  474. {
  475. throw new UnsupportedOperationException( "Not supported yet." );
  476. }
  477. @Override
  478. public String getMessage( String code, Object[] args, Locale locale )
  479. throws NoSuchMessageException
  480. {
  481. throw new UnsupportedOperationException( "Not supported yet." );
  482. }
  483. @Override
  484. public String getMessage( MessageSourceResolvable resolvable, Locale locale )
  485. throws NoSuchMessageException
  486. {
  487. throw new UnsupportedOperationException( "Not supported yet." );
  488. }
  489. @Override
  490. public void publishEvent( ApplicationEvent event )
  491. {
  492. throw new UnsupportedOperationException( "Not supported yet." );
  493. }
  494. @Override
  495. public Resource[] getResources( String locationPattern )
  496. throws IOException
  497. {
  498. throw new UnsupportedOperationException( "Not supported yet." );
  499. }
  500. @Override
  501. public ClassLoader getClassLoader()
  502. {
  503. throw new UnsupportedOperationException( "Not supported yet." );
  504. }
  505. @Override
  506. public Resource getResource( String location )
  507. {
  508. throw new UnsupportedOperationException( "Not supported yet." );
  509. }
  510. @Override
  511. public <T> T getBean( Class<T> tClass )
  512. throws BeansException
  513. {
  514. throw new UnsupportedOperationException( "Not supported yet." );
  515. }
  516. @Override
  517. public Map<String, Object> getBeansWithAnnotation( Class<? extends Annotation> aClass )
  518. throws BeansException
  519. {
  520. throw new UnsupportedOperationException( "Not supported yet." );
  521. }
  522. @Override
  523. public <A extends Annotation> A findAnnotationOnBean( String s, Class<A> aClass )
  524. {
  525. throw new UnsupportedOperationException( "Not supported yet." );
  526. }
  527. @Override
  528. public Environment getEnvironment()
  529. {
  530. return null;
  531. }
  532. @Override
  533. public String[] getBeanNamesForAnnotation( Class<? extends Annotation> aClass )
  534. {
  535. return new String[0];
  536. }
  537. @Override
  538. public void publishEvent( Object o )
  539. {
  540. // no op
  541. }
  542. @Override
  543. public String[] getBeanNamesForType( ResolvableType resolvableType )
  544. {
  545. return new String[0];
  546. }
  547. @Override
  548. public String[] getBeanNamesForType( ResolvableType resolvableType, boolean b, boolean b1 )
  549. {
  550. return new String[0];
  551. }
  552. @Override
  553. public boolean isTypeMatch( String s, ResolvableType resolvableType )
  554. throws NoSuchBeanDefinitionException
  555. {
  556. return false;
  557. }
  558. }
  559. }