Repository: atlas Updated Branches: refs/heads/master 0abf84caa -> 435fe3fba
http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java index a13f069..f25fc5f 100755 --- a/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/MetadataDiscoveryJerseyResourceIT.java @@ -18,23 +18,16 @@ package org.apache.atlas.web.integration; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.core.util.MultivaluedMapImpl; import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasServiceException; -import org.apache.atlas.typesystem.Referenceable; -import org.apache.atlas.typesystem.Struct; -import org.apache.atlas.typesystem.TypesDef; -import org.apache.atlas.typesystem.persistence.Id; -import org.apache.atlas.typesystem.types.ClassType; -import org.apache.atlas.typesystem.types.DataTypes; -import org.apache.atlas.typesystem.types.EnumTypeDefinition; -import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition; -import org.apache.atlas.typesystem.types.StructTypeDefinition; -import org.apache.atlas.typesystem.types.TraitType; -import org.apache.atlas.typesystem.types.utils.TypesUtil; +import org.apache.atlas.model.typedef.AtlasBaseTypeDef; +import org.apache.atlas.v1.model.instance.Id; +import org.apache.atlas.v1.model.instance.Referenceable; +import org.apache.atlas.v1.model.instance.Struct; +import org.apache.atlas.v1.model.typedef.*; +import org.apache.atlas.v1.typesystem.types.utils.TypesUtil; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; import org.testng.Assert; @@ -42,6 +35,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import javax.ws.rs.core.MultivaluedMap; +import java.util.Collections; import java.util.List; import static org.testng.Assert.assertEquals; @@ -236,16 +230,16 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT { private void createTypes() throws Exception { createTypeDefinitionsV1(); - HierarchicalTypeDefinition<ClassType> dslTestTypeDefinition = TypesUtil - .createClassTypeDef("dsl_test_type", ImmutableSet.<String>of(), - TypesUtil.createUniqueRequiredAttrDef("name", DataTypes.STRING_TYPE), - TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE)); + ClassTypeDefinition dslTestTypeDefinition = TypesUtil + .createClassTypeDef("dsl_test_type", null, Collections.<String>emptySet(), + TypesUtil.createUniqueRequiredAttrDef("name", AtlasBaseTypeDef.ATLAS_TYPE_STRING), + TypesUtil.createRequiredAttrDef("description", AtlasBaseTypeDef.ATLAS_TYPE_STRING)); - HierarchicalTypeDefinition<TraitType> classificationTraitDefinition = TypesUtil - .createTraitTypeDef("Classification", ImmutableSet.<String>of(), - TypesUtil.createRequiredAttrDef("tag", DataTypes.STRING_TYPE)); - TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), - ImmutableList.of(classificationTraitDefinition), ImmutableList.of(dslTestTypeDefinition)); + TraitTypeDefinition classificationTraitDefinition = TypesUtil + .createTraitTypeDef("Classification", null, Collections.<String>emptySet(), + TypesUtil.createRequiredAttrDef("tag", AtlasBaseTypeDef.ATLAS_TYPE_STRING)); + TypesDef typesDef = new TypesDef(Collections.<EnumTypeDefinition>emptyList(), Collections.<StructTypeDefinition>emptyList(), + Collections.singletonList(classificationTraitDefinition), Collections.singletonList(dslTestTypeDefinition)); createType(typesDef); } @@ -259,7 +253,7 @@ public class MetadataDiscoveryJerseyResourceIT extends BaseResourceIT { tagName = randomString(); traitInstance.set("tag", tagName); - List<String> traits = entityInstance.getTraits(); + List<String> traits = entityInstance.getTraitNames(); assertEquals(traits.size(), 1); return createInstance(entityInstance); http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java index c46689c..5ee8d30 100644 --- a/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/TypedefsJerseyResourceIT.java @@ -18,7 +18,6 @@ package org.apache.atlas.web.integration; -import com.google.common.collect.ImmutableSet; import com.sun.jersey.core.util.MultivaluedMapImpl; import org.apache.atlas.AtlasClientV2; import org.apache.atlas.AtlasServiceException; @@ -33,7 +32,6 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef; import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.type.AtlasTypeUtil; -import org.apache.atlas.typesystem.types.DataTypes; import org.apache.atlas.utils.AuthenticationUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; @@ -43,7 +41,9 @@ import org.testng.annotations.Test; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; +import java.util.Arrays; import java.util.Collections; +import java.util.HashSet; import static org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality; import static org.apache.atlas.type.AtlasTypeUtil.createClassTypeDef; @@ -105,7 +105,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { @Test public void testDuplicateCreate() throws Exception { AtlasEntityDef type = createClassTypeDef(randomString(), - ImmutableSet.<String>of(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string")); + Collections.<String>emptySet(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string")); AtlasTypesDef typesDef = new AtlasTypesDef(); typesDef.getEntityDefs().add(type); @@ -124,7 +124,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { public void testUpdate() throws Exception { String entityType = randomString(); AtlasEntityDef typeDefinition = - createClassTypeDef(entityType, ImmutableSet.<String>of(), + createClassTypeDef(entityType, Collections.<String>emptySet(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string")); AtlasTypesDef atlasTypesDef = new AtlasTypesDef(); @@ -136,7 +136,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { //Add attribute description typeDefinition = createClassTypeDef(typeDefinition.getName(), - ImmutableSet.<String>of(), + Collections.<String>emptySet(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), AtlasTypeUtil.createOptionalAttrDef("description", "string")); @@ -263,10 +263,10 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { @Test public void testListTypesByFilter() throws Exception { AtlasAttributeDef attr = AtlasTypeUtil.createOptionalAttrDef("attr", "string"); - AtlasEntityDef classDefA = AtlasTypeUtil.createClassTypeDef("A" + randomString(), ImmutableSet.<String>of(), attr); - AtlasEntityDef classDefA1 = AtlasTypeUtil.createClassTypeDef("A1" + randomString(), ImmutableSet.of(classDefA.getName()), attr); - AtlasEntityDef classDefB = AtlasTypeUtil.createClassTypeDef("B" + randomString(), ImmutableSet.<String>of(), attr); - AtlasEntityDef classDefC = AtlasTypeUtil.createClassTypeDef("C" + randomString(), ImmutableSet.of(classDefB.getName(), classDefA.getName()), attr); + AtlasEntityDef classDefA = AtlasTypeUtil.createClassTypeDef("A" + randomString(), Collections.<String>emptySet(), attr); + AtlasEntityDef classDefA1 = AtlasTypeUtil.createClassTypeDef("A1" + randomString(), Collections.singleton(classDefA.getName()), attr); + AtlasEntityDef classDefB = AtlasTypeUtil.createClassTypeDef("B" + randomString(), Collections.<String>emptySet(), attr); + AtlasEntityDef classDefC = AtlasTypeUtil.createClassTypeDef("C" + randomString(), new HashSet<>(Arrays.asList(classDefB.getName(), classDefA.getName())), attr); AtlasTypesDef atlasTypesDef = new AtlasTypesDef(); atlasTypesDef.getEntityDefs().add(classDefA); @@ -297,19 +297,19 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { AtlasTypesDef atlasTypesDef = new AtlasTypesDef(); AtlasEntityDef databaseTypeDefinition = - createClassTypeDef("database", ImmutableSet.<String>of(), + createClassTypeDef("database", Collections.<String>emptySet(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), AtlasTypeUtil.createRequiredAttrDef("description", "string")); atlasTypesDef.getEntityDefs().add(databaseTypeDefinition); AtlasEntityDef tableTypeDefinition = - createClassTypeDef("table", ImmutableSet.<String>of(), + createClassTypeDef("table", Collections.<String>emptySet(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), AtlasTypeUtil.createRequiredAttrDef("description", "string"), - AtlasTypeUtil.createOptionalAttrDef("columnNames", DataTypes.arrayTypeName("string")), + AtlasTypeUtil.createOptionalAttrDef("columnNames", AtlasBaseTypeDef.getArrayTypeName("string")), AtlasTypeUtil.createOptionalAttrDef("created", "date"), AtlasTypeUtil.createOptionalAttrDef("parameters", - DataTypes.mapTypeName("string", "string")), + AtlasBaseTypeDef.getMapTypeName("string", "string")), AtlasTypeUtil.createRequiredAttrDef("type", "string"), new AtlasAttributeDef("database", "database", false, @@ -319,7 +319,7 @@ public class TypedefsJerseyResourceIT extends BaseResourceIT { atlasTypesDef.getEntityDefs().add(tableTypeDefinition); AtlasClassificationDef fetlTypeDefinition = AtlasTypeUtil - .createTraitTypeDef("fetl", ImmutableSet.<String>of(), + .createTraitTypeDef("fetl", Collections.<String>emptySet(), AtlasTypeUtil.createRequiredAttrDef("level", "int")); atlasTypesDef.getClassificationDefs().add(fetlTypeDefinition); http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java index 351e5ae..cd876f4 100755 --- a/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/TypesJerseyResourceIT.java @@ -18,23 +18,14 @@ package org.apache.atlas.web.integration; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.sun.jersey.core.util.MultivaluedMapImpl; import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasServiceException; -import org.apache.atlas.typesystem.TypesDef; -import org.apache.atlas.typesystem.json.TypesSerialization; -import org.apache.atlas.typesystem.json.TypesSerialization$; -import org.apache.atlas.typesystem.types.AttributeDefinition; -import org.apache.atlas.typesystem.types.ClassType; +import org.apache.atlas.model.typedef.AtlasBaseTypeDef; +import org.apache.atlas.v1.model.typedef.*; +import org.apache.atlas.type.AtlasType; import org.apache.atlas.typesystem.types.DataTypes; -import org.apache.atlas.typesystem.types.EnumTypeDefinition; -import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition; -import org.apache.atlas.typesystem.types.Multiplicity; -import org.apache.atlas.typesystem.types.StructTypeDefinition; -import org.apache.atlas.typesystem.types.TraitType; -import org.apache.atlas.typesystem.types.utils.TypesUtil; +import org.apache.atlas.v1.typesystem.types.utils.TypesUtil; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; import org.testng.Assert; @@ -44,11 +35,9 @@ import org.testng.annotations.Test; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; -import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef; +import static org.apache.atlas.v1.typesystem.types.utils.TypesUtil.createOptionalAttrDef; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; @@ -76,9 +65,9 @@ public class TypesJerseyResourceIT extends BaseResourceIT { public void testSubmit() throws Exception { for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) { try{ - atlasClientV1.getType(typeDefinition.typeName); + atlasClientV1.getType(typeDefinition.getTypeName()); } catch (AtlasServiceException ase){ - String typesAsJSON = TypesSerialization.toJson(typeDefinition, false); + String typesAsJSON = AtlasType.toV1Json(typeDefinition); System.out.println("typesAsJSON = " + typesAsJSON); JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API_V1.CREATE_TYPE, typesAsJSON); @@ -87,18 +76,18 @@ public class TypesJerseyResourceIT extends BaseResourceIT { JSONArray typesAdded = response.getJSONArray(AtlasClient.TYPES); assertEquals(typesAdded.length(), 1); - assertEquals(typesAdded.getJSONObject(0).getString(NAME), typeDefinition.typeName); + assertEquals(typesAdded.getJSONObject(0).getString(NAME), typeDefinition.getTypeName()); Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));} } } @Test public void testDuplicateSubmit() throws Exception { - HierarchicalTypeDefinition<ClassType> type = TypesUtil.createClassTypeDef(randomString(), - ImmutableSet.<String>of(), TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE)); + ClassTypeDefinition type = TypesUtil.createClassTypeDef(randomString(), null, + Collections.<String>emptySet(), TypesUtil.createUniqueRequiredAttrDef(NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING)); TypesDef typesDef = - TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), - ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.of(type)); + new TypesDef(Collections.<EnumTypeDefinition>emptyList(), Collections.<StructTypeDefinition>emptyList(), + Collections.<TraitTypeDefinition>emptyList(), Collections.singletonList(type)); atlasClientV1.createType(typesDef); try { @@ -111,51 +100,49 @@ public class TypesJerseyResourceIT extends BaseResourceIT { @Test public void testUpdate() throws Exception { - HierarchicalTypeDefinition<ClassType> typeDefinition = TypesUtil - .createClassTypeDef(randomString(), null, "1.0", ImmutableSet.<String>of(), - TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE)); - List<String> typesCreated = atlasClientV1.createType(TypesSerialization.toJson(typeDefinition, false)); + ClassTypeDefinition typeDefinition = TypesUtil + .createClassTypeDef(randomString(), null, "1.0", Collections.<String>emptySet(), + TypesUtil.createUniqueRequiredAttrDef(NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING)); + List<String> typesCreated = atlasClientV1.createType(AtlasType.toV1Json(typeDefinition)); assertEquals(typesCreated.size(), 1); - assertEquals(typesCreated.get(0), typeDefinition.typeName); + assertEquals(typesCreated.get(0), typeDefinition.getTypeName()); //Add attribute description - typeDefinition = TypesUtil.createClassTypeDef(typeDefinition.typeName, null, "2.0", - ImmutableSet.<String>of(), - TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE), - createOptionalAttrDef(DESCRIPTION, DataTypes.STRING_TYPE)); - TypesDef typeDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), - ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), - ImmutableList.of(typeDefinition)); + typeDefinition = TypesUtil.createClassTypeDef(typeDefinition.getTypeName(), null, "2.0", + Collections.<String>emptySet(), + TypesUtil.createUniqueRequiredAttrDef(NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + createOptionalAttrDef(DESCRIPTION, AtlasBaseTypeDef.ATLAS_TYPE_STRING)); + TypesDef typeDef = new TypesDef(Collections.<EnumTypeDefinition>emptyList(), Collections.<StructTypeDefinition>emptyList(), Collections.<TraitTypeDefinition>emptyList(), Collections.singletonList(typeDefinition)); List<String> typesUpdated = atlasClientV1.updateType(typeDef); assertEquals(typesUpdated.size(), 1); - Assert.assertTrue(typesUpdated.contains(typeDefinition.typeName)); + Assert.assertTrue(typesUpdated.contains(typeDefinition.getTypeName())); - TypesDef updatedTypeDef = atlasClientV1.getType(typeDefinition.typeName); + TypesDef updatedTypeDef = atlasClientV1.getType(typeDefinition.getTypeName()); assertNotNull(updatedTypeDef); - HierarchicalTypeDefinition<ClassType> updatedType = updatedTypeDef.classTypesAsJavaList().get(0); - assertEquals(updatedType.attributeDefinitions.length, 2); + ClassTypeDefinition updatedType = updatedTypeDef.getClassTypes().get(0); + assertEquals(updatedType.getAttributeDefinitions().size(), 2); } @Test(dependsOnMethods = "testSubmit") public void testGetDefinition() throws Exception { for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) { - System.out.println("typeName = " + typeDefinition.typeName); + System.out.println("typeName = " + typeDefinition.getTypeName()); - JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.LIST_TYPES, null, typeDefinition.typeName); + JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API_V1.LIST_TYPES, null, typeDefinition.getTypeName()); Assert.assertNotNull(response); Assert.assertNotNull(response.get(AtlasClient.DEFINITION)); Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID)); String typesJson = response.getString(AtlasClient.DEFINITION); - final TypesDef typesDef = TypesSerialization.fromJson(typesJson); - List<HierarchicalTypeDefinition<ClassType>> hierarchicalTypeDefinitions = typesDef.classTypesAsJavaList(); - for (HierarchicalTypeDefinition<ClassType> classType : hierarchicalTypeDefinitions) { - for (AttributeDefinition attrDef : classType.attributeDefinitions) { - if (NAME.equals(attrDef.name)) { - assertEquals(attrDef.isIndexable, true); - assertEquals(attrDef.isUnique, true); + final TypesDef typesDef = AtlasType.fromV1Json(typesJson, TypesDef.class); + List<ClassTypeDefinition> hierarchicalTypeDefinitions = typesDef.getClassTypes(); + for (ClassTypeDefinition classType : hierarchicalTypeDefinitions) { + for (AttributeDefinition attrDef : classType.getAttributeDefinitions()) { + if (NAME.equals(attrDef.getName())) { + assertEquals(attrDef.getIsIndexable(), true); + assertEquals(attrDef.getIsUnique(), true); } } } @@ -202,15 +189,15 @@ public class TypesJerseyResourceIT extends BaseResourceIT { @Test public void testListTypesByFilter() throws Exception { - AttributeDefinition attr = TypesUtil.createOptionalAttrDef("attr", DataTypes.STRING_TYPE); - String a = createType(TypesSerialization.toJson( - TypesUtil.createClassTypeDef("A" + randomString(), ImmutableSet.<String>of(), attr), false)).get(0); - String a1 = createType(TypesSerialization.toJson( - TypesUtil.createClassTypeDef("A1" + randomString(), ImmutableSet.of(a), attr), false)).get(0); - String b = createType(TypesSerialization.toJson( - TypesUtil.createClassTypeDef("B" + randomString(), ImmutableSet.<String>of(), attr), false)).get(0); - String c = createType(TypesSerialization.toJson( - TypesUtil.createClassTypeDef("C" + randomString(), ImmutableSet.of(a, b), attr), false)).get(0); + AttributeDefinition attr = TypesUtil.createOptionalAttrDef("attr", AtlasBaseTypeDef.ATLAS_TYPE_STRING); + String a = createType(AtlasType.toV1Json( + TypesUtil.createClassTypeDef("A" + randomString(), null, Collections.<String>emptySet(), attr))).get(0); + String a1 = createType(AtlasType.toV1Json( + TypesUtil.createClassTypeDef("A1" + randomString(), null, Collections.singleton(a), attr))).get(0); + String b = createType(AtlasType.toV1Json( + TypesUtil.createClassTypeDef("B" + randomString(), null, Collections.<String>emptySet(), attr))).get(0); + String c = createType(AtlasType.toV1Json( + TypesUtil.createClassTypeDef("C" + randomString(), null, new HashSet<>(Arrays.asList(a, b)), attr))).get(0); List<String> results = atlasClientV1.listTypes(DataTypes.TypeCategory.CLASS, a, b); assertEquals(results, Arrays.asList(a1), "Results: " + results); @@ -220,9 +207,9 @@ public class TypesJerseyResourceIT extends BaseResourceIT { String[] traitNames = {"class_trait", "secure_trait", "pii_trait", "ssn_trait", "salary_trait", "sox_trait",}; for (String traitName : traitNames) { - HierarchicalTypeDefinition<TraitType> traitTypeDef = - TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of()); - String json = TypesSerialization$.MODULE$.toJson(traitTypeDef, true); + TraitTypeDefinition traitTypeDef = + TypesUtil.createTraitTypeDef(traitName, null, Collections.<String>emptySet()); + String json = AtlasType.toV1Json(traitTypeDef); createType(json); } @@ -232,29 +219,29 @@ public class TypesJerseyResourceIT extends BaseResourceIT { private List<HierarchicalTypeDefinition> createHiveTypes() throws Exception { ArrayList<HierarchicalTypeDefinition> typeDefinitions = new ArrayList<>(); - HierarchicalTypeDefinition<ClassType> databaseTypeDefinition = TypesUtil - .createClassTypeDef("database", ImmutableSet.<String>of(), - TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE), - TypesUtil.createRequiredAttrDef(DESCRIPTION, DataTypes.STRING_TYPE), - TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, DataTypes.STRING_TYPE)); + ClassTypeDefinition databaseTypeDefinition = TypesUtil + .createClassTypeDef("database", null, Collections.<String>emptySet(), + TypesUtil.createUniqueRequiredAttrDef(NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + TypesUtil.createRequiredAttrDef(DESCRIPTION, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING)); typeDefinitions.add(databaseTypeDefinition); - HierarchicalTypeDefinition<ClassType> tableTypeDefinition = TypesUtil - .createClassTypeDef("table", ImmutableSet.<String>of(), - TypesUtil.createUniqueRequiredAttrDef(NAME, DataTypes.STRING_TYPE), - TypesUtil.createRequiredAttrDef(DESCRIPTION, DataTypes.STRING_TYPE), - TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, DataTypes.STRING_TYPE), - createOptionalAttrDef("columnNames", DataTypes.arrayTypeName(DataTypes.STRING_TYPE)), - createOptionalAttrDef("created", DataTypes.DATE_TYPE), + ClassTypeDefinition tableTypeDefinition = TypesUtil + .createClassTypeDef("table", null, Collections.<String>emptySet(), + TypesUtil.createUniqueRequiredAttrDef(NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + TypesUtil.createRequiredAttrDef(DESCRIPTION, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + TypesUtil.createRequiredAttrDef(QUALIFIED_NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING), + createOptionalAttrDef("columnNames", AtlasBaseTypeDef.getArrayTypeName(AtlasBaseTypeDef.ATLAS_TYPE_STRING)), + createOptionalAttrDef("created", AtlasBaseTypeDef.ATLAS_TYPE_DATE), createOptionalAttrDef("parameters", - DataTypes.mapTypeName(DataTypes.STRING_TYPE, DataTypes.STRING_TYPE)), - TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE), + AtlasBaseTypeDef.getMapTypeName(AtlasBaseTypeDef.ATLAS_TYPE_STRING, AtlasBaseTypeDef.ATLAS_TYPE_STRING)), + TypesUtil.createRequiredAttrDef("type", AtlasBaseTypeDef.ATLAS_TYPE_STRING), new AttributeDefinition("database", "database", Multiplicity.REQUIRED, false, "database")); typeDefinitions.add(tableTypeDefinition); - HierarchicalTypeDefinition<TraitType> fetlTypeDefinition = TypesUtil - .createTraitTypeDef("fetl", ImmutableSet.<String>of(), - TypesUtil.createRequiredAttrDef("level", DataTypes.INT_TYPE)); + TraitTypeDefinition fetlTypeDefinition = TypesUtil + .createTraitTypeDef("fetl", null, Collections.<String>emptySet(), + TypesUtil.createRequiredAttrDef("level", AtlasBaseTypeDef.ATLAS_TYPE_INT)); typeDefinitions.add(fetlTypeDefinition); return typeDefinitions; http://git-wip-us.apache.org/repos/asf/atlas/blob/435fe3fb/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java index 7ad2f76..25f39f2 100644 --- a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java @@ -34,8 +34,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import scala.actors.threadpool.Arrays; +import java.util.Arrays; import java.nio.charset.Charset; import static org.mockito.Mockito.mock;