Search in sources :

Example 6 with AtlasErrorCode

use of org.apache.atlas.AtlasErrorCode in project incubator-atlas by apache.

the class TestAtlasEntityType method testConstraintInValidInverseRef_InvalidAttributeType.

@Test
public void testConstraintInValidInverseRef_InvalidAttributeType() {
    AtlasTypeRegistry typeRegistry = new AtlasTypeRegistry();
    AtlasTransientTypeRegistry ttr = null;
    boolean commit = false;
    List<AtlasEntityDef> entityDefs = new ArrayList<>();
    AtlasErrorCode errorCode = null;
    entityDefs.add(createTableEntityDef());
    entityDefs.add(createColumnEntityDefWithInvalidInverseAttributeType());
    try {
        ttr = typeRegistry.lockTypeRegistryForUpdate();
        ttr.addTypes(entityDefs);
        commit = true;
    } catch (AtlasBaseException excp) {
        errorCode = excp.getAtlasErrorCode();
    } finally {
        typeRegistry.releaseTypeRegistryForUpdate(ttr, commit);
    }
    assertEquals(errorCode, AtlasErrorCode.CONSTRAINT_INVERSE_REF_INVERSE_ATTRIBUTE_INVALID_TYPE, "expected invalid constraint failure - invalid refAttribute type");
}
Also used : AtlasEntityDef(org.apache.atlas.model.typedef.AtlasEntityDef) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) AtlasTransientTypeRegistry(org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry) ArrayList(java.util.ArrayList) AtlasErrorCode(org.apache.atlas.AtlasErrorCode) Test(org.testng.annotations.Test)

Aggregations

AtlasErrorCode (org.apache.atlas.AtlasErrorCode)6 ArrayList (java.util.ArrayList)5 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)5 AtlasEntityDef (org.apache.atlas.model.typedef.AtlasEntityDef)5 AtlasTransientTypeRegistry (org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry)5 Test (org.testng.annotations.Test)5 LinkedHashMap (java.util.LinkedHashMap)1 Response (javax.ws.rs.core.Response)1