levilentz commented on a change in pull request #5444:
URL: https://github.com/apache/nifi/pull/5444#discussion_r745274634



##########
File path: 
nifi-nar-bundles/nifi-jolt-record-bundle/nifi-jolt-record-processors/src/test/java/org/apache/nifi/processors/jolt/record/TestJoltTransformRecord.java
##########
@@ -582,6 +582,35 @@ public void 
testTransformInputCustomTransformationIgnored() throws IOException {
                 new String(transformed.toByteArray()));
     }
 
+    @Test
+    public void testExpressionLanguageJarFile() throws IOException {
+        generateTestData(1, null);
+        final String outputSchemaText = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformRecord/defaultrOutputSchema.avsc")));
+        runner.setProperty(writer, SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY, 
SchemaAccessUtils.SCHEMA_TEXT_PROPERTY);
+        runner.setProperty(writer, SchemaAccessUtils.SCHEMA_TEXT, 
outputSchemaText);
+        runner.setProperty(writer, "Pretty Print JSON", "true");
+        runner.enableControllerService(writer);
+        final String customJarPath = 
"src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar";
+        final String spec = new 
String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformRecord/defaultrSpec.json")));
+        final String customJoltTransform = "TestCustomJoltTransform";
+        runner.setVariable("CUSTOM_JAR", customJarPath);
+        runner.setProperty(JoltTransformRecord.JOLT_SPEC, "${JOLT_SPEC}");
+        runner.setProperty(JoltTransformRecord.MODULES, "${CUSTOM_JAR}");
+        runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM, 
JoltTransformRecord.DEFAULTR);

Review comment:
       Good catch! 
   
   I did try to have it also load the jar in the test suite, however, I cant 
seem to get it to modify the class path within that context (the test suite), 
so I just have it assert that it was valid. Please let me know if you have a 
better way of effectuating that unit test. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to