Elffuss BraidHub

kikocis/java-driver public

Fix issue where tests were being skipped in CI.

Because we have @Before* methods on CCMTestsSupport, any test class
extending this class that had a @CassandraVersion annotation which
causes tests to be skipped for that class would also cause subsequent
tests to be skipped, even if they lacked the @CassandraVersion
annotation.

This happens because TestNG takes the declaring Class of the method
being skipped instead of the Class implementation being evaluated.  To
bypass this, setting configfailurepolicy to true causes TestNG to
evaluate the class implementation instead of the declaring class of the
@Before-annotated method.

Also simplifies build by declaring profiles in parent pom,
and use test.groups property for declaring test groups.

Version mapper tests based on features used. (UDTs, Named params)
Changesetd969dcfd7ef6a48c0243ac2da578fba9be4083e0b90351ec54ba62c3d67a1e58
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-07 14:56 -06:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-11 13:23 -06:00
Parents3b3b00845566

Browse the files at this changeset

7 files changed

modified driver-core/pom.xml +0 −141
@@ -304,66 +304,6 @@
304304 </build>
305305
306306 <profiles>
307- <profile>
308- <id>default</id>
309- <properties>
310- <env>default</env>
311- </properties>
312- <activation>
313- <activeByDefault>true</activeByDefault>
314- </activation>
315- <build>
316- <plugins>
317- <plugin>
318- <groupId>org.apache.maven.plugins</groupId>
319- <artifactId>maven-surefire-plugin</artifactId>
320- <version>2.16</version>
321- <configuration>
322- <groups>unit</groups>
323- <useFile>false</useFile>
324- <systemPropertyVariables>
325- <cassandra.version>${cassandra.version}</cassandra.version>
326- <ipprefix>${ipprefix}</ipprefix>
327- <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS>
328- </systemPropertyVariables>
329- <classpathDependencyExcludes>
330- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
331- </classpathDependencyExcludes>
332- <!--May be needed for debugging-->
333- <!--<forkMode>never</forkMode>-->
334- </configuration>
335- </plugin>
336- </plugins>
337- </build>
338- </profile>
339-
340- <profile>
341- <id>short</id>
342- <properties>
343- <env>default</env>
344- </properties>
345- <build>
346- <plugins>
347- <plugin>
348- <groupId>org.apache.maven.plugins</groupId>
349- <artifactId>maven-surefire-plugin</artifactId>
350- <version>2.16</version>
351- <configuration>
352- <groups>unit,short</groups>
353- <useFile>false</useFile>
354- <systemPropertyVariables>
355- <cassandra.version>${cassandra.version}</cassandra.version>
356- <ipprefix>${ipprefix}</ipprefix>
357- </systemPropertyVariables>
358- <classpathDependencyExcludes>
359- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
360- </classpathDependencyExcludes>
361- </configuration>
362- </plugin>
363- </plugins>
364- </build>
365- </profile>
366-
367307 <profile>
368308 <id>isolated</id>
369309 <properties>
@@ -387,87 +327,6 @@
387327 </plugins>
388328 </build>
389329 </profile>
390-
391- <profile>
392- <id>long</id>
393- <properties>
394- <env>default</env>
395- </properties>
396- <build>
397- <plugins>
398- <plugin>
399- <groupId>org.apache.maven.plugins</groupId>
400- <artifactId>maven-surefire-plugin</artifactId>
401- <version>2.16</version>
402- <configuration>
403- <groups>unit,short,long</groups>
404- <useFile>false</useFile>
405- <systemPropertyVariables>
406- <cassandra.version>${cassandra.version}</cassandra.version>
407- <ipprefix>${ipprefix}</ipprefix>
408- </systemPropertyVariables>
409- <classpathDependencyExcludes>
410- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
411- </classpathDependencyExcludes>
412- </configuration>
413- </plugin>
414- </plugins>
415- </build>
416- </profile>
417-
418- <profile>
419- <id>duration</id>
420- <properties>
421- <env>default</env>
422- </properties>
423- <build>
424- <plugins>
425- <plugin>
426- <groupId>org.apache.maven.plugins</groupId>
427- <artifactId>maven-surefire-plugin</artifactId>
428- <version>2.16</version>
429- <configuration>
430- <groups>unit,short,long,duration</groups>
431- <useFile>false</useFile>
432- <systemPropertyVariables>
433- <cassandra.version>${cassandra.version}</cassandra.version>
434- <ipprefix>${ipprefix}</ipprefix>
435- </systemPropertyVariables>
436- <classpathDependencyExcludes>
437- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
438- </classpathDependencyExcludes>
439- </configuration>
440- </plugin>
441- </plugins>
442- </build>
443- </profile>
444-
445- <profile>
446- <id>doc</id>
447- <properties>
448- <env>default</env>
449- </properties>
450- <build>
451- <plugins>
452- <plugin>
453- <groupId>org.apache.maven.plugins</groupId>
454- <artifactId>maven-surefire-plugin</artifactId>
455- <version>2.16</version>
456- <configuration>
457- <groups>unit,doc</groups>
458- <useFile>false</useFile>
459- <systemPropertyVariables>
460- <cassandra.version>${cassandra.version}</cassandra.version>
461- <ipprefix>${ipprefix}</ipprefix>
462- </systemPropertyVariables>
463- <classpathDependencyExcludes>
464- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
465- </classpathDependencyExcludes>
466- </configuration>
467- </plugin>
468- </plugins>
469- </build>
470- </profile>
471330 </profiles>
472331
473332 <licenses>
modified driver-examples/osgi/pom.xml +2 −41
@@ -193,13 +193,6 @@
193193 </activation>
194194 <build>
195195 <plugins>
196- <plugin>
197- <groupId>org.apache.maven.plugins</groupId>
198- <artifactId>maven-surefire-plugin</artifactId>
199- <version>2.14</version>
200- <configuration>
201- </configuration>
202- </plugin>
203196 <plugin>
204197 <groupId>org.apache.maven.plugins</groupId>
205198 <artifactId>maven-failsafe-plugin</artifactId>
@@ -222,30 +215,14 @@
222215
223216 <profile>
224217 <id>short</id>
225- <properties>
226- <env>default</env>
227- </properties>
228218 <build>
229219 <plugins>
230- <plugin>
231- <groupId>org.apache.maven.plugins</groupId>
232- <artifactId>maven-surefire-plugin</artifactId>
233- <version>2.14</version>
234- <configuration>
235- <groups>unit,short</groups>
236- <useFile>false</useFile>
237- <systemPropertyVariables>
238- <cassandra.version>${cassandra.version}</cassandra.version>
239- <ipprefix>${ipprefix}</ipprefix>
240- </systemPropertyVariables>
241- </configuration>
242- </plugin>
243220 <plugin>
244221 <groupId>org.apache.maven.plugins</groupId>
245222 <artifactId>maven-failsafe-plugin</artifactId>
246223 <version>2.18.1</version>
247224 <configuration>
248- <groups>unit,short</groups>
225+ <groups>${test.groups}</groups>
249226 <useFile>false</useFile>
250227 <systemPropertyVariables>
251228 <cassandra.version>${cassandra.version}</cassandra.version>
@@ -259,30 +236,14 @@
259236
260237 <profile>
261238 <id>long</id>
262- <properties>
263- <env>default</env>
264- </properties>
265239 <build>
266240 <plugins>
267- <plugin>
268- <groupId>org.apache.maven.plugins</groupId>
269- <artifactId>maven-surefire-plugin</artifactId>
270- <version>2.16</version>
271- <configuration>
272- <groups>unit,short,long</groups>
273- <useFile>false</useFile>
274- <systemPropertyVariables>
275- <cassandra.version>${cassandra.version}</cassandra.version>
276- <ipprefix>${ipprefix}</ipprefix>
277- </systemPropertyVariables>
278- </configuration>
279- </plugin>
280241 <plugin>
281242 <groupId>org.apache.maven.plugins</groupId>
282243 <artifactId>maven-failsafe-plugin</artifactId>
283244 <version>2.18.1</version>
284245 <configuration>
285- <groups>unit,short,long</groups>
246+ <groups>${test.groups}</groups>
286247 <useFile>false</useFile>
287248 <systemPropertyVariables>
288249 <cassandra.version>${cassandra.version}</cassandra.version>
modified driver-mapping/pom.xml +0 −87
@@ -126,93 +126,6 @@
126126 </plugin>
127127 </plugins>
128128 </build>
129-
130- <profiles>
131- <profile>
132- <id>default</id>
133- <properties>
134- <env>default</env>
135- </properties>
136- <activation>
137- <activeByDefault>true</activeByDefault>
138- </activation>
139- <build>
140- <plugins>
141- <plugin>
142- <groupId>org.apache.maven.plugins</groupId>
143- <artifactId>maven-surefire-plugin</artifactId>
144- <version>2.14</version>
145- <configuration>
146- <groups>unit</groups>
147- <useFile>false</useFile>
148- <systemPropertyVariables>
149- <cassandra.version>${cassandra.version}</cassandra.version>
150- <ipprefix>${ipprefix}</ipprefix>
151- </systemPropertyVariables>
152- </configuration>
153- </plugin>
154- <plugin>
155- <artifactId>maven-compiler-plugin</artifactId>
156- <configuration>
157- <compilerArgument>-Xlint:all</compilerArgument>
158- <showWarnings>true</showWarnings>
159- <showDeprecation>true</showDeprecation>
160- </configuration>
161- </plugin>
162- </plugins>
163- </build>
164- </profile>
165-
166- <profile>
167- <id>short</id>
168- <properties>
169- <env>default</env>
170- </properties>
171- <build>
172- <plugins>
173- <plugin>
174- <groupId>org.apache.maven.plugins</groupId>
175- <artifactId>maven-surefire-plugin</artifactId>
176- <version>2.14</version>
177- <configuration>
178- <groups>unit,short</groups>
179- <useFile>false</useFile>
180- <systemPropertyVariables>
181- <cassandra.version>${cassandra.version}</cassandra.version>
182- <ipprefix>${ipprefix}</ipprefix>
183- </systemPropertyVariables>
184- </configuration>
185- </plugin>
186- </plugins>
187- </build>
188- </profile>
189-
190- <profile>
191- <id>long</id>
192- <properties>
193- <env>default</env>
194- </properties>
195- <build>
196- <plugins>
197- <plugin>
198- <groupId>org.apache.maven.plugins</groupId>
199- <artifactId>maven-surefire-plugin</artifactId>
200- <version>2.14</version>
201- <configuration>
202- <groups>unit,short,long</groups>
203- <useFile>false</useFile>
204- <systemPropertyVariables>
205- <cassandra.version>${cassandra.version}</cassandra.version>
206- <ipprefix>${ipprefix}</ipprefix>
207- </systemPropertyVariables>
208- </configuration>
209- </plugin>
210- </plugins>
211- </build>
212- </profile>
213-
214- </profiles>
215-
216129 <licenses>
217130 <license>
218131 <name>Apache 2</name>
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperTest.java +4 −0
@@ -468,6 +468,7 @@
468468 * @test_category object_mapper
469469 */
470470 @Test(groups = "short")
471+ @CassandraVersion(major = 2.0)
471472 public void should_flag_statement_as_idempotent() {
472473 MappingManager manager = new MappingManager(session());
473474 PostAccessor post = manager.createAccessor(PostAccessor.class);
@@ -484,6 +485,7 @@
484485 * @test_category object_mapper
485486 */
486487 @Test(groups = "short")
488+ @CassandraVersion(major = 2.0)
487489 public void should_flag_statement_as_non_idempotent() {
488490 MappingManager manager = new MappingManager(session());
489491 PostAccessor post = manager.createAccessor(PostAccessor.class);
@@ -500,6 +502,7 @@
500502 * @test_category object_mapper
501503 */
502504 @Test(groups = "short")
505+ @CassandraVersion(major = 2.0)
503506 public void should_flag_statement_with_null_idempotence() {
504507 MappingManager manager = new MappingManager(session());
505508 PostAccessor post = manager.createAccessor(PostAccessor.class);
@@ -515,6 +518,7 @@
515518 * @test_category object_mapper
516519 */
517520 @Test(groups = "short")
521+ @CassandraVersion(major = 2.0)
518522 public void should_flag_all_mapper_generated_statements_as_idempotent() {
519523 MappingManager manager = new MappingManager(session());
520524 Mapper<User> mapper = manager.mapper(User.class);
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTCollectionsTest.java +2 −0
@@ -16,6 +16,7 @@
1616 package com.datastax.driver.mapping;
1717
1818 import com.datastax.driver.core.CCMTestsSupport;
19+import com.datastax.driver.core.utils.CassandraVersion;
1920 import com.datastax.driver.mapping.annotations.*;
2021 import com.google.common.base.Objects;
2122 import com.google.common.collect.ImmutableMap;
@@ -33,6 +34,7 @@
3334 * Tests mapping of collections of UDTs.
3435 */
3536 @SuppressWarnings("unused")
37+@CassandraVersion(major = 2.1)
3638 public class MapperUDTCollectionsTest extends CCMTestsSupport {
3739
3840 @Override
modified driver-mapping/src/test/java/com/datastax/driver/mapping/MapperUDTTest.java +2 −0
@@ -17,6 +17,7 @@
1717
1818 import com.datastax.driver.core.CCMTestsSupport;
1919 import com.datastax.driver.core.ResultSet;
20+import com.datastax.driver.core.utils.CassandraVersion;
2021 import com.datastax.driver.mapping.annotations.*;
2122 import com.google.common.base.Objects;
2223 import com.google.common.collect.Maps;
@@ -29,6 +30,7 @@
2930 import static org.testng.Assert.*;
3031
3132 @SuppressWarnings("unused")
33+@CassandraVersion(major = 2.1)
3234 public class MapperUDTTest extends CCMTestsSupport {
3335
3436 @Override
modified pom.xml +66 −9
@@ -64,6 +64,8 @@
6464 <mockito.version>1.10.8</mockito.version>
6565 <scassandra.version>0.11.0</scassandra.version>
6666 <main.basedir>${project.basedir}</main.basedir>
67+ <ipprefix>127.0.1.</ipprefix>
68+ <test.groups>unit</test.groups>
6769 </properties>
6870
6971 <dependencies>
@@ -83,6 +85,16 @@
8385 </dependencies>
8486
8587 <profiles>
88+ <profile>
89+ <id>default</id>
90+ <properties>
91+ <env>default</env>
92+ <test.groups>unit</test.groups>
93+ </properties>
94+ <activation>
95+ <activeByDefault>true</activeByDefault>
96+ </activation>
97+ </profile>
8698 <profile>
8799 <id>doclint-java8-disable</id>
88100 <activation>
@@ -92,11 +104,40 @@
92104 <javadoc.opts>-Xdoclint:none</javadoc.opts>
93105 </properties>
94106 </profile>
107+ <profile>
108+ <id>short</id>
109+ <properties>
110+ <env>default</env>
111+ <test.groups>unit,short</test.groups>
112+ </properties>
113+ </profile>
114+ <profile>
115+ <id>long</id>
116+ <properties>
117+ <env>default</env>
118+ <test.groups>unit,short,long</test.groups>
119+ </properties>
120+ </profile>
121+ <profile>
122+ <id>duration</id>
123+ <properties>
124+ <env>default</env>
125+ <test.groups>unit,short,long,duration</test.groups>
126+ </properties>
127+ </profile>
128+ <profile>
129+ <id>doc</id>
130+ <properties>
131+ <env>default</env>
132+ <test.groups>unit,doc</test.groups>
133+ </properties>
134+ </profile>
95135 <profile>
96136 <!-- default profile settings for 'isolated' test group, will skip tests unless overriden in child module. -->
97137 <id>isolated</id>
98138 <properties>
99139 <env>default</env>
140+ <test.groups>isolated</test.groups>
100141 </properties>
101142 <build>
102143 <plugins>
@@ -108,16 +149,7 @@
108149 <skip>true</skip>
109150 <forkCount>1</forkCount>
110151 <reuseForks>false</reuseForks>
111- <groups>isolated</groups>
112152 <reportNameSuffix>isolated</reportNameSuffix>
113- <useFile>false</useFile>
114- <systemPropertyVariables>
115- <cassandra.version>${cassandra.version}</cassandra.version>
116- <ipprefix>${ipprefix}</ipprefix>
117- </systemPropertyVariables>
118- <classpathDependencyExcludes>
119- <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
120- </classpathDependencyExcludes>
121153 <!-- This requires includes to be explicitly specified by implementing classes.
122154 This is needed to prevent creating a JVM fork for each test, even those that don't
123155 have the isolated group. -->
@@ -242,7 +274,32 @@
242274 </execution>
243275 </executions>
244276 </plugin>
277+ <plugin>
278+ <groupId>org.apache.maven.plugins</groupId>
279+ <artifactId>maven-surefire-plugin</artifactId>
280+ <version>2.16</version>
281+ <configuration>
282+ <groups>${test.groups}</groups>
283+ <useFile>false</useFile>
284+ <systemPropertyVariables>
285+ <cassandra.version>${cassandra.version}</cassandra.version>
286+ <ipprefix>${ipprefix}</ipprefix>
287+ <com.datastax.driver.NEW_NODE_DELAY_SECONDS>60</com.datastax.driver.NEW_NODE_DELAY_SECONDS>
288+ </systemPropertyVariables>
289+ <classpathDependencyExcludes>
290+ <classpathDependencyExcludes>io.netty:netty-transport-native-epoll</classpathDependencyExcludes>
291+ </classpathDependencyExcludes>
292+ <properties>
293+ <property>
294+ <!-- Don't skip tests after a @Before method throws a SkipException -->
295+ <name>configfailurepolicy</name>
296+ <value>continue</value>
297+ </property>
298+ </properties>
299+ </configuration>
300+ </plugin>
245301 </plugins>
302+
246303 </build>
247304
248305 <licenses>