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
73640cc6
Commit
73640cc6
authored
May 03, 2016
by
Shwetha GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-723 JSON deserialization regression (guptaneeru via shwethags)
parent
c69df40f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
7 deletions
+72
-7
release-log.txt
release-log.txt
+1
-0
InstanceSerialization.scala
.../apache/atlas/typesystem/json/InstanceSerialization.scala
+2
-2
InstanceSerializationTest.scala
...che/atlas/typesystem/json/InstanceSerializationTest.scala
+69
-5
No files found.
release-log.txt
View file @
73640cc6
...
...
@@ -18,6 +18,7 @@ ATLAS-409 Atlas will not import avro tables with schema read from a file (dosset
ATLAS-379 Create sqoop and falcon metadata addons (venkatnrangan,bvellanki,sowmyaramesh via shwethags)
ALL CHANGES:
ATLAS-723 JSON deserialization regression (guptaneeru via shwethags)
ATLAS-728 Fix few typos in committer email IDs (yhemanth)
ATLAS-435 Add ORDER BY and Limit to search DSL (neerugupta via sumasai)
ATLAS-543 Entity Instance requests should not require ID element for new Entities (harishjp via shwethags)
...
...
typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
View file @
73640cc6
...
...
@@ -104,9 +104,9 @@ object InstanceSerialization {
refClass
<-
idClass
typNm
<-
typeName
i
<-
id
s
<-
state
s
<-
Some
(
state
)
v
<-
version
}
yield
_Id
(
i
,
v
,
typNm
,
Some
(
s
)
)
}
yield
_Id
(
i
,
v
,
typNm
,
s
)
}
/**
...
...
typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
View file @
73640cc6
...
...
@@ -18,14 +18,20 @@
package
org.apache.atlas.typesystem.json
import
com.google.common.collect.ImmutableSet
import
scala.util.Random
import
org.apache.atlas.typesystem.Referenceable
import
org.apache.atlas.typesystem.types.
{
DataTypes
,
TypeSystem
}
import
org.apache.atlas.typesystem.persistence.Id
import
org.apache.atlas.typesystem.types.DataTypes
import
org.apache.atlas.typesystem.types.TypeSystem
import
org.apache.atlas.typesystem.types.utils.TypesUtil
import
org.testng.Assert._
import
org.testng.annotations.
{
BeforeClass
,
Test
}
import
org.testng.Assert.assertEquals
import
org.testng.Assert.assertNotNull
import
org.testng.Assert.assertTrue
import
org.testng.annotations.BeforeClass
import
org.testng.annotations.Test
import
scala.util.Random
import
com.google.common.collect.ImmutableSet
class
InstanceSerializationTest
{
private
var
typeName
:
String
=
null
...
...
@@ -46,6 +52,64 @@ class InstanceSerializationTest {
assertEquals
(
entity2
.
getTraits
,
entity
.
getTraits
,
"Traits mismatch"
)
}
@Test
def
testReferenceArrayWithNoState
{
val
staticJson
=
"""{
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference",
"id": {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
"version": 0,
"typeName": "LoadProcess"
},
"typeName": "LoadProcess",
"values": {
"inputTables": [{
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
"id": "bacfa996-e88e-4d7e-9630-68c9829b10b4",
"version": 0,
"typeName": "Table"
}, {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
"id": "6da06805-3f56-446f-8831-672a65ac2199",
"version": 0,
"typeName": "Table"
}
],
"outputTable": {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id",
"id": "d5c3d6d0-aa10-44c1-b05d-ed9400d2a5ac",
"version": 0,
"typeName": "Table"
},
"name": "loadSalesDaily"
},
"traitNames": [
"ETL"
],
"traits": {
"ETL": {
"jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Struct",
"typeName": "ETL",
"values": {
}
}
}
}
"""
;
val
entity
:
Referenceable
=
InstanceSerialization
.
fromJsonReferenceable
(
staticJson
,
true
)
val
outputTable
=
entity
.
getValuesMap
.
get
(
"outputTable"
)
val
inputTables
:
java.util.List
[
_
]
=
entity
.
getValuesMap
().
get
(
"inputTables"
).
asInstanceOf
[
java.util.List
[
_
]]
assertTrue
(
outputTable
.
isInstanceOf
[
Id
]);
import
scala.collection.JavaConversions._
for
(
inputTable
<-
inputTables
)
{
assertTrue
(
inputTable
.
isInstanceOf
[
Id
]);
}
}
@Test
def
testMissingStateInId
:
Unit
=
{
val
entity
:
Referenceable
=
new
Referenceable
(
typeName
)
val
json
:
String
=
InstanceSerialization
.
toJson
(
entity
,
true
)
...
...
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