atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject incubator-atlas git commit: ATLAS-723 JSON deserialization regression (guptaneeru via shwethags)
Date Tue, 03 May 2016 04:34:43 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master c69df40f7 -> 73640cc68


ATLAS-723 JSON deserialization regression (guptaneeru via shwethags)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/73640cc6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/73640cc6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/73640cc6

Branch: refs/heads/master
Commit: 73640cc68a2045fe10a2508fac51701d62629f4f
Parents: c69df40
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Tue May 3 10:04:36 2016 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Tue May 3 10:04:36 2016 +0530

----------------------------------------------------------------------
 release-log.txt                                 |  1 +
 .../typesystem/json/InstanceSerialization.scala |  4 +-
 .../json/InstanceSerializationTest.scala        | 74 ++++++++++++++++++--
 3 files changed, 72 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/73640cc6/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ef74ddd..de16600 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -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)

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/73640cc6/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
----------------------------------------------------------------------
diff --git a/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
b/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
index a8389bd..eae3063 100755
--- a/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
+++ b/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
@@ -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)
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/73640cc6/typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
----------------------------------------------------------------------
diff --git a/typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
b/typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
index 98a9739..f837b6c 100644
--- a/typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
+++ b/typesystem/src/test/scala/org/apache/atlas/typesystem/json/InstanceSerializationTest.scala
@@ -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)


Mime
View raw message