|
| 1 | +package com.datastax.driver.core; |
| 2 | + |
| 3 | +import static org.assertj.core.api.Assertions.assertThat; |
| 4 | + |
| 5 | +import org.testng.annotations.Test; |
| 6 | + |
| 7 | +public class StatementPagesTest extends CCMTestsSupport { |
| 8 | + @Override |
| 9 | + public void onTestContextInitialized() { |
| 10 | + execute( |
| 11 | + "CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}"); |
| 12 | + execute("CREATE TABLE IF NOT EXISTS ks.t (pk int, ck int, v int, PRIMARY KEY(pk, ck))"); |
| 13 | + |
| 14 | + for (int i = 0; i < 50; i++) { |
| 15 | + // System.out.println("Insert " + i); |
| 16 | + session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 15); |
| 17 | + session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 32); |
| 18 | + } |
| 19 | + |
| 20 | + session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 8, 8, 14); |
| 21 | + session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 11, 11, 14); |
| 22 | + session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 14, 14, 14); |
| 23 | + } |
| 24 | + |
| 25 | + @Test(groups = "short") |
| 26 | + public void should_not_get_stuck_on_empty_pages() { |
| 27 | + SimpleStatement st = new SimpleStatement("SELECT * FROM ks.t WHERE v = 14 ALLOW FILTERING"); |
| 28 | + st.setFetchSize(1); |
| 29 | + ResultSet rs = session().execute(st); |
| 30 | + assertThat(rs.all().size()).isEqualTo(3); |
| 31 | + } |
| 32 | +} |
0 commit comments