TransformOperator extends BaseOperator implements Operator.ActivationListener { public TransformOperator() { expressionFunctions.add("java.lang.Math.*"); expressionFunctions.add("org.apache.commons.lang3.StringUtils.*"); expressionFunctions.add("org.apache.commons.lang3.StringEscapeUtils.*"); expressionFunctions.add("org.apache.commons.lang3.time.DurationFormatUtils.*"); expressionFunctions.add("org.apache.commons.lang3.time.DateFormatUtils.*"); } TransformOperator(); @Override void activate(Context context); @Override void deactivate(); Map<String, String> getExpressionMap(); void setExpressionMap(Map<String, String> expressionMap); List<String> getExpressionFunctions(); void setExpressionFunctions(List<String> expressionFunctions); boolean isCopyMatchingFields(); void setCopyMatchingFields(boolean copyMatchingFields); @InputPortFieldAnnotation(schemaRequired = true)
  final transient DefaultInputPort<Object> input; @OutputPortFieldAnnotation(schemaRequired = true)
  final transient DefaultOutputPort<Object> output; }
@Test public void testTransformOperator() { Map<String, String> expMap = new HashMap<>(); expMap.put("var21", "var1"); expMap.put("var22", "$.var2"); expMap.put("var23", "{$.var3}"); operator.setExpressionMap(expMap); operator.activate(null); operator.beginWindow(1L); InputClass inputClass = new InputClass(); inputClass.setVar1(123); inputClass.setVar2(12); inputClass.setVar3("ABC"); operator.input.put(inputClass); operator.endWindow(); Assert.assertEquals(1, sink.collectedTuples.size()); Object o = sink.collectedTuples.get(0); Assert.assertTrue(o instanceof OutputClass); OutputClass out = (OutputClass)o; Assert.assertEquals(123, out.getVar21()); Assert.assertEquals(12, out.getVar22()); Assert.assertEquals("ABC", out.getVar23()); }