From b5c38b29a293d78a08190ebca8f4273c971f0794 Mon Sep 17 00:00:00 2001
From: Sean Busbey <sean.busbey@gmail.com>
Date: Fri, 25 Mar 2016 02:01:11 -0500
Subject: [PATCH] [cassandra2] switch to maven profile to skip tests under
 jdk7.

---
 cassandra2/pom.xml                            | 20 +++++++++++++++++++
 .../yahoo/ycsb/db/CassandraCQLClientTest.java |  5 -----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/cassandra2/pom.xml b/cassandra2/pom.xml
index a5c34b12..fccd4b32 100644
--- a/cassandra2/pom.xml
+++ b/cassandra2/pom.xml
@@ -31,6 +31,11 @@ LICENSE file.
   <name>Cassandra 2.1+ DB Binding</name>
   <packaging>jar</packaging>
 
+  <properties>
+    <!-- Skip tests by default. will be activated by jdk8 profile -->
+    <skipTests>true</skipTests>
+  </properties>
+
   <dependencies>
     <!-- CQL driver -->
     <dependency>
@@ -58,4 +63,19 @@ LICENSE file.
       <scope>test</scope>
     </dependency>
   </dependencies>
+
+  <profiles>
+    <!-- Cassandra 2.2+ requires JDK8 to run, so none of our tests
+         will work unless we're using jdk8.
+      -->
+    <profile>
+      <id>jdk8-tests</id>
+      <activation>
+        <jdk>1.8</jdk>
+      </activation>
+      <properties>
+        <skipTests>false</skipTests>
+      </properties>
+    </profile>
+  </profiles>
 </project>
diff --git a/cassandra2/src/test/java/com/yahoo/ycsb/db/CassandraCQLClientTest.java b/cassandra2/src/test/java/com/yahoo/ycsb/db/CassandraCQLClientTest.java
index 8336dc07..60b7e2f3 100644
--- a/cassandra2/src/test/java/com/yahoo/ycsb/db/CassandraCQLClientTest.java
+++ b/cassandra2/src/test/java/com/yahoo/ycsb/db/CassandraCQLClientTest.java
@@ -41,7 +41,6 @@ import com.yahoo.ycsb.workloads.CoreWorkload;
 import org.cassandraunit.CassandraCQLUnit;
 import org.cassandraunit.dataset.cql.ClassPathCQLDataSet;
 import org.junit.After;
-import org.junit.Assume;
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Test;
@@ -68,10 +67,6 @@ public class CassandraCQLClientTest {
 
   @Before
   public void setUp() throws Exception {
-    // check that this is Java 8+
-    int javaVersion = Integer.parseInt(System.getProperty("java.version").split("\\.")[1]);
-    Assume.assumeTrue(javaVersion >= 8);
-
     session = cassandraUnit.getSession();
 
     Properties p = new Properties();
-- 
GitLab