Repository: nifi
Updated Branches:
  refs/heads/master 274dc0902 -> cb3aa8f5c


http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformJSON.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformJSON.java
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformJSON.java
deleted file mode 100644
index e19d320..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTransformJSON.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.standard;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.nifi.flowfile.attributes.CoreAttributes;
-import org.apache.nifi.processor.Processor;
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.stream.io.ByteArrayInputStream;
-import org.apache.nifi.util.MockFlowFile;
-import org.apache.nifi.util.StringUtils;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.junit.Test;
-
-import com.bazaarvoice.jolt.CardinalityTransform;
-import com.bazaarvoice.jolt.Chainr;
-import com.bazaarvoice.jolt.Defaultr;
-import com.bazaarvoice.jolt.Diffy;
-import com.bazaarvoice.jolt.JsonUtils;
-import com.bazaarvoice.jolt.Removr;
-import com.bazaarvoice.jolt.Shiftr;
-import com.bazaarvoice.jolt.Sortr;
-import com.bazaarvoice.jolt.Transform;
-
-import static org.junit.Assert.assertTrue;
-
-public class TestTransformJSON {
-
-    final static Path JSON_INPUT = 
Paths.get("src/test/resources/TestTransformJson/input.json");
-    final static Diffy DIFFY = new Diffy();
-
-    @Test
-    public void testRelationshipsCreated() throws IOException{
-        Processor processor= new TransformJSON();
-        final TestRunner runner = TestRunners.newTestRunner(processor);
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.enqueue(JSON_INPUT);
-        Set<Relationship> relationships = processor.getRelationships();
-        assertTrue(relationships.contains(TransformJSON.REL_FAILURE));
-        assertTrue(relationships.contains(TransformJSON.REL_SUCCESS));
-        assertTrue(relationships.size() == 2);
-    }
-
-    @Test
-    public void testInvalidJOLTSpec() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = "[{}]";
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.assertNotValid();
-    }
-
-    @Test
-    public void testIncorrectJOLTSpec() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String chainrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, chainrSpec);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SHIFTR);
-        runner.assertNotValid();
-    }
-
-    @Test
-    public void testSpecIsNotSet() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SHIFTR);
-        runner.assertNotValid();
-    }
-
-    @Test
-    public void testSpecIsEmpty() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        runner.setProperty(TransformJSON.JOLT_SPEC, StringUtils.EMPTY);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SHIFTR);
-        runner.assertNotValid();
-    }
-
-    @Test
-    public void testSpecNotRequired() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SORTR);
-        runner.assertValid();
-    }
-
-    @Test
-    public void testNoFlowFileContent() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.run();
-        runner.assertQueueEmpty();
-        runner.assertTransferCount(TransformJSON.REL_FAILURE,0);
-        runner.assertTransferCount(TransformJSON.REL_SUCCESS,0);
-    }
-
-    @Test
-    public void testInvalidFlowFileContentJson() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.enqueue("invalid json");
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_FAILURE);
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetChainTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-
-        final String chainrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.CHAINR.getValue(),JsonUtils.jsonToObject(chainrSpec));
-        assertTrue(transform instanceof Chainr);
-
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetRemoveTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-
-        final String removrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/removrSpec.json")));
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.REMOVR.getValue(),JsonUtils.jsonToObject(removrSpec));
-        assertTrue(transform instanceof Removr);
-
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetShiftTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-
-        final String shiftrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/shiftrSpec.json")));
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.SHIFTR.getValue(),JsonUtils.jsonToObject(shiftrSpec));
-        assertTrue(transform instanceof Shiftr);
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetDefaultTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-
-        final String defaultrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/defaultrSpec.json")));
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.DEFAULTR.getValue(),JsonUtils.jsonToObject(defaultrSpec));
-        assertTrue(transform instanceof Defaultr);
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetCardinalityTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-
-        final String cardrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/cardrSpec.json")));
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.CARDINALITY.getValue(),JsonUtils.jsonToObject(cardrSpec));
-        assertTrue(transform instanceof CardinalityTransform);
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetSortrTransform() throws NoSuchMethodException, 
IOException,InvocationTargetException, IllegalAccessException{
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        Transform transform = (Transform) 
method.invoke(null,TransformJSON.SORTR.getValue(),null);
-        assertTrue(transform instanceof Sortr);
-    }
-
-
-    @Test
-    @SuppressWarnings("unchecked")
-    public void testGetInvalidTransformWithNoSpec() throws 
NoSuchMethodException, IOException,InvocationTargetException, 
IllegalAccessException{
-        List<Class> classes = 
Arrays.<Class>asList(TransformJSON.class.getDeclaredClasses());
-        Class factory = classes.stream().filter(clazz -> 
clazz.getSimpleName().equals("TransformationFactory")).findFirst().get();
-        Method method = factory.getDeclaredMethod("getTransform", 
String.class, Object.class);
-        method.setAccessible(true);
-        try {
-            method.invoke(null, TransformJSON.CHAINR.getValue(), null);
-        }catch (InvocationTargetException ite){
-            
assertTrue(ite.getTargetException().getLocalizedMessage().equals("JOLT Chainr 
expects a JSON array of objects - Malformed spec."));
-        }
-    }
-
-    @Test
-    public void testTransformInputWithChainr() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/chainrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        transformed.assertAttributeExists(CoreAttributes.MIME_TYPE.key());
-        
transformed.assertAttributeEquals(CoreAttributes.MIME_TYPE.key(),"application/json");
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/chainrOutput.json")));
-        assertTrue(DIFFY.diff(compareJson, transformedJson).isEmpty());
-    }
-
-    @Test
-    public void testTransformInputWithShiftr() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/shiftrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SHIFTR);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        transformed.assertAttributeExists(CoreAttributes.MIME_TYPE.key());
-        
transformed.assertAttributeEquals(CoreAttributes.MIME_TYPE.key(),"application/json");
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/shiftrOutput.json")));
-        assertTrue(DIFFY.diff(compareJson, transformedJson).isEmpty());
-    }
-
-    @Test
-    public void testTransformInputWithDefaultr() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/defaultrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, 
TransformJSON.DEFAULTR);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/defaultrOutput.json")));
-        assertTrue(DIFFY.diff(compareJson, transformedJson).isEmpty());
-    }
-
-    @Test
-    public void testTransformInputWithRemovr() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/removrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.REMOVR);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/removrOutput.json")));
-        assertTrue(DIFFY.diff(compareJson, transformedJson).isEmpty());
-    }
-
-    @Test
-    public void testTransformInputWithCardinality() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformJson/cardrSpec.json")));
-        runner.setProperty(TransformJSON.JOLT_SPEC, spec);
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, 
TransformJSON.CARDINALITY);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/cardrOutput.json")));
-        assertTrue(DIFFY.diff(compareJson, transformedJson).isEmpty());
-    }
-
-    @Test
-    public void testTransformInputWithSortr() throws IOException {
-        final TestRunner runner = TestRunners.newTestRunner(new 
TransformJSON());
-        runner.setProperty(TransformJSON.JOLT_TRANSFORM, TransformJSON.SORTR);
-        runner.enqueue(JSON_INPUT);
-        runner.run();
-        runner.assertAllFlowFilesTransferred(TransformJSON.REL_SUCCESS);
-        final MockFlowFile transformed = 
runner.getFlowFilesForRelationship(TransformJSON.REL_SUCCESS).get(0);
-        transformed.assertAttributeExists(CoreAttributes.MIME_TYPE.key());
-        
transformed.assertAttributeEquals(CoreAttributes.MIME_TYPE.key(),"application/json");
-        Object transformedJson = JsonUtils.jsonToObject(new 
ByteArrayInputStream(transformed.toByteArray()));
-        Object compareJson = 
JsonUtils.jsonToObject(Files.newInputStream(Paths.get("src/test/resources/TestTransformJson/sortrOutput.json")));
-        String transformedJsonString = JsonUtils.toJsonString(transformedJson);
-        String compareJsonString = JsonUtils.toJsonString(compareJson);
-        assertTrue(compareJsonString.equals(transformedJsonString));
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrOutput.json
new file mode 100644
index 0000000..3dc53ab
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrOutput.json
@@ -0,0 +1,13 @@
+{
+  "rating": {
+    "primary": {
+      "value": 3
+    },
+    "quality": {
+      "value": 3
+    },
+    "series": {
+      "value": 5
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrSpec.json
new file mode 100644
index 0000000..fc77f18
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/cardrSpec.json
@@ -0,0 +1,7 @@
+{
+   "rating" : {
+      "series" : {
+          "value" : "ONE"
+      }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrOutput.json
new file mode 100644
index 0000000..2e8af88
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrOutput.json
@@ -0,0 +1,16 @@
+{
+  "Range" : 5,
+  "Rating" : 3,
+  "SecondaryRatings" : {
+    "quality" : {
+      "Id" : "quality",
+      "Range" : 5,
+      "Value" : 3
+    },
+    "series" : {
+      "Id" : "series",
+      "Range" : 5,
+      "Value" : [5,4]
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrSpec.json
new file mode 100644
index 0000000..7884abf
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/chainrSpec.json
@@ -0,0 +1,29 @@
+[
+  {
+    "operation": "shift",
+    "spec": {
+      "rating": {
+        "primary": {
+          "value": "Rating",
+          "max": "RatingRange"
+        },
+        "*": {
+          "max": "SecondaryRatings.&1.Range",
+          "value": "SecondaryRatings.&1.Value",
+          "$": "SecondaryRatings.&1.Id"
+        }
+      }
+    }
+  },
+  {
+    "operation": "default",
+    "spec": {
+      "Range": 5,
+      "SecondaryRatings": {
+        "*": {
+          "Range": 5
+        }
+      }
+    }
+  }
+]

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrOutput.json
new file mode 100644
index 0000000..87581f4
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrOutput.json
@@ -0,0 +1,24 @@
+{
+  "RatingRange" : 5,
+  "rating": {
+    "primary": {
+      "value": 3,
+      "MaxLabel": "High",
+      "MinLabel": "Low",
+      "DisplayType": "NORMAL"
+    },
+    "quality": {
+      "value": 3,
+      "MaxLabel": "High",
+      "MinLabel": "Low",
+      "DisplayType": "NORMAL"
+    },
+    "series": {
+      "value": [5,4],
+      "MaxLabel": "High",
+      "MinLabel": "Low",
+      "DisplayType": "NORMAL"
+    }
+
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrSpec.json
new file mode 100644
index 0000000..2f2ea9f
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/defaultrSpec.json
@@ -0,0 +1,10 @@
+ {
+   "RatingRange" : 5,
+   "rating": {
+     "*": {
+        "MaxLabel": "High",
+        "MinLabel": "Low",
+        "DisplayType": "NORMAL"
+     }
+   }
+ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/input.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/input.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/input.json
new file mode 100644
index 0000000..12d85db
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/input.json
@@ -0,0 +1,13 @@
+{
+  "rating": {
+    "primary": {
+      "value": 3
+    },
+    "series": {
+      "value": [5,4]
+    },
+    "quality": {
+      "value": 3
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrOutput.json
new file mode 100644
index 0000000..da0de3a
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrOutput.json
@@ -0,0 +1,10 @@
+{
+  "rating": {
+    "primary": {
+      "value": 3
+    },
+    "series":{
+      "value":[5,4]
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrSpec.json
new file mode 100644
index 0000000..a6bde70
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/removrSpec.json
@@ -0,0 +1,5 @@
+{
+  "rating": {
+    "quality": ""
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrOutput.json
new file mode 100644
index 0000000..8fd6c3b
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrOutput.json
@@ -0,0 +1,8 @@
+{
+   "SecondaryRatings" : {
+     "quality" : {
+       "Value" : 3,
+       "RatingRange" : 3
+     }
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrSpec.json
new file mode 100644
index 0000000..d292cdd
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/shiftrSpec.json
@@ -0,0 +1,10 @@
+{
+     "rating": {
+       "primary": {
+         "value": "SecondaryRatings.quality.RatingRange"
+       },
+       "quality": {
+         "value": "SecondaryRatings.quality.Value"
+       }
+     }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/sortrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/sortrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/sortrOutput.json
new file mode 100644
index 0000000..ee559da
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJoltTransformJson/sortrOutput.json
@@ -0,0 +1,13 @@
+{
+  "rating": {
+    "primary": {
+      "value": 3
+    },
+    "quality": {
+      "value": 3
+    },
+    "series": {
+      "value": [5,4]
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrOutput.json
deleted file mode 100644
index 3dc53ab..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrOutput.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "rating": {
-    "primary": {
-      "value": 3
-    },
-    "quality": {
-      "value": 3
-    },
-    "series": {
-      "value": 5
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrSpec.json
deleted file mode 100644
index fc77f18..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/cardrSpec.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-   "rating" : {
-      "series" : {
-          "value" : "ONE"
-      }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrOutput.json
deleted file mode 100644
index 2e8af88..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrOutput.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "Range" : 5,
-  "Rating" : 3,
-  "SecondaryRatings" : {
-    "quality" : {
-      "Id" : "quality",
-      "Range" : 5,
-      "Value" : 3
-    },
-    "series" : {
-      "Id" : "series",
-      "Range" : 5,
-      "Value" : [5,4]
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrSpec.json
deleted file mode 100644
index 7884abf..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/chainrSpec.json
+++ /dev/null
@@ -1,29 +0,0 @@
-[
-  {
-    "operation": "shift",
-    "spec": {
-      "rating": {
-        "primary": {
-          "value": "Rating",
-          "max": "RatingRange"
-        },
-        "*": {
-          "max": "SecondaryRatings.&1.Range",
-          "value": "SecondaryRatings.&1.Value",
-          "$": "SecondaryRatings.&1.Id"
-        }
-      }
-    }
-  },
-  {
-    "operation": "default",
-    "spec": {
-      "Range": 5,
-      "SecondaryRatings": {
-        "*": {
-          "Range": 5
-        }
-      }
-    }
-  }
-]

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrOutput.json
deleted file mode 100644
index 87581f4..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrOutput.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  "RatingRange" : 5,
-  "rating": {
-    "primary": {
-      "value": 3,
-      "MaxLabel": "High",
-      "MinLabel": "Low",
-      "DisplayType": "NORMAL"
-    },
-    "quality": {
-      "value": 3,
-      "MaxLabel": "High",
-      "MinLabel": "Low",
-      "DisplayType": "NORMAL"
-    },
-    "series": {
-      "value": [5,4],
-      "MaxLabel": "High",
-      "MinLabel": "Low",
-      "DisplayType": "NORMAL"
-    }
-
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrSpec.json
deleted file mode 100644
index 2f2ea9f..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/defaultrSpec.json
+++ /dev/null
@@ -1,10 +0,0 @@
- {
-   "RatingRange" : 5,
-   "rating": {
-     "*": {
-        "MaxLabel": "High",
-        "MinLabel": "Low",
-        "DisplayType": "NORMAL"
-     }
-   }
- }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/input.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/input.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/input.json
deleted file mode 100644
index 12d85db..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/input.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "rating": {
-    "primary": {
-      "value": 3
-    },
-    "series": {
-      "value": [5,4]
-    },
-    "quality": {
-      "value": 3
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrOutput.json
deleted file mode 100644
index da0de3a..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrOutput.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "rating": {
-    "primary": {
-      "value": 3
-    },
-    "series":{
-      "value":[5,4]
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrSpec.json
deleted file mode 100644
index a6bde70..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/removrSpec.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "rating": {
-    "quality": ""
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrOutput.json
deleted file mode 100644
index 8fd6c3b..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrOutput.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-   "SecondaryRatings" : {
-     "quality" : {
-       "Value" : 3,
-       "RatingRange" : 3
-     }
-   }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrSpec.json
deleted file mode 100644
index d292cdd..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/shiftrSpec.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-     "rating": {
-       "primary": {
-         "value": "SecondaryRatings.quality.RatingRange"
-       },
-       "quality": {
-         "value": "SecondaryRatings.quality.Value"
-       }
-     }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/sortrOutput.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/sortrOutput.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/sortrOutput.json
deleted file mode 100644
index ee559da..0000000
--- 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestTransformJson/sortrOutput.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "rating": {
-    "primary": {
-      "value": 3
-    },
-    "quality": {
-      "value": 3
-    },
-    "series": {
-      "value": [5,4]
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/pom.xml 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/pom.xml
new file mode 100644
index 0000000..f8a149f
--- /dev/null
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+license agreements. See the NOTICE file distributed with this work for 
additional
+information regarding copyright ownership. The ASF licenses this file to
+You under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of
+the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+by applicable law or agreed to in writing, software distributed under the
+License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, either express or implied. See the License for the specific
+language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>nifi-standard-bundle</artifactId>
+        <groupId>org.apache.nifi</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>nifi-standard-utils</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.bazaarvoice.jolt</groupId>
+            <artifactId>jolt-core</artifactId>
+            <version>0.0.20</version>
+        </dependency>
+        <dependency>
+            <groupId>com.bazaarvoice.jolt</groupId>
+            <artifactId>json-utils</artifactId>
+            <version>0.0.20</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>2.6.2</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes combine.children="append">
+                        
<exclude>src/test/resources/TestTransformFactory/chainrSpec.json</exclude>
+                        
<exclude>src/test/resources/TestTransformFactory/cardrSpec.json</exclude>
+                        
<exclude>src/test/resources/TestTransformFactory/defaultrSpec.json</exclude>
+                        
<exclude>src/test/resources/TestTransformFactory/shiftrSpec.json</exclude>
+                        
<exclude>src/test/resources/TestTransformFactory/removrSpec.json</exclude>
+                        
<exclude>src/test/resources/TestTransformJFactory/defaultrSpec.json</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/main/java/org/apache/nifi/processors/standard/util/TransformFactory.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/main/java/org/apache/nifi/processors/standard/util/TransformFactory.java
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/main/java/org/apache/nifi/processors/standard/util/TransformFactory.java
new file mode 100644
index 0000000..5bb8374
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/main/java/org/apache/nifi/processors/standard/util/TransformFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.standard.util;
+
+import com.bazaarvoice.jolt.CardinalityTransform;
+import com.bazaarvoice.jolt.Chainr;
+import com.bazaarvoice.jolt.Defaultr;
+import com.bazaarvoice.jolt.Removr;
+import com.bazaarvoice.jolt.Shiftr;
+import com.bazaarvoice.jolt.Sortr;
+import com.bazaarvoice.jolt.Transform;
+
+public class TransformFactory {
+
+    public static Transform getTransform(String transform, Object specJson) {
+        if (transform.equals("jolt-transform-default")) {
+            return new Defaultr(specJson);
+        } else if (transform.equals("jolt-transform-shift")) {
+            return new Shiftr(specJson);
+        } else if (transform.equals("jolt-transform-remove")) {
+            return new Removr(specJson);
+        } else if (transform.equals("jolt-transform-card")) {
+            return new CardinalityTransform(specJson);
+        } else if(transform.equals("jolt-transform-sort")){
+            return new Sortr();
+        } else {
+            return Chainr.fromSpec(specJson);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/java/org/apache/nifi/processors/standard/util/TestTransformFactory.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/java/org/apache/nifi/processors/standard/util/TestTransformFactory.java
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/java/org/apache/nifi/processors/standard/util/TestTransformFactory.java
new file mode 100644
index 0000000..e2be189
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/java/org/apache/nifi/processors/standard/util/TestTransformFactory.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors.standard.util;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.junit.Test;
+
+import com.bazaarvoice.jolt.CardinalityTransform;
+import com.bazaarvoice.jolt.Chainr;
+import com.bazaarvoice.jolt.Defaultr;
+import com.bazaarvoice.jolt.JsonUtils;
+import com.bazaarvoice.jolt.Removr;
+import com.bazaarvoice.jolt.Shiftr;
+import com.bazaarvoice.jolt.Sortr;
+import com.bazaarvoice.jolt.Transform;
+
+import static org.junit.Assert.assertTrue;
+
+public class TestTransformFactory {
+
+
+    @Test
+    public void testGetChainTransform() throws IOException{
+        final String chainrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/chainrSpec.json")));
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-chain",JsonUtils.jsonToObject(chainrSpec));
+        assertTrue(transform instanceof Chainr);
+    }
+
+    @Test
+    public void testGetDefaultTransform() throws IOException{
+        final String defaultrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/defaultrSpec.json")));
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-default",JsonUtils.jsonToObject(defaultrSpec));
+        assertTrue(transform instanceof Defaultr);
+    }
+
+    @Test
+    public void testGetSortTransform() throws IOException{
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-sort",null);
+        assertTrue(transform instanceof Sortr);
+    }
+
+    @Test
+    public void testGetShiftTransform() throws IOException{
+        final String shiftrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/shiftrSpec.json")));
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-shift",JsonUtils.jsonToObject(shiftrSpec));
+        assertTrue(transform instanceof Shiftr);
+    }
+
+    @Test
+    public void testGetRemoveTransform() throws IOException{
+        final String removrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/removrSpec.json")));
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-remove",JsonUtils.jsonToObject(removrSpec));
+        assertTrue(transform instanceof Removr);
+    }
+
+    @Test
+    public void testGetCardinalityTransform() throws IOException{
+        final String cardrSpec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/cardrSpec.json")));
+        Transform transform = 
TransformFactory.getTransform("jolt-transform-card",JsonUtils.jsonToObject(cardrSpec));
+        assertTrue(transform instanceof CardinalityTransform);
+    }
+
+    public void testGetInvalidTransformWithNoSpec() {
+        try{
+            TransformFactory.getTransform("jolt-transform-chain",null);
+        }catch (Exception e){
+            assertTrue(e.toString().equals("JOLT Chainr expects a JSON array 
of objects - Malformed spec."));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/cardrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/cardrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/cardrSpec.json
new file mode 100644
index 0000000..fc77f18
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/cardrSpec.json
@@ -0,0 +1,7 @@
+{
+   "rating" : {
+      "series" : {
+          "value" : "ONE"
+      }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/chainrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/chainrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/chainrSpec.json
new file mode 100644
index 0000000..7884abf
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/chainrSpec.json
@@ -0,0 +1,29 @@
+[
+  {
+    "operation": "shift",
+    "spec": {
+      "rating": {
+        "primary": {
+          "value": "Rating",
+          "max": "RatingRange"
+        },
+        "*": {
+          "max": "SecondaryRatings.&1.Range",
+          "value": "SecondaryRatings.&1.Value",
+          "$": "SecondaryRatings.&1.Id"
+        }
+      }
+    }
+  },
+  {
+    "operation": "default",
+    "spec": {
+      "Range": 5,
+      "SecondaryRatings": {
+        "*": {
+          "Range": 5
+        }
+      }
+    }
+  }
+]

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/defaultrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/defaultrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/defaultrSpec.json
new file mode 100644
index 0000000..2f2ea9f
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/defaultrSpec.json
@@ -0,0 +1,10 @@
+ {
+   "RatingRange" : 5,
+   "rating": {
+     "*": {
+        "MaxLabel": "High",
+        "MinLabel": "Low",
+        "DisplayType": "NORMAL"
+     }
+   }
+ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/removrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/removrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/removrSpec.json
new file mode 100644
index 0000000..a6bde70
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/removrSpec.json
@@ -0,0 +1,5 @@
+{
+  "rating": {
+    "quality": ""
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/shiftrSpec.json
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/shiftrSpec.json
 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/shiftrSpec.json
new file mode 100644
index 0000000..d292cdd
--- /dev/null
+++ 
b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-utils/src/test/resources/TestTransformFactory/shiftrSpec.json
@@ -0,0 +1,10 @@
+{
+     "rating": {
+       "primary": {
+         "value": "SecondaryRatings.quality.RatingRange"
+       },
+       "quality": {
+         "value": "SecondaryRatings.quality.Value"
+       }
+     }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/pom.xml 
b/nifi-nar-bundles/nifi-standard-bundle/pom.xml
index 04ab2f8..f9b5525 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/pom.xml
+++ b/nifi-nar-bundles/nifi-standard-bundle/pom.xml
@@ -29,6 +29,8 @@
         <module>nifi-standard-reporting-tasks</module>
         <module>nifi-standard-content-viewer</module>
         <module>nifi-standard-nar</module>
+        <module>nifi-jolt-transform-json-ui</module>
+        <module>nifi-standard-utils</module>
     </modules>
     <dependencyManagement>
         <dependencies>
@@ -53,6 +55,12 @@
                 <type>war</type>
                 <version>1.0.0-SNAPSHOT</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-jolt-transform-json-ui</artifactId>
+                <type>war</type>
+                <version>1.0.0-SNAPSHOT</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/java/org/apache/nifi/update/attributes/api/RuleResource.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/java/org/apache/nifi/update/attributes/api/RuleResource.java
 
b/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/java/org/apache/nifi/update/attributes/api/RuleResource.java
index b211b72..8eddfbc 100644
--- 
a/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/java/org/apache/nifi/update/attributes/api/RuleResource.java
+++ 
b/nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/java/org/apache/nifi/update/attributes/api/RuleResource.java
@@ -632,7 +632,7 @@ public class RuleResource {
 
         try {
             // save the annotation data
-            configurationContext.setAnnotationData(requestContext, 
annotationData);
+            configurationContext.updateComponent(requestContext, 
annotationData, null);
         } catch (final InvalidRevisionException ire) {
             throw new WebApplicationException(ire, 
invalidRevision(ire.getMessage()));
         } catch (final Exception e) {

Reply via email to