kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | bdbef4d2f3a9a79815223e216881c158f7e622e5ed546176ca5ce71c47e05d46 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2016-03-22 19:18 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-04-01 19:51 +02:00 |
| Parents | 2204d64a11c8 |
4 files changed
modified driver-core/src/test/java/com/datastax/driver/core/CCMConfig.java +1 −1
| @@ -135,7 +135,7 @@ | ||
| 135 | 135 | * |
| 136 | 136 | * @return The workloads to assign to each node. |
| 137 | 137 | */ |
| 138 | - CCMAccess.Workload[] workloads() default {}; | |
| 138 | + CCMWorkload[] workloads() default {}; | |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Returns {@code true} if a {@link CCMBridge} instance should be automatically created, {@code false} otherwise. |
modified driver-core/src/test/java/com/datastax/driver/core/CCMTestsSupport.java +7 −7
| @@ -361,17 +361,17 @@ | ||
| 361 | 361 | return args; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - private List<Workload> workloads() { | |
| 364 | + private List<Workload[]> workloads() { | |
| 365 | 365 | int total = 0; |
| 366 | 366 | for (int perDc : numberOfNodes()) |
| 367 | 367 | total += perDc; |
| 368 | - List<Workload> workloads = new ArrayList<Workload>(Collections.<Workload>nCopies(total, null)); | |
| 368 | + List<Workload[]> workloads = new ArrayList<Workload[]>(Collections.<Workload[]>nCopies(total, null)); | |
| 369 | 369 | for (int i = annotations.size() - 1; i >= 0; i--) { |
| 370 | 370 | CCMConfig ann = annotations.get(i); |
| 371 | - Workload[] annWorkloads = ann.workloads(); | |
| 371 | + CCMWorkload[] annWorkloads = ann.workloads(); | |
| 372 | 372 | for (int j = 0; j < annWorkloads.length; j++) { |
| 373 | - Workload workload = annWorkloads[j]; | |
| 374 | - workloads.set(j, workload); | |
| 373 | + CCMWorkload nodeWorkloads = annWorkloads[j]; | |
| 374 | + workloads.set(j, nodeWorkloads.value()); | |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | return workloads; |
| @@ -448,9 +448,9 @@ | ||
| 448 | 448 | for (String arg : jvmArgs()) { |
| 449 | 449 | ccmBuilder.withJvmArgs(arg); |
| 450 | 450 | } |
| 451 | - List<Workload> workloads = workloads(); | |
| 451 | + List<Workload[]> workloads = workloads(); | |
| 452 | 452 | for (int i = 0; i < workloads.size(); i++) { |
| 453 | - Workload workload = workloads.get(i); | |
| 453 | + Workload[] workload = workloads.get(i); | |
| 454 | 454 | if (workload != null) |
| 455 | 455 | ccmBuilder.withWorkload(i + 1, workload); |
| 456 | 456 | } |
added driver-core/src/test/java/com/datastax/driver/core/CCMWorkload.java +37 −0
| @@ -0,0 +1,37 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2012-2015 DataStax Inc. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + */ | |
| 16 | +package com.datastax.driver.core; | |
| 17 | + | |
| 18 | +import java.lang.annotation.ElementType; | |
| 19 | +import java.lang.annotation.Retention; | |
| 20 | +import java.lang.annotation.RetentionPolicy; | |
| 21 | +import java.lang.annotation.Target; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * A set of workloads to assign to a specific node. | |
| 25 | + */ | |
| 26 | +@Retention(RetentionPolicy.RUNTIME) | |
| 27 | +@Target(ElementType.ANNOTATION_TYPE) | |
| 28 | +public @interface CCMWorkload { | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * The workloads to assign to a specific node. | |
| 32 | + * | |
| 33 | + * @return The workloads to assign to a specifc node. | |
| 34 | + */ | |
| 35 | + CCMAccess.Workload[] value() default {}; | |
| 36 | + | |
| 37 | +} |
modified driver-core/src/test/java/com/datastax/driver/core/DseCCMClusterTest.java +13 −1
| @@ -17,6 +17,8 @@ | ||
| 17 | 17 | |
| 18 | 18 | import org.testng.annotations.Test; |
| 19 | 19 | |
| 20 | +import static com.datastax.driver.core.CCMAccess.Workload.*; | |
| 21 | + | |
| 20 | 22 | /** |
| 21 | 23 | * A simple test to validate DSE setups. |
| 22 | 24 | * <p/> |
| @@ -68,11 +70,21 @@ | ||
| 68 | 70 | * A correct example is as follows: {@code /usr/bin:/usr/local/bin:/bin:/usr/sbin:$JAVA_HOME/bin:$PATH}. |
| 69 | 71 | */ |
| 70 | 72 | @Test(enabled = false) |
| 71 | -@CCMConfig(dse = true, version = "4.8.3") | |
| 73 | +@CCMConfig( | |
| 74 | + dse = true, | |
| 75 | + numberOfNodes = 3, | |
| 76 | + version = "4.8.3", | |
| 77 | + workloads = { | |
| 78 | + @CCMWorkload(solr), | |
| 79 | + @CCMWorkload({spark, solr}), | |
| 80 | + @CCMWorkload({cassandra, spark}) | |
| 81 | + } | |
| 82 | +) | |
| 72 | 83 | public class DseCCMClusterTest extends CCMTestsSupport { |
| 73 | 84 | |
| 74 | 85 | @Test(groups = "short") |
| 75 | 86 | public void should_conenct_to_dse() throws InterruptedException { |
| 87 | + | |
| 76 | 88 | } |
| 77 | 89 | |
| 78 | 90 | } |