Skip to content

Commit

Permalink
Merge pull request #669 from busbey/update-cassandra-driver
Browse files Browse the repository at this point in the history
Update cassandra2-cql driver to only run tests on jdk8
  • Loading branch information
busbey committed Mar 30, 2016
2 parents c44906c + b5c38b2 commit 6d2f903
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
25 changes: 23 additions & 2 deletions cassandra2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -46,8 +51,9 @@ LICENSE file.
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-shaded</artifactId>
<version>2.1.9.2</version>
<artifactId>cassandra-unit</artifactId>
<version>3.0.0.1</version>
<classifier>shaded</classifier>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -57,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>
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ public class CassandraCQLClientTest {
private Session session;

@ClassRule
public static CassandraCQLUnit cassandraUnit =
new CassandraCQLUnit(new ClassPathCQLDataSet("ycsb.cql", "ycsb"));
public static CassandraCQLUnit cassandraUnit = new CassandraCQLUnit(new ClassPathCQLDataSet("ycsb.cql", "ycsb"));

@Before
public void setUpClient() throws Exception {
public void setUp() throws Exception {
session = cassandraUnit.getSession();

Properties p = new Properties();
p.setProperty("hosts", HOST);
p.setProperty("port", Integer.toString(PORT));
Expand All @@ -81,22 +82,21 @@ public void setUpClient() throws Exception {
client.init();
}

@Before
public void setSession() {
session = cassandraUnit.getSession();
}

@After
public void tearDownClient() throws Exception {
client.cleanup();
if (client != null) {
client.cleanup();
}
client = null;
}

@After
public void clearTable() throws Exception {
// Clear the table so that each test starts fresh.
final Statement truncate = QueryBuilder.truncate(TABLE);
cassandraUnit.getSession().execute(truncate);
if (cassandraUnit != null) {
cassandraUnit.getSession().execute(truncate);
}
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ LICENSE file.
<accumulo.version>1.6.0</accumulo.version>
<cassandra.version>1.2.9</cassandra.version>
<cassandra.cql.version>1.0.3</cassandra.cql.version>
<cassandra2.cql.version>2.1.8</cassandra2.cql.version>
<cassandra2.cql.version>3.0.0</cassandra2.cql.version>
<geode.version>1.0.0-incubating.M1</geode.version>
<infinispan.version>7.2.2.Final</infinispan.version>
<kudu.version>0.6.0</kudu.version>
Expand Down

0 comments on commit 6d2f903

Please sign in to comment.