kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | ec70fbe19981b515eb49e8989dac1e58e011efbf32b1b7ddd5666ed1b4779538 |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-03-26 12:31 -05:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2015-03-31 15:12 +02:00 |
| Parents | 06a7241b7aba |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/SessionTest.java +26 −6
| @@ -21,6 +21,7 @@ | ||
| 21 | 21 | import java.util.concurrent.Executors; |
| 22 | 22 | import java.util.concurrent.TimeUnit; |
| 23 | 23 | |
| 24 | +import com.datastax.driver.core.utils.CassandraVersion; | |
| 24 | 25 | import org.testng.annotations.Test; |
| 25 | 26 | |
| 26 | 27 | import static org.testng.Assert.assertEquals; |
| @@ -106,19 +107,38 @@ | ||
| 106 | 107 | assertEquals(rows.get(0).getLong("c"), 2L); |
| 107 | 108 | } |
| 108 | 109 | |
| 110 | + /** | |
| 111 | + * Validates that a session can be established using snappy compression and executes some queries that inserts and | |
| 112 | + * retrieves data using that session. | |
| 113 | + * | |
| 114 | + * @test_category connection:compression | |
| 115 | + * @expected_result session established and queries made successfully using it. | |
| 116 | + */ | |
| 109 | 117 | @Test(groups = "short") |
| 110 | - public void compressionTest() throws Exception { | |
| 111 | - | |
| 112 | - // Same as executeTest, but with compression enabled | |
| 118 | + public void session_should_function_with_snappy_compression() throws Exception { | |
| 119 | + compressionTest(ProtocolOptions.Compression.SNAPPY); | |
| 120 | + } | |
| 113 | 121 | |
| 114 | - cluster.getConfiguration().getProtocolOptions().setCompression(ProtocolOptions.Compression.SNAPPY); | |
| 122 | + /** | |
| 123 | + * Validates that a session can be established using lz4 compression and executes some queries that inserts and | |
| 124 | + * retrieves data using that session. | |
| 125 | + * | |
| 126 | + * @test_category connection:compression | |
| 127 | + * @expected_result session established and queries made successfully using it. | |
| 128 | + */ | |
| 129 | + @Test(groups = "short") | |
| 130 | + @CassandraVersion(major=2.0) | |
| 131 | + public void session_should_function_with_lz4_compression() throws Exception { | |
| 132 | + compressionTest(ProtocolOptions.Compression.LZ4); | |
| 133 | + } | |
| 115 | 134 | |
| 135 | + public void compressionTest(ProtocolOptions.Compression compression) { | |
| 136 | + cluster.getConfiguration().getProtocolOptions().setCompression(compression); | |
| 116 | 137 | try { |
| 117 | - | |
| 118 | 138 | Session compressedSession = cluster.connect(keyspace); |
| 119 | 139 | |
| 120 | 140 | // Simple calls to all versions of the execute/executeAsync methods |
| 121 | - String key = "execute_compressed_test"; | |
| 141 | + String key = "execute_compressed_test_" + compression; | |
| 122 | 142 | ResultSet rs = compressedSession.execute(String.format(Locale.US, TestUtils.INSERT_FORMAT, TABLE3, key, "foo", 42, 24.03f)); |
| 123 | 143 | assertTrue(rs.isExhausted()); |
| 124 | 144 |