Search in sources :

Example 1 with QueueTest

use of co.cask.cdap.data2.transaction.queue.QueueTest in project cdap by caskdata.

the class HBaseQueueTest method testQueueTableNameFormat.

// TODO: CDAP-1177 Should move to QueueTest after making getApplicationName() etc instance methods in a base class
@Test
public void testQueueTableNameFormat() throws Exception {
    QueueName queueName = QueueName.fromFlowlet(NamespaceId.DEFAULT.getEntityName(), "application1", "flow1", "flowlet1", "output1");
    HBaseQueueAdmin hbaseQueueAdmin = (HBaseQueueAdmin) queueAdmin;
    TableId tableId = hbaseQueueAdmin.getDataTableId(queueName);
    Assert.assertEquals(NamespaceId.DEFAULT.getEntityName(), tableId.getNamespace());
    Assert.assertEquals("system." + hbaseQueueAdmin.getType() + ".application1.flow1", tableId.getTableName());
    String tableName = tableUtil.buildHTableDescriptor(tableId).build().getNameAsString();
    Assert.assertEquals("application1", HBaseQueueAdmin.getApplicationName(tableName));
    Assert.assertEquals("flow1", HBaseQueueAdmin.getFlowName(tableName));
    queueName = QueueName.fromFlowlet("testNamespace", "application1", "flow1", "flowlet1", "output1");
    tableId = hbaseQueueAdmin.getDataTableId(queueName);
    Assert.assertEquals(String.format("%s_testNamespace", TABLE_PREFIX), tableId.getNamespace());
    Assert.assertEquals("system." + hbaseQueueAdmin.getType() + ".application1.flow1", tableId.getTableName());
    tableName = tableUtil.buildHTableDescriptor(tableId).build().getNameAsString();
    Assert.assertEquals("application1", HBaseQueueAdmin.getApplicationName(tableName));
    Assert.assertEquals("flow1", HBaseQueueAdmin.getFlowName(tableName));
}
Also used : TableId(co.cask.cdap.data2.util.TableId) QueueName(co.cask.cdap.common.queue.QueueName) Test(org.junit.Test) QueueTest(co.cask.cdap.data2.transaction.queue.QueueTest)

Example 2 with QueueTest

use of co.cask.cdap.data2.transaction.queue.QueueTest in project cdap by caskdata.

the class LevelDBQueueTest method testQueueTableNameFormat.

// TODO: CDAP-1177 Should move to QueueTest after making getApplicationName() etc instance methods in a base class
@Test
public void testQueueTableNameFormat() throws Exception {
    QueueName queueName = QueueName.fromFlowlet(NamespaceId.DEFAULT.getNamespace(), "application1", "flow1", "flowlet1", "output1");
    String tableName = ((LevelDBQueueAdmin) queueAdmin).getActualTableName(queueName);
    Assert.assertEquals("default.system.queue.application1.flow1", tableName);
    Assert.assertEquals("application1", LevelDBQueueAdmin.getApplicationName(tableName));
    Assert.assertEquals("flow1", LevelDBQueueAdmin.getFlowName(tableName));
    queueName = QueueName.fromFlowlet("testNamespace", "application1", "flow1", "flowlet1", "output1");
    tableName = ((LevelDBQueueAdmin) queueAdmin).getActualTableName(queueName);
    Assert.assertEquals("testNamespace.system.queue.application1.flow1", tableName);
    Assert.assertEquals("application1", LevelDBQueueAdmin.getApplicationName(tableName));
    Assert.assertEquals("flow1", LevelDBQueueAdmin.getFlowName(tableName));
}
Also used : QueueName(co.cask.cdap.common.queue.QueueName) Test(org.junit.Test) QueueTest(co.cask.cdap.data2.transaction.queue.QueueTest)

Aggregations

QueueName (co.cask.cdap.common.queue.QueueName)2 QueueTest (co.cask.cdap.data2.transaction.queue.QueueTest)2 Test (org.junit.Test)2 TableId (co.cask.cdap.data2.util.TableId)1