kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 83e16610372dfea6e5f8feb5d15bcafa14e642ae2c9abce03cf7713e3cd26ef7 |
|---|---|
| Author | Alexandre Dutra <alexandre.dutra@datastax.com> · 2017-02-09 10:20 +01:00 |
| Committer | Alexandre Dutra <alexandre.dutra@datastax.com> · 2017-02-09 15:51 +01:00 |
| Parents | b30b02a7d32d |
3 files changed
modified changelog/README.md +1 −0
| @@ -3,6 +3,7 @@ | ||
| 3 | 3 | ### 3.0.7 (in progress) |
| 4 | 4 | |
| 5 | 5 | - [bug] JAVA-1371: Reintroduce connection pool timeout. |
| 6 | +- [bug] JAVA-1313: Copy SerialConsistencyLevel to PreparedStatement. | |
| 6 | 7 | |
| 7 | 8 | |
| 8 | 9 | ### 3.0.6 |
modified driver-core/src/main/java/com/datastax/driver/core/AbstractSession.java +4 −1
| @@ -144,7 +144,10 @@ | ||
| 144 | 144 | ByteBuffer routingKey = statement.getRoutingKey(protocolVersion, codecRegistry); |
| 145 | 145 | if (routingKey != null) |
| 146 | 146 | prepared.setRoutingKey(routingKey); |
| 147 | - prepared.setConsistencyLevel(statement.getConsistencyLevel()); | |
| 147 | + if (statement.getConsistencyLevel() != null) | |
| 148 | + prepared.setConsistencyLevel(statement.getConsistencyLevel()); | |
| 149 | + if (statement.getSerialConsistencyLevel() != null) | |
| 150 | + prepared.setSerialConsistencyLevel(statement.getSerialConsistencyLevel()); | |
| 148 | 151 | if (statement.isTracing()) |
| 149 | 152 | prepared.enableTracing(); |
| 150 | 153 | prepared.setRetryPolicy(statement.getRetryPolicy()); |
modified driver-core/src/test/java/com/datastax/driver/core/PreparedStatementTest.java +24 −3
| @@ -17,7 +17,10 @@ | ||
| 17 | 17 | |
| 18 | 18 | import com.datastax.driver.core.exceptions.InvalidQueryException; |
| 19 | 19 | import com.datastax.driver.core.exceptions.UnsupportedFeatureException; |
| 20 | +import com.datastax.driver.core.policies.FallthroughRetryPolicy; | |
| 21 | +import com.datastax.driver.core.utils.Bytes; | |
| 20 | 22 | import com.datastax.driver.core.utils.CassandraVersion; |
| 23 | +import com.google.common.collect.ImmutableMap; | |
| 21 | 24 | import com.google.common.util.concurrent.Uninterruptibles; |
| 22 | 25 | import org.testng.annotations.Test; |
| 23 | 26 | |
| @@ -25,6 +28,7 @@ | ||
| 25 | 28 | import java.util.*; |
| 26 | 29 | import java.util.concurrent.TimeUnit; |
| 27 | 30 | |
| 31 | +import static com.datastax.driver.core.ProtocolVersion.V4; | |
| 28 | 32 | import static com.datastax.driver.core.TestUtils.*; |
| 29 | 33 | import static org.assertj.core.api.Assertions.assertThat; |
| 30 | 34 | import static org.testng.Assert.*; |
| @@ -334,13 +338,30 @@ | ||
| 334 | 338 | |
| 335 | 339 | RegularStatement toPrepare = new SimpleStatement("SELECT * FROM test WHERE k=?"); |
| 336 | 340 | toPrepare.setConsistencyLevel(ConsistencyLevel.QUORUM); |
| 341 | + toPrepare.setSerialConsistencyLevel(ConsistencyLevel.LOCAL_SERIAL); | |
| 342 | + toPrepare.setRetryPolicy(FallthroughRetryPolicy.INSTANCE); | |
| 343 | + if (TestUtils.getDesiredProtocolVersion().compareTo(V4) >= 0) | |
| 344 | + toPrepare.setOutgoingPayload(ImmutableMap.of("foo", Bytes.fromHexString("0xcafebabe"))); | |
| 345 | + toPrepare.setIdempotent(true); | |
| 337 | 346 | toPrepare.enableTracing(); |
| 338 | 347 | |
| 339 | 348 | PreparedStatement prepared = session().prepare(toPrepare); |
| 340 | - BoundStatement bs = prepared.bind("someValue"); | |
| 349 | + assertThat(prepared.getConsistencyLevel()).isEqualTo(ConsistencyLevel.QUORUM); | |
| 350 | + assertThat(prepared.getSerialConsistencyLevel()).isEqualTo(ConsistencyLevel.LOCAL_SERIAL); | |
| 351 | + assertThat(prepared.getRetryPolicy()).isEqualTo(FallthroughRetryPolicy.INSTANCE); | |
| 352 | + if (TestUtils.getDesiredProtocolVersion().compareTo(V4) >= 0) | |
| 353 | + assertThat(prepared.getOutgoingPayload()).isEqualTo(ImmutableMap.of("foo", Bytes.fromHexString("0xcafebabe"))); | |
| 354 | + assertThat(prepared.isIdempotent()).isTrue(); | |
| 355 | + assertThat(prepared.isTracing()).isTrue(); | |
| 341 | 356 | |
| 342 | - assertEquals(ConsistencyLevel.QUORUM, bs.getConsistencyLevel()); | |
| 343 | - assertTrue(bs.isTracing()); | |
| 357 | + BoundStatement bs = prepared.bind("someValue"); | |
| 358 | + assertThat(bs.getConsistencyLevel()).isEqualTo(ConsistencyLevel.QUORUM); | |
| 359 | + assertThat(bs.getSerialConsistencyLevel()).isEqualTo(ConsistencyLevel.LOCAL_SERIAL); | |
| 360 | + assertThat(bs.getRetryPolicy()).isEqualTo(FallthroughRetryPolicy.INSTANCE); | |
| 361 | + if (TestUtils.getDesiredProtocolVersion().compareTo(V4) >= 0) | |
| 362 | + assertThat(bs.getOutgoingPayload()).isEqualTo(ImmutableMap.of("foo", Bytes.fromHexString("0xcafebabe"))); | |
| 363 | + assertThat(bs.isIdempotent()).isTrue(); | |
| 364 | + assertThat(bs.isTracing()).isTrue(); | |
| 344 | 365 | } |
| 345 | 366 | |
| 346 | 367 | /** |