Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
8a3795b8
Commit
8a3795b8
authored
Apr 16, 2018
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2560: Addresses relationship handling during import.
Signed-off-by:
Ashutosh Mestry
<
amestry@hortonworks.com
>
parent
19abdf68
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
EntityGraphMapper.java
...he/atlas/repository/store/graph/v1/EntityGraphMapper.java
+8
-2
ImportServiceTest.java
...org/apache/atlas/repository/impexp/ImportServiceTest.java
+14
-1
rel-lineage.zip
repository/src/test/resources/rel-lineage.zip
+0
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java
View file @
8a3795b8
...
...
@@ -695,6 +695,10 @@ public class EntityGraphMapper {
}
if
(
attributeVertex
==
null
)
{
if
(
context
.
isImport
())
{
return
null
;
}
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_OBJECT_ID
,
(
ctx
.
getValue
()
==
null
?
null
:
ctx
.
getValue
().
toString
()));
}
...
...
@@ -733,7 +737,7 @@ public class EntityGraphMapper {
// for import use the relationship guid provided
if
(
context
.
isImport
())
{
AtlasGraphUtilsV1
.
setProperty
(
ret
,
Constants
.
GUID_PROPERTY_KEY
,
getRelationshipGuid
(
ctx
.
getValue
()));
AtlasGraphUtilsV1
.
setProperty
(
ret
,
Constants
.
RELATIONSHIP_
GUID_PROPERTY_KEY
,
getRelationshipGuid
(
ctx
.
getValue
()));
}
// if relationship did not exist before and new relationship was created
...
...
@@ -869,16 +873,18 @@ public class EntityGraphMapper {
Object
newEntry
=
mapCollectionElementsToVertex
(
arrCtx
,
context
);
if
(
isReference
&&
newEntry
instanceof
AtlasEdge
&&
inverseRefAttribute
!=
null
)
{
if
(
isReference
&&
newEntry
!=
null
&&
newEntry
instanceof
AtlasEdge
&&
inverseRefAttribute
!=
null
)
{
// Update the inverse reference value.
AtlasEdge
newEdge
=
(
AtlasEdge
)
newEntry
;
addInverseReference
(
inverseRefAttribute
,
newEdge
,
getRelationshipAttributes
(
ctx
.
getValue
()));
}
if
(
newEntry
!=
null
)
{
newElementsCreated
.
add
(
newEntry
);
}
}
}
if
(
isReference
)
{
List
<
AtlasEdge
>
additionalEdges
=
removeUnusedArrayEntries
(
attribute
,
(
List
)
currentElements
,
(
List
)
newElementsCreated
,
ctx
.
getReferringVertex
());
...
...
repository/src/test/java/org/apache/atlas/repository/impexp/ImportServiceTest.java
View file @
8a3795b8
...
...
@@ -202,8 +202,21 @@ public class ImportServiceTest {
}
}
@DataProvider
(
name
=
"relationship"
)
@DataProvider
(
name
=
"relationship
Lineage
"
)
public
static
Object
[][]
getImportWithRelationships
(
ITestContext
context
)
throws
IOException
{
return
getZipSource
(
"rel-lineage.zip"
);
}
@Test
(
dataProvider
=
"relationshipLineage"
)
public
void
importDB8
(
ZipSource
zipSource
)
throws
AtlasBaseException
,
IOException
{
loadBaseModel
();
loadHiveModel
();
AtlasImportRequest
request
=
getDefaultImportRequest
();
runImportWithParameters
(
importService
,
request
,
zipSource
);
}
@DataProvider
(
name
=
"relationship"
)
public
static
Object
[][]
getImportWithRelationshipsWithLineage
(
ITestContext
context
)
throws
IOException
{
return
getZipSource
(
"stocks-rel-2.zip"
);
}
...
...
repository/src/test/resources/rel-lineage.zip
0 → 100644
View file @
8a3795b8
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment