Here are the examples of the java api org.springframework.boot.autoconfigure.AutoConfigurations.of() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
270 Examples
19
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validatorWithConfigurerTakesPrecedence() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).withUserConfiguration(MvcValidator.clreplaced).run((context) -> {
replacedertThat(context).hreplacedingleBean(ValidatorFactory.clreplaced);
replacedertThat(context).hreplacedingleBean(javax.validation.Validator.clreplaced);
replacedertThat(context).getBeanNames(Validator.clreplaced).containsOnly("defaultValidator", "mvcValidator");
replacedertThat(context.getBean("mvcValidator")).isSameAs(context.getBean(MvcValidator.clreplaced).validator);
// Primary Spring validator is the auto-configured one as the MVC one
// has been customized via a WebMvcConfigurer
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(context.getBean("defaultValidator"));
});
}
19
Source : WebFluxAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validationCustomConfigurerTakesPrecedence() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).withUserConfiguration(ValidatorWebFluxConfigurer.clreplaced).run((context) -> {
replacedertThat(context).getBeans(ValidatorFactory.clreplaced).hreplacedize(1);
replacedertThat(context).getBeans(javax.validation.Validator.clreplaced).hreplacedize(1);
replacedertThat(context).getBeanNames(Validator.clreplaced).containsExactlyInAnyOrder("defaultValidator", "webFluxValidator");
replacedertThat(context.getBean("webFluxValidator")).isSameAs(context.getBean(ValidatorWebFluxConfigurer.clreplaced).validator);
// Primary Spring validator is the auto-configured one as the WebFlux
// one has been
// customized via a WebFluxConfigurer
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(context.getBean("defaultValidator"));
});
}
19
Source : JacksonAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void doubleModuleRegistration() {
this.contextRunner.withUserConfiguration(DoubleModulesConfig.clreplaced).withConfiguration(AutoConfigurations.of(HttpMessageConvertersAutoConfiguration.clreplaced)).run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.clreplaced);
replacedertThat(mapper.writeValuereplacedtring(new Foo())).isEqualTo("{\"foo\":\"bar\"}");
});
}
19
Source : HttpMessageConvertersAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
private ApplicationContextRunner allOptionsRunner() {
return this.contextRunner.withConfiguration(AutoConfigurations.of(GsonAutoConfiguration.clreplaced, JacksonAutoConfiguration.clreplaced, JsonbAutoConfiguration.clreplaced));
}
19
Source : CacheAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void hazelcastAsJCacheWithExistingHazelcastInstance() {
String cachingProviderFqn = HazelcastCachingProvider.clreplaced.getName();
this.contextRunner.withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.clreplaced)).withUserConfiguration(DefaultCacheConfiguration.clreplaced).withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn).run((context) -> {
JCacheCacheManager cacheManager = getCacheManager(context, JCacheCacheManager.clreplaced);
javax.cache.CacheManager jCacheManager = cacheManager.getCacheManager();
replacedertThat(jCacheManager).isInstanceOf(com.hazelcast.cache.HazelcastCacheManager.clreplaced);
replacedertThat(context).hreplacedingleBean(HazelcastInstance.clreplaced);
HazelcastInstance hazelcastInstance = context.getBean(HazelcastInstance.clreplaced);
replacedertThat(((com.hazelcast.cache.HazelcastCacheManager) jCacheManager).getHazelcastInstance()).isSameAs(hazelcastInstance);
replacedertThat(hazelcastInstance.getName()).isEqualTo("default-instance");
replacedertThat(Hazelcast.getAllHazelcastInstances()).hreplacedize(1);
});
}
19
Source : CloudFoundryActuatorAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() {
this.contextRunner.withPropertyValues("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id", "vcap.application.cf_api:http://my-cloud-controller.com").withConfiguration(AutoConfigurations.of(HealthIndicatorAutoConfiguration.clreplaced, HealthEndpointAutoConfiguration.clreplaced)).run((context) -> {
Collection<ExposableWebEndpoint> endpoints = context.getBean("cloudFoundryWebEndpointServletHandlerMapping", CloudFoundryWebEndpointServletHandlerMapping.clreplaced).getEndpoints();
ExposableWebEndpoint endpoint = endpoints.iterator().next();
replacedertThat(endpoint.getOperations()).hreplacedize(3);
WebOperation webOperation = findOperationWithRequestPath(endpoint, "health");
Object invoker = ReflectionTestUtils.getField(webOperation, "invoker");
replacedertThat(ReflectionTestUtils.getField(invoker, "target")).isInstanceOf(CloudFoundryHealthEndpointWebExtension.clreplaced);
});
}
19
Source : ReactiveCloudFoundryActuatorAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void healthEndpointInvokerShouldBeCloudFoundryWebExtension() {
this.contextRunner.withConfiguration(AutoConfigurations.of(HealthEndpointAutoConfiguration.clreplaced)).withPropertyValues("VCAP_APPLICATION:---", "vcap.application.application_id:my-app-id", "vcap.application.cf_api:http://my-cloud-controller.com").run((context) -> {
Collection<ExposableWebEndpoint> endpoints = getHandlerMapping(context).getEndpoints();
ExposableWebEndpoint endpoint = endpoints.iterator().next();
replacedertThat(endpoint.getOperations()).hreplacedize(3);
WebOperation webOperation = findOperationWithRequestPath(endpoint, "health");
Object invoker = ReflectionTestUtils.getField(webOperation, "invoker");
replacedertThat(ReflectionTestUtils.getField(invoker, "target")).isInstanceOf(CloudFoundryReactiveHealthEndpointWebExtension.clreplaced);
});
}
19
Source : OtelOpentracingAutoConfigurationTests.java
with Apache License 2.0
from spring-cloud-incubator
with Apache License 2.0
from spring-cloud-incubator
private ApplicationContextRunner withAutoConfiguration() {
return new ApplicationContextRunner().withPropertyValues("spring.sleuth.tracer.mode=AUTO").withConfiguration(AutoConfigurations.of(OtelAutoConfiguration.clreplaced, OtelOpentracingAutoConfiguration.clreplaced));
}
19
Source : GrpcTestUtils.java
with Apache License 2.0
from sfcodes
with Apache License 2.0
from sfcodes
private static ApplicationContextRunner applicationContextRunner() {
return new ApplicationContextRunner().withPropertyValues("grpc.client.scanPackages=io.grpc.examples").withConfiguration(AutoConfigurations.of(GrpcClientAutoConfiguration.clreplaced));
}
19
Source : TransactionalMongrationTest.java
with Apache License 2.0
from KuliginStepan
with Apache License 2.0
from KuliginStepan
@AfterEach
void tearDown() {
new ApplicationContextRunner().withInitializer(new Initializer()).withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced)).run(context -> {
MongoTemplate template = context.getBean(MongoTemplate.clreplaced);
template.dropCollection("test");
template.dropCollection("test_collection");
});
}
19
Source : EventRegistryAutoConfigurationTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Test
public void eventRegistryWithBasicDataSourceAndProcessEngine() {
contextRunner.withConfiguration(AutoConfigurations.of(ProcessEngineServicesAutoConfiguration.clreplaced, ProcessEngineAutoConfiguration.clreplaced)).run(context -> {
replacedertThat(context).doesNotHaveBean(AppEngine.clreplaced).doesNotHaveBean(ChannelModelProcessor.clreplaced).hasBean("eventProcessEngineConfigurationConfigurer").doesNotHaveBean("eventAppEngineConfigurationConfigurer");
ProcessEngine processEngine = context.getBean(ProcessEngine.clreplaced);
replacedertThat(processEngine).as("Process engine").isNotNull();
EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine(processEngine);
EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.clreplaced);
replacedertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
replacedertThat(eventRegistryEngine.getEventRegistryEngineConfiguration()).as("Event registry Configuration").isEqualTo(eventRegistryEngineConfiguration);
Iterablereplacedert<ChannelModelProcessor> channelModelProcessorreplacedert = replacedertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());
channelModelProcessorreplacedert.hreplacedize(4);
channelModelProcessorreplacedert.element(0).isInstanceOf(DelegateExpressionInboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(1).isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(2).isInstanceOf(InboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(3).isInstanceOf(OutboundChannelModelProcessor.clreplaced);
replacedertAllServicesPresent(context, eventRegistryEngine);
replacedertThat(context).hreplacedingleBean(CustomUserEngineConfigurerConfiguration.clreplaced).getBean(CustomUserEngineConfigurerConfiguration.clreplaced).satisfies(configuration -> {
replacedertThat(configuration.getInvokedConfigurations()).containsExactly(SpringEventRegistryEngineConfiguration.clreplaced, SpringProcessEngineConfiguration.clreplaced);
});
deleteDeployments(processEngine);
});
}
19
Source : EventRegistryAutoConfigurationTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Test
public void idmEngineWithBasicDataSourceAndAppEngine() {
contextRunner.withConfiguration(AutoConfigurations.of(AppEngineServicesAutoConfiguration.clreplaced, AppEngineAutoConfiguration.clreplaced, ProcessEngineServicesAutoConfiguration.clreplaced, ProcessEngineAutoConfiguration.clreplaced)).run(context -> {
replacedertThat(context).doesNotHaveBean(ChannelModelProcessor.clreplaced).doesNotHaveBean("eventProcessEngineConfigurationConfigurer").hasBean("eventAppEngineConfigurationConfigurer");
AppEngine appEngine = context.getBean(AppEngine.clreplaced);
replacedertThat(appEngine).as("App engine").isNotNull();
EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine(appEngine);
EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.clreplaced);
replacedertThat(eventRegistryEngine).as("Idm engine").isNotNull();
replacedertThat(eventRegistryEngine.getEventRegistryEngineConfiguration()).as("Event registry Configuration").isEqualTo(eventRegistryEngineConfiguration);
Iterablereplacedert<ChannelModelProcessor> channelModelProcessorreplacedert = replacedertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());
channelModelProcessorreplacedert.hreplacedize(4);
channelModelProcessorreplacedert.element(0).isInstanceOf(DelegateExpressionInboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(1).isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(2).isInstanceOf(InboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(3).isInstanceOf(OutboundChannelModelProcessor.clreplaced);
replacedertAllServicesPresent(context, eventRegistryEngine);
replacedertThat(context).hreplacedingleBean(CustomUserEngineConfigurerConfiguration.clreplaced).getBean(CustomUserEngineConfigurerConfiguration.clreplaced).satisfies(configuration -> {
replacedertThat(configuration.getInvokedConfigurations()).containsExactly(SpringProcessEngineConfiguration.clreplaced, SpringEventRegistryEngineConfiguration.clreplaced, SpringAppEngineConfiguration.clreplaced);
});
deleteDeployments(appEngine);
deleteDeployments(context.getBean(ProcessEngine.clreplaced));
});
}
19
Source : EventRegistryAutoConfigurationTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Test
public void eventRegistryWithKafka() {
contextRunner.withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.clreplaced)).run(context -> {
replacedertThat(context).hreplacedingleBean(KafkaChannelDefinitionProcessor.clreplaced).hasBean("kafkaChannelDefinitionProcessor");
EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.clreplaced);
replacedertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
Iterablereplacedert<ChannelModelProcessor> channelModelProcessorreplacedert = replacedertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());
channelModelProcessorreplacedert.hreplacedize(5);
channelModelProcessorreplacedert.element(0).isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.clreplaced));
channelModelProcessorreplacedert.element(1).isInstanceOf(DelegateExpressionInboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(2).isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(3).isInstanceOf(InboundChannelModelProcessor.clreplaced);
channelModelProcessorreplacedert.element(4).isInstanceOf(OutboundChannelModelProcessor.clreplaced);
});
}
19
Source : SqsAutoConfigurationTest.java
with Apache License 2.0
from awspring
with Apache License 2.0
from awspring
@Test
void configuration_withoutAwsCredentials_shouldCreateAClientWithDefaultCredentialsProvider() throws Exception {
// Arrange & Act
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(SqsAutoConfiguration.clreplaced)).withUserConfiguration(ConfigurationWithMissingAwsCredentials.clreplaced).run((context) -> {
// replacedert
AmazonSQSBufferedAsyncClient bufferedAmazonSqsClient = context.getBean(AmazonSQSBufferedAsyncClient.clreplaced);
replacedertThat(bufferedAmazonSqsClient).extracting("realSQS").extracting("awsCredentialsProvider").isInstanceOf(DefaultAWSCredentialsProviderChain.clreplaced);
});
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validatorWithCustomSpringValidatorIgnored() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).withUserConfiguration(CustomSpringValidator.clreplaced).run((context) -> {
replacedertThat(context).getBeanNames(javax.validation.Validator.clreplaced).containsOnly("defaultValidator");
replacedertThat(context).getBeanNames(Validator.clreplaced).containsOnly("customSpringValidator", "defaultValidator", "mvcValidator");
Validator validator = context.getBean("mvcValidator", Validator.clreplaced);
replacedertThat(validator).isInstanceOf(ValidatorAdapter.clreplaced);
Object defaultValidator = context.getBean("defaultValidator");
replacedertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator);
// Primary Spring validator is the one used by MVC behind the scenes
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(defaultValidator);
});
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void asyncTaskExecutorWithMvcConfigurerCanOverrideExecutor() {
this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfigurer.clreplaced).withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.clreplaced)).run((context) -> replacedertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.clreplaced), "taskExecutor")).isSameAs(context.getBean(CustomAsyncTaskExecutorConfigurer.clreplaced).taskExecutor));
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validatorWhenNoCustomizationShouldUseAutoConfigured() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).run((context) -> {
replacedertThat(context).getBeanNames(javax.validation.Validator.clreplaced).containsOnly("defaultValidator");
replacedertThat(context).getBeanNames(Validator.clreplaced).containsOnly("defaultValidator", "mvcValidator");
Validator validator = context.getBean("mvcValidator", Validator.clreplaced);
replacedertThat(validator).isInstanceOf(ValidatorAdapter.clreplaced);
Object defaultValidator = context.getBean("defaultValidator");
replacedertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator);
// Primary Spring validator is the one used by MVC behind the scenes
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(defaultValidator);
});
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void asyncTaskExecutorWithCustomNonApplicationTaskExecutor() {
this.contextRunner.withUserConfiguration(CustomAsyncTaskExecutorConfig.clreplaced).withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.clreplaced)).run((context) -> {
replacedertThat(context).hreplacedingleBean(AsyncTaskExecutor.clreplaced);
replacedertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.clreplaced), "taskExecutor")).isNotSameAs(context.getBean("customTaskExecutor"));
});
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void asyncTaskExecutorWithNonMatchApplicationTaskExecutorBean() {
this.contextRunner.withUserConfiguration(CustomApplicationTaskExecutorConfig.clreplaced).withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.clreplaced)).run((context) -> {
replacedertThat(context).doesNotHaveBean(AsyncTaskExecutor.clreplaced);
replacedertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.clreplaced), "taskExecutor")).isNotSameAs(context.getBean("applicationTaskExecutor"));
});
}
18
Source : WebMvcAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void asyncTaskExecutorWithApplicationTaskExecutor() {
this.contextRunner.withConfiguration(AutoConfigurations.of(TaskExecutionAutoConfiguration.clreplaced)).run((context) -> {
replacedertThat(context).hreplacedingleBean(AsyncTaskExecutor.clreplaced);
replacedertThat(ReflectionTestUtils.getField(context.getBean(RequestMappingHandlerAdapter.clreplaced), "taskExecutor")).isSameAs(context.getBean("applicationTaskExecutor"));
});
}
18
Source : WebFluxAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validatorWithCustomSpringValidatorIgnored() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).withUserConfiguration(CustomSpringValidator.clreplaced).run((context) -> {
replacedertThat(context).getBeanNames(javax.validation.Validator.clreplaced).containsExactly("defaultValidator");
replacedertThat(context).getBeanNames(Validator.clreplaced).containsExactlyInAnyOrder("customValidator", "defaultValidator", "webFluxValidator");
Validator validator = context.getBean("webFluxValidator", Validator.clreplaced);
replacedertThat(validator).isInstanceOf(ValidatorAdapter.clreplaced);
Object defaultValidator = context.getBean("defaultValidator");
replacedertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator);
// Primary Spring validator is the one used by WebFlux behind the
// scenes
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(defaultValidator);
});
}
18
Source : WebFluxAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void validatorWhenNoCustomizationShouldUseAutoConfigured() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.clreplaced)).run((context) -> {
replacedertThat(context).getBeanNames(javax.validation.Validator.clreplaced).containsExactly("defaultValidator");
replacedertThat(context).getBeanNames(Validator.clreplaced).containsExactlyInAnyOrder("defaultValidator", "webFluxValidator");
Validator validator = context.getBean("webFluxValidator", Validator.clreplaced);
replacedertThat(validator).isInstanceOf(ValidatorAdapter.clreplaced);
Object defaultValidator = context.getBean("defaultValidator");
replacedertThat(((ValidatorAdapter) validator).getTarget()).isSameAs(defaultValidator);
// Primary Spring validator is the one used by WebFlux behind the
// scenes
replacedertThat(context.getBean(Validator.clreplaced)).isEqualTo(defaultValidator);
});
}
18
Source : HttpHandlerAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void shouldConfigureHttpHandlerAnnotation() {
this.contextRunner.withConfiguration(AutoConfigurations.of(WebFluxAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).hreplacedingleBean(HttpHandler.clreplaced));
}
18
Source : SessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void defaultConfigWithUniqueStoreImplementation() {
this.contextRunner.withClreplacedLoader(new FilteredClreplacedLoader(HazelcastSessionRepository.clreplaced, JdbcOperationsSessionRepository.clreplaced, RedisOperationsSessionRepository.clreplaced)).withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced)).run(validateSpringSessionUsesMongo("sessions"));
}
18
Source : SessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void defaultConfig() {
this.contextRunner.withPropertyValues("spring.session.store-type=mongodb").withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced)).run(validateSpringSessionUsesMongo("sessions"));
}
18
Source : SessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void mongoSessionStoreWithCustomizations() {
this.contextRunner.withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced)).withPropertyValues("spring.session.store-type=mongodb", "spring.session.mongodb.collection-name=foo").run(validateSpringSessionUsesMongo("foo"));
}
18
Source : ReactiveSessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void mongoSessionStoreWithCustomizations() {
this.contextRunner.withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced, MongoReactiveAutoConfiguration.clreplaced, MongoReactiveDataAutoConfiguration.clreplaced)).withPropertyValues("spring.session.store-type=mongodb", "spring.session.mongodb.collection-name=foo").run(validateSpringSessionUsesMongo("foo"));
}
18
Source : ReactiveSessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void defaultConfigWithUniqueStoreImplementation() {
this.contextRunner.withClreplacedLoader(new FilteredClreplacedLoader(ReactiveRedisOperationsSessionRepository.clreplaced)).withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced, MongoReactiveAutoConfiguration.clreplaced, MongoReactiveDataAutoConfiguration.clreplaced)).run(validateSpringSessionUsesMongo("sessions"));
}
18
Source : ReactiveSessionAutoConfigurationMongoTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void defaultConfig() {
this.contextRunner.withPropertyValues("spring.session.store-type=mongodb").withConfiguration(AutoConfigurations.of(EmbeddedMongoAutoConfiguration.clreplaced, MongoAutoConfiguration.clreplaced, MongoDataAutoConfiguration.clreplaced, MongoReactiveAutoConfiguration.clreplaced, MongoReactiveDataAutoConfiguration.clreplaced)).run(validateSpringSessionUsesMongo("sessions"));
}
18
Source : SecurityRequestMatcherProviderAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void mvcRequestMatcherProviderConditionalOnHandlerMappingIntrospectorBean() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(SecurityRequestMatcherProviderAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).doesNotHaveBean(MvcRequestMatcherProvider.clreplaced));
}
18
Source : SecurityRequestMatcherProviderAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void mvcRequestMatcherProviderConditionalOnWebApplication() {
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(SecurityRequestMatcherProviderAutoConfiguration.clreplaced)).withUserConfiguration(TestConfiguration.clreplaced).run((context) -> replacedertThat(context).doesNotHaveBean(MvcRequestMatcherProvider.clreplaced));
}
18
Source : SecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testCustomFilterOrder() {
this.contextRunner.withConfiguration(AutoConfigurations.of(SecurityFilterAutoConfiguration.clreplaced)).withPropertyValues("spring.security.filter.order:12345").run((context) -> replacedertThat(context.getBean("securityFilterChainRegistration", DelegatingFilterProxyRegistrationBean.clreplaced).getOrder()).isEqualTo(12345));
}
18
Source : SecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testJpaCoexistsHappily() {
this.contextRunner.withPropertyValues("spring.datasource.url:jdbc:hsqldb:mem:testsecdb", "spring.datasource.initialization-mode:never").withUserConfiguration(EnreplacedyConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(HibernateJpaAutoConfiguration.clreplaced, DataSourceAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context.getBean(JpaTransactionManager.clreplaced)).isNotNull());
// This can fail if security @Conditionals force early instantiation of the
// HibernateJpaAutoConfiguration (e.g. the EnreplacedyManagerFactory is not found)
}
18
Source : SecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testDefaultFilterOrderWithSecurityAdapter() {
this.contextRunner.withConfiguration(AutoConfigurations.of(WebSecurity.clreplaced, SecurityFilterAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context.getBean("securityFilterChainRegistration", DelegatingFilterProxyRegistrationBean.clreplaced).getOrder()).isEqualTo(OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100));
}
18
Source : SecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testDefaultFilterOrder() {
this.contextRunner.withConfiguration(AutoConfigurations.of(SecurityFilterAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context.getBean("securityFilterChainRegistration", DelegatingFilterProxyRegistrationBean.clreplaced).getOrder()).isEqualTo(OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100));
}
18
Source : ReactiveUserDetailsServiceAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void doesNotConfigureDefaultUserIfAuthenticationManagerAvailable() {
this.contextRunner.withUserConfiguration(AuthenticationManagerConfig.clreplaced, TestSecurityConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(ReactiveSecurityAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).getBean(ReactiveUserDetailsService.clreplaced).isNull());
}
18
Source : ReactiveSecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void enablesWebFluxSecurity() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ReactiveSecurityAutoConfiguration.clreplaced, ReactiveUserDetailsServiceAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).getBean(WebFilterChainProxy.clreplaced).isNotNull());
}
18
Source : ReactiveSecurityAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void backsOffWhenWebFilterChainProxyBeanPresent() {
this.contextRunner.withConfiguration(AutoConfigurations.of(ReactiveSecurityAutoConfiguration.clreplaced)).withUserConfiguration(WebFilterChainProxyConfiguration.clreplaced).run((context) -> replacedertThat(context).hreplacedingleBean(WebFilterChainProxy.clreplaced));
}
18
Source : ReactiveOAuth2ClientAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void autoConfigurationShouldBackOffForServletEnvironments() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(ReactiveOAuth2ClientAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).doesNotHaveBean(ReactiveOAuth2ClientAutoConfiguration.clreplaced));
}
18
Source : QuartzAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void withDataSourceNoTransactionManager() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.clreplaced)).withPropertyValues("spring.quartz.job-store-type=jdbc").run(replacedertDataSourceJobStore("dataSource"));
}
18
Source : QuartzAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void withDataSource() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.clreplaced, DataSourceTransactionManagerAutoConfiguration.clreplaced)).withPropertyValues("spring.quartz.job-store-type=jdbc").run(replacedertDataSourceJobStore("dataSource"));
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testLiquibasePlusValidation() {
contextRunner().withPropertyValues("spring.datasource.initialization-mode:never", "spring.liquibase.changeLog:clreplacedpath:db/changelog/db.changelog-city.yaml", "spring.jpa.hibernate.ddl-auto:validate").withConfiguration(AutoConfigurations.of(LiquibaseAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).hasNotFailed());
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void jtaDefaultPlatform() {
contextRunner().withConfiguration(AutoConfigurations.of(JtaAutoConfiguration.clreplaced)).run(replacedertJtaPlatform(SpringJtaPlatform.clreplaced));
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void providerDisablesAutoCommitIsNotConfiguredWithJta() {
contextRunner().withConfiguration(AutoConfigurations.of(JtaAutoConfiguration.clreplaced)).withPropertyValues("spring.datasource.type:" + HikariDataSource.clreplaced.getName(), "spring.datasource.hikari.auto-commit:false").run((context) -> {
Map<String, Object> jpaProperties = context.getBean(LocalContainerEnreplacedyManagerFactoryBean.clreplaced).getJpaPropertyMap();
replacedertThat(jpaProperties).doesNotContainKeys("hibernate.connection.provider_disables_autocommit");
});
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testFlywayPlusValidation() {
contextRunner().withPropertyValues("spring.datasource.initialization-mode:never", "spring.flyway.locations:clreplacedpath:db/city", "spring.jpa.hibernate.ddl-auto:validate").withConfiguration(AutoConfigurations.of(FlywayAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).hasNotFailed());
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void autoConfigurationBacksOffWithSeveralDataSources() {
contextRunner().withConfiguration(AutoConfigurations.of(DataSourceTransactionManagerAutoConfiguration.clreplaced, XADataSourceAutoConfiguration.clreplaced, JtaAutoConfiguration.clreplaced)).withUserConfiguration(TestTwoDataSourcesConfiguration.clreplaced).run((context) -> {
replacedertThat(context).hasNotFailed();
replacedertThat(context).doesNotHaveBean(EnreplacedyManagerFactory.clreplaced);
});
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void jtaCustomPlatform() {
contextRunner().withPropertyValues("spring.jpa.properties.hibernate.transaction.jta.platform:" + TestJtaPlatform.clreplaced.getName()).withConfiguration(AutoConfigurations.of(JtaAutoConfiguration.clreplaced)).run(replacedertJtaPlatform(TestJtaPlatform.clreplaced));
}
18
Source : HibernateJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void testFlywaySwitchOffDdlAuto() {
contextRunner().withPropertyValues("spring.datasource.initialization-mode:never", "spring.flyway.locations:clreplacedpath:db/city").withConfiguration(AutoConfigurations.of(FlywayAutoConfiguration.clreplaced)).run((context) -> replacedertThat(context).hasNotFailed());
}
18
Source : AbstractJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void openEnreplacedyManagerInViewInterceptorISNotRegisteredWhenExplicitlyOff() {
new WebApplicationContextRunner().withPropertyValues("spring.datasource.generate-unique-name=true", "spring.jpa.open-in-view=false").withUserConfiguration(TestConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.clreplaced, TransactionAutoConfiguration.clreplaced, this.autoConfiguredClreplaced)).run((context) -> replacedertThat(context).doesNotHaveBean(OpenEnreplacedyManagerInViewInterceptor.clreplaced));
}
18
Source : AbstractJpaAutoConfigurationTests.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Test
public void openEnreplacedyManagerInViewInterceptorIsNotRegisteredWhenFilterPresent() {
new WebApplicationContextRunner().withPropertyValues("spring.datasource.generate-unique-name=true").withUserConfiguration(TestFilterConfiguration.clreplaced).withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.clreplaced, TransactionAutoConfiguration.clreplaced, this.autoConfiguredClreplaced)).run((context) -> replacedertThat(context).doesNotHaveBean(OpenEnreplacedyManagerInViewInterceptor.clreplaced));
}
See More Examples