use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class QuickStartV2IT method testProcessIsAdded.
@Test
public void testProcessIsAdded() throws AtlasServiceException, JSONException {
Map<String, String> attributes = new HashMap<>();
attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, QuickStartV2.LOAD_SALES_DAILY_PROCESS);
AtlasEntity loadProcess = atlasClientV2.getEntityByAttribute(QuickStartV2.LOAD_PROCESS_TYPE, attributes).getEntity();
Map loadProcessAttribs = loadProcess.getAttributes();
assertEquals(QuickStartV2.LOAD_SALES_DAILY_PROCESS, loadProcessAttribs.get(AtlasClient.NAME));
assertEquals("hive query for daily summary", loadProcessAttribs.get("description"));
List inputs = (List) loadProcessAttribs.get("inputs");
List outputs = (List) loadProcessAttribs.get("outputs");
assertEquals(2, inputs.size());
String salesFactTableId = getTableId(QuickStartV2.SALES_FACT_TABLE);
String timeDimTableId = getTableId(QuickStartV2.TIME_DIM_TABLE);
String salesFactDailyMVId = getTableId(QuickStartV2.SALES_FACT_DAILY_MV_TABLE);
assertEquals(salesFactTableId, ((Map) inputs.get(0)).get("guid"));
assertEquals(timeDimTableId, ((Map) inputs.get(1)).get("guid"));
assertEquals(salesFactDailyMVId, ((Map) outputs.get(0)).get("guid"));
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class TestEntitiesREST method serDeserEntity.
AtlasEntity serDeserEntity(AtlasEntity entity) throws IOException {
//Convert from json to object and back to trigger the case where it gets translated to a map for attributes instead of AtlasEntity
String jsonString = AtlasType.toJson(entity);
AtlasEntity newEntity = AtlasType.fromJson(jsonString, AtlasEntity.class);
return newEntity;
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class TestEntitiesREST method testGetEntities.
@Test(dependsOnMethods = "testCreateOrUpdateEntities")
public void testGetEntities() throws Exception {
final AtlasEntitiesWithExtInfo response = entityREST.getByGuids(createdGuids);
final List<AtlasEntity> entities = response.getEntities();
Assert.assertNotNull(entities);
Assert.assertEquals(entities.size(), 3);
verifyAttributes(entities);
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class ZipSourceTest method useCreationOrderToFetchEntities.
private void useCreationOrderToFetchEntities(ZipSource zipSource, List<String> creationOrder) {
for (String guid : creationOrder) {
AtlasEntity e = zipSource.getByGuid(guid);
assertNotNull(e);
}
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class ZipSourceTest method iteratorBehavor_WorksAsExpected.
@Test(dataProvider = "zipFileStocks")
public void iteratorBehavor_WorksAsExpected(ZipSource zipSource) throws IOException, AtlasBaseException {
Assert.assertTrue(zipSource.hasNext());
List<String> creationOrder = zipSource.getCreationOrder();
for (int i = 0; i < creationOrder.size(); i++) {
AtlasEntity e = zipSource.next();
assertNotNull(e);
assertEquals(e.getGuid(), creationOrder.get(i));
}
Assert.assertFalse(zipSource.hasNext());
}
Aggregations