use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.
the class TerminateHiveTableFeed method completeOperation.
@Override
protected DataOperation completeOperation(ProcessContext context, FlowFile flowFile, Datasource dataset, DataOperation op, DataOperation.State state) {
MetadataProvider provider = getProviderService(context).getProvider();
if (state == State.SUCCESS) {
HiveTableDatasource hds = (HiveTableDatasource) dataset;
Dataset changeSet = provider.createDataset(hds, null);
return provider.completeOperation(op.getId(), "", changeSet);
} else {
return provider.completeOperation(op.getId(), "", state);
}
}
use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.
the class MetadataClientProviderTest method testEnsureHiveTableDatasource.
@Test
public void testEnsureHiveTableDatasource() {
this.provider.ensureHiveTableDatasource("test7", "", "testdb", "test_table");
Datasource ds = this.provider.getDatasourceByName("test7");
assertThat(ds).isNotNull();
assertThat(ds).isInstanceOf(HiveTableDatasource.class);
String dsId = ds.getId();
HiveTableDatasource dds = (HiveTableDatasource) ds;
assertThat(dds.getTableName()).contains("test_table");
ds = this.provider.ensureHiveTableDatasource("test7", "", "testdb", "test_table");
assertThat(ds).isNotNull();
assertThat(ds.getId()).isEqualTo(dsId);
}
use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.
the class MetadataClientTest method testAddFeedSource.
// @Test
public void testAddFeedSource() throws ParseException {
Feed feed = buildFeed("category", "feed1").post();
HiveTableDatasource ds = buildHiveTableDatasource("test-table").post();
Feed result = client.addSource(feed.getId(), ds.getId());
assertThat(result).isNotNull();
}
use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.
the class MetadataClientTest method testCompleteOperation.
// @Test
public void testCompleteOperation() throws ParseException {
Feed feedA = buildFeed("category", "feedA").post();
HiveTableDatasource dsA = buildHiveTableDatasource("test-table").post();
feedA = client.addDestination(feedA.getId(), dsA.getId());
Feed feedB = buildFeed("category", "feedB", "category", "feedA").post();
feedB = client.addSource(feedB.getId(), dsA.getId());
String destA = feedA.getDestinations().iterator().next().getId();
DataOperation op = client.beginOperation(destA, "");
op.setState(State.SUCCESS);
HiveTablePartitions changeSet = new HiveTablePartitions();
changeSet.setPartitions(Arrays.asList(new HiveTablePartition("month", null, "Jan", "Feb"), new HiveTablePartition("year", null, "2015", "2016")));
Dataset dataset = new Dataset(new DateTime(), dsA, ChangeType.UPDATE, ContentType.PARTITIONS, changeSet);
op.setDataset(dataset);
op = client.updateDataOperation(op);
assertThat(op).isNotNull();
}
use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.
the class MetadataClientTest method testBeginOperation.
// @Test
public void testBeginOperation() throws ParseException {
Feed feed = buildFeed("category", "feed1").post();
HiveTableDatasource ds = buildHiveTableDatasource("test-table").post();
feed = client.addDestination(feed.getId(), ds.getId());
String destId = feed.getDestinations().iterator().next().getId();
DataOperation op = client.beginOperation(destId, "");
assertThat(op).isNotNull();
}
Aggregations