[04/20] atlas git commit: ATLAS-2490: updates to make usage of v1/v2 in class names consistent
http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java -- diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java new file mode 100644 index 000..ebd5f0f --- /dev/null +++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java @@ -0,0 +1,512 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph.v2; + +import org.apache.atlas.TestModules; +import org.apache.atlas.TestUtilsV2; +import org.apache.atlas.model.instance.AtlasEntity; +import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo; +import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo; +import org.apache.atlas.model.instance.AtlasEntityHeader; +import org.apache.atlas.model.instance.AtlasObjectId; +import org.apache.atlas.model.instance.AtlasStruct; +import org.apache.atlas.model.instance.EntityMutationResponse; +import org.apache.atlas.model.typedef.AtlasTypesDef; +import org.apache.atlas.repository.graphdb.AtlasEdge; +import org.apache.atlas.repository.graphdb.AtlasEdgeDirection; +import org.apache.atlas.repository.graphdb.AtlasVertex; +import org.apache.commons.lang.time.DateUtils; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_MAP; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR_DELETE; +import static org.apache.atlas.TestUtilsV2.NAME; +import static org.apache.atlas.repository.graph.GraphHelper.getStatus; +import static org.apache.atlas.type.AtlasTypeUtil.getAtlasObjectId; +import static org.testng.Assert.assertNull; +import static org.testng.AssertJUnit.assertEquals; + +@Guice(modules = TestModules.TestOnlyModule.class) +public class AtlasComplexAttributesTest extends AtlasEntityTestBase { +private AtlasEntityWithExtInfo complexCollectionAttrEntity; +private AtlasEntityWithExtInfo complexCollectionAttrEntityForDelete; +private AtlasEntityWithExtInfo mapAttributesEntity; + +@BeforeClass +public void setUp() throws Exception { +super.setUp(); + +// create typeDefs +AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineTypeWithComplexCollectionAttributes(), + TestUtilsV2.defineTypeWithMapAttributes() }; +createTypesDef(testTypesDefs); + +// create entity +complexCollectionAttrEntity = TestUtilsV2.createComplexCollectionAttrEntity(); +complexCollectionAttrEntityForDelete = TestUtilsV2.createComplexCollectionAttrEntity(); +mapAttributesEntity = TestUtilsV2.createMapAttrEntity(); +} + +@Test +public void testCreateComplexAttributeEntity() throws Exception { +init(); + +EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(complexCollectionAttrEntity), false); +AtlasEntityHeader entityCreated = response.getFirstCreatedEntityByTypeName(ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR); + +validateEntity(complexCollectionAttrEntity, getEntityFromStore(entityCreated)); +} + +@Test +public void testPrimitiveMapAttributes() throws Exception { +init(); + +EntityMutationResponse response= entityStore.createOrUpdate(new AtlasEntityStream(mapAttributesEntity), false); +AtlasEntityHeader entityCreated =
[04/20] atlas git commit: ATLAS-2490: updates to make usage of v1/v2 in class names consistent
http://git-wip-us.apache.org/repos/asf/atlas/blob/3d5b4880/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java -- diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java new file mode 100644 index 000..ebd5f0f --- /dev/null +++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/AtlasComplexAttributesTest.java @@ -0,0 +1,512 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph.v2; + +import org.apache.atlas.TestModules; +import org.apache.atlas.TestUtilsV2; +import org.apache.atlas.model.instance.AtlasEntity; +import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo; +import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo; +import org.apache.atlas.model.instance.AtlasEntityHeader; +import org.apache.atlas.model.instance.AtlasObjectId; +import org.apache.atlas.model.instance.AtlasStruct; +import org.apache.atlas.model.instance.EntityMutationResponse; +import org.apache.atlas.model.typedef.AtlasTypesDef; +import org.apache.atlas.repository.graphdb.AtlasEdge; +import org.apache.atlas.repository.graphdb.AtlasEdgeDirection; +import org.apache.atlas.repository.graphdb.AtlasVertex; +import org.apache.commons.lang.time.DateUtils; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_MAP; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR; +import static org.apache.atlas.TestUtilsV2.ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR_DELETE; +import static org.apache.atlas.TestUtilsV2.NAME; +import static org.apache.atlas.repository.graph.GraphHelper.getStatus; +import static org.apache.atlas.type.AtlasTypeUtil.getAtlasObjectId; +import static org.testng.Assert.assertNull; +import static org.testng.AssertJUnit.assertEquals; + +@Guice(modules = TestModules.TestOnlyModule.class) +public class AtlasComplexAttributesTest extends AtlasEntityTestBase { +private AtlasEntityWithExtInfo complexCollectionAttrEntity; +private AtlasEntityWithExtInfo complexCollectionAttrEntityForDelete; +private AtlasEntityWithExtInfo mapAttributesEntity; + +@BeforeClass +public void setUp() throws Exception { +super.setUp(); + +// create typeDefs +AtlasTypesDef[] testTypesDefs = new AtlasTypesDef[] { TestUtilsV2.defineTypeWithComplexCollectionAttributes(), + TestUtilsV2.defineTypeWithMapAttributes() }; +createTypesDef(testTypesDefs); + +// create entity +complexCollectionAttrEntity = TestUtilsV2.createComplexCollectionAttrEntity(); +complexCollectionAttrEntityForDelete = TestUtilsV2.createComplexCollectionAttrEntity(); +mapAttributesEntity = TestUtilsV2.createMapAttrEntity(); +} + +@Test +public void testCreateComplexAttributeEntity() throws Exception { +init(); + +EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(complexCollectionAttrEntity), false); +AtlasEntityHeader entityCreated = response.getFirstCreatedEntityByTypeName(ENTITY_TYPE_WITH_COMPLEX_COLLECTION_ATTR); + +validateEntity(complexCollectionAttrEntity, getEntityFromStore(entityCreated)); +} + +@Test +public void testPrimitiveMapAttributes() throws Exception { +init(); + +EntityMutationResponse response= entityStore.createOrUpdate(new AtlasEntityStream(mapAttributesEntity), false); +AtlasEntityHeader entityCreated =