kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 9fd6b8ac2d4c1cd11aa8724005fae576f30fd222fba337423356099692efe45c |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-09-17 13:17 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-09-17 13:17 -05:00 |
| Parents | 4d62c19c02ff |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/TableMetadataTest.java +33 −0
| @@ -22,6 +22,8 @@ | ||
| 22 | 22 | |
| 23 | 23 | import static org.assertj.core.api.Assertions.entry; |
| 24 | 24 | |
| 25 | +import com.datastax.driver.core.utils.CassandraVersion; | |
| 26 | + | |
| 25 | 27 | import static com.datastax.driver.core.Assertions.assertThat; |
| 26 | 28 | import static com.datastax.driver.core.DataType.*; |
| 27 | 29 | import static com.datastax.driver.core.TableOrView.Order.ASC; |
| @@ -391,6 +393,37 @@ | ||
| 391 | 393 | |
| 392 | 394 | } |
| 393 | 395 | |
| 396 | + /** | |
| 397 | + * Validates that metadata is appropriately parsed when using the new compression options format introduced | |
| 398 | + * in 3.0.0-alpha1. Since compression options are parsed as a String map, this should behave exactly as | |
| 399 | + * the old style compression options used in {@link #should_parse_table_options}. | |
| 400 | + * | |
| 401 | + * @jira_ticket CASSANDRA-9424 | |
| 402 | + */ | |
| 403 | + @Test(groups="short") | |
| 404 | + @CassandraVersion(major=3.0) | |
| 405 | + public void should_parse_new_compression_options() { | |
| 406 | + // given | |
| 407 | + String cql = String.format("CREATE TABLE %s.new_compression_options (\n" | |
| 408 | + + " k text,\n" | |
| 409 | + + " c1 int,\n" | |
| 410 | + + " c2 int,\n" | |
| 411 | + + " i int,\n" | |
| 412 | + + " PRIMARY KEY (k, c1, c2)\n" | |
| 413 | + + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n" | |
| 414 | + + " AND compression = { 'class' : 'DeflateCompressor', 'chunk_length_in_kb' : 128 };", | |
| 415 | + keyspace); | |
| 416 | + | |
| 417 | + // when | |
| 418 | + session.execute(cql); | |
| 419 | + TableMetadata table = cluster.getMetadata().getKeyspace(keyspace).getTable("new_compression_options"); | |
| 420 | + | |
| 421 | + // then | |
| 422 | + assertThat(table.getOptions().getCompression()) | |
| 423 | + .contains(entry("class", "org.apache.cassandra.io.compress.DeflateCompressor")) | |
| 424 | + .contains(entry("chunk_length_in_kb", "128")); | |
| 425 | + } | |
| 426 | + | |
| 394 | 427 | @Test(groups = "short") |
| 395 | 428 | public void should_escape_single_quote_table_comment() { |
| 396 | 429 | // given |