atlas git commit: ATLAS-2969: Attempt to import empty zip file should not throw excpetion

2018-11-15 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/master 40329046a -> b96c6b7a9


ATLAS-2969: Attempt to import empty zip file should not throw excpetion

(cherry picked from commit 4ca33fcbf4e8845c86340622fb28d88e4457dccd)


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

Branch: refs/heads/master
Commit: b96c6b7a9127021c5e3624048bc0d21b0e1e24e3
Parents: 4032904
Author: Sarath Subramanian 
Authored: Thu Nov 15 23:07:33 2018 -0800
Committer: Sarath Subramanian 
Committed: Thu Nov 15 23:35:27 2018 -0800

--
 .../main/java/org/apache/atlas/web/resources/AdminResource.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/b96c6b7a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
--
diff --git 
a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java 
b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 3998932..83dac65 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -410,10 +410,8 @@ public class AdminResource {
 LOG.info(excp.getMessage());
 } else {
 LOG.error("importData(binary) failed", excp);
+throw excp;
 }
-
-throw excp;
-
 } catch (Exception excp) {
 LOG.error("importData(binary) failed", excp);
 



atlas git commit: ATLAS-2969: Attempt to import empty zip file should not throw excpetion

2018-11-15 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 a36b27ae7 -> 4ca33fcbf


ATLAS-2969: Attempt to import empty zip file should not throw excpetion


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

Branch: refs/heads/branch-0.8
Commit: 4ca33fcbf4e8845c86340622fb28d88e4457dccd
Parents: a36b27a
Author: Sarath Subramanian 
Authored: Thu Nov 15 23:07:33 2018 -0800
Committer: Sarath Subramanian 
Committed: Thu Nov 15 23:07:33 2018 -0800

--
 .../main/java/org/apache/atlas/web/resources/AdminResource.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/4ca33fcb/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
--
diff --git 
a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java 
b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index 9069f44..c0a139e 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -400,10 +400,8 @@ public class AdminResource {
 LOG.info(excp.getMessage());
 } else {
 LOG.error("importData(binary) failed", excp);
+throw excp;
 }
-
-throw excp;
-
 } catch (Exception excp) {
 LOG.error("importData(binary) failed", excp);
 



atlas git commit: ATLAS-2965: Duplicate entities are created when when same qualifiedName is given but different guids

2018-11-15 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 daabed131 -> a36b27ae7


ATLAS-2965: Duplicate entities are created when when same qualifiedName is 
given but different guids


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

Branch: refs/heads/branch-0.8
Commit: a36b27ae798d97b5b30238d13b8d63a3652a0260
Parents: daabed1
Author: Sarath Subramanian 
Authored: Thu Nov 15 15:43:29 2018 -0800
Committer: Sarath Subramanian 
Committed: Thu Nov 15 15:43:29 2018 -0800

--
 .../test/java/org/apache/atlas/TestUtilsV2.java | 33 
 .../store/graph/v1/AtlasEntityStoreV1.java  | 29 -
 .../store/graph/v1/EntityGraphMapper.java   | 24 +-
 .../store/graph/v1/AtlasEntityStoreV1Test.java  | 23 ++
 4 files changed, 107 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/a36b27ae/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
--
diff --git a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java 
b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
index 8470054..18f8b25 100755
--- a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+++ b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
@@ -1057,6 +1057,39 @@ public final class TestUtilsV2 {
 return ret;
 }
 
+public static AtlasEntityWithExtInfo 
createTableEntityDuplicatesV2(AtlasEntity dbEntity) {
+AtlasEntity tblEntity = new AtlasEntity(TABLE_TYPE);
+
+tblEntity.setAttribute(NAME, RandomStringUtils.randomAlphanumeric(10));
+tblEntity.setAttribute("description", "random table");
+tblEntity.setAttribute("type", "type");
+tblEntity.setAttribute("tableType", "MANAGED");
+tblEntity.setAttribute("database", 
AtlasTypeUtil.getAtlasObjectId(dbEntity));
+
+AtlasEntity col1 = createColumnEntity(tblEntity);
+col1.setAttribute(NAME, "col1");
+
+AtlasEntity col2 = createColumnEntity(tblEntity);
+col2.setAttribute(NAME, "col1");
+
+AtlasEntity col3 = createColumnEntity(tblEntity);
+col3.setAttribute(NAME, "col1");
+
+// all 3 columns have different guid but same typeName and unique 
attributes
+tblEntity.setAttribute(COLUMNS_ATTR_NAME, 
Arrays.asList(AtlasTypeUtil.getAtlasObjectId(col1),
+
AtlasTypeUtil.getAtlasObjectId(col2),
+
AtlasTypeUtil.getAtlasObjectId(col3)));
+
+AtlasEntityWithExtInfo ret = new AtlasEntityWithExtInfo(tblEntity);
+
+ret.addReferredEntity(dbEntity);
+ret.addReferredEntity(col1);
+ret.addReferredEntity(col2);
+ret.addReferredEntity(col3);
+
+return ret;
+}
+
 public static AtlasEntity createColumnEntity(AtlasEntity tableEntity) {
 return createColumnEntity(tableEntity, "col" + seq.addAndGet(1));
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/a36b27ae/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
index c98c8c4..f578ded 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
@@ -612,10 +612,10 @@ public class AtlasEntityStoreV1 implements 
AtlasEntityStore {
 RequestContextV1requestContext   = RequestContextV1.get();
 
 for (String guid : discoveryContext.getReferencedGuids()) {
-AtlasVertex vertex = 
discoveryContext.getResolvedEntityVertex(guid);
 AtlasEntity entity = entityStream.getByGuid(guid);
 
 if (entity != null) {
+AtlasVertex vertex = getResolvedEntityVertex(discoveryContext, 
entity);
 
 if (vertex != null) {
 // entity would be null if guid is not in the stream but 
referenced by an entity in the stream
@@ -650,6 +650,8 @@ public class AtlasEntityStoreV1 implements AtlasEntityStore 
{
 
 discoveryContext.addResolvedGuid(guid, vertex);
 
+
discoveryContext.addResolvedIdByUniqAttribs(getAtlasObjectId(entity), vertex);
+
 String generatedGuid = 

atlas git commit: ATLAS-2965: Duplicate entities are created when when same qualifiedName is given but different guids

2018-11-15 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 7869c9a5f -> d3aaef05f


ATLAS-2965: Duplicate entities are created when when same qualifiedName is 
given but different guids

(cherry picked from commit 40329046a1d67059409c02396d696153bb2de653)


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

Branch: refs/heads/branch-1.0
Commit: d3aaef05fa4fdae5e1a5dda4ac8cb6a40748f4c3
Parents: 7869c9a
Author: Sarath Subramanian 
Authored: Thu Nov 15 15:42:19 2018 -0800
Committer: Sarath Subramanian 
Committed: Thu Nov 15 15:42:57 2018 -0800

--
 .../test/java/org/apache/atlas/TestUtilsV2.java | 33 
 .../store/graph/v2/AtlasEntityStoreV2.java  | 33 +++-
 .../store/graph/v2/EntityGraphRetriever.java| 21 +
 .../graph/v2/AtlasComplexAttributesTest.java| 21 ++---
 .../store/graph/v2/AtlasEntityStoreV2Test.java  | 21 +
 5 files changed, 124 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/d3aaef05/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
--
diff --git a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java 
b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
index 4e9a651..093105b 100755
--- a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+++ b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
@@ -1256,6 +1256,39 @@ public final class TestUtilsV2 {
 return newtestEntityDef;
 }
 
+public static AtlasEntityWithExtInfo 
createTableEntityDuplicatesV2(AtlasEntity dbEntity) {
+AtlasEntity tblEntity = new AtlasEntity(TABLE_TYPE);
+
+tblEntity.setAttribute(NAME, RandomStringUtils.randomAlphanumeric(10));
+tblEntity.setAttribute("description", "random table");
+tblEntity.setAttribute("type", "type");
+tblEntity.setAttribute("tableType", "MANAGED");
+tblEntity.setAttribute("database", 
AtlasTypeUtil.getAtlasObjectId(dbEntity));
+
+AtlasEntity col1 = createColumnEntity(tblEntity);
+col1.setAttribute(NAME, "col1");
+
+AtlasEntity col2 = createColumnEntity(tblEntity);
+col2.setAttribute(NAME, "col1");
+
+AtlasEntity col3 = createColumnEntity(tblEntity);
+col3.setAttribute(NAME, "col1");
+
+// all 3 columns have different guid but same typeName and unique 
attributes
+tblEntity.setAttribute(COLUMNS_ATTR_NAME, 
Arrays.asList(AtlasTypeUtil.getAtlasObjectId(col1),
+AtlasTypeUtil.getAtlasObjectId(col2),
+AtlasTypeUtil.getAtlasObjectId(col3)));
+
+AtlasEntityWithExtInfo ret = new AtlasEntityWithExtInfo(tblEntity);
+
+ret.addReferredEntity(dbEntity);
+ret.addReferredEntity(col1);
+ret.addReferredEntity(col2);
+ret.addReferredEntity(col3);
+
+return ret;
+}
+
 public static AtlasEntity createColumnEntity(AtlasEntity tableEntity) {
 return createColumnEntity(tableEntity, "col" + seq.addAndGet(1));
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/d3aaef05/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
index ee8de1f..6ee0279 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
@@ -742,10 +742,11 @@ public class AtlasEntityStoreV2 implements 
AtlasEntityStore {
 RequestContext  requestContext   = RequestContext.get();
 
 for (String guid : discoveryContext.getReferencedGuids()) {
-AtlasVertex vertex = 
discoveryContext.getResolvedEntityVertex(guid);
 AtlasEntity entity = entityStream.getByGuid(guid);
 
 if (entity != null) { // entity would be null if guid is not in 
the stream but referenced by an entity in the stream
+AtlasVertex vertex = getResolvedEntityVertex(discoveryContext, 
entity);
+
 if (vertex != null) {
 if (!isPartialUpdate) {
 graphDiscoverer.validateAndNormalize(entity);
@@ -779,6 +780,8 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore 
{
 
 discoveryContext.addResolvedGuid(guid, vertex);
 
+

atlas git commit: ATLAS-2965: Duplicate entities are created when when same qualifiedName is given but different guids

2018-11-15 Thread sarath
Repository: atlas
Updated Branches:
  refs/heads/master d003ddb33 -> 40329046a


ATLAS-2965: Duplicate entities are created when when same qualifiedName is 
given but different guids


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

Branch: refs/heads/master
Commit: 40329046a1d67059409c02396d696153bb2de653
Parents: d003ddb
Author: Sarath Subramanian 
Authored: Thu Nov 15 15:42:19 2018 -0800
Committer: Sarath Subramanian 
Committed: Thu Nov 15 15:42:19 2018 -0800

--
 .../test/java/org/apache/atlas/TestUtilsV2.java | 33 
 .../store/graph/v2/AtlasEntityStoreV2.java  | 33 +++-
 .../store/graph/v2/EntityGraphRetriever.java| 21 +
 .../graph/v2/AtlasComplexAttributesTest.java| 21 ++---
 .../store/graph/v2/AtlasEntityStoreV2Test.java  | 21 +
 5 files changed, 124 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/40329046/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
--
diff --git a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java 
b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
index 4e9a651..093105b 100755
--- a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+++ b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
@@ -1256,6 +1256,39 @@ public final class TestUtilsV2 {
 return newtestEntityDef;
 }
 
+public static AtlasEntityWithExtInfo 
createTableEntityDuplicatesV2(AtlasEntity dbEntity) {
+AtlasEntity tblEntity = new AtlasEntity(TABLE_TYPE);
+
+tblEntity.setAttribute(NAME, RandomStringUtils.randomAlphanumeric(10));
+tblEntity.setAttribute("description", "random table");
+tblEntity.setAttribute("type", "type");
+tblEntity.setAttribute("tableType", "MANAGED");
+tblEntity.setAttribute("database", 
AtlasTypeUtil.getAtlasObjectId(dbEntity));
+
+AtlasEntity col1 = createColumnEntity(tblEntity);
+col1.setAttribute(NAME, "col1");
+
+AtlasEntity col2 = createColumnEntity(tblEntity);
+col2.setAttribute(NAME, "col1");
+
+AtlasEntity col3 = createColumnEntity(tblEntity);
+col3.setAttribute(NAME, "col1");
+
+// all 3 columns have different guid but same typeName and unique 
attributes
+tblEntity.setAttribute(COLUMNS_ATTR_NAME, 
Arrays.asList(AtlasTypeUtil.getAtlasObjectId(col1),
+AtlasTypeUtil.getAtlasObjectId(col2),
+AtlasTypeUtil.getAtlasObjectId(col3)));
+
+AtlasEntityWithExtInfo ret = new AtlasEntityWithExtInfo(tblEntity);
+
+ret.addReferredEntity(dbEntity);
+ret.addReferredEntity(col1);
+ret.addReferredEntity(col2);
+ret.addReferredEntity(col3);
+
+return ret;
+}
+
 public static AtlasEntity createColumnEntity(AtlasEntity tableEntity) {
 return createColumnEntity(tableEntity, "col" + seq.addAndGet(1));
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/40329046/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
index ee8de1f..6ee0279 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
@@ -742,10 +742,11 @@ public class AtlasEntityStoreV2 implements 
AtlasEntityStore {
 RequestContext  requestContext   = RequestContext.get();
 
 for (String guid : discoveryContext.getReferencedGuids()) {
-AtlasVertex vertex = 
discoveryContext.getResolvedEntityVertex(guid);
 AtlasEntity entity = entityStream.getByGuid(guid);
 
 if (entity != null) { // entity would be null if guid is not in 
the stream but referenced by an entity in the stream
+AtlasVertex vertex = getResolvedEntityVertex(discoveryContext, 
entity);
+
 if (vertex != null) {
 if (!isPartialUpdate) {
 graphDiscoverer.validateAndNormalize(entity);
@@ -779,6 +780,8 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore 
{
 
 discoveryContext.addResolvedGuid(guid, vertex);
 
+
discoveryContext.addResolvedIdByUniqAttribs(getAtlasObjectId(entity), vertex);
+