Search in sources :

Example 6 with ReadResultCounter

use of com.datastax.oss.dsbulk.workflow.commons.schema.ReadResultCounter in project dsbulk by datastax.

the class SchemaSettingsTest method should_create_row_counter_for_global_stats.

@Test
void should_create_row_counter_for_global_stats() {
    when(table.getPrimaryKey()).thenReturn(newArrayList(col1, col2));
    Config config = TestConfigUtils.createTestConfig("dsbulk.schema", "keyspace", "ks", "table", "t1");
    SchemaSettings settings = new SchemaSettings(config, READ_AND_COUNT);
    settings.init(session, codecFactory, false, true);
    ReadResultCounter counter = settings.createReadResultCounter(session, codecFactory, EnumSet.of(global), 10);
    assertThat(counter).isNotNull();
    ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
    verify(session).prepare(argument.capture());
    assertThat(argument.getValue()).isEqualTo("SELECT c1 FROM ks.t1 WHERE token(c1) > :start AND token(c1) <= :end");
}
Also used : Config(com.typesafe.config.Config) ReadResultCounter(com.datastax.oss.dsbulk.workflow.commons.schema.ReadResultCounter) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Aggregations

ReadResultCounter (com.datastax.oss.dsbulk.workflow.commons.schema.ReadResultCounter)6 Config (com.typesafe.config.Config)6 Test (org.junit.jupiter.api.Test)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6