Java Code Examples for org.springframework.boot.test.util.TestPropertyValues#applyTo()
The following examples show how to use
org.springframework.boot.test.util.TestPropertyValues#applyTo() .
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: AbstractUnitTest.java From event-sourcing-microservices-example with GNU General Public License v3.0 | 6 votes |
@Override public void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) { String jdbcUrl = String.format("jdbc:postgresql://%s:%d/%s", postgres.getContainerIpAddress(), postgres.getMappedPort(5432), "postgres"); TestPropertyValues values = TestPropertyValues.of( "postgres.host=" + postgres.getContainerIpAddress(), "postgres.port=" + postgres.getMappedPort(5432), "postgres.url=" + jdbcUrl, "postgres.database-name=postgres", "spring.application.name=friend-service", "spring.datasource.data-username=postgres", "spring.datasource.data-password=password", "spring.datasource.url=" + jdbcUrl, "eureka.client.enabled=false"); values.applyTo(configurableApplicationContext); }
Example 2
Source File: AbstractUnitTest.java From event-sourcing-microservices-example with GNU General Public License v3.0 | 6 votes |
@Override public void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) { String jdbcUrl = String.format("jdbc:postgresql://%s:%d/%s", postgres.getContainerIpAddress(), postgres.getMappedPort(5432), "postgres"); TestPropertyValues values = TestPropertyValues.of( "postgres.host=" + postgres.getContainerIpAddress(), "postgres.port=" + postgres.getMappedPort(5432), "postgres.url=" + jdbcUrl, "postgres.database-name=postgres", "spring.application.name=user-service", "spring.datasource.data-username=postgres", "spring.datasource.data-password=password", "spring.datasource.url=" + jdbcUrl, "eureka.client.enabled=false"); values.applyTo(configurableApplicationContext); }
Example 3
Source File: GetPersonByIdIT.java From blog-tutorials with MIT License | 5 votes |
@Override public void initialize(ConfigurableApplicationContext configurableApplicationContext) { TestPropertyValues values = TestPropertyValues.of( "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), "spring.datasource.password=" + postgreSQLContainer.getPassword(), "spring.datasource.username=" + postgreSQLContainer.getUsername() ); values.applyTo(configurableApplicationContext); }
Example 4
Source File: GetAllPersonsIT.java From blog-tutorials with MIT License | 5 votes |
@Override public void initialize(ConfigurableApplicationContext configurableApplicationContext) { TestPropertyValues values = TestPropertyValues.of( "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), "spring.datasource.password=" + postgreSQLContainer.getPassword(), "spring.datasource.username=" + postgreSQLContainer.getUsername() ); values.applyTo(configurableApplicationContext); }
Example 5
Source File: DeletePersonIT.java From blog-tutorials with MIT License | 5 votes |
@Override public void initialize(ConfigurableApplicationContext configurableApplicationContext) { TestPropertyValues values = TestPropertyValues.of( "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), "spring.datasource.password=" + postgreSQLContainer.getPassword(), "spring.datasource.username=" + postgreSQLContainer.getUsername() ); values.applyTo(configurableApplicationContext); }
Example 6
Source File: LicenseAcceptedMSSQLServerContainer.java From infobip-spring-data-querydsl with Apache License 2.0 | 5 votes |
@Override public void initialize(ConfigurableApplicationContext applicationContext) { INSTANCE.start(); String url = applicationContext.getEnvironment() .getProperty("spring.datasource.url") .replace("<port>", INSTANCE.getMappedPort(MS_SQL_SERVER_PORT).toString()); TestPropertyValues values = TestPropertyValues.of( "spring.datasource.url=" + url); values.applyTo(applicationContext); DatabaseCreator creator = new DatabaseCreator(url, INSTANCE.getUsername(), INSTANCE.getPassword()); creator.createDatabaseIfItDoesntExist(); }
Example 7
Source File: AbstractIntegrationTest.java From event-sourcing-microservices-example with GNU General Public License v3.0 | 5 votes |
@Override public void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) { String jdbcUrl = String.format("jdbc:postgresql://%s:%d/%s", postgres.getContainerIpAddress(), postgres.getMappedPort(5432), "postgres"); TestPropertyValues values = TestPropertyValues.of( "postgres.host=" + postgres.getContainerIpAddress(), "postgres.port=" + postgres.getMappedPort(5432), "postgres.url=" + jdbcUrl, "spring.datasource.url=" + jdbcUrl, "spring.cloud.stream.kafka.binder.brokers=" + kafka.getBootstrapServers(), "eureka.client.enabled=false"); values.applyTo(configurableApplicationContext); }
Example 8
Source File: AbstractIntegrationTest.java From event-sourcing-microservices-example with GNU General Public License v3.0 | 5 votes |
@Override public void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) { String jdbcUrl = String.format("jdbc:postgresql://%s:%d/%s", postgres.getContainerIpAddress(), postgres.getMappedPort(5432), "postgres"); TestPropertyValues values = TestPropertyValues.of( "postgres.host=" + postgres.getContainerIpAddress(), "postgres.port=" + postgres.getMappedPort(5432), "postgres.url=" + jdbcUrl, "spring.datasource.url=" + jdbcUrl, "spring.cloud.stream.kafka.binder.brokers=" + kafka.getBootstrapServers(), "eureka.client.enabled=false"); values.applyTo(configurableApplicationContext); }
Example 9
Source File: TimestampTaskPropertiesTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void testEmptyFormat() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); TestPropertyValues testPropertyValues = TestPropertyValues.of("format:"); testPropertyValues.applyTo(context); context.register(Conf.class); context.refresh(); TimestampTaskProperties properties = context .getBean(TimestampTaskProperties.class); properties.getFormat(); }