kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 1663962b818505653215f8a0071595c24767dbe22911121b141fedfbb3598496 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-17 13:33 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-08-17 13:33 -05:00 |
| Parents | e8e1d8b945b9 |
2 files changed
modified driver-core/src/test/java/com/datastax/driver/core/TupleTest.java +19 −0
| @@ -22,6 +22,7 @@ | ||
| 22 | 22 | import com.google.common.base.Joiner; |
| 23 | 23 | import org.testng.annotations.Test; |
| 24 | 24 | |
| 25 | +import static org.assertj.core.api.Assertions.assertThat; | |
| 25 | 26 | import static org.testng.Assert.assertEquals; |
| 26 | 27 | import static org.testng.Assert.fail; |
| 27 | 28 | |
| @@ -388,6 +389,24 @@ | ||
| 388 | 389 | } |
| 389 | 390 | } |
| 390 | 391 | |
| 392 | + /** | |
| 393 | + * Validates that tuple values generated from an attached type (cluster-provided TupleType) and | |
| 394 | + * a detached type (using TupleType.of) are the same. | |
| 395 | + * | |
| 396 | + * @since 2.2.0 | |
| 397 | + */ | |
| 398 | + @Test(groups = "short") | |
| 399 | + public void detachedTupleTypeTest() { | |
| 400 | + TupleType detachedType = TupleType.of(TestUtils.getDesiredProtocolVersion(), CodecRegistry.DEFAULT_INSTANCE, | |
| 401 | + DataType.cint(), DataType.text(), DataType.cfloat()); | |
| 402 | + TupleValue detachedValue = detachedType.newValue(1, "hello", 2.0f); | |
| 403 | + | |
| 404 | + TupleType attachedType = cluster.getMetadata().newTupleType(DataType.cint(), DataType.text(), DataType.cfloat()); | |
| 405 | + TupleValue attachedValue = attachedType.newValue(1, "hello", 2.0f); | |
| 406 | + | |
| 407 | + assertThat(detachedValue).isEqualTo(attachedValue); | |
| 408 | + } | |
| 409 | + | |
| 391 | 410 | /** |
| 392 | 411 | * Helper method for creating nested tuple schema |
| 393 | 412 | * @param depth |
modified driver-core/src/test/java/com/datastax/driver/core/querybuilder/QueryBuilderTest.java +1 −14
| @@ -42,20 +42,7 @@ | ||
| 42 | 42 | |
| 43 | 43 | public class QueryBuilderTest { |
| 44 | 44 | |
| 45 | - private QueryBuilder builder; | |
| 46 | - | |
| 47 | - @BeforeMethod(groups = "unit") | |
| 48 | - public void setUpQueryBuilder() throws Exception { | |
| 49 | - CodecRegistry codecRegistry = new CodecRegistry(); | |
| 50 | - Cluster cluster = mock(Cluster.class); | |
| 51 | - Configuration configuration = mock(Configuration.class); | |
| 52 | - ProtocolOptions protocolOptions = mock(ProtocolOptions.class); | |
| 53 | - when(cluster.getConfiguration()).thenReturn(configuration); | |
| 54 | - when(configuration.getCodecRegistry()).thenReturn(codecRegistry); | |
| 55 | - when(configuration.getProtocolOptions()).thenReturn(protocolOptions); | |
| 56 | - when(protocolOptions.getProtocolVersion()).thenReturn(TestUtils.getDesiredProtocolVersion()); | |
| 57 | - builder = new QueryBuilder(cluster); | |
| 58 | - } | |
| 45 | + private QueryBuilder builder = new QueryBuilder(TestUtils.getDesiredProtocolVersion(), CodecRegistry.DEFAULT_INSTANCE); | |
| 59 | 46 | |
| 60 | 47 | @Test(groups = "unit") |
| 61 | 48 | public void selectTest() throws Exception { |