apex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From che...@apache.org
Subject [22/50] incubator-apex-core git commit: APEX-12 #resolve #comment filter BaseOperator from introspection
Date Wed, 09 Sep 2015 22:12:53 GMT
APEX-12 #resolve #comment filter BaseOperator from introspection


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/b2a606bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/b2a606bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/b2a606bc

Branch: refs/heads/master
Commit: b2a606bcd76f89af4bd42525670765fce01bccd3
Parents: 3f8f97e
Author: siyuan <siyuan@datatorrent.com>
Authored: Mon Aug 10 12:52:33 2015 -0700
Committer: siyuan <siyuan@datatorrent.com>
Committed: Mon Aug 10 12:52:33 2015 -0700

----------------------------------------------------------------------
 .../com/datatorrent/stram/webapp/TypeGraph.java     |  5 ++++-
 .../stram/webapp/OperatorDiscoveryTest.java         | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/b2a606bc/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 61dc99d..8d7e346 100644
--- a/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
+++ b/engine/src/main/java/com/datatorrent/stram/webapp/TypeGraph.java
@@ -38,6 +38,8 @@ import org.slf4j.LoggerFactory;
 
 import com.datatorrent.api.Component;
 import com.datatorrent.api.Operator;
+
+import com.datatorrent.common.util.BaseOperator;
 import com.datatorrent.netlet.util.DTThrowable;
 import com.datatorrent.stram.webapp.asm.ClassNodeType;
 import com.datatorrent.stram.webapp.asm.ClassSignatureVisitor;
@@ -73,7 +75,8 @@ public class TypeGraph
   public static final String[] EXCLUDE_CLASSES = {Object.class.getName().replace('.', '/'),

     Enum.class.getName().replace('.', '/'), 
     Operator.class.getName().replace('.', '/'),
-    Component.class.getName().replace('.', '/')};
+    Component.class.getName().replace('.', '/'),
+    BaseOperator.class.getName().replace('.', '/')};
 
   public static final ImmutableSet<String> JACKSON_INSTANTIABLE_CLASSES;
 

http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/b2a606bc/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 8baa08a..d937ad7 100644
--- a/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
+++ b/engine/src/test/java/com/datatorrent/stram/webapp/OperatorDiscoveryTest.java
@@ -15,6 +15,9 @@
  */
 package com.datatorrent.stram.webapp;
 
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -199,7 +202,7 @@ public class OperatorDiscoveryTest
     JSONArray outputPorts = oper.getJSONArray("outputPorts");
 
     Assert.assertNotNull(debug + "Properties aren't null ", props);
-    Assert.assertEquals(debug + "Number of properties ", 5, props.length());
+    Assert.assertEquals(debug + "Number of properties ", 4, props.length());
 
     Assert.assertNotNull(debug + "Port types aren't null ", portTypes);
     Assert.assertEquals(debug + "Number of port types ", 5, portTypes.length());
@@ -285,7 +288,16 @@ public class OperatorDiscoveryTest
 
     JSONArray props = asmDesc.getJSONArray("properties");
     Assert.assertNotNull(debug + "Properties aren't null ", props);
-    Assert.assertEquals(debug + "Number of properties ", 28, props.length());
+    Assert.assertEquals(debug + "Number of properties ", 27, props.length());
+
+    // make sure properties of excluded classes are not in the asm description of the type
+    for(String classN : TypeGraph.EXCLUDE_CLASSES){
+      Class c = Class.forName(classN.replace('/', '.'));
+      BeanInfo bi = Introspector.getBeanInfo(c);
+      for (PropertyDescriptor pd : bi.getPropertyDescriptors()){
+        Assert.assertNull(debug, getJSONProperty(props, pd.getName()));
+      }
+    }
 
     JSONObject mapProperty = getJSONProperty(props, "map");
     Assert.assertEquals(debug + "canGet " + mapProperty, true, mapProperty.get("canGet"));


Mime
View raw message