Skip to content

Commit

Permalink
Merge pull request apache#77 from joaquincasares/new_test_groups
Browse files Browse the repository at this point in the history
New test groups
  • Loading branch information
Sylvain Lebresne committed May 7, 2013
2 parents 624ab68 + 6fa85db commit 214b157
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 64 deletions.
52 changes: 50 additions & 2 deletions driver-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
</profile>

<profile>
<id>integration</id>
<id>short</id>
<properties>
<env>default</env>
</properties>
Expand All @@ -120,7 +120,55 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<groups>unit,integration</groups>
<groups>unit,short</groups>
<useFile>false</useFile>
<systemPropertyVariables>
<cassandra.version>${cassandra.version}</cassandra.version>
<ipprefix>${ipprefix}</ipprefix>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>long</id>
<properties>
<env>default</env>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<groups>unit,short,long</groups>
<useFile>false</useFile>
<systemPropertyVariables>
<cassandra.version>${cassandra.version}</cassandra.version>
<ipprefix>${ipprefix}</ipprefix>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>duration</id>
<properties>
<env>default</env>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<groups>unit,short,long,duration</groups>
<useFile>false</useFile>
<systemPropertyVariables>
<cassandra.version>${cassandra.version}</cassandra.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static void createCluster() {
}
}

@AfterClass(groups = {"integration"})
@AfterClass(groups = {"short", "long"})
public static void discardCluster() {
if (cluster != null)
cluster.shutdown();
Expand All @@ -243,7 +243,7 @@ public static void discardCluster() {
}
}

@BeforeClass(groups = {"integration"})
@BeforeClass(groups = {"short", "long"})
public void beforeClass() {
createCluster();
maybeCreateSchema();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private ByteBuffer serializeForDynamicType(Object... params) {
return res;
}

@Test(groups = "integration")
@Test(groups = "short")
public void DynamicCompositeTypeTest() {

session.execute("INSERT INTO test(k, c, v) VALUES (0, 's@foo:i@32', 1)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public void primitiveSelectTest() throws Throwable {
/**
* Test simple statement inserts and selects for all primitive data types
*/
@Test(groups = "integration")
@Test(groups = "long")
public void primitiveTests() throws Throwable {
primitiveInsertTest();
primitiveSelectTest();
Expand Down Expand Up @@ -475,7 +475,7 @@ public void collectionSelectTest() throws Throwable {
/**
* Test simple statement inserts and selects for all collection data types
*/
@Test(groups = "integration")
@Test(groups = "long")
public void collectionTest() throws Throwable {
collectionInsertTest();
collectionSelectTest();
Expand All @@ -484,23 +484,23 @@ public void collectionTest() throws Throwable {
/**
* Test TTLs.
*/
// TODO: @Test(groups = "integration")
// TODO: @Test(groups = "long")
public void ttlTest() throws Throwable {

}

/**
* Test Counters in an isolated format.
*/
// TODO: @Test(groups = "integration")
// TODO: @Test(groups = "long")
public void countersTest() throws Throwable {

}

/**
* Test tombstones.
*/
// TODO: @Test(groups = "integration")
// TODO: @Test(groups = "long")
public void tombstonesTest() throws Throwable {

}
Expand All @@ -514,7 +514,7 @@ public void tombstonesTest() throws Throwable {
* Prints the table definitions that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printTableDefinitions() {
String objective = "Table Definitions";
System.out.println(String.format("Printing %s...", objective));
Expand All @@ -531,7 +531,7 @@ public void printTableDefinitions() {
* Prints the sample data that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printSampleData() {
String objective = "Sample Data";
System.out.println(String.format("Printing %s...", objective));
Expand All @@ -548,7 +548,7 @@ public void printSampleData() {
* Prints the sample collections that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printSampleCollections() {
String objective = "Sample Collections";
System.out.println(String.format("Printing %s...", objective));
Expand Down Expand Up @@ -578,7 +578,7 @@ public void printSampleCollections() {
* Prints the simple insert statements that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printPrimitiveInsertStatements() {
String objective = "Primitive Insert Statements";
System.out.println(String.format("Printing %s...", objective));
Expand All @@ -594,7 +594,7 @@ public void printPrimitiveInsertStatements() {
* Prints the simple select statements that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printPrimitiveSelectStatements() {
String objective = "Primitive Select Statements";
System.out.println(String.format("Printing %s...", objective));
Expand All @@ -610,7 +610,7 @@ public void printPrimitiveSelectStatements() {
* Prints the simple insert statements that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printCollectionInsertStatements() {
String objective = "Collection Insert Statements";
System.out.println(String.format("Printing %s...", objective));
Expand All @@ -626,7 +626,7 @@ public void printCollectionInsertStatements() {
* Prints the simple insert statements that will be used in testing
* (for exporting purposes)
*/
@Test(groups = { "doc" })
@Test(groups = "doc")
public void printCollectionSelectStatements() {
String objective = "Collection Select Statements";
System.out.println(String.format("Printing %s...", objective));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ExceptionsTest{
* Create a keyspace twice and a table twice.
* Catch and test all the exception methods.
*/
@Test(groups = "integration")
@Test(groups = "short")
public void alreadyExistsException() throws Throwable {
Cluster.Builder builder = Cluster.builder();
CCMBridge.CCMCluster cluster = CCMBridge.buildCluster(1, builder);
Expand Down Expand Up @@ -96,7 +96,7 @@ public void authenticationException() throws Exception {
* Tests DriverInternalError.
* Tests basic message, rethrow, and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void driverInternalError() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -118,7 +118,7 @@ public void driverInternalError() throws Exception {
* Tests InvalidConfigurationInQueryException.
* Tests basic message abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void invalidConfigurationInQueryException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -133,7 +133,7 @@ public void invalidConfigurationInQueryException() throws Exception {
* Tests InvalidQueryException.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void invalidQueryException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -151,7 +151,7 @@ public void invalidQueryException() throws Exception {
* Tests InvalidTypeException.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void invalidTypeException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -170,14 +170,14 @@ public void invalidTypeException() throws Exception {
* by attempting to build a cluster using the IP address "255.255.255.255"
* and test all available exception methods.
*/
@Test(groups = "integration")
@Test(groups = "short")
public void noHostAvailableException() throws Exception {
String ipAddress = "255.255.255.255";
HashMap<InetAddress, String> errorsHashMap = new HashMap<InetAddress, String>();
errorsHashMap.put(InetAddress.getByName(ipAddress), "[/255.255.255.255] Cannot connect");

try {
Cluster cluster = Cluster.builder().addContactPoints("255.255.255.255").build();
Cluster.builder().addContactPoints("255.255.255.255").build();
} catch (NoHostAvailableException e) {
assertEquals(e.getMessage(), String.format("All host(s) tried for query failed (tried: [/%s])", ipAddress));
assertEquals(e.getErrors(), errorsHashMap);
Expand All @@ -194,7 +194,7 @@ public void noHostAvailableException() throws Exception {
* Then forcibly kill single node and attempt a read of the key at CL.ALL.
* Catch and test all available exception methods.
*/
@Test(groups = "integration")
@Test(groups = "long")
public void readTimeoutException() throws Throwable {
Cluster.Builder builder = Cluster.builder();
CCMBridge.CCMCluster cluster = CCMBridge.buildCluster(3, builder);
Expand Down Expand Up @@ -238,7 +238,7 @@ public void readTimeoutException() throws Throwable {
* Tests SyntaxError.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void syntaxError() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -256,7 +256,7 @@ public void syntaxError() throws Exception {
* Tests TraceRetrievalException.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void traceRetrievalException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -274,7 +274,7 @@ public void traceRetrievalException() throws Exception {
* Tests TruncateException.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void truncateException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -292,7 +292,7 @@ public void truncateException() throws Exception {
* Tests UnauthorizedException.
* Tests basic message and copy abilities.
*/
@Test(groups = "integration")
@Test(groups = "unit")
public void unauthorizedException() throws Exception {
String errorMessage = "Test Message";

Expand All @@ -313,7 +313,7 @@ public void unauthorizedException() throws Exception {
* and attempt to read and write the same key at CL.ALL.
* Catch and test all available exception methods.
*/
@Test(groups = "integration")
@Test(groups = "long")
public void unavailableException() throws Throwable {
Cluster.Builder builder = Cluster.builder();
CCMBridge.CCMCluster cluster = CCMBridge.buildCluster(3, builder);
Expand Down Expand Up @@ -369,7 +369,7 @@ public void unavailableException() throws Throwable {
* Then forcibly kill single node and attempt to write the same key at CL.ALL.
* Catch and test all available exception methods.
*/
@Test(groups = "integration")
@Test(groups = "long")
public void writeTimeoutException() throws Throwable {
Cluster.Builder builder = Cluster.builder();
CCMBridge.CCMCluster cluster = CCMBridge.buildCluster(3, builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class LoadBalancingPolicyTest extends AbstractPoliciesTest {

private PreparedStatement prepared;

@Test(groups = "integration")
@Test(groups = "long")
public void roundRobinTest() throws Throwable {

Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new RoundRobinPolicy());
Expand Down Expand Up @@ -74,7 +74,7 @@ public void roundRobinTest() throws Throwable {
}
}

@Test(groups = "integration")
@Test(groups = "long")
public void roundRobinWith2DCsTest() throws Throwable {

Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new RoundRobinPolicy());
Expand Down Expand Up @@ -113,7 +113,7 @@ public void roundRobinWith2DCsTest() throws Throwable {
}
}

@Test(groups = "integration")
@Test(groups = "long")
public void DCAwareRoundRobinTest() throws Throwable {

Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("dc2"));
Expand All @@ -138,7 +138,7 @@ public void DCAwareRoundRobinTest() throws Throwable {
}
}

@Test(groups = "integration")
@Test(groups = "long")
public void dcAwareRoundRobinTestWithOneRemoteHost() throws Throwable {

Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new DCAwareRoundRobinPolicy("dc2", 1));
Expand Down Expand Up @@ -225,12 +225,12 @@ public void dcAwareRoundRobinTestWithOneRemoteHost() throws Throwable {
}
}

@Test(groups = "integration")
@Test(groups = "long")
public void tokenAwareTest() throws Throwable {
tokenAwareTest(false);
}

@Test(groups = "integration")
@Test(groups = "long")
public void tokenAwarePreparedTest() throws Throwable {
tokenAwareTest(true);
}
Expand Down Expand Up @@ -295,7 +295,7 @@ public void tokenAwareTest(boolean usePrepared) throws Throwable {
}
}

@Test(groups = "integration")
@Test(groups = "long")
public void tokenAwareWithRF2Test() throws Throwable {
Cluster.Builder builder = Cluster.builder().withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()));
CCMBridge.CCMCluster c = CCMBridge.buildCluster(2, builder);
Expand Down
Loading

0 comments on commit 214b157

Please sign in to comment.