Source:
public void testAddOperator() { LogicalPlan dag = new LogicalPlan(); TestOperator<String, Integer> firstOperator = new TestOperator(); TestOperator<Integer, Date> secondOperator = new TestOperator(); new ApexStreamImpl<String>().addOperator("first", firstOperator, null, firstOperator.output) .addOperator("second", secondOperator, secondOperator.input, null) .with(DAG.Locality.THREAD_LOCAL) .with(Context.OperatorContext.AUTO_RECORD, true) .with("prop", "TestProp").populateDag(dag); Assert.assertTrue(dag.getAllOperators().size() == 2); Set<String> opNames = new HashSet<>(); opNames.add("first"); opNames.add("second"); for (LogicalPlan.OperatorMeta operatorMeta : dag.getAllOperators()) { Assert.assertTrue(operatorMeta.getOperator() instanceof TestOperator); Assert.assertTrue(opNames.contains(operatorMeta.getName())); if (operatorMeta.getName().equals("second")) { Assert.assertTrue(operatorMeta.getAttributes().get(Context.OperatorContext.AUTO_RECORD)); Assert.assertEquals("TestProp", ((TestOperator)operatorMeta.getOperator()).prop); } else { Assert.assertNull(operatorMeta.getAttributes().get(Context.OperatorContext.AUTO_RECORD)); Assert.assertNull(((TestOperator)operatorMeta.getOperator()).prop); } } Collection<LogicalPlan.StreamMeta> streams = dag.getAllStreams(); Assert.assertTrue(streams.size() == 1); for (LogicalPlan.StreamMeta stream : streams) { Assert.assertEquals("first", stream.getSource().getOperatorMeta().getName()); Assert.assertTrue(1 == stream.getSinks().size()); Assert.assertEquals("second", stream.getSinks().get(0).getOperatorWrapper().getName()); Assert.assertTrue(stream.getLocality() == DAG.Locality.THREAD_LOCAL); } }

Target:
public void testAddOperator() { LogicalPlan dag = new LogicalPlan(); TestOperator<String, Integer> firstOperator = new TestOperator<>(); TestOperator<Integer, Date> secondOperator = new TestOperator<>(); new ApexStreamImpl<String>().addOperator("first", firstOperator, null, firstOperator.output) .addOperator("second", secondOperator, secondOperator.input, null) .with(DAG.Locality.THREAD_LOCAL) .with(Context.OperatorContext.AUTO_RECORD, true) .with("prop", "TestProp").populateDag(dag); Assert.assertTrue(dag.getAllOperators().size() == 2); Set<String> opNames = new HashSet<>(); opNames.add("first"); opNames.add("second"); for (LogicalPlan.OperatorMeta operatorMeta : dag.getAllOperators()) { Assert.assertTrue(operatorMeta.getOperator() instanceof TestOperator); Assert.assertTrue(opNames.contains(operatorMeta.getName())); if (operatorMeta.getName().equals("second")) { Assert.assertTrue(operatorMeta.getAttributes().get(Context.OperatorContext.AUTO_RECORD)); Assert.assertEquals("TestProp", ((TestOperator)operatorMeta.getOperator()).prop); } else { Assert.assertNull(operatorMeta.getAttributes().get(Context.OperatorContext.AUTO_RECORD)); Assert.assertNull(((TestOperator)operatorMeta.getOperator()).prop); } } Collection<LogicalPlan.StreamMeta> streams = dag.getAllStreams(); Assert.assertTrue(streams.size() == 1); for (LogicalPlan.StreamMeta stream : streams) { Assert.assertEquals("first", stream.getSource().getOperatorMeta().getName()); Assert.assertTrue(1 == stream.getSinks().size()); Assert.assertEquals("second", stream.getSinks().get(0).getOperatorWrapper().getName()); Assert.assertTrue(stream.getLocality() == DAG.Locality.THREAD_LOCAL); } }