Search in sources :

Example 6 with AtlasTypesDef

use of org.apache.atlas.model.typedef.AtlasTypesDef in project atlas by apache.

the class ZipFileResourceTestUtils method loadModelFromResourcesJson.

public static void loadModelFromResourcesJson(String fileName, AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry) throws IOException, AtlasBaseException {
    AtlasTypesDef typesFromJson = getAtlasTypesDefFromResourceFile(fileName);
    createTypesAsNeeded(typesFromJson, typeDefStore, typeRegistry);
}
Also used : AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef)

Example 7 with AtlasTypesDef

use of org.apache.atlas.model.typedef.AtlasTypesDef in project atlas by apache.

the class ZipFileResourceTestUtils method loadModelFromJson.

public static void loadModelFromJson(String fileName, AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry) throws IOException, AtlasBaseException {
    AtlasTypesDef typesFromJson = getAtlasTypesDefFromFile(fileName);
    createTypesAsNeeded(typesFromJson, typeDefStore, typeRegistry);
}
Also used : AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef)

Example 8 with AtlasTypesDef

use of org.apache.atlas.model.typedef.AtlasTypesDef in project atlas by apache.

the class ZipSourceTest method examineContents_BehavesAsExpected.

@Test(dataProvider = "zipFileStocks")
public void examineContents_BehavesAsExpected(ZipSource zipSource) throws IOException, AtlasBaseException {
    List<String> creationOrder = zipSource.getCreationOrder();
    assertNotNull(creationOrder);
    assertEquals(creationOrder.size(), 4);
    AtlasTypesDef typesDef = zipSource.getTypesDef();
    assertNotNull(typesDef);
    assertEquals(typesDef.getEntityDefs().size(), 6);
    useCreationOrderToFetchEntitiesWithExtInfo(zipSource, creationOrder);
    useCreationOrderToFetchEntities(zipSource, creationOrder);
    attemptToFetchNonExistentGuid_ReturnsNull(zipSource, "non-existent-guid");
    verifyGuidRemovalOnImportComplete(zipSource, creationOrder.get(0));
}
Also used : AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef) Test(org.testng.annotations.Test)

Example 9 with AtlasTypesDef

use of org.apache.atlas.model.typedef.AtlasTypesDef in project atlas by apache.

the class ExportServiceTest method setupSampleData.

@BeforeClass
public void setupSampleData() throws AtlasBaseException {
    entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, mockChangeNotifier, graphMapper);
    ;
    AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes();
    AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry);
    if (!typesToCreate.isEmpty()) {
        typeDefStore.createTypesDef(typesToCreate);
    }
    AtlasEntity.AtlasEntitiesWithExtInfo hrDept = TestUtilsV2.createDeptEg2();
    AtlasEntityStream entityStream = new AtlasEntityStream(hrDept);
    entityStore.createOrUpdate(entityStream, false);
    LOG.debug("==> setupSampleData: ", AtlasEntity.dumpObjects(hrDept.getEntities(), null).toString());
}
Also used : AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntityStream(org.apache.atlas.repository.store.graph.v1.AtlasEntityStream) AtlasEntityStoreV1(org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1) AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef) BeforeClass(org.testng.annotations.BeforeClass)

Example 10 with AtlasTypesDef

use of org.apache.atlas.model.typedef.AtlasTypesDef in project atlas by apache.

the class ExportService method processTypesDef.

private void processTypesDef(ExportContext context) {
    AtlasTypesDef typesDef = context.result.getData().getTypesDef();
    for (String entityType : context.entityTypes) {
        AtlasEntityDef entityDef = typeRegistry.getEntityDefByName(entityType);
        typesDef.getEntityDefs().add(entityDef);
    }
    for (String classificationType : context.classificationTypes) {
        AtlasClassificationDef classificationDef = typeRegistry.getClassificationDefByName(classificationType);
        typesDef.getClassificationDefs().add(classificationDef);
    }
    for (String structType : context.structTypes) {
        AtlasStructDef structDef = typeRegistry.getStructDefByName(structType);
        typesDef.getStructDefs().add(structDef);
    }
    for (String enumType : context.enumTypes) {
        AtlasEnumDef enumDef = typeRegistry.getEnumDefByName(enumType);
        typesDef.getEnumDefs().add(enumDef);
    }
}
Also used : AtlasClassificationDef(org.apache.atlas.model.typedef.AtlasClassificationDef) AtlasStructDef(org.apache.atlas.model.typedef.AtlasStructDef) AtlasEntityDef(org.apache.atlas.model.typedef.AtlasEntityDef) AtlasEnumDef(org.apache.atlas.model.typedef.AtlasEnumDef) AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef)

Aggregations

AtlasTypesDef (org.apache.atlas.model.typedef.AtlasTypesDef)118 AtlasEntityDef (org.apache.atlas.model.typedef.AtlasEntityDef)54 AtlasClassificationDef (org.apache.atlas.model.typedef.AtlasClassificationDef)39 Test (org.testng.annotations.Test)39 AtlasStructDef (org.apache.atlas.model.typedef.AtlasStructDef)30 AtlasEntity (org.apache.atlas.model.instance.AtlasEntity)22 AtlasEnumDef (org.apache.atlas.model.typedef.AtlasEnumDef)22 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)20 AtlasAttributeDef (org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef)19 ArrayList (java.util.ArrayList)18 SearchFilter (org.apache.atlas.model.SearchFilter)15 EntityMutationResponse (org.apache.atlas.model.instance.EntityMutationResponse)15 AtlasEntityHeader (org.apache.atlas.model.instance.AtlasEntityHeader)14 BeforeClass (org.testng.annotations.BeforeClass)14 HashMap (java.util.HashMap)13 AtlasConstraintDef (org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef)13 AtlasClassification (org.apache.atlas.model.instance.AtlasClassification)12 AtlasEnumElementDef (org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef)9 MultivaluedMapImpl (com.sun.jersey.core.util.MultivaluedMapImpl)8 AtlasServiceException (org.apache.atlas.AtlasServiceException)7