List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext close
@Override public void close()
From source file:com.netflix.genie.web.security.oauth2.pingfederate.PingFederateConditionsUnitTests.java
/** * Test to make sure that when no supported security is enabled the class doesn't fire. * * @throws Exception on any error/*from w w w .j av a2s .c o m*/ */ @Test public void cantEnableJWTBeanWithoutAnySecurityEnabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(PingFederateJWTEnabledConfig.class); Assert.assertFalse(context.containsBean("myBean")); context.close(); }
From source file:com.netflix.genie.web.security.oauth2.pingfederate.PingFederateConditionsUnitTests.java
/** * Test to make sure that when no supported security is enabled the class doesn't fire. * * @throws Exception on any error//from www.j a v a 2s . co m */ @Test public void cantEnableRemoteBeanWithoutAnySecurityEnabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(PingFederateRemoteEnabledConfig.class); Assert.assertFalse(context.containsBean("myBean")); context.close(); }
From source file:nats.client.spring.JavaConfigAnnotationConfigTest.java
@Test public void subscribeAnnotation() { final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( AnnotationConfig.class); try {//from www . ja v a 2s. c o m final Nats nats = context.getBean(Nats.class); testNatsConfig(context, nats); } finally { context.close(); } }
From source file:org.springframework.data.web.config.SpringDataWebConfigurationIntegrationTests.java
private SpringDataWebConfiguration createConfigWithClassLoader(ClassLoader classLoader) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( SpringDataWebConfiguration.class); context.setClassLoader(classLoader); try {/* w w w . j a v a2 s . co m*/ return context.getBean(SpringDataWebConfiguration.class); } finally { context.close(); } }
From source file:com.netflix.genie.web.security.SecurityConditionsUnitTests.java
/** * Test to make sure that when a supported security is enabled the class fires. * * @throws Exception on any error/*from w w w .j av a2 s. c om*/ */ @Test public void canEnableBeanWithAllSecurityEnabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(SecurityEnabled.class, "genie.security.saml.enabled:true", "genie.security.x509.enabled:true", "genie.security.oauth2.enabled:true"); Assert.assertTrue(context.containsBean("myBean")); context.close(); }
From source file:com.netflix.genie.web.security.SecurityConditionsUnitTests.java
/** * Test to make sure that when a supported security is enabled the class fires. * * @throws Exception on any error//from ww w . j ava 2 s . c om */ @Test public void canEnableBeanWithSAMLEnabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(SecurityEnabled.class, "genie.security.saml.enabled:true", "genie.security.x509.enabled:false", "genie.security.oauth2.enabled:false"); Assert.assertTrue(context.containsBean("myBean")); context.close(); }
From source file:com.netflix.genie.web.security.SecurityConditionsUnitTests.java
/** * Test to make sure that when a supported security is enabled the class fires. * * @throws Exception on any error/* w ww .j a va 2 s .c o m*/ */ @Test public void canEnableBeanWithX509Enabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(SecurityEnabled.class, "genie.security.saml.enabled:false", "genie.security.x509.enabled:true", "genie.security.oauth2.enabled:false"); Assert.assertTrue(context.containsBean("myBean")); context.close(); }
From source file:com.netflix.genie.web.security.SecurityConditionsUnitTests.java
/** * Test to make sure that when a supported security is enabled the class fires. * * @throws Exception on any error/* www . j ava2 s .c om*/ */ @Test public void canEnableBeanWithOAuth2Enabled() throws Exception { final AnnotationConfigApplicationContext context = this.load(SecurityEnabled.class, "genie.security.saml.enabled:false", "genie.security.x509.enabled:false", "genie.security.oauth2.enabled:true"); Assert.assertTrue(context.containsBean("myBean")); context.close(); }
From source file:com.mine.cassandra.sink.CassandraSinkPropertiesTests.java
@Test public void ttlCanBeCustomized() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(context, "ttl:" + 1000); context.register(Conf.class); context.refresh();/*from ww w . j a va2s . c o m*/ CassandraSinkProperties properties = context.getBean(CassandraSinkProperties.class); assertThat(properties.getTtl(), equalTo(1000)); context.close(); }
From source file:org.springframework.data.rest.webmvc.config.RepositoryRestMvConfigurationIntegrationTests.java
/** * @see DATAREST-424// www .j av a 2 s. c o m */ @Test public void halHttpMethodConverterIsRegisteredAfterTheGeneralOneIfHalIsDisabledAsDefaultMediaType() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( NonHalConfiguration.class); CollectingComponent component = context.getBean(CollectingComponent.class); context.close(); List<HttpMessageConverter<?>> converters = component.converters; assertThat(converters.get(0).getSupportedMediaTypes(), hasItem(RestMediaTypes.SCHEMA_JSON)); assertThat(converters.get(1).getSupportedMediaTypes(), hasItem(MediaTypes.HAL_JSON)); }