You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2018/10/04 22:23:36 UTC

atlas git commit: ATLAS-2905: Generate lineage information for process entities #3 fix test

Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 55f8b78fd -> 20525f866


ATLAS-2905: Generate lineage information for process entities #3 fix test


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/20525f86
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/20525f86
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/20525f86

Branch: refs/heads/branch-0.8
Commit: 20525f86675d48ee29f0e4df17d1e4aec2372414
Parents: 55f8b78
Author: Sarath Subramanian <ss...@hortonworks.com>
Authored: Thu Oct 4 14:56:50 2018 -0700
Committer: Sarath Subramanian <ss...@hortonworks.com>
Committed: Thu Oct 4 15:11:03 2018 -0700

----------------------------------------------------------------------
 .../org/apache/atlas/BaseRepositoryTest.java    | 30 ++++++++++++++------
 .../atlas/lineage/EntityLineageServiceTest.java |  4 +--
 2 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/20525f86/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
index 7c6b60b..fc82cf6 100644
--- a/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
+++ b/repository/src/test/java/org/apache/atlas/BaseRepositoryTest.java
@@ -20,9 +20,12 @@ package org.apache.atlas;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.MetadataRepository;
+import org.apache.atlas.repository.converters.TypeConverterUtil;
 import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
 import org.apache.atlas.services.MetadataService;
+import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
@@ -51,6 +54,12 @@ public class BaseRepositoryTest {
     protected MetadataService metadataService;
 
     @Inject
+    protected AtlasTypeRegistry typeRegistry;
+
+    @Inject
+    protected AtlasTypeDefStore typeDefStore;
+
+    @Inject
     protected MetadataRepository repository;
 
 
@@ -71,12 +80,6 @@ public class BaseRepositoryTest {
         TypeSystem.getInstance().reset();
     }
 
-    private void setUpTypes() throws Exception {
-        TypesDef typesDef = createTypeDefinitions();
-        String typesAsJSON = TypesSerialization.toJson(typesDef);
-        metadataService.createType(typesAsJSON);
-    }
-
     protected static final String DATABASE_TYPE = "hive_db";
     protected static final String HIVE_TABLE_TYPE = "hive_table";
     private static final String COLUMN_TYPE = "hive_column";
@@ -389,9 +392,18 @@ public class BaseRepositoryTest {
     }
 
     private void setUpDefaultTypes() throws Exception {
-        TypesDef typesDef = createDefaultTypeDefinitions();
-        String typesAsJSON = TypesSerialization.toJson(typesDef);
-        metadataService.createType(typesAsJSON);
+        createTypesDef(createDefaultTypeDefinitions());
+    }
+
+    private void setUpTypes() throws Exception {
+        createTypesDef(createTypeDefinitions());
+    }
+
+    private void createTypesDef(TypesDef typesDef) throws Exception {
+        String        typesAsJSON   = TypesSerialization.toJson(typesDef);
+        AtlasTypesDef atlasTypesDef = TypeConverterUtil.toAtlasTypesDef(typesAsJSON, typeRegistry);
+
+        typeDefStore.createTypesDef(atlasTypesDef);
     }
 
     TypesDef createDefaultTypeDefinitions() {

http://git-wip-us.apache.org/repos/asf/atlas/blob/20525f86/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
index f3c26bd..33e0992 100644
--- a/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/lineage/EntityLineageServiceTest.java
@@ -216,8 +216,8 @@ public class EntityLineageServiceTest extends BaseRepositoryTest {
                 {" ", null, 0, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
                 {null, null, 0, AtlasErrorCode.TYPE_NAME_NOT_FOUND},
                 {"invalidGuid", LineageDirection.OUTPUT, 6, AtlasErrorCode.INSTANCE_GUID_NOT_FOUND},
-                {entityGuid, null, -10, AtlasErrorCode.TYPE_NAME_NOT_FOUND},
-                {entityGuid, null, 5, AtlasErrorCode.TYPE_NAME_NOT_FOUND}
+                {entityGuid, null, -10, AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS},
+                {entityGuid, null, 5, AtlasErrorCode.INSTANCE_LINEAGE_INVALID_PARAMS}
         };
     }