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

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