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
f87f5f22
Commit
f87f5f22
authored
7 years ago
by
Sarath Subramanian
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1648: Fix HiveHookIT failures
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
d0e9d48b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
8 deletions
+54
-8
HiveHookIT.java
.../src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+2
-1
AtlasBaseTypeDef.java
...java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
+5
-0
AtlasObjectIdConverter.java
...e/atlas/repository/converters/AtlasObjectIdConverter.java
+46
-6
EntityJerseyResourceIT.java
...rg/apache/atlas/web/resources/EntityJerseyResourceIT.java
+1
-1
No files found.
addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
View file @
f87f5f22
...
...
@@ -942,7 +942,8 @@ public class HiveHookIT extends HiveITBase {
private
String
createTrait
(
String
guid
)
throws
AtlasServiceException
,
JSONException
{
//add trait
String
traitName
=
"PII_Trait"
+
RandomStringUtils
.
random
(
10
);
//valid type names in v2 must consist of a letter followed by a sequence of letter, number, or _ characters
String
traitName
=
"PII_Trait"
+
random
();
atlasClient
.
createTraitType
(
traitName
);
Struct
traitInstance
=
new
Struct
(
traitName
);
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
View file @
f87f5f22
...
...
@@ -35,6 +35,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.TimeZone
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
...
...
@@ -110,6 +111,10 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable {
public
static
final
String
SERIALIZED_DATE_FORMAT_STR
=
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
;
public
static
final
DateFormat
DATE_FORMATTER
=
new
SimpleDateFormat
(
SERIALIZED_DATE_FORMAT_STR
);
static
{
DATE_FORMATTER
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
}
private
final
TypeCategory
category
;
private
String
guid
=
null
;
private
String
createdBy
=
null
;
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/converters/AtlasObjectIdConverter.java
View file @
f87f5f22
...
...
@@ -19,6 +19,7 @@ package org.apache.atlas.repository.converters;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasEntity
;
...
...
@@ -27,7 +28,10 @@ import org.apache.atlas.type.AtlasEntityType;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.typesystem.IReferenceableInstance
;
import
org.apache.atlas.typesystem.Referenceable
;
import
org.apache.atlas.typesystem.persistence.Id
;
import
org.apache.atlas.typesystem.persistence.StructInstance
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Map
;
...
...
@@ -50,23 +54,24 @@ AtlasObjectIdConverter extends AtlasAbstractFormatConverter {
if
(
v1Obj
!=
null
)
{
if
(
v1Obj
instanceof
Id
)
{
Id
id
=
(
Id
)
v1Obj
;
ret
=
new
AtlasObjectId
(
id
.
_getId
(),
id
.
getTypeName
());
}
else
if
(
v1Obj
instanceof
IReferenceableInstance
)
{
IReferenceableInstance
refInst
=
(
IReferenceableInstance
)
v1Obj
;
String
guid
=
refInst
.
getId
().
_getId
();
String
guid
=
refInst
.
getId
().
_getId
();
ret
=
new
AtlasObjectId
(
guid
,
refInst
.
getTypeName
());
if
(!
converterContext
.
entityExists
(
guid
))
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
refInst
.
getTypeName
());
AtlasEntityFormatConverter
entityFormatConverter
=
(
AtlasEntityFormatConverter
)
converterRegistry
.
getConverter
(
TypeCategory
.
ENTITY
);
AtlasEntity
entity
=
entityFormatConverter
.
fromV1ToV2
(
v1Obj
,
entityType
,
converterContext
);
if
(!
converterContext
.
entityExists
(
guid
)
&&
hasAnyAssignedAttribute
(
refInst
))
{
AtlasEntityType
entityType
=
typeRegistry
.
getEntityTypeByName
(
refInst
.
getTypeName
());
AtlasEntityFormatConverter
converter
=
(
AtlasEntityFormatConverter
)
converterRegistry
.
getConverter
(
TypeCategory
.
ENTITY
);
AtlasEntity
entity
=
converter
.
fromV1ToV2
(
v1Obj
,
entityType
,
converterContext
);
converterContext
.
addReferredEntity
(
entity
);
}
}
}
return
ret
;
}
...
...
@@ -97,4 +102,39 @@ AtlasObjectIdConverter extends AtlasAbstractFormatConverter {
}
return
ret
;
}
private
boolean
hasAnyAssignedAttribute
(
IReferenceableInstance
rInstance
)
{
boolean
ret
=
false
;
if
(
rInstance
instanceof
StructInstance
)
{
StructInstance
sInstance
=
(
StructInstance
)
rInstance
;
Map
<
String
,
Object
>
attributes
=
null
;
try
{
attributes
=
sInstance
.
getValuesMap
();
}
catch
(
AtlasException
e
)
{
// ignore
}
if
(
MapUtils
.
isNotEmpty
(
attributes
))
{
for
(
String
attrName
:
attributes
.
keySet
())
{
try
{
if
(
sInstance
.
isValueSet
(
attrName
))
{
ret
=
true
;
break
;
}
}
catch
(
AtlasException
e
)
{
// ignore
}
}
}
}
else
if
(
rInstance
instanceof
Referenceable
)
{
Referenceable
referenceable
=
(
Referenceable
)
rInstance
;
ret
=
MapUtils
.
isNotEmpty
(
referenceable
.
getValuesMap
());
}
return
ret
;
}
}
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
View file @
f87f5f22
...
...
@@ -738,7 +738,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
LOG
.
debug
(
"Updating entity= {}"
,
tableUpdated
);
AtlasClient
.
EntityResult
entityResult
=
atlasClientV1
.
updateEntity
(
tableId
.
_getId
(),
tableUpdated
);
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
2
);
assertEquals
(
entityResult
.
getUpdateEntities
().
size
(),
1
);
assertEquals
(
entityResult
.
getUpdateEntities
().
get
(
0
),
tableId
.
_getId
());
JSONObject
response
=
atlasClientV1
.
callAPIWithBodyAndParams
(
AtlasClient
.
API
.
GET_ENTITY
,
null
,
tableId
.
_getId
());
...
...
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