use of org.apache.drill.metastore.mongo.operate.Overwrite in project drill by apache.
the class TestTablesOperationTransformer method testToOverwriteOperation.
@Test
public void testToOverwriteOperation() {
TableMetadataUnit unit = TableMetadataUnit.builder().storagePlugin("dfs").workspace("tmp").tableName("nation").metadataType(MetadataType.TABLE.name()).metadataIdentifier("s1").build();
List<Overwrite> operations = transformer.toOverwrite(Collections.singletonList(unit));
InputDataTransformer<TableMetadataUnit> inputDataTransformer = ((MongoTables) metastore.tables()).transformer().inputData();
Document expected = new Document();
expected.append("storagePlugin", "dfs");
expected.append("workspace", "tmp");
expected.append("tableName", "nation");
expected.append("metadataType", MetadataType.TABLE.name());
expected.append("metadataIdentifier", "s1");
assertEquals(new Document().append(MongoConfigConstants.ID, inputDataTransformer.createId(expected)), operations.get(0).filter());
assertEquals(expected, operations.get(0).data().get(MongoConfigConstants.ID));
}
Aggregations