use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class NotificationHookConsumerIT method testDeleteByQualifiedName.
@Test
public void testDeleteByQualifiedName() throws Exception {
final Referenceable entity = new Referenceable(DATABASE_TYPE_BUILTIN);
final String dbName = "db" + randomString();
entity.set(NAME, dbName);
entity.set(DESCRIPTION, randomString());
entity.set(QUALIFIED_NAME, dbName);
entity.set(CLUSTER_NAME, randomString());
final String dbId = atlasClientV1.createEntity(entity).get(0);
sendHookMessage(new EntityDeleteRequest(TEST_USER, DATABASE_TYPE_BUILTIN, QUALIFIED_NAME, dbName));
waitFor(MAX_WAIT_TIME, new Predicate() {
@Override
public boolean evaluate() throws Exception {
Referenceable getEntity = atlasClientV1.getEntity(dbId);
return getEntity.getId().getState() == Id.EntityState.DELETED;
}
});
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class NotificationHookConsumerIT method testCreateEntity.
@Test
public void testCreateEntity() throws Exception {
final Referenceable entity = new Referenceable(DATABASE_TYPE_BUILTIN);
final String dbName = "db" + randomString();
entity.set(NAME, dbName);
entity.set(DESCRIPTION, randomString());
entity.set(QUALIFIED_NAME, dbName);
entity.set(CLUSTER_NAME, randomString());
sendHookMessage(new EntityCreateRequest(TEST_USER, entity));
waitFor(MAX_WAIT_TIME, new Predicate() {
@Override
public boolean evaluate() throws Exception {
ArrayNode results = searchByDSL(String.format("%s where qualifiedName='%s'", DATABASE_TYPE_BUILTIN, entity.get(QUALIFIED_NAME)));
return results.size() == 1;
}
});
// Assert that user passed in hook message is used in audit
Referenceable instance = atlasClientV1.getEntity(DATABASE_TYPE_BUILTIN, QUALIFIED_NAME, (String) entity.get(QUALIFIED_NAME));
List<EntityAuditEvent> events = atlasClientV1.getEntityAuditEvents(instance.getId()._getId(), (short) 1);
assertEquals(events.size(), 1);
assertEquals(events.get(0).getUser(), TEST_USER);
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class QuickStartIT method testViewIsAdded.
@Test
public void testViewIsAdded() throws AtlasServiceException {
Referenceable view = atlasClientV1.getEntity(QuickStart.VIEW_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStart.PRODUCT_DIM_VIEW);
assertEquals(QuickStart.PRODUCT_DIM_VIEW, view.get(AtlasClient.NAME));
Id productDimId = getTable(QuickStart.PRODUCT_DIM_TABLE).getId();
Id inputTableId = ((List<Id>) view.get(QuickStart.INPUT_TABLES_ATTRIBUTE)).get(0);
assertEquals(productDimId, inputTableId);
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class QuickStartIT method verifyDBIsLinkedToTable.
private void verifyDBIsLinkedToTable(Referenceable table) throws AtlasServiceException {
Referenceable db = getDB(QuickStart.SALES_DB);
assertEquals(db.getId(), table.get(QuickStart.DB_ATTRIBUTE));
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class QuickStartIT method verifyColumnsAreAddedToTable.
private void verifyColumnsAreAddedToTable(Referenceable table) {
List<Referenceable> columns = (List<Referenceable>) table.get(QuickStart.COLUMNS_ATTRIBUTE);
assertEquals(4, columns.size());
Referenceable column = columns.get(0);
assertEquals(QuickStart.TIME_ID_COLUMN, column.get("name"));
assertEquals("int", column.get("dataType"));
}
Aggregations