-
Notifications
You must be signed in to change notification settings - Fork 634
/
pom.xml
416 lines (390 loc) · 15.3 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--
Integration test demo which makes some small tests for Jolokia
Call it with: 'mvn verify'
The test does the following:
* Creates a Docker data container with 'jolokia.war' and 'jolokia-it.war' as described in
assembly descriptor src/main/docker-assembly.xml
* Starts (and optionally pull) the jolokia/tomcat-7.0 container with the data container linked to it
* Waits until Tomcat is up (i.e. until it is reachable via an HTTP request)
* Runs an integration test via maven-failsafe-plugin, using rest-assured for accessing the deployed app.
* Prints out some version information about the contaner running (in order prove that's not a fake ;-)
* Stops and removes the containers.
-->
<groupId>org.jolokia</groupId>
<artifactId>docker-jolokia-demo</artifactId>
<version>0.11.5-SNAPSHOT</version>
<url>http://www.jolokia.org</url>
<properties>
<server.version>7.0</server.version>
<server.name>tomcat</server.name>
<image>consol/${server.name}-${server.version}:latest</image>
<jolokia.version>1.2.2</jolokia.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- Dependencies with their version which are referenced from the
src/main/docker-assembly.xml descriptor. These are the WAR files which gets
stored in the data docker container which then is linked into tomcat container for
deployment -->
<!-- Jolokia Agent -->
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-war</artifactId>
<version>${jolokia.version}</version>
<type>war</type>
</dependency>
<!-- Jolokia Integration Test Setup (registers some Test MBeans) -->
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-it-war</artifactId>
<version>${jolokia.version}</version>
<type>war</type>
</dependency>
<!-- ====================================================================================== -->
<!-- Used for the integration tests -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<logDate>default</logDate>
<verbose>true</verbose>
<images>
<!-- Docker Image to use -->
<image>
<!-- App-Server Image -->
<alias>server</alias>
<name>${image}</name>
<run>
<namingStrategy>alias</namingStrategy>
<volumes>
<from>
<image>data</image>
</from>
</volumes>
<env>
<CATALINA_OPTS>-Xmx32m</CATALINA_OPTS>
<!-- Base starts jolokia by default. With this, it can be disabled -->
<JOLOKIA_OFF>1</JOLOKIA_OFF>
</env>
<envPropertyFile>${project.basedir}/src/main/docker/environment.properties</envPropertyFile>
<ports>
<!-- Port mappings: Container internal port (which must be exposed) will be
dynamically mapped and this (random) port will be assigned to the maven variable
${jolokia.port}. Multiple port mappings can be specified here-->
<port>jolokia.port:8080</port>
<port>8600:53/udp</port>
</ports>
<wait>
<!-- The plugin waits until this URL is reachable via HTTP ... -->
<log>Server startup</log>
<url>http://${docker.host.address}:${jolokia.port}/jolokia</url>
<time>10000</time>
<shutdown>500</shutdown>
</wait>
<log>
<enabled>true</enabled>
<color>red</color>
</log>
</run>
</image>
<image>
<alias>data</alias>
<!-- Artifact Image-->
<name>jolokia/${project.artifactId}:${project.version}</name>
<build>
<!--<tags>-->
<!--<tag>latest</tag>-->
<!--</tags>-->
<!--<!– The assembly descriptor prepares the "/maven" directory in the temporary data-->
container which will be made available to the specified container. The startup script in the
container (jolokia/tomcat-7.0) should check for files in this directory and use them
for deploying them. I.e. this image has a script 'deploy-and-run.sh' which exactly
does this. -->
<assembly>
<mode>zip</mode>
<descriptor>assembly.xml</descriptor>
</assembly>
</build>
</image>
</images>
</configuration>
<!-- Connect this plugin to the maven lifecycle around the integration-test phase. I.e. start the container
in pre-integration-test and stop it in post-integration-test. -->
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- fails-safe-plugin should be used instead of surefire so that the container gets stopped even
when the tests fail -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<!-- Needs to be repeated here (the following two lines strangely doesn't work when the next line is omitted although)
Maven, you little sneaky beast ... -->
<jolokia.port>${jolokia.port}</jolokia.port>
<!-- Map maven variables to system properties which in turn can be used in the test classes -->
<jolokia.url>http://${docker.host.address}:${jolokia.port}/jolokia</jolokia.url>
<jolokia.version>${jolokia.version}</jolokia.version>
</systemPropertyVariables>
</configuration>
</plugin>
<!-- Tell surefire to skip test, we are using the failsafe plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<profiles>
<profile>
<id>merge</id>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<image>
<!-- Artifact Image-->
<name>jolokia/${project.artifactId}:${project.version}</name>
<build>
<from>${image}</from>
<assembly>
<descriptor>assembly.xml</descriptor>
</assembly>
</build>
<run>
<env>
<CATALINA_OPTS>-Xmx32m</CATALINA_OPTS>
<JOLOKIA_OFF>1</JOLOKIA_OFF>
</env>
<ports>
<!-- Port mappings: Container internal port (which must be exposed) will be
dynamically mapped and this (random) port will be assigned to the maven variable
${tomcat.port}. Multiple port mapping can be specified here-->
<port>jolokia.port:8080</port>
</ports>
<wait>
<!-- The plugin waits until this URL is reachable via HTTP ... -->
<url>http://${docker.host.address}:${jolokia.port}/jolokia</url>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>inline</id>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<image>
<!-- Artifact Image-->
<name>jolokia/${project.artifactId}:${project.version}</name>
<build>
<from>${image}</from>
<assembly>
<inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jolokia-it</id>
<dependencySets>
<dependencySet>
<includes>
<include>org.jolokia:jolokia-war</include>
</includes>
<outputDirectory>.</outputDirectory>
<outputFileNameMapping>jolokia.war</outputFileNameMapping>
</dependencySet>
<dependencySet>
<includes>
<include>org.jolokia:jolokia-it-war</include>
</includes>
<outputDirectory>.</outputDirectory>
<outputFileNameMapping>jolokia-it.war</outputFileNameMapping>
</dependencySet>
</dependencySets>
</inline>
</assembly>
</build>
<run>
<ports>
<port>jolokia.port:8080</port>
</ports>
<wait>
<!-- The plugin waits until this URL is reachable via HTTP ... -->
<url>http://${docker.host.address}:${jolokia.port}/jolokia</url>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>props</id>
<properties>
<docker.name>jolokia/${project.artifactId}:${project.version}</docker.name>
<docker.alias>service</docker.alias>
<docker.from>${image}</docker.from>
<docker.assembly.descriptor>assembly.xml</docker.assembly.descriptor>
<docker.env.CATALINA_OPTS>-Xmx32m</docker.env.CATALINA_OPTS>
<docker.env.JOLOKIA_OPTS>1</docker.env.JOLOKIA_OPTS>
<docker.ports.0>jolokia.port:8080</docker.ports.0>
<docker.wait.url>http://${docker.host.address}:${jolokia.port}/jolokia</docker.wait.url>
<docker.wait.time>10000</docker.wait.time>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<image>
<external>
<type>props</type>
<prefix>docker</prefix>
</external>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>wildfly</id>
<build>
<plugins>
<plugin>
<groupId>org.jolokia</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration combine.self="override">
<images>
<image>
<!-- Artifact Image-->
<name>jolokia/${project.artifactId}-wildfly:${project.version}</name>
<build>
<from>jboss/wildfly:8.2.0.Final</from>
<assembly>
<user>jboss:jboss:jboss</user>
<basedir>/opt/jboss/wildfly/standalone/deployments</basedir>
<descriptor>assembly.xml</descriptor>
</assembly>
</build>
<run>
<ports>
<port>jolokia.port:8080</port>
</ports>
<wait>
<!-- The plugin waits until this URL is reachable via HTTP ... -->
<url>http://${docker.host.address}:${jolokia.port}/jolokia</url>
<time>10000</time>
</wait>
</run>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>tomcat</id>
<properties>
<server.name>tomcat</server.name>
<server.version>7.0</server.version>
</properties>
<activation><activeByDefault>true</activeByDefault></activation>
</profile>
<profile>
<id>jetty</id>
<properties>
<server.name>jetty</server.name>
<server.version>8</server.version>
</properties>
</profile>
</profiles>
</project>