apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tweise <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEXCORE-304 Added support for l...
Date Wed, 20 Apr 2016 22:23:00 GMT
Github user tweise commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/311#discussion_r60498165
  
    --- Diff: engine/src/test/java/com/datatorrent/stram/StramLocalClusterTest.java ---
    @@ -274,4 +286,103 @@ public WindowGenerator setupWindowGenerator()
         localCluster.shutdown();
       }
     
    +  @Test
    +  public void testDynamicLoading() throws IOException, ClassNotFoundException
    +  {
    +    final String generatedJar = generatejar();
    +    File file = new File(generatedJar);
    +    final Class<?> pojo = URLClassLoader.newInstance(new URL[]{file.toURI().toURL()}).loadClass("POJO");
    +
    +    StreamingApplication app = new StreamingApplication()
    +    {
    +      @Override
    +      public void populateDAG(DAG dag, Configuration conf)
    +      {
    +        TestGeneratorInputOperator genNode = dag.addOperator("genNode", TestGeneratorInputOperator.class);
    +        genNode.setMaxTuples(2);
    +
    +        DynamicLoader dynamicLoader = dag.addOperator("DynamicLoader", new DynamicLoader());
    +        dynamicLoader.setClass("POJO");
    +
    +        dag.addStream("fromNode1", genNode.outport, dynamicLoader.in);
    +
    +        dag.setInputPortAttribute(dynamicLoader.in, Context.PortContext.TUPLE_CLASS,
pojo);
    +        conf.set(LIBJARS_CONF_KEY_NAME, generatedJar);
    +      }
    +    };
    +
    +    LocalMode.runApp(app, 10000);
    --- End diff --
    
    Please structure the unit tests so that you wait for expected result instead of waiting
for arbitrary time. There are examples in Malhar for this.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message