Пример #1
0
 @Test
 public void testTableExists() throws Exception {
   QualifiedObjectName name = new QualifiedObjectName("redis", "default", tableName);
   transaction(queryRunner.getTransactionManager(), new AllowAllAccessControl())
       .singleStatement()
       .execute(
           SESSION,
           session -> {
             Optional<TableHandle> handle =
                 queryRunner.getServer().getMetadata().getTableHandle(session, name);
             assertTrue(handle.isPresent());
           });
 }
Пример #2
0
  @Test
  public void testTableHasData() throws Exception {
    MaterializedResult result = queryRunner.execute("SELECT count(1) from " + tableName);

    MaterializedResult expected =
        MaterializedResult.resultBuilder(SESSION, BigintType.BIGINT).row(0L).build();

    assertEquals(result, expected);

    int count = 1000;
    populateData(count);

    result = queryRunner.execute("SELECT count(1) from " + tableName);

    expected =
        MaterializedResult.resultBuilder(SESSION, BigintType.BIGINT).row((long) count).build();

    assertEquals(result, expected);
  }
Пример #3
0
 @AfterMethod
 public void tearDown() throws Exception {
   queryRunner.close();
 }