Search in sources :

Example 1 with CreateTableReplicationTask

use of org.apache.hive.hcatalog.api.repl.exim.CreateTableReplicationTask in project hive by apache.

the class TestReplicationTask method testCreate.

@Test
public static void testCreate() throws HCatException {
    Table t = new Table();
    t.setDbName("testdb");
    t.setTableName("testtable");
    NotificationEvent event = new NotificationEvent(0, (int) System.currentTimeMillis(), HCatConstants.HCAT_CREATE_TABLE_EVENT, msgFactory.buildCreateTableMessage(t).toString());
    event.setDbName(t.getDbName());
    event.setTableName(t.getTableName());
    ReplicationTask.resetFactory(null);
    ReplicationTask rtask = ReplicationTask.create(HCatClient.create(new HiveConf()), new HCatNotificationEvent(event));
    assertTrue("Provided factory instantiation should yield CreateTableReplicationTask", rtask instanceof CreateTableReplicationTask);
    ReplicationTask.resetFactory(NoopFactory.class);
    rtask = ReplicationTask.create(HCatClient.create(new HiveConf()), new HCatNotificationEvent(event));
    assertTrue("Provided factory instantiation should yield NoopReplicationTask", rtask instanceof NoopReplicationTask);
    ReplicationTask.resetFactory(null);
}
Also used : Table(org.apache.hadoop.hive.metastore.api.Table) CreateTableReplicationTask(org.apache.hive.hcatalog.api.repl.exim.CreateTableReplicationTask) CreateTableReplicationTask(org.apache.hive.hcatalog.api.repl.exim.CreateTableReplicationTask) HCatNotificationEvent(org.apache.hive.hcatalog.api.HCatNotificationEvent) NotificationEvent(org.apache.hadoop.hive.metastore.api.NotificationEvent) HiveConf(org.apache.hadoop.hive.conf.HiveConf) HCatNotificationEvent(org.apache.hive.hcatalog.api.HCatNotificationEvent) Test(org.junit.Test)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)1 NotificationEvent (org.apache.hadoop.hive.metastore.api.NotificationEvent)1 Table (org.apache.hadoop.hive.metastore.api.Table)1 HCatNotificationEvent (org.apache.hive.hcatalog.api.HCatNotificationEvent)1 CreateTableReplicationTask (org.apache.hive.hcatalog.api.repl.exim.CreateTableReplicationTask)1 Test (org.junit.Test)1