Skip to content

Commit 9ba99d2

Browse files
committed
Integration test inited
1 parent 85a5a6e commit 9ba99d2

34 files changed

Lines changed: 759 additions & 76 deletions

File tree

api-gateway-service/pom.xml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2424
<java.version>1.8</java.version>
2525
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26+
<docker.baseDir>${basedir}/src/main/docker</docker.baseDir>
2627
</properties>
2728

2829
<dependencies>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-actuator</artifactId>
33+
</dependency>
2934
<dependency>
3035
<groupId>org.springframework.cloud</groupId>
3136
<artifactId>spring-cloud-starter-zuul</artifactId>
3237
</dependency>
33-
3438
<dependency>
3539
<groupId>org.springframework.cloud</groupId>
3640
<artifactId>spring-cloud-starter-eureka</artifactId>
@@ -61,8 +65,48 @@
6165
<groupId>org.springframework.boot</groupId>
6266
<artifactId>spring-boot-maven-plugin</artifactId>
6367
</plugin>
68+
<plugin>
69+
<artifactId>maven-antrun-plugin</artifactId>
70+
<configuration>
71+
<tasks>
72+
<copy file="${project.build.directory}/${project.build.finalName}.jar"
73+
tofile="${project.build.directory}/${project.artifactId}.jar"/>
74+
</tasks>
75+
</configuration>
76+
<executions>
77+
<execution>
78+
<phase>install</phase>
79+
<goals>
80+
<goal>run</goal>
81+
</goals>
82+
</execution>
83+
</executions>
84+
</plugin>
85+
<plugin>
86+
<groupId>com.spotify</groupId>
87+
<artifactId>docker-maven-plugin</artifactId>
88+
<version>1.0.0</version>
89+
<executions>
90+
<execution>
91+
<id>build-image</id>
92+
<phase>install</phase>
93+
<goals>
94+
<goal>build</goal>
95+
</goals>
96+
</execution>
97+
</executions>
98+
<configuration>
99+
<imageName>${project.artifactId}</imageName>
100+
<dockerDirectory>${docker.baseDir}</dockerDirectory>
101+
<resources>
102+
<resource>
103+
<targetPath>/</targetPath>
104+
<directory>${project.build.directory}</directory>
105+
<include>${project.artifactId}.jar</include>
106+
</resource>
107+
</resources>
108+
</configuration>
109+
</plugin>
64110
</plugins>
65111
</build>
66-
67-
68112
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM java:8
2+
ADD api-gateway-service.jar api-gateway-service.jar
3+
ADD wrapper.sh wrapper.sh
4+
RUN bash -c 'chmod +x /wrapper.sh'
5+
RUN bash -c 'touch /app.jar'
6+
ENTRYPOINT ["/bin/bash", "/wrapper.sh"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
if [ "$WATE" == "true" ]; then
4+
5+
echo "Trying to connect to discovery-server"
6+
until $(curl --output /dev/null --silent --head --fail http://discovery-server:8761/info); do
7+
echo '.'
8+
sleep 1
9+
done
10+
11+
echo "Trying to connect to storage-service"
12+
until $(curl --output /dev/null --silent --head --fail http://storage-service:8091/info); do
13+
echo '.'
14+
sleep 1
15+
done
16+
17+
echo "Trying to connect to realtor-service"
18+
until $(curl --output /dev/null --silent --head --fail http://realtor-service:8080/info); do
19+
echo '.'
20+
sleep 1
21+
done
22+
echo "Starting"
23+
24+
fi
25+
26+
java -jar /api-gateway-service.jar
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
spring.application.name=api-gateway-service
2-
server.port=8090
2+
server.port=8090
3+
4+
eureka.instance.preferIpAddress=true
5+
6+
endpoints.info.id=info
7+
endpoints.info.sensitive=false
8+
endpoints.info.enabled=true
9+
10+
info.app.name=Api gateway service

config-server/pom.xml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,32 @@
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2424
<java.version>1.8</java.version>
2525
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26+
<docker.baseDir>${basedir}/src/main/docker</docker.baseDir>
2627
</properties>
2728

2829
<dependencies>
2930
<dependency>
3031
<groupId>org.springframework.boot</groupId>
3132
<artifactId>spring-boot-starter-actuator</artifactId>
3233
</dependency>
33-
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter-actuator</artifactId>
37+
</dependency>
3438
<dependency>
3539
<groupId>org.springframework.cloud</groupId>
3640
<artifactId>spring-cloud-config-server</artifactId>
3741
</dependency>
42+
<dependency>
43+
<groupId>org.springframework.cloud</groupId>
44+
<artifactId>spring-cloud-starter-eureka</artifactId>
45+
</dependency>
3846

3947
<dependency>
4048
<groupId>org.springframework.boot</groupId>
4149
<artifactId>spring-boot-starter-test</artifactId>
4250
<scope>test</scope>
4351
</dependency>
44-
45-
<dependency>
46-
<groupId>org.springframework.cloud</groupId>
47-
<artifactId>spring-cloud-starter-eureka</artifactId>
48-
</dependency>
4952
</dependencies>
5053

5154
<dependencyManagement>
@@ -66,8 +69,48 @@
6669
<groupId>org.springframework.boot</groupId>
6770
<artifactId>spring-boot-maven-plugin</artifactId>
6871
</plugin>
72+
<plugin>
73+
<artifactId>maven-antrun-plugin</artifactId>
74+
<configuration>
75+
<tasks>
76+
<copy file="${project.build.directory}/${project.build.finalName}.jar"
77+
tofile="${project.build.directory}/${project.artifactId}.jar"/>
78+
</tasks>
79+
</configuration>
80+
<executions>
81+
<execution>
82+
<phase>install</phase>
83+
<goals>
84+
<goal>run</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
<plugin>
90+
<groupId>com.spotify</groupId>
91+
<artifactId>docker-maven-plugin</artifactId>
92+
<version>1.0.0</version>
93+
<executions>
94+
<execution>
95+
<id>build-image</id>
96+
<phase>install</phase>
97+
<goals>
98+
<goal>build</goal>
99+
</goals>
100+
</execution>
101+
</executions>
102+
<configuration>
103+
<imageName>${project.artifactId}</imageName>
104+
<dockerDirectory>${docker.baseDir}</dockerDirectory>
105+
<resources>
106+
<resource>
107+
<targetPath>/</targetPath>
108+
<directory>${project.build.directory}</directory>
109+
<include>${project.artifactId}.jar</include>
110+
</resource>
111+
</resources>
112+
</configuration>
113+
</plugin>
69114
</plugins>
70115
</build>
71-
72-
73116
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM java:8
2+
ADD config-server.jar config-server.jar
3+
ADD wrapper.sh wrapper.sh
4+
RUN bash -c 'chmod +x /wrapper.sh'
5+
RUN bash -c 'touch /app.jar'
6+
ENTRYPOINT ["/bin/bash", "/wrapper.sh"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
if [ "$WATE" == "true" ]; then
4+
5+
echo "Trying to connect to discovery-server"
6+
until $(curl --output /dev/null --silent --head --fail http://discovery-server:8761/info); do
7+
echo '.'
8+
sleep 1
9+
done
10+
echo "Starting"
11+
12+
fi
13+
14+
java -jar /config-server.jar

config-server/src/main/resources/application.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ spring.cloud.config.discovery.enabled=true
55
spring.application.name=config-server
66

77
server.port=8888
8+
9+
eureka.instance.preferIpAddress=true
10+
11+
endpoints.info.id=info
12+
endpoints.info.sensitive=false
13+
endpoints.info.enabled=true
14+
15+
info.app.name=Config server

discovery-server/pom.xml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2424
<java.version>1.8</java.version>
2525
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
26+
<docker.baseDir>${basedir}/src/main/docker</docker.baseDir>
2627
</properties>
2728

2829
<dependencies>
30+
<dependency>
31+
<groupId>org.springframework.boot</groupId>
32+
<artifactId>spring-boot-starter-actuator</artifactId>
33+
</dependency>
2934
<dependency>
3035
<groupId>org.springframework.cloud</groupId>
3136
<artifactId>spring-cloud-starter-eureka-server</artifactId>
@@ -56,8 +61,48 @@
5661
<groupId>org.springframework.boot</groupId>
5762
<artifactId>spring-boot-maven-plugin</artifactId>
5863
</plugin>
64+
<plugin>
65+
<artifactId>maven-antrun-plugin</artifactId>
66+
<configuration>
67+
<tasks>
68+
<copy file="${project.build.directory}/${project.build.finalName}.jar"
69+
tofile="${project.build.directory}/${project.artifactId}.jar"/>
70+
</tasks>
71+
</configuration>
72+
<executions>
73+
<execution>
74+
<phase>install</phase>
75+
<goals>
76+
<goal>run</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
<plugin>
82+
<groupId>com.spotify</groupId>
83+
<artifactId>docker-maven-plugin</artifactId>
84+
<version>1.0.0</version>
85+
<executions>
86+
<execution>
87+
<id>build-image</id>
88+
<phase>install</phase>
89+
<goals>
90+
<goal>build</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
<configuration>
95+
<imageName>${project.artifactId}</imageName>
96+
<dockerDirectory>${docker.baseDir}</dockerDirectory>
97+
<resources>
98+
<resource>
99+
<targetPath>/</targetPath>
100+
<directory>${project.build.directory}</directory>
101+
<include>${project.artifactId}.jar</include>
102+
</resource>
103+
</resources>
104+
</configuration>
105+
</plugin>
59106
</plugins>
60107
</build>
61-
62-
63108
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM java:8
2+
ADD discovery-server.jar discovery-server.jar
3+
ADD wrapper.sh wrapper.sh
4+
RUN bash -c 'chmod +x /wrapper.sh'
5+
RUN bash -c 'touch /app.jar'
6+
ENTRYPOINT ["/bin/bash", "/wrapper.sh"]

0 commit comments

Comments
 (0)