apex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hsy...@apache.org
Subject incubator-apex-core git commit: APEXCORE-461: Fixed hiding of overridden ports. Refactored unit test.
Date Thu, 26 May 2016 17:24:18 GMT
Repository: incubator-apex-core
Updated Branches:
  refs/heads/master 8f0d31544 -> 19733c057


APEXCORE-461: Fixed hiding of overridden ports. Refactored unit test.


Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/19733c05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/19733c05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/19733c05

Branch: refs/heads/master
Commit: 19733c05761b9cc5af3985bb7810ad6d1033ce22
Parents: 8f0d315
Author: bhupesh <bhupeshchawda@gmail.com>
Authored: Tue May 24 14:55:37 2016 -0700
Committer: bhupesh <bhupeshchawda@gmail.com>
Committed: Wed May 25 18:29:45 2016 -0700

----------------------------------------------------------------------
 .../java/com/datatorrent/stram/webapp/TypeGraph.java  | 14 ++++++++++++--
 .../stram/webapp/OperatorDiscoveryTest.java           |  8 ++++----
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/19733c05/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java b/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
index e50cb77..434943d 100644
--- a/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
+++ b/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
@@ -817,7 +817,7 @@ public class TypeGraph
       for (CompactFieldNode field : fields) {
         TypeGraphVertex fieldVertex = typeGraph.get(field.getDescription());
 
-        if (isAncestor(portVertex, fieldVertex)) {
+        if (isAncestor(portVertex, fieldVertex) && !isNodeInList(ports, field)) {
           ports.add(field);
         }
       }
@@ -827,6 +827,16 @@ public class TypeGraph
     }
   }
 
+  private static boolean isNodeInList(List<CompactFieldNode> list, CompactFieldNode
vertex)
+  {
+    for (CompactFieldNode node: list) {
+      if (node.getName().equals(vertex.getName())) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private void addClassPropertiesAndPorts(String clazzName, JSONObject desc) throws JSONException
   {
     TypeGraphVertex tgv = typeGraph.get(clazzName);
@@ -948,7 +958,7 @@ public class TypeGraph
     if (fields != null) {
       for (CompactFieldNode field : fields) {
         TypeGraphVertex fieldVertex = typeGraph.get(field.getDescription());
-        if (isAncestor(portVertex, fieldVertex)) {
+        if (isAncestor(portVertex, fieldVertex) && !isNodeInList(ports, field)) {
           ports.add(field);
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/19733c05/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
b/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
index 1c915ef..1a81719 100644
--- a/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
+++ b/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
@@ -164,7 +164,7 @@ public class OperatorDiscoveryTest
 
   public static class SubSubClassGeneric<T extends Long> extends SubClassGeneric<T>
   {
-
+    public final transient DefaultOutputPort<T> output1 = new DefaultOutputPort<>();
   }
 
   public static class CircleType<E extends Comparator<E>>
@@ -241,11 +241,11 @@ public class OperatorDiscoveryTest
 
     // Validate port types
     JSONObject portType = (JSONObject)portTypes.get(0);
-    Assert.assertEquals(portType.get("name"), "input");
+    Assert.assertEquals(portType.get("name"), "output1");
     Assert.assertEquals(portType.get("typeLiteral"), "T");
     Assert.assertEquals(portType.get("type"), "long");
 
-    portType = (JSONObject)portTypes.get(2);
+    portType = (JSONObject)portTypes.get(3);
     Assert.assertEquals(portType.get("name"), "input2");
     Assert.assertEquals(portType.get("type"), "java.util.Map");
     JSONArray typeArgs = portType.getJSONArray("typeArgs");
@@ -261,7 +261,7 @@ public class OperatorDiscoveryTest
     Assert.assertEquals(debug + "type " + wildcardType, "class " + Number.class.getName(),
         wildcardType.getJSONArray("typeArgs").getJSONObject(1).getJSONObject("typeBounds").getJSONArray("upper").get(0));
 
-    portType = (JSONObject)portTypes.get(3);
+    portType = (JSONObject)portTypes.get(4);
     Assert.assertEquals(portType.get("name"), "output");
     Assert.assertEquals(portType.get("type"), "java.lang.String");
 


Mime
View raw message