Elffuss BraidHub

kikocis/java-driver public

Allow multiple workloads to specified for a node.
Changeset77adf3ba1b9a69b2bd90789586afbcddf2f7df2ebb1bb8bb01f7410d66dddb66
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-03-20 20:15 -05:00
Committerolim7t <omichallat+github@gmail.com> · 2016-04-01 19:51 +02:00
Parents6b53da5530f8

Browse the files at this changeset

4 files changed

modified driver-core/src/test/java/com/datastax/driver/core/CCMAccess.java +2 −2
@@ -203,11 +203,11 @@
203203 void updateNodeConfig(int n, Map<String, Object> configs);
204204
205205 /**
206- * Sets the workload for the {@code nth} host in the CCM cluster.
206+ * Sets the workload(s) for the {@code nth} host in the CCM cluster.
207207 *
208208 * @param n the node number (starting from 1).
209209 */
210- void setWorkload(int n, Workload workload);
210+ void setWorkload(int n, Workload... workload);
211211
212212
213213 // Methods blocking until nodes are up or down
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +7 −6
@@ -537,8 +537,9 @@
537537 }
538538
539539 @Override
540- public void setWorkload(int node, Workload workload) {
541- execute(CCM_COMMAND + " node%d setworkload %s", node, workload);
540+ public void setWorkload(int node, Workload... workload) {
541+ String workloadStr = Joiner.on(",").join(workload);
542+ execute(CCM_COMMAND + " node%d setworkload %s", node, workloadStr);
542543 }
543544
544545 private String execute(String command, Object... args) {
@@ -673,7 +674,7 @@
673674 private Set<String> jvmArgs = new LinkedHashSet<String>();
674675 private final Map<String, Object> cassandraConfiguration = Maps.newLinkedHashMap();
675676 private final Map<String, Object> dseConfiguration = Maps.newLinkedHashMap();
676- private Map<Integer, Workload> workloads = new HashMap<Integer, Workload>();
677+ private Map<Integer, Workload[]> workloads = new HashMap<Integer, Workload[]>();
677678
678679 private Builder() {
679680 cassandraConfiguration.put("start_rpc", false);
@@ -804,10 +805,10 @@
804805 * Sets the DSE workload for a given node.
805806 *
806807 * @param node The node to set the workload for (starting with 1).
807- * @param workload The workload (e.g. solr, spark, hadoop)
808+ * @param workload The workload(s) (e.g. solr, spark, hadoop)
808809 * @return This builder
809810 */
810- public Builder withWorkload(int node, Workload workload) {
811+ public Builder withWorkload(int node, Workload... workload) {
811812 this.workloads.put(node, workload);
812813 return this;
813814 }
@@ -833,7 +834,7 @@
833834 ccm.updateConfig(cassandraConfiguration);
834835 if (!dseConfiguration.isEmpty())
835836 ccm.updateDSEConfig(dseConfiguration);
836- for (Map.Entry<Integer, Workload> entry : workloads.entrySet()) {
837+ for (Map.Entry<Integer, Workload[]> entry : workloads.entrySet()) {
837838 ccm.setWorkload(entry.getKey(), entry.getValue());
838839 }
839840 if (start)
modified driver-core/src/test/java/com/datastax/driver/core/CCMCache.java +1 −1
@@ -191,7 +191,7 @@
191191 }
192192
193193 @Override
194- public void setWorkload(int n, Workload workload) {
194+ public void setWorkload(int n, Workload... workload) {
195195 ccm.setWorkload(n, workload);
196196 }
197197
modified driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java +1 −1
@@ -213,7 +213,7 @@
213213 }
214214
215215 @Override
216- public void setWorkload(int node, Workload workload) {
216+ public void setWorkload(int node, Workload... workload) {
217217 throw new UnsupportedOperationException("This CCM cluster is read-only");
218218 }
219219