@Test public void testIsAcceptedServiceInterface7() { final AutowiredRemoteServiceGroupConfig config; config = new AutowiredRemoteServiceGroupConfig(); config.setBasePackages(Arrays.asList(new String[] {"de.itsvs.cwtrpc.controller.config."})); config.setIncludeFilters( Arrays.asList( new Pattern[] { PatternFactory.compile( PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService[13]"), PatternFactory.compile( PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService5") })); config.setExcludeFilters( Arrays.asList( new Pattern[] { PatternFactory.compile( PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService1") })); Assert.assertFalse(config.isAcceptedServiceInterface(TestService1.class)); Assert.assertFalse(config.isAcceptedServiceInterface(TestService2.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService3.class)); Assert.assertTrue(config.isAcceptedServiceInterface(TestService5.class)); }
@Test public void testAfterPropertiesSet6() { final StaticApplicationContext appContext; final AutowiredRemoteServiceGroupConfig config; appContext = new StaticApplicationContext(); appContext.registerSingleton("tService1", TestService1Impl.class); appContext.registerSingleton("tService2", TestService2Impl.class); appContext.registerSingleton("tService3", TestService3Impl.class); appContext.registerSingleton("tService5", TestService5Impl.class); config = new AutowiredRemoteServiceGroupConfig(); config.setBasePackages(Arrays.asList(new String[] {"de.itsvs.cwtrpc.controller.config."})); config.setExcludeFilters( Arrays.asList( new Pattern[] { PatternFactory.compile( PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService[13]"), PatternFactory.compile( PatternType.REGEX, MatcherType.PACKAGE, "de\\..+\\.TestService5") })); config.setApplicationContext(appContext); config.afterPropertiesSet(); Assert.assertTrue(config.getChildGroupConfigs().isEmpty()); Assert.assertEquals(1, config.getServiceConfigs().size()); Assert.assertTrue( containsServiceConfig(appContext, config.getServiceConfigs(), TestService2Impl.class)); }