Java Code Examples for example.profilescan.ProfileAnnotatedComponent

The following examples show how to use example.profilescan.ProfileAnnotatedComponent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void testWithInactiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles("other");
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}
 
Example 2
@Test
public void testWithActiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(true));
}
 
Example 3
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_noProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 4
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_validProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(true));
}
 
Example 5
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_invalidProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles("other");
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 6
@Test
public void testWithInactiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles("other");
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}
 
Example 7
@Test
public void testWithActiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(true));
}
 
Example 8
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_noProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 9
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_validProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(true));
}
 
Example 10
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_invalidProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles("other");
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 11
@Test
public void testWithInactiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles("other");
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}
 
Example 12
@Test
public void testWithActiveProfile() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	ConfigurableEnvironment env = new StandardEnvironment();
	env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	provider.setEnvironment(env);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(true));
}
 
Example 13
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_noProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 14
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_validProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(true));
}
 
Example 15
@Test
public void testIntegrationWithAnnotationConfigApplicationContext_invalidProfile() {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
	ctx.getEnvironment().setActiveProfiles("other");
	ctx.register(ProfileAnnotatedComponent.class);
	ctx.refresh();
	assertThat(ctx.containsBean(ProfileAnnotatedComponent.BEAN_NAME), is(false));
}
 
Example 16
@Test
public void testWithNullEnvironment() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}
 
Example 17
@Test
public void testWithNullEnvironment() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}
 
Example 18
@Test
public void testWithNullEnvironment() {
	ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
	Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
	assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class), is(false));
}