Search in sources :

Example 31 with AtlasEntity

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"));
}
Also used : HashMap(java.util.HashMap) AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.testng.annotations.Test)

Example 32 with AtlasEntity

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;
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity)

Example 33 with AtlasEntity

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);
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntitiesWithExtInfo(org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo) Test(org.testng.annotations.Test)

Example 34 with AtlasEntity

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);
    }
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity)

Example 35 with AtlasEntity

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());
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) Test(org.testng.annotations.Test)

Aggregations

AtlasEntity (org.apache.atlas.model.instance.AtlasEntity)124 Test (org.testng.annotations.Test)58 EntityMutationResponse (org.apache.atlas.model.instance.EntityMutationResponse)43 AtlasEntityHeader (org.apache.atlas.model.instance.AtlasEntityHeader)36 HashMap (java.util.HashMap)25 BeforeTest (org.testng.annotations.BeforeTest)25 AtlasEntityWithExtInfo (org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo)24 AtlasObjectId (org.apache.atlas.model.instance.AtlasObjectId)24 AtlasEntitiesWithExtInfo (org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo)21 AtlasEntityType (org.apache.atlas.type.AtlasEntityType)17 ArrayList (java.util.ArrayList)16 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)14 Map (java.util.Map)12 List (java.util.List)11 AtlasTypesDef (org.apache.atlas.model.typedef.AtlasTypesDef)11 AtlasStruct (org.apache.atlas.model.instance.AtlasStruct)9 ITypedReferenceableInstance (org.apache.atlas.typesystem.ITypedReferenceableInstance)9 TestUtils.randomString (org.apache.atlas.TestUtils.randomString)7 AtlasEntityDef (org.apache.atlas.model.typedef.AtlasEntityDef)7 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)7