This repository has been archived by the owner on Oct 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pom.xml
331 lines (301 loc) · 9.8 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
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>resteasy-spring-integration-test</artifactId>
<groupId>com.codereligion</groupId>
<version>1.0</version>
<packaging>war</packaging>
<name>RESTEasy with Spring DI and integration test</name>
<properties>
<!-- general maven properties -->
<java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dependency versions -->
<maven.compiler.plugin.version>2.0.2</maven.compiler.plugin.version>
<spring.version>3.1.0.RELEASE</spring.version>
<resteasy.version>2.3.2.Final</resteasy.version>
<!-- test properties -->
<integration.test.context.path>resteasy-spring-integration-test</integration.test.context.path>
<!-- test dependency versions -->
<failsafe.version>2.12.4</failsafe.version>
<surefire.version>2.12.4</surefire.version>
<junit.version>4.10</junit.version>
<jacoco.version>0.5.9.201207300726</jacoco.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- RESTEasy -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<version>${resteasy.version}</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<!-- skip default execution of failsafe and surefire plugin, so that they
are only executed through the profiles -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<!-- defines 2 profiles, one is specific for unit tests the other for integration
tests. both are mutually exclusive, so that in a jenkins build pipeline each
job executes only one profile. -->
<profiles>
<profile>
<id>unit.test</id>
<build>
<plugins>
<!-- code coverage tool to be easily integration into sonar -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-prepare</id>
<phase>test</phase>
<configuration>
<!-- jacoco results are dumped on jvm exit -->
<dumpOnExit>true</dumpOnExit>
<!-- results are appended to existing data -->
<append>true</append>
<!-- name of the property to set the jacoco agent command line to,
this will also include the above configuration -->
<propertyName>jacoco.argLine</propertyName>
</configuration>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<!-- create report on verify (after unit and integration test phase) -->
<id>jacoco-report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- run actual unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>run.unit.tests</id>
<configuration>
<skip>false</skip>
<!-- do not execute classes ending with integration test -->
<excludes>
<exclude>**/*IntegrationTest.class</exclude>
</excludes>
<!-- pass jacoco agent -->
<argLine>${jacoco.argLine}</argLine>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration.test</id>
<build>
<plugins>
<!-- code coverage tool to be easily integration into sonar -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>jacoco-prepare</id>
<phase>test</phase>
<configuration>
<!-- jacoco results are dumped on jvm exit -->
<dumpOnExit>true</dumpOnExit>
<!-- results are appended to existing data -->
<append>true</append>
<!-- name of the property to set the jacoco agent command line to,
this will also include the above configuration -->
<propertyName>jacoco.argLine</propertyName>
</configuration>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<!-- create report on verify (after unit and integration test phase) -->
<id>jacoco-report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- find free ports -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<configuration>
<portNames>
<portName>integration.test.servlet.port</portName>
<portName>integration.test.ajp.port</portName>
</portNames>
</configuration>
<executions>
<execution>
<id>reserve-port</id>
<phase>pre-integration-test</phase>
<goals>
<goal>reserve-network-port</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- web application container wrapper to abstract instantiation of
tomcat, jetty, jboss, etc. this allows us to run tomcat and pass in the jacoco
agent to record code coverage during integration test. -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.1.2</version>
<configuration>
<container>
<!-- container configuration, can also point to a local home directory -->
<containerId>tomcat7x</containerId>
<zipUrlInstaller>
<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.6/bin/apache-tomcat-7.0.6.zip</url>
</zipUrlInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.port>${integration.test.servlet.port}</cargo.servlet.port>
<cargo.tomcat.ajp.port>${integration.test.ajp.port}</cargo.tomcat.ajp.port>
<!-- pass jacoco agent to server, because thats the place where
the actaul code is executed. -->
<cargo.jvmargs>${jacoco.argLine}</cargo.jvmargs>
</properties>
<deployables>
<deployable>
<properties>
<!-- the context path of the application -->
<context>${integration.test.context.path}</context>
</properties>
</deployable>
</deployables>
</configuration>
</configuration>
<executions>
<!-- start server before integration tests -->
<execution>
<id>start-webapp-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<!-- stop server after integration tests -->
<execution>
<id>stop-webapp-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- run actual integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<configuration>
<skip>false</skip>
<!-- only run integration testss -->
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
<systemPropertyVariables>
<integration.test.servlet.port>${integration.test.servlet.port}</integration.test.servlet.port>
<integration.test.context.path>${integration.test.context.path}</integration.test.context.path>
</systemPropertyVariables>
</configuration>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>