Allow multiple workloads to be specified per node in @CCMConfig.
diff --git a/driver-core/src/test/java/com/datastax/driver/core/CCMConfig.java b/driver-core/src/test/java/com/datastax/driver/core/CCMConfig.java
index 11fd6f6..75ab44c 100644
--- a/driver-core/src/test/java/com/datastax/driver/core/CCMConfig.java
+++ b/driver-core/src/test/java/com/datastax/driver/core/CCMConfig.java
@@ -135,7 +135,7 @@
*
* @return The workloads to assign to each node.
*/
- CCMAccess.Workload[] workloads() default {};
+ CCMWorkload[] workloads() default {};
/**
* Returns {@code true} if a {@link CCMBridge} instance should be automatically created, {@code false} otherwise.
diff --git a/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java b/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java
index 3ba2fbf..50b7119 100644
--- a/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java
+++ b/driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java
@@ -361,17 +361,17 @@
return args;
}
- private List<Workload> workloads() {
+ private List<Workload[]> workloads() {
int total = 0;
for (int perDc : numberOfNodes())
total += perDc;
- List<Workload> workloads = new ArrayList<Workload>(Collections.<Workload>nCopies(total, null));
+ List<Workload[]> workloads = new ArrayList<Workload[]>(Collections.<Workload[]>nCopies(total, null));
for (int i = annotations.size() - 1; i >= 0; i--) {
CCMConfig ann = annotations.get(i);
- Workload[] annWorkloads = ann.workloads();
+ CCMWorkload[] annWorkloads = ann.workloads();
for (int j = 0; j < annWorkloads.length; j++) {
- Workload workload = annWorkloads[j];
- workloads.set(j, workload);
+ CCMWorkload nodeWorkloads = annWorkloads[j];
+ workloads.set(j, nodeWorkloads.value());
}
}
return workloads;
@@ -448,9 +448,9 @@
for (String arg : jvmArgs()) {
ccmBuilder.withJvmArgs(arg);
}
- List<Workload> workloads = workloads();
+ List<Workload[]> workloads = workloads();
for (int i = 0; i < workloads.size(); i++) {
- Workload workload = workloads.get(i);
+ Workload[] workload = workloads.get(i);
if (workload != null)
ccmBuilder.withWorkload(i + 1, workload);
}
diff --git a/driver-core/src/test/java/com/datastax/driver/core/CCMWorkload.java b/driver-core/src/test/java/com/datastax/driver/core/CCMWorkload.java
new file mode 100644
index 0000000..9f0c6f7
--- /dev/null
+++ b/driver-core/src/test/java/com/datastax/driver/core/CCMWorkload.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012-2015 DataStax Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.datastax.driver.core;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A set of workloads to assign to a specific node.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface CCMWorkload {
+
+ /**
+ * The workloads to assign to a specific node.
+ *
+ * @return The workloads to assign to a specifc node.
+ */
+ CCMAccess.Workload[] value() default {};
+
+}
diff --git a/driver-core/src/test/java/com/datastax/driver/core/DseCCMClusterTest.java b/driver-core/src/test/java/com/datastax/driver/core/DseCCMClusterTest.java
index e89d587..9cbfaf9 100644
--- a/driver-core/src/test/java/com/datastax/driver/core/DseCCMClusterTest.java
+++ b/driver-core/src/test/java/com/datastax/driver/core/DseCCMClusterTest.java
@@ -17,6 +17,8 @@
import org.testng.annotations.Test;
+import static com.datastax.driver.core.CCMAccess.Workload.*;
+
/**
* A simple test to validate DSE setups.
* <p/>
@@ -68,11 +70,21 @@
* A correct example is as follows: {@code /usr/bin:/usr/local/bin:/bin:/usr/sbin:$JAVA_HOME/bin:$PATH}.
*/
@Test(enabled = false)
-@CCMConfig(dse = true, version = "4.8.3")
+@CCMConfig(
+ dse = true,
+ numberOfNodes = 3,
+ version = "4.8.3",
+ workloads = {
+ @CCMWorkload(solr),
+ @CCMWorkload({spark, solr}),
+ @CCMWorkload({cassandra, spark})
+ }
+)
public class DseCCMClusterTest extends CCMTestsSupport {
@Test(groups = "short")
public void should_conenct_to_dse() throws InterruptedException {
+
}
}