org.springframework.test.context.support.TestPropertySourceUtils Java Examples

The following examples show how to use org.springframework.test.context.support.TestPropertySourceUtils. 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
Source File: KafkaNotifierTest.java    From adaptive-alerting with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(applicationContext,
            "bootstrap.servers=" + bootstrapServers(kafka),
            "webhook.port=" + webhook.getPort()
    );
}
 
Example #2
Source File: GcpCloudFoundryEnvironmentPostProcessorTests.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
			"spring.cloud.gcp.sql.instance-connection-name=test-connection",
			"spring.cloud.gcp.sql.database-name=test-dbname",
			"spring.cloud.gcp.sql.credentials.encoded-key=test-key");
}
 
Example #3
Source File: ServiceBrokerPropertiesBindingTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Test
void bindMinimumValidProperties() {
	this.context.register(ServiceBrokerPropertiesConfiguration.class);
	TestPropertySourceUtils.addPropertiesFilesToEnvironment(this.context, "classpath:catalog-minimal.properties");
	validateMinimumCatalog();
}
 
Example #4
Source File: ServiceBrokerPropertiesBindingTest.java    From spring-cloud-open-service-broker with Apache License 2.0 4 votes vote down vote up
@Test
void bindFullValidProperties() {
	this.context.register(ServiceBrokerPropertiesConfiguration.class);
	TestPropertySourceUtils.addPropertiesFilesToEnvironment(this.context, "classpath:catalog-full.properties");
	validateFullCatalog();
}
 
Example #5
Source File: PropertyOverrideContextInitializer.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(configurableApplicationContext, "example.firstProperty=" + PROPERTY_FIRST_VALUE);

    TestPropertySourceUtils.addPropertiesFilesToEnvironment(configurableApplicationContext, "context-override-application.properties");
}