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 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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.consumers.RepositoryContentConsumer;
  25. import org.apache.archiva.repository.BasicManagedRepository;
  26. import org.apache.archiva.repository.BasicRemoteRepository;
  27. import org.apache.archiva.repository.ManagedRepository;
  28. import org.apache.archiva.repository.RemoteRepository;
  29. import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
  30. import org.apache.commons.lang.SystemUtils;
  31. import org.easymock.IMocksControl;
  32. import org.junit.Test;
  33. import org.junit.runner.RunWith;
  34. import org.springframework.beans.BeansException;
  35. import org.springframework.beans.factory.BeanFactory;
  36. import org.springframework.beans.factory.NoSuchBeanDefinitionException;
  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 String[] getBeanNamesForType( Class type )
  349. {
  350. throw new UnsupportedOperationException( "Not supported yet." );
  351. }
  352. @Override
  353. public String[] getBeanNamesForType( Class type, boolean includeNonSingletons, boolean allowEagerInit )
  354. {
  355. throw new UnsupportedOperationException( "Not supported yet." );
  356. }
  357. @Override
  358. public <T> T getBean( Class<T> aClass, Object... objects )
  359. throws BeansException
  360. {
  361. throw new UnsupportedOperationException( "Not supported yet." );
  362. }
  363. @SuppressWarnings( "unchecked" )
  364. @Override
  365. public <T> Map<String, T> getBeansOfType( Class<T> type )
  366. throws BeansException
  367. {
  368. List<T> list = null;
  369. if (type == KnownRepositoryContentConsumer.class) {
  370. list = (List<T>) knownRepositoryContentConsumer;
  371. } else if (type == InvalidRepositoryContentConsumer.class) {
  372. list = (List<T>) invalidRepositoryContentConsumers;
  373. }
  374. if (list!=null) {
  375. return getConversionFunction( type ).apply( list );
  376. }
  377. throw new UnsupportedOperationException( "Should not have been called" );
  378. }
  379. @Override
  380. public <T> Map<String, T> getBeansOfType( Class<T> type, boolean includeNonSingletons, boolean allowEagerInit )
  381. throws BeansException
  382. {
  383. throw new UnsupportedOperationException( "Not supported yet." );
  384. }
  385. @Override
  386. public boolean containsBean( String name )
  387. {
  388. throw new UnsupportedOperationException( "Not supported yet." );
  389. }
  390. @Override
  391. public String[] getAliases( String name )
  392. {
  393. throw new UnsupportedOperationException( "Not supported yet." );
  394. }
  395. @Override
  396. public Object getBean( String name )
  397. throws BeansException
  398. {
  399. throw new UnsupportedOperationException( "Not supported yet." );
  400. }
  401. @Override
  402. public <T> T getBean( String name, Class<T> requiredType )
  403. throws BeansException
  404. {
  405. throw new UnsupportedOperationException( "Not supported yet." );
  406. }
  407. @Override
  408. public Object getBean( String name, Object[] args )
  409. throws BeansException
  410. {
  411. throw new UnsupportedOperationException( "Not supported yet." );
  412. }
  413. @Override
  414. public Class getType( String name )
  415. throws NoSuchBeanDefinitionException
  416. {
  417. throw new UnsupportedOperationException( "Not supported yet." );
  418. }
  419. @Override
  420. public boolean isPrototype( String name )
  421. throws NoSuchBeanDefinitionException
  422. {
  423. throw new UnsupportedOperationException( "Not supported yet." );
  424. }
  425. @Override
  426. public boolean isSingleton( String name )
  427. throws NoSuchBeanDefinitionException
  428. {
  429. throw new UnsupportedOperationException( "Not supported yet." );
  430. }
  431. @Override
  432. public boolean isTypeMatch( String name, Class targetType )
  433. throws NoSuchBeanDefinitionException
  434. {
  435. throw new UnsupportedOperationException( "Not supported yet." );
  436. }
  437. @Override
  438. public boolean containsLocalBean( String name )
  439. {
  440. throw new UnsupportedOperationException( "Not supported yet." );
  441. }
  442. @Override
  443. public BeanFactory getParentBeanFactory()
  444. {
  445. throw new UnsupportedOperationException( "Not supported yet." );
  446. }
  447. @Override
  448. public String getMessage( String code, Object[] args, String defaultMessage, Locale locale )
  449. {
  450. throw new UnsupportedOperationException( "Not supported yet." );
  451. }
  452. @Override
  453. public String getMessage( String code, Object[] args, Locale locale )
  454. throws NoSuchMessageException
  455. {
  456. throw new UnsupportedOperationException( "Not supported yet." );
  457. }
  458. @Override
  459. public String getMessage( MessageSourceResolvable resolvable, Locale locale )
  460. throws NoSuchMessageException
  461. {
  462. throw new UnsupportedOperationException( "Not supported yet." );
  463. }
  464. @Override
  465. public void publishEvent( ApplicationEvent event )
  466. {
  467. throw new UnsupportedOperationException( "Not supported yet." );
  468. }
  469. @Override
  470. public Resource[] getResources( String locationPattern )
  471. throws IOException
  472. {
  473. throw new UnsupportedOperationException( "Not supported yet." );
  474. }
  475. @Override
  476. public ClassLoader getClassLoader()
  477. {
  478. throw new UnsupportedOperationException( "Not supported yet." );
  479. }
  480. @Override
  481. public Resource getResource( String location )
  482. {
  483. throw new UnsupportedOperationException( "Not supported yet." );
  484. }
  485. @Override
  486. public <T> T getBean( Class<T> tClass )
  487. throws BeansException
  488. {
  489. throw new UnsupportedOperationException( "Not supported yet." );
  490. }
  491. @Override
  492. public Map<String, Object> getBeansWithAnnotation( Class<? extends Annotation> aClass )
  493. throws BeansException
  494. {
  495. throw new UnsupportedOperationException( "Not supported yet." );
  496. }
  497. @Override
  498. public <A extends Annotation> A findAnnotationOnBean( String s, Class<A> aClass )
  499. {
  500. throw new UnsupportedOperationException( "Not supported yet." );
  501. }
  502. @Override
  503. public Environment getEnvironment()
  504. {
  505. return null;
  506. }
  507. @Override
  508. public String[] getBeanNamesForAnnotation( Class<? extends Annotation> aClass )
  509. {
  510. return new String[0];
  511. }
  512. @Override
  513. public void publishEvent( Object o )
  514. {
  515. // no op
  516. }
  517. @Override
  518. public String[] getBeanNamesForType( ResolvableType resolvableType )
  519. {
  520. return new String[0];
  521. }
  522. @Override
  523. public boolean isTypeMatch( String s, ResolvableType resolvableType )
  524. throws NoSuchBeanDefinitionException
  525. {
  526. return false;
  527. }
  528. }
  529. }