use of org.apache.hive.hcatalog.api.repl.Command in project hive by apache.
the class TestEximReplicationTasks method verifyDropDbReplicationTask.
private static void verifyDropDbReplicationTask(ReplicationTask rtask) throws IOException {
assertEquals(DropDatabaseReplicationTask.class, rtask.getClass());
assertEquals(false, rtask.needsStagingDirs());
assertEquals(true, rtask.isActionable());
rtask.withDbNameMapping(debugMapping).withTableNameMapping(debugMapping);
for (Command c : rtask.getSrcWhCommands()) {
assertEquals(NoopCommand.class, c.getClass());
}
List<? extends Command> dstCommands = Lists.newArrayList(rtask.getDstWhCommands());
assertEquals(1, dstCommands.size());
assertEquals(DropDatabaseCommand.class, dstCommands.get(0).getClass());
DropDatabaseCommand dropDatabaseCommand = new DropDatabaseCommand(debugMapping.apply(rtask.getEvent().getDbName()), rtask.getEvent().getEventId());
assertEquals(ReplicationUtils.serializeCommand(dropDatabaseCommand), ReplicationUtils.serializeCommand(dstCommands.get(0)));
}
use of org.apache.hive.hcatalog.api.repl.Command in project hive by apache.
the class TestEximReplicationTasks method verifyDropTableReplicationTask.
private static void verifyDropTableReplicationTask(ReplicationTask rtask) throws IOException {
assertEquals(DropTableReplicationTask.class, rtask.getClass());
assertEquals(false, rtask.needsStagingDirs());
assertEquals(true, rtask.isActionable());
rtask.withDbNameMapping(debugMapping).withTableNameMapping(debugMapping);
for (Command c : rtask.getSrcWhCommands()) {
assertEquals(NoopCommand.class, c.getClass());
}
List<? extends Command> dstCommands = Lists.newArrayList(rtask.getDstWhCommands());
assertEquals(1, dstCommands.size());
assertEquals(DropTableCommand.class, dstCommands.get(0).getClass());
DropTableCommand dropTableCommand = new DropTableCommand(debugMapping.apply(rtask.getEvent().getDbName()), debugMapping.apply(rtask.getEvent().getTableName()), true, rtask.getEvent().getEventId());
assertEquals(ReplicationUtils.serializeCommand(dropTableCommand), ReplicationUtils.serializeCommand(dstCommands.get(0)));
}
Aggregations