Search in sources :

Example 1 with Row

use of com.hazelcast.jet.sql.SqlTestSupport.Row in project hazelcast by hazelcast.

the class MapScanMigrationStressTest method stressTest_noIndex.

@Test(timeout = 600_000)
public void stressTest_noIndex() throws InterruptedException {
    List<Row> expected = new ArrayList<>();
    Map<Integer, Integer> temp = new HashMap<>();
    for (int i = 0; i <= ITEM_COUNT / 7; i++) {
        temp.put(i, 1);
        expected.add(new Row(i, i + "-" + 1));
    }
    map.putAll(temp);
    mutator = new MutatorThread(1000L);
    assertRowsAnyOrder("SELECT __key, Concat_WS('-', __key, this) FROM " + MAP_NAME, expected, mutator);
    mutator.terminate();
    mutator.join();
    assertThat(mutatorException.get()).isNull();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SqlRow(com.hazelcast.sql.SqlRow) Row(com.hazelcast.jet.sql.SqlTestSupport.Row) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 2 with Row

use of com.hazelcast.jet.sql.SqlTestSupport.Row in project hazelcast by hazelcast.

the class MapScanMigrationStressTest method stressTest_sortedIndex.

@Test(timeout = 600_000)
public void stressTest_sortedIndex() throws InterruptedException {
    List<Row> expected = new ArrayList<>();
    Map<Integer, Integer> temp = new HashMap<>();
    for (int i = 0; i <= ITEM_COUNT; i++) {
        temp.put(i, i);
        expected.add(new Row(ITEM_COUNT - i, ITEM_COUNT - i));
    }
    map.putAll(temp);
    IndexConfig indexConfig = new IndexConfig(IndexType.SORTED, "this").setName(randomName());
    map.addIndex(indexConfig);
    mutator = new MutatorThread(2000L);
    assertRowsOrdered("SELECT * FROM " + MAP_NAME + " ORDER BY this DESC", expected, mutator);
    mutator.terminate();
    mutator.join();
    assertThat(mutatorException.get()).isNull();
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SqlRow(com.hazelcast.sql.SqlRow) Row(com.hazelcast.jet.sql.SqlTestSupport.Row) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Example 3 with Row

use of com.hazelcast.jet.sql.SqlTestSupport.Row in project hazelcast by hazelcast.

the class MapScanMigrationStressTest method stressTest_hashIndex.

@Test(timeout = 600_000)
public void stressTest_hashIndex() throws InterruptedException {
    List<Row> expected = new ArrayList<>();
    Map<Integer, Integer> temp = new HashMap<>();
    for (int i = 0; i <= ITEM_COUNT / 5; i++) {
        temp.put(i, 1);
        expected.add(new Row(i, 1));
    }
    map.putAll(temp);
    IndexConfig indexConfig = new IndexConfig(IndexType.HASH, "this").setName(randomName());
    map.addIndex(indexConfig);
    mutator = new MutatorThread(2000L);
    // Awful performance of such a query, but still a good load for test.
    assertRowsAnyOrder("SELECT * FROM " + MAP_NAME + " WHERE this = 1", expected, mutator);
    mutator.terminate();
    mutator.join();
    assertThat(mutatorException.get()).isNull();
}
Also used : IndexConfig(com.hazelcast.config.IndexConfig) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SqlRow(com.hazelcast.sql.SqlRow) Row(com.hazelcast.jet.sql.SqlTestSupport.Row) Test(org.junit.Test) SlowTest(com.hazelcast.test.annotation.SlowTest)

Aggregations

Row (com.hazelcast.jet.sql.SqlTestSupport.Row)3 SqlRow (com.hazelcast.sql.SqlRow)3 SlowTest (com.hazelcast.test.annotation.SlowTest)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 IndexConfig (com.hazelcast.config.IndexConfig)2