Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0625D200CDA for ; Fri, 21 Jul 2017 04:20:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 04C4616C7C9; Fri, 21 Jul 2017 02:20:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 24DB916C7C3 for ; Fri, 21 Jul 2017 04:20:12 +0200 (CEST) Received: (qmail 5595 invoked by uid 500); 21 Jul 2017 02:20:12 -0000 Mailing-List: contact commits-help@atlas.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.apache.org Delivered-To: mailing list commits@atlas.apache.org Received: (qmail 5584 invoked by uid 99); 21 Jul 2017 02:20:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2017 02:20:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B4869C3735 for ; Fri, 21 Jul 2017 02:20:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.779 X-Spam-Level: X-Spam-Status: No, score=0.779 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id u0Ih7A0ZIlNU for ; Fri, 21 Jul 2017 02:20:04 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 699AF60D56 for ; Fri, 21 Jul 2017 02:20:03 +0000 (UTC) Received: (qmail 4872 invoked by uid 99); 21 Jul 2017 02:20:02 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2017 02:20:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DBB78DFC27; Fri, 21 Jul 2017 02:20:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.incubator.apache.org Message-Id: <58f254f59ea04f118cd5732aaac1c732@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-atlas git commit: ATLAS-1979: Update storm model relationship category and fix for UT and Coverity scan issues Date: Fri, 21 Jul 2017 02:20:01 +0000 (UTC) archived-at: Fri, 21 Jul 2017 02:20:14 -0000 Repository: incubator-atlas Updated Branches: refs/heads/master e0fb7dc17 -> 13ba156f1 ATLAS-1979: Update storm model relationship category and fix for UT and Coverity scan issues Signed-off-by: Madhan Neethiraj Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/13ba156f Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/13ba156f Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/13ba156f Branch: refs/heads/master Commit: 13ba156f1d76caaa969e2f6fd93e2387307ae7c7 Parents: e0fb7dc Author: Sarath Subramanian Authored: Thu Jul 20 14:12:54 2017 -0700 Committer: Madhan Neethiraj Committed: Thu Jul 20 19:03:40 2017 -0700 ---------------------------------------------------------------------- addons/models/0080-storm_model.json | 2 +- .../repository/store/graph/v1/EntityGraphMapper.java | 9 +++++++-- .../graph/ReverseReferenceUpdateSoftDeleteTest.java | 1 + .../store/graph/v1/AtlasRelationshipStoreV1Test.java | 10 +++++++--- 4 files changed, 16 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/13ba156f/addons/models/0080-storm_model.json ---------------------------------------------------------------------- diff --git a/addons/models/0080-storm_model.json b/addons/models/0080-storm_model.json index b008c7a..ab3d603 100644 --- a/addons/models/0080-storm_model.json +++ b/addons/models/0080-storm_model.json @@ -147,7 +147,7 @@ { "name": "storm_topology_nodes", "typeVersion": "1.0", - "relationshipCategory": "ASSOCIATION", + "relationshipCategory": "AGGREGATION", "endDef1": { "type": "storm_topology", "name": "nodes", http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/13ba156f/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java index 1282be5..b8fd70e 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java @@ -1075,7 +1075,7 @@ public class EntityGraphMapper { String newEntityId = getIdFromVertex(newEntityVertex); AtlasEdge ret = currentEdge; - if (!currentEntityId.equals(newEntityId) && newEntityVertex != null) { + if (!currentEntityId.equals(newEntityId)) { // create a new relationship edge to the new attribute vertex from the instance String relationshipName = AtlasGraphUtilsV1.getTypeName(currentEdge); @@ -1230,6 +1230,11 @@ public class EntityGraphMapper { // get the classification vertex from entity String relationshipLabel = GraphHelper.getTraitLabel(entityTypeName, classification.getTypeName()); AtlasEdge classificationEdge = graphHelper.getEdgeForLabel(instanceVertex, relationshipLabel); + + if (classificationEdge == null) { + throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "classificationEdge is null for label: " + relationshipLabel); + } + AtlasVertex classificationVertex = classificationEdge.getInVertex(); if (LOG.isDebugEnabled()) { @@ -1363,7 +1368,7 @@ public class EntityGraphMapper { private boolean objectIdsContain(Collection objectIds, AtlasObjectId objectId) { boolean ret = false; - if (objectIds != null && objectIds.isEmpty()) { + if (CollectionUtils.isEmpty(objectIds)) { ret = false; } else { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/13ba156f/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java ---------------------------------------------------------------------- diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java index c5eda37..ce43bdc 100644 --- a/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java +++ b/repository/src/test/java/org/apache/atlas/repository/graph/ReverseReferenceUpdateSoftDeleteTest.java @@ -48,6 +48,7 @@ public class ReverseReferenceUpdateSoftDeleteTest extends ReverseReferenceUpdate AtlasVertex vertexForGUID = GraphHelper.getInstance().getVertexForGUID(referencingInstance.getId()._getId()); String edgeLabel = GraphHelper.getEdgeLabel(typeB, typeB.fieldMapping.fields.get("a")); AtlasEdge edgeForLabel = GraphHelper.getInstance().getEdgeForLabel(vertexForGUID, edgeLabel); + Assert.assertNotNull(edgeForLabel); String edgeState = edgeForLabel.getProperty(Constants.STATE_PROPERTY_KEY, String.class); Assert.assertEquals(edgeState, Id.EntityState.DELETED.name()); } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/13ba156f/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1Test.java ---------------------------------------------------------------------- diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1Test.java index 31efe86..3ebda0d 100644 --- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1Test.java +++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipStoreV1Test.java @@ -169,7 +169,7 @@ public abstract class AtlasRelationshipStoreV1Test { assertObjectIdEquals(johnMentorId, maxId); List johnMenteesId = toAtlasObjectIds(john.getRelationshipAttribute("mentees")); - assertNull(johnMenteesId); + assertEmpty(johnMenteesId); // Jane Manager validation AtlasObjectId janeDepartmentId = toAtlasObjectId(jane.getRelationshipAttribute("department")); @@ -183,7 +183,7 @@ public abstract class AtlasRelationshipStoreV1Test { assertNull(janeMentorId); List janeMenteesId = toAtlasObjectIds(jane.getRelationshipAttribute("mentees")); - assertNull(janeMenteesId); + assertEmpty(janeMenteesId); List janeSubordinateIds = toAtlasObjectIds(jane.getRelationshipAttribute("subordinates")); assertNotNull(janeSubordinateIds); @@ -208,7 +208,7 @@ public abstract class AtlasRelationshipStoreV1Test { assertObjectIdsContains(juliusMenteesId, maxId); List juliusSubordinateIds = toAtlasObjectIds(julius.getRelationshipAttribute("subordinates")); - assertNull(juliusSubordinateIds); + assertEmpty(juliusSubordinateIds); } @Test @@ -444,6 +444,10 @@ public abstract class AtlasRelationshipStoreV1Test { assertTrue(objId1.equals(objId2)); } + private static void assertEmpty(List collection) { + assertTrue(collection != null && collection.isEmpty()); + } + private static List toAtlasObjectIds(Object objectIds) { if (objectIds instanceof List) { return (List) objectIds;