kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 776dc2ff107a730f4e7124fea36edb30e293f2f3e7b6d7bdfe1b79b27b1b4ee7 |
|---|---|
| Author | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-05-13 14:23 +02:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2015-05-13 14:23 +02:00 |
| Parents | a595da19ff47, d280ea92122e |
2 files changed
modified driver-core/src/test/java/com/datastax/driver/core/DynamicConnectionPoolTest.java +4 −1
| @@ -45,7 +45,10 @@ | ||
| 45 | 45 | |
| 46 | 46 | @Override |
| 47 | 47 | protected Cluster.Builder configure(Cluster.Builder builder) { |
| 48 | - return builder.withProtocolVersion(ProtocolVersion.V2); | |
| 48 | + // Use version 2 at highest. | |
| 49 | + ProtocolVersion versionToUse = TestUtils.getDesiredProtocolVersion(); | |
| 50 | + versionToUse = versionToUse == ProtocolVersion.V3 ? ProtocolVersion.V2 : versionToUse; | |
| 51 | + return builder.withProtocolVersion(versionToUse); | |
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | /** |
modified driver-core/src/test/java/com/datastax/driver/core/TestUtils.java +5 −3
| @@ -434,14 +434,16 @@ | ||
| 434 | 434 | /** |
| 435 | 435 | * @return The desired target protocol version based on the 'cassandra.version' System property. |
| 436 | 436 | */ |
| 437 | - public static int getDesiredProtocolVersion() { | |
| 437 | + public static ProtocolVersion getDesiredProtocolVersion() { | |
| 438 | 438 | String version = System.getProperty("cassandra.version"); |
| 439 | 439 | String[] versionArray = version.split("\\.|-"); |
| 440 | 440 | double major = Double.parseDouble(versionArray[0] + "." + versionArray[1]); |
| 441 | 441 | if(major < 2.0) { |
| 442 | - return 1; | |
| 442 | + return ProtocolVersion.V1; | |
| 443 | + } else if (major < 2.1) { | |
| 444 | + return ProtocolVersion.V2; | |
| 443 | 445 | } else { |
| 444 | - return 2; | |
| 446 | + return ProtocolVersion.V3; | |
| 445 | 447 | } |
| 446 | 448 | } |
| 447 | 449 |