Merge pull request #6705 from rozagerardo/geroza/BAEL-9493_Fix-tests-in-spring-cloud-projects-part-2
[BAEL-9494] fix spring-cloud context integration tests - part 2
This commit is contained in:
commit
ffbfa16435
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung;
|
package com.baeldung.spring.cloud.config.client;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -6,12 +6,15 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import com.baeldung.spring.cloud.config.client.ConfigClient;
|
/**
|
||||||
|
*
|
||||||
|
* The app needs the server running on port 8888. Can be started with docker
|
||||||
|
*
|
||||||
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = ConfigClient.class)
|
@SpringBootTest(classes = ConfigClient.class)
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
@Test
|
@Test
|
||||||
public void contextLoads() {
|
public void contextLoads() {
|
||||||
}
|
}
|
@ -6,16 +6,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* The context will load successfully with some properties provided by docker
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = ConfigServer.class)
|
@SpringBootTest(classes = ConfigServer.class)
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class SpringContextLiveTest {
|
public class SpringContextIntegrationTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
}
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
### This should be provided by the docker config
|
||||||
|
spring.cloud.config.server.git.uri=classpath:.
|
@ -4,5 +4,6 @@ spring.datasource.maxIdle=5
|
|||||||
spring.datasource.minIdle=2
|
spring.datasource.minIdle=2
|
||||||
spring.datasource.initialSize=5
|
spring.datasource.initialSize=5
|
||||||
spring.datasource.removeAbandoned=true
|
spring.datasource.removeAbandoned=true
|
||||||
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung;
|
package com.baeldung.spring.cloud.connectors.heroku;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
@ -0,0 +1,2 @@
|
|||||||
|
spring.jpa.hibernate.ddl-auto=create
|
||||||
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung;
|
package com.baeldung.spring.cloud.consul;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -9,10 +9,18 @@ import com.baeldung.spring.cloud.consul.discovery.DiscoveryClientApplication;
|
|||||||
import com.baeldung.spring.cloud.consul.health.ServiceDiscoveryApplication;
|
import com.baeldung.spring.cloud.consul.health.ServiceDiscoveryApplication;
|
||||||
import com.baeldung.spring.cloud.consul.properties.DistributedPropertiesApplication;
|
import com.baeldung.spring.cloud.consul.properties.DistributedPropertiesApplication;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This Live test requires:
|
||||||
|
* * a Consul instance running on port 8500
|
||||||
|
* * Consul configured with particular properties (e.g. 'my.prop')
|
||||||
|
*
|
||||||
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = { DiscoveryClientApplication.class, ServiceDiscoveryApplication.class,
|
@SpringBootTest(classes = { DiscoveryClientApplication.class, ServiceDiscoveryApplication.class,
|
||||||
DistributedPropertiesApplication.class })
|
DistributedPropertiesApplication.class })
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -5,9 +5,15 @@ import org.junit.runner.RunWith;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This Live Test requires:
|
||||||
|
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = BooksApiApplication.class)
|
@SpringBootTest(classes = BooksApiApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -0,0 +1,21 @@
|
|||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This Live Test requires:
|
||||||
|
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = SpringCloudRestServerApplication.class)
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,15 @@ import org.junit.runner.RunWith;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This Live Test requires:
|
||||||
|
* * A Redis instance running in port 6379 (e.g. using `docker run --name some-redis -p 6379:6379 -d redis`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = BookReviewsApiApplication.class)
|
@SpringBootTest(classes = BookReviewsApiApplication.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -1,4 +1,4 @@
|
|||||||
package org.baeldung;
|
package com.baeldung.twitterhdfs.aggregate;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -6,7 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = SpringCloudRestServerApplication.class)
|
@SpringBootTest(classes = AggregateApp.class)
|
||||||
public class SpringContextIntegrationTest {
|
public class SpringContextIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -1,20 +0,0 @@
|
|||||||
package org.baeldung;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
import com.baeldung.twitterhdfs.aggregate.AggregateApp;
|
|
||||||
import com.baeldung.twitterhdfs.processor.ProcessorApp;
|
|
||||||
import com.baeldung.twitterhdfs.sink.SinkApp;
|
|
||||||
import com.baeldung.twitterhdfs.source.SourceApp;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = {AggregateApp.class, ProcessorApp.class, SinkApp.class, SourceApp.class})
|
|
||||||
public class SpringContextIntegrationTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user