forked from apache/cassandra-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a simple test that checks if empty pages are correctly skipped through and all rows are being returned. Covers #254.
- Loading branch information
1 parent
7caca1e
commit 143ae5f
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
driver-core/src/test/java/com/datastax/driver/core/StatementPagesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.datastax.driver.core; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
public class StatementPagesTest extends CCMTestsSupport { | ||
@Override | ||
public void onTestContextInitialized() { | ||
execute( | ||
"CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}"); | ||
execute("CREATE TABLE IF NOT EXISTS ks.t (pk int, ck int, v int, PRIMARY KEY(pk, ck))"); | ||
|
||
for (int i = 0; i < 50; i++) { | ||
// System.out.println("Insert " + i); | ||
session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 15); | ||
session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 32); | ||
} | ||
|
||
session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 8, 8, 14); | ||
session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 11, 11, 14); | ||
session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 14, 14, 14); | ||
} | ||
|
||
@Test(groups = "short") | ||
public void should_not_get_stuck_on_empty_pages() { | ||
SimpleStatement st = new SimpleStatement("SELECT * FROM ks.t WHERE v = 14 ALLOW FILTERING"); | ||
st.setFetchSize(1); | ||
ResultSet rs = session().execute(st); | ||
assertThat(rs.all().size()).isEqualTo(3); | ||
} | ||
} |