Search in sources :

Example 41 with AtlasTypesDef

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

the class AtlasTypeDefGraphStoreTest method testGet.

@Test(priority = 1)
public void testGet() {
    try {
        AtlasTypesDef typesDef = typeDefStore.searchTypesDef(new SearchFilter());
        assertNotNull(typesDef.getEnumDefs());
        assertEquals(typesDef.getStructDefs().size(), 0);
        assertNotNull(typesDef.getStructDefs());
        assertEquals(typesDef.getClassificationDefs().size(), 0);
        assertNotNull(typesDef.getClassificationDefs());
        assertEquals(typesDef.getEntityDefs().size(), 0);
        assertNotNull(typesDef.getEntityDefs());
    } catch (AtlasBaseException e) {
        fail("Search of types shouldn't have failed");
    }
}
Also used : AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) SearchFilter(org.apache.atlas.model.SearchFilter) AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef) Test(org.testng.annotations.Test)

Example 42 with AtlasTypesDef

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

the class AtlasTypeDefGraphStoreTest method testUpdate.

@Test(dependsOnMethods = { "testCreateDept" }, dataProvider = "validUpdateDeptTypes")
public void testUpdate(AtlasTypesDef atlasTypesDef) {
    try {
        AtlasTypesDef updatedTypesDef = typeDefStore.updateTypesDef(atlasTypesDef);
        assertNotNull(updatedTypesDef);
        assertEquals(updatedTypesDef.getEnumDefs().size(), atlasTypesDef.getEnumDefs().size(), "EnumDefs update failed");
        assertEquals(updatedTypesDef.getClassificationDefs().size(), atlasTypesDef.getClassificationDefs().size(), "ClassificationDef update failed");
        assertEquals(updatedTypesDef.getStructDefs().size(), atlasTypesDef.getStructDefs().size(), "StructDef update failed");
        assertEquals(updatedTypesDef.getEntityDefs().size(), atlasTypesDef.getEntityDefs().size(), "EntityDef update failed");
        // Try another update round by name and GUID
        for (AtlasEnumDef enumDef : updatedTypesDef.getEnumDefs()) {
            AtlasEnumDef updated = typeDefStore.updateEnumDefByGuid(enumDef.getGuid(), enumDef);
            assertNotNull(updated);
        }
        for (AtlasEnumDef enumDef : atlasTypesDef.getEnumDefs()) {
            AtlasEnumDef updated = typeDefStore.updateEnumDefByName(enumDef.getName(), enumDef);
            assertNotNull(updated);
        }
        // Try another update round by name and GUID
        for (AtlasClassificationDef classificationDef : updatedTypesDef.getClassificationDefs()) {
            AtlasClassificationDef updated = typeDefStore.updateClassificationDefByGuid(classificationDef.getGuid(), classificationDef);
            assertNotNull(updated);
        }
        for (AtlasClassificationDef classificationDef : atlasTypesDef.getClassificationDefs()) {
            AtlasClassificationDef updated = typeDefStore.updateClassificationDefByName(classificationDef.getName(), classificationDef);
            assertNotNull(updated);
        }
        // Try another update round by name and GUID
        for (AtlasStructDef structDef : updatedTypesDef.getStructDefs()) {
            AtlasStructDef updated = typeDefStore.updateStructDefByGuid(structDef.getGuid(), structDef);
            assertNotNull(updated);
        }
        for (AtlasStructDef structDef : atlasTypesDef.getStructDefs()) {
            AtlasStructDef updated = typeDefStore.updateStructDefByName(structDef.getName(), structDef);
            assertNotNull(updated);
        }
        // Try another update round by name and GUID
        for (AtlasEntityDef entityDef : updatedTypesDef.getEntityDefs()) {
            AtlasEntityDef updated = typeDefStore.updateEntityDefByGuid(entityDef.getGuid(), entityDef);
            assertNotNull(updated);
        }
        for (AtlasEntityDef entityDef : atlasTypesDef.getEntityDefs()) {
            AtlasEntityDef updated = typeDefStore.updateEntityDefByName(entityDef.getName(), entityDef);
            assertNotNull(updated);
        }
    } catch (AtlasBaseException e) {
        fail("TypeDef updates should've succeeded");
    }
}
Also used : AtlasClassificationDef(org.apache.atlas.model.typedef.AtlasClassificationDef) AtlasStructDef(org.apache.atlas.model.typedef.AtlasStructDef) AtlasEntityDef(org.apache.atlas.model.typedef.AtlasEntityDef) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) AtlasEnumDef(org.apache.atlas.model.typedef.AtlasEnumDef) AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef) Test(org.testng.annotations.Test)

Example 43 with AtlasTypesDef

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

the class AtlasClientV2 method createEntityDef.

@Deprecated
public AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasServiceException {
    AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
    atlasTypesDef.getEntityDefs().add(entityDef);
    AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
    assert created != null;
    assert created.getEntityDefs() != null;
    return created.getEntityDefs().get(0);
}
Also used : AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef)

Example 44 with AtlasTypesDef

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

the class AtlasClientV2 method createEnumDef.

@Deprecated
public AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasServiceException {
    AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
    atlasTypesDef.getEnumDefs().add(enumDef);
    AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
    assert created != null;
    assert created.getEnumDefs() != null;
    return created.getEnumDefs().get(0);
}
Also used : AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef)

Example 45 with AtlasTypesDef

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

the class AtlasClientV2 method createStructDef.

@Deprecated
public AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasServiceException {
    AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
    atlasTypesDef.getStructDefs().add(structDef);
    AtlasTypesDef created = createAtlasTypeDefs(atlasTypesDef);
    assert created != null;
    assert created.getStructDefs() != null;
    return created.getStructDefs().get(0);
}
Also used : 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