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
214c1572
Commit
214c1572
authored
8 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1603: fix to handle null value for object_id type attributes (#2 - fix unit test failure)
parent
88ca02c6
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
TestUtilsV2.java
intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+5
-1
AtlasEntityStoreV1Test.java
...las/repository/store/graph/v1/AtlasEntityStoreV1Test.java
+18
-7
No files found.
intg/src/test/java/org/apache/atlas/TestUtilsV2.java
View file @
214c1572
...
@@ -743,7 +743,11 @@ public final class TestUtilsV2 {
...
@@ -743,7 +743,11 @@ public final class TestUtilsV2 {
new
AtlasAttributeDef
(
"databaseComposite"
,
DATABASE_TYPE
,
true
,
new
AtlasAttributeDef
(
"databaseComposite"
,
DATABASE_TYPE
,
true
,
AtlasAttributeDef
.
Cardinality
.
SINGLE
,
0
,
1
,
AtlasAttributeDef
.
Cardinality
.
SINGLE
,
0
,
1
,
false
,
false
,
false
,
false
,
Collections
.<
AtlasConstraintDef
>
emptyList
()));
new
ArrayList
<
AtlasStructDef
.
AtlasConstraintDef
>()
{{
add
(
new
AtlasStructDef
.
AtlasConstraintDef
(
AtlasConstraintDef
.
CONSTRAINT_TYPE_OWNED_REF
));
}}
));
AtlasClassificationDef
piiTypeDefinition
=
AtlasClassificationDef
piiTypeDefinition
=
AtlasTypeUtil
.
createTraitTypeDef
(
PII
,
PII
+
_description
,
ImmutableSet
.<
String
>
of
());
AtlasTypeUtil
.
createTraitTypeDef
(
PII
,
PII
+
_description
,
ImmutableSet
.<
String
>
of
());
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
View file @
214c1572
...
@@ -75,7 +75,6 @@ import static org.apache.atlas.TestUtils.randomString;
...
@@ -75,7 +75,6 @@ import static org.apache.atlas.TestUtils.randomString;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
TABLE_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
TABLE_TYPE
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
static
org
.
testng
.
Assert
.
assertNull
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
@Guice
(
modules
=
RepositoryMetadataModule
.
class
)
...
@@ -814,22 +813,30 @@ public class AtlasEntityStoreV1Test {
...
@@ -814,22 +813,30 @@ public class AtlasEntityStoreV1Test {
@Test
@Test
public
void
testSetObjectIdAttrToNull
()
throws
Exception
{
public
void
testSetObjectIdAttrToNull
()
throws
Exception
{
final
AtlasEntity
dbEntity
=
TestUtilsV2
.
createDBEntity
();
final
AtlasEntity
dbEntity
=
TestUtilsV2
.
createDBEntity
();
EntityMutationResponse
dbCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
dbEntity
),
false
);
final
AtlasEntity
db2Entity
=
TestUtilsV2
.
createDBEntity
();
final
AtlasEntity
tableEntity
=
TestUtilsV2
.
createTableEntity
(
dbEntity
);
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
dbEntity
),
false
);
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
db2Entity
),
false
);
final
AtlasEntity
tableEntity
=
TestUtilsV2
.
createTableEntity
(
dbEntity
);
tableEntity
.
setAttribute
(
"databaseComposite"
,
AtlasTypeUtil
.
getAtlasObjectId
(
db2Entity
));
final
EntityMutationResponse
tblCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
tableEntity
),
false
);
final
EntityMutationResponse
tblCreationResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
tableEntity
),
false
);
final
AtlasEntityHeader
createdTblHeader
=
tblCreationResponse
.
getCreatedEntityByTypeNameAndAttribute
(
TABLE_TYPE
,
NAME
,
(
String
)
tableEntity
.
getAttribute
(
NAME
));
final
AtlasEntityHeader
createdTblHeader
=
tblCreationResponse
.
getCreatedEntityByTypeNameAndAttribute
(
TABLE_TYPE
,
NAME
,
(
String
)
tableEntity
.
getAttribute
(
NAME
));
final
AtlasEntity
createdTblEntity
=
getEntityFromStore
(
createdTblHeader
);
final
AtlasEntity
createdTblEntity
=
getEntityFromStore
(
createdTblHeader
);
init
();
init
();
createdTblEntity
.
setAttribute
(
"database"
,
null
);
createdTblEntity
.
setAttribute
(
"database
Composite
"
,
null
);
final
EntityMutationResponse
tblUpdateResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
createdTblEntity
),
true
);
final
EntityMutationResponse
tblUpdateResponse
=
entityStore
.
createOrUpdate
(
new
AtlasEntityStream
(
createdTblEntity
),
true
);
final
AtlasEntityHeader
updatedTblHeader
=
tblUpdateResponse
.
getFirstEntityPartialUpdated
();
final
AtlasEntityHeader
updatedTblHeader
=
tblUpdateResponse
.
getFirstEntityPartialUpdated
();
final
AtlasEntity
updatedTblEntity
=
getEntityFromStore
(
updatedTblHeader
);
final
AtlasEntity
updatedTblEntity
=
getEntityFromStore
(
updatedTblHeader
);
final
AtlasEntity
deletedDb2Entity
=
getEntityFromStore
(
db2Entity
.
getGuid
());
assert
Null
(
updatedTblEntity
.
getAttribute
(
"database"
)
);
assert
Equals
(
deletedDb2Entity
.
getStatus
(),
AtlasEntity
.
Status
.
DELETED
);
}
}
private
String
randomStrWithReservedChars
()
{
private
String
randomStrWithReservedChars
()
{
...
@@ -925,7 +932,11 @@ public class AtlasEntityStoreV1Test {
...
@@ -925,7 +932,11 @@ public class AtlasEntityStoreV1Test {
}
}
private
AtlasEntity
getEntityFromStore
(
AtlasEntityHeader
header
)
throws
AtlasBaseException
{
private
AtlasEntity
getEntityFromStore
(
AtlasEntityHeader
header
)
throws
AtlasBaseException
{
AtlasEntityWithExtInfo
entity
=
header
!=
null
?
entityStore
.
getById
(
header
.
getGuid
())
:
null
;
return
header
!=
null
?
getEntityFromStore
(
header
.
getGuid
())
:
null
;
}
private
AtlasEntity
getEntityFromStore
(
String
guid
)
throws
AtlasBaseException
{
AtlasEntityWithExtInfo
entity
=
guid
!=
null
?
entityStore
.
getById
(
guid
)
:
null
;
return
entity
!=
null
?
entity
.
getEntity
()
:
null
;
return
entity
!=
null
?
entity
.
getEntity
()
:
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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