This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new dfd2651a27 NIFI-15338 Switched Jolt bundle to io.github.jolt-community
1.1.0 (#10640)
dfd2651a27 is described below
commit dfd2651a27460097d91d50c28a91ce8f12d5728d
Author: Pierre Villard <[email protected]>
AuthorDate: Thu Dec 18 23:02:11 2025 +0100
NIFI-15338 Switched Jolt bundle to io.github.jolt-community 1.1.0 (#10640)
Signed-off-by: David Handermann <[email protected]>
---
.../nifi-jolt-bundle/nifi-jolt-processors/pom.xml | 9 +++-
.../processors/jolt/AbstractJoltTransform.java | 17 +++++--
.../nifi/processors/jolt/JoltTransformJSON.java | 6 +--
.../nifi/processors/jolt/JoltTransformRecord.java | 6 +--
.../processors/jolt/TestJoltTransformJSON.java | 47 +++++++++---------
.../processors/jolt/TestJoltTransformRecord.java | 34 +++++++------
.../TestCustomJoltTransform.jar | Bin 1025 -> 0 bytes
.../TestCustomJoltTransform.jar | Bin 1025 -> 0 bytes
.../src/test/resources/specs/customChainrSpec.json | 4 +-
.../api/transformjson/TransformJSONResource.java | 4 +-
.../api/processor/TestProcessorResource.java | 2 +-
.../transformjson/TestTransformJSONResource.java | 13 ++---
.../nifi-jolt-bundle/nifi-jolt-utils/pom.xml | 22 +++++++--
.../apache/nifi/jolt/util/TransformFactory.java | 23 ++++-----
.../org/apache/nifi/jolt/util/TransformUtils.java | 7 +--
.../nifi/jolt/util/TestTransformFactory.java | 47 ++++++++++--------
.../jolt/CustomTransformJarProvider.java | 53 +++++++++++++++++++++
.../processors/jolt}/TestCustomJoltTransform.java | 19 +++-----
.../TestCustomJoltTransform.jar | Bin 1025 -> 0 bytes
nifi-extension-bundles/nifi-jolt-bundle/pom.xml | 10 ++--
20 files changed, 210 insertions(+), 113 deletions(-)
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/pom.xml
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/pom.xml
index d98e1f70cd..047842b841 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/pom.xml
+++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/pom.xml
@@ -40,6 +40,13 @@
<artifactId>nifi-jolt-utils</artifactId>
<version>2.8.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-jolt-utils</artifactId>
+ <version>2.8.0-SNAPSHOT</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
@@ -104,4 +111,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/AbstractJoltTransform.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/AbstractJoltTransform.java
index 85aeca5e70..cd5959978f 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/AbstractJoltTransform.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/AbstractJoltTransform.java
@@ -16,10 +16,10 @@
*/
package org.apache.nifi.processors.jolt;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.JsonUtils;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.JsonUtils;
import org.apache.nifi.annotation.lifecycle.OnScheduled;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.PropertyValue;
@@ -43,6 +43,7 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
+import java.net.URLClassLoader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
@@ -138,11 +139,13 @@ public abstract class AbstractJoltTransform extends
AbstractProcessor {
results.add(new
ValidationResult.Builder().subject(JOLT_SPEC.getDisplayName()).valid(false).explanation(
"'Jolt Specification' must be set, or the Transformation
must be 'Sort'").build());
} else {
- final ClassLoader customClassLoader;
+ ClassLoader customClassLoader = null;
+ boolean customClassLoaderCreated = false;
try {
if (modulePath != null &&
!validationContext.isExpressionLanguagePresent(modulePath)) {
customClassLoader =
ClassLoaderUtils.getCustomClassLoader(modulePath,
this.getClass().getClassLoader(), getJarFilenameFilter());
+ customClassLoaderCreated = true;
} else {
customClassLoader = this.getClass().getClassLoader();
}
@@ -193,6 +196,14 @@ public abstract class AbstractJoltTransform extends
AbstractProcessor {
.subject(JOLT_SPEC.getDisplayName())
.explanation(message)
.build());
+ } finally {
+ if (customClassLoaderCreated && customClassLoader instanceof
URLClassLoader) {
+ try {
+ ((URLClassLoader) customClassLoader).close();
+ } catch (final IOException e) {
+ getLogger().warn("Failed to close custom ClassLoader",
e);
+ }
+ }
}
}
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java
index d46d46497e..9b98420385 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java
@@ -16,11 +16,11 @@
*/
package org.apache.nifi.processors.jolt;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.JsonUtil;
-import com.bazaarvoice.jolt.JsonUtils;
import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.JsonUtil;
+import io.joltcommunity.jolt.JsonUtils;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.RequiresInstanceClassLoading;
import org.apache.nifi.annotation.behavior.SideEffectFree;
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
index 3e51258b3e..d0f0da1d7c 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformRecord.java
@@ -16,9 +16,9 @@
*/
package org.apache.nifi.processors.jolt;
-import com.bazaarvoice.jolt.ContextualTransform;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.Transform;
+import io.joltcommunity.jolt.ContextualTransform;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.Transform;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.RequiresInstanceClassLoading;
import org.apache.nifi.annotation.behavior.SideEffectFree;
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java
index b736ea0910..9dba22f74d 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java
@@ -16,8 +16,8 @@
*/
package org.apache.nifi.processors.jolt;
-import com.bazaarvoice.jolt.Diffy;
-import com.bazaarvoice.jolt.JsonUtils;
+import io.joltcommunity.jolt.Diffy;
+import io.joltcommunity.jolt.JsonUtils;
import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.jolt.util.JoltTransformStrategy;
import org.apache.nifi.processor.Processor;
@@ -29,6 +29,7 @@ import org.apache.nifi.util.TestRunners;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@@ -54,15 +55,21 @@ class TestJoltTransformJSON {
final static String SHIFTR_SPEC_PATH =
"src/test/resources/specs/shiftrSpec.json";
final static String SHIFTR_JSON_OUTPUT = "shiftrOutput.json";
final static String CHAINR_JSON_OUTPUT = "chainrOutput.json";
+ private static final String CUSTOM_CLASS_NAME =
CustomTransformJarProvider.getCustomTransformClassName();
private static final String JSON_SOURCE_ATTR_NAME = "jsonSourceAttr";
+ private static String chainrSpecContents;
+ private static Path customTransformJar;
+
+ @TempDir
+ private static Path tempDir;
- static String chainrSpecContents;
private Processor processor;
private TestRunner runner;
@BeforeAll
static void setUpBeforeAll() throws Exception {
chainrSpecContents = Files.readString(Paths.get(CHAINR_SPEC_PATH));
+ customTransformJar =
CustomTransformJarProvider.createCustomTransformJar(tempDir);
}
@BeforeEach
@@ -163,7 +170,7 @@ class TestJoltTransformJSON {
void testCustomTransformationWithNoModule() throws IOException {
final String spec =
Files.readString(Paths.get("src/test/resources/specs/customChainrSpec.json"));
runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"TestCustomJoltTransform");
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(JSON_INPUT);
runner.run();
@@ -172,7 +179,7 @@ class TestJoltTransformJSON {
@Test
void testCustomTransformationWithMissingClassName() throws IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar";
+ final String customJarPath = customTransformJar.toString();
runner.setProperty(JoltTransformJSON.JOLT_SPEC, chainrSpecContents);
runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
@@ -184,7 +191,7 @@ class TestJoltTransformJSON {
void testCustomTransformationWithInvalidClassPath() throws IOException {
final String customJarPath =
"src/test/resources/TestJoltTransformJson/FakeCustomJar.jar";
runner.setProperty(JoltTransformJSON.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"TestCustomJoltTransform");
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(JSON_INPUT);
@@ -193,9 +200,9 @@ class TestJoltTransformJSON {
@Test
void testCustomTransformationWithInvalidClassName() throws IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar";
+ final String customJarPath = customTransformJar.toString();
runner.setProperty(JoltTransformJSON.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"FakeCustomJoltTransform");
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"org.apache.nifi.processors.jolt.FakeCustomJoltTransform");
runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(JSON_INPUT);
@@ -377,10 +384,9 @@ class TestJoltTransformJSON {
@Test
void testTransformInputWithCustomTransformationWithJar() throws
IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar";
runner.setProperty(JoltTransformJSON.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"TestCustomJoltTransform");
- runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
+ runner.setProperty(JoltTransformJSON.MODULES,
customTransformJar.toString());
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(JSON_INPUT);
runner.run();
@@ -390,8 +396,7 @@ class TestJoltTransformJSON {
@Test
void testExpressionLanguageJarFile() throws IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar";
- final String customJoltTransform = "TestCustomJoltTransform";
+ final String customJoltTransform = CUSTOM_CLASS_NAME;
Map<String, String> customSpecs = new HashMap<>();
customSpecs.put("JOLT_SPEC", chainrSpecContents);
@@ -400,7 +405,7 @@ class TestJoltTransformJSON {
runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"${CUSTOM_JOLT_CLASS}");
runner.setProperty(JoltTransformJSON.MODULES, "${CUSTOM_JAR}");
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
- runner.setEnvironmentVariableValue("CUSTOM_JAR", customJarPath);
+ runner.setEnvironmentVariableValue("CUSTOM_JAR",
customTransformJar.toString());
runner.enqueue(JSON_INPUT, customSpecs);
runner.run();
@@ -409,10 +414,9 @@ class TestJoltTransformJSON {
@Test
void testTransformInputWithCustomTransformationWithDir() throws
IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson";
runner.setProperty(JoltTransformJSON.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"TestCustomJoltTransform");
- runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
+ runner.setProperty(JoltTransformJSON.MODULES,
customTransformJar.getParent().toString());
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(JSON_INPUT);
runner.run();
@@ -422,10 +426,10 @@ class TestJoltTransformJSON {
@Test
void testTransformInputWithChainrEmbeddedCustomTransformation() throws
IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson";
final String spec =
Files.readString(Paths.get("src/test/resources/specs/customChainrSpec.json"));
runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec);
- runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
+ runner.setProperty(JoltTransformJSON.MODULES,
customTransformJar.getParent().toString());
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
runner.enqueue(JSON_INPUT);
runner.run();
@@ -434,11 +438,10 @@ class TestJoltTransformJSON {
@Test
void testTransformInputCustomTransformationIgnored() throws IOException {
- final String customJarPath =
"src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar";
final String spec =
Files.readString(Paths.get("src/test/resources/specs/defaultrSpec.json"));
runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec);
- runner.setProperty(JoltTransformJSON.CUSTOM_CLASS,
"TestCustomJoltTransform");
- runner.setProperty(JoltTransformJSON.MODULES, customJarPath);
+ runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, CUSTOM_CLASS_NAME);
+ runner.setProperty(JoltTransformJSON.MODULES,
customTransformJar.toString());
runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM,
JoltTransformStrategy.DEFAULTR);
runner.enqueue(JSON_INPUT);
runner.run();
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformRecord.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformRecord.java
index 9e70d6a8f6..6c0de1bfe8 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformRecord.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformRecord.java
@@ -37,12 +37,12 @@ import org.apache.nifi.util.TestRunners;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.io.IOException;
-import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -56,13 +56,18 @@ import java.util.function.BiFunction;
import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestJoltTransformRecord {
final static String CHAINR_SPEC_PATH =
"src/test/resources/specs/chainrSpec.json";
- static String chainrSpecContents;
+ private static final String CUSTOM_CLASS_NAME =
CustomTransformJarProvider.getCustomTransformClassName();
+ private static String chainrSpecContents;
+ private static Path customTransformJar;
+
+ @TempDir
+ private static Path tempDir;
+
private TestRunner runner;
private JoltTransformRecord processor;
private MockRecordParser parser;
@@ -71,6 +76,7 @@ public class TestJoltTransformRecord {
@BeforeAll
static void setUpBeforeAll() throws Exception {
chainrSpecContents = Files.readString(Paths.get(CHAINR_SPEC_PATH));
+ customTransformJar =
CustomTransformJarProvider.createCustomTransformJar(tempDir);
}
@BeforeEach
@@ -237,7 +243,7 @@ public class TestJoltTransformRecord {
runner.enableControllerService(writer);
final String spec =
Files.readString(Paths.get("src/test/resources/specs/customChainrSpec.json"));
runner.setProperty(JoltTransformRecord.JOLT_SPEC, spec);
- runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"TestCustomJoltTransform");
+ runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
CUSTOM_CLASS_NAME);
runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.assertValid();
}
@@ -250,7 +256,7 @@ public class TestJoltTransformRecord {
runner.setProperty(writer, SchemaAccessUtils.SCHEMA_TEXT,
outputSchemaText);
runner.setProperty(writer, JsonRecordSetWriter.PRETTY_PRINT_JSON,
"true");
runner.enableControllerService(writer);
- final String customJarPath =
"src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar";
+ final String customJarPath = customTransformJar.toString();
runner.setProperty(JoltTransformRecord.JOLT_SPEC, chainrSpecContents);
runner.setProperty(JoltTransformRecord.MODULES, customJarPath);
runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
@@ -262,7 +268,7 @@ public class TestJoltTransformRecord {
public void testCustomTransformationWithInvalidClassPath() {
final String customJarPath =
"src/test/resources/TestJoltTransformRecord/FakeCustomJar.jar";
runner.setProperty(JoltTransformRecord.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"TestCustomJoltTransform");
+ runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
CUSTOM_CLASS_NAME);
runner.setProperty(JoltTransformRecord.MODULES, customJarPath);
runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(new byte[0]);
@@ -271,9 +277,9 @@ public class TestJoltTransformRecord {
@Test
public void testCustomTransformationWithInvalidClassName() {
- final String customJarPath =
"src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar";
+ final String customJarPath = customTransformJar.toString();
runner.setProperty(JoltTransformRecord.JOLT_SPEC, chainrSpecContents);
- runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"FakeCustomJoltTransform");
+ runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"org.apache.nifi.processors.jolt.FakeCustomJoltTransform");
runner.setProperty(JoltTransformRecord.MODULES, customJarPath);
runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM,
JoltTransformStrategy.CUSTOMR);
runner.enqueue(new byte[0]);
@@ -584,10 +590,10 @@ public class TestJoltTransformRecord {
runner.setProperty(writer, SchemaAccessUtils.SCHEMA_TEXT,
outputSchemaText);
runner.setProperty(writer, JsonRecordSetWriter.PRETTY_PRINT_JSON,
"true");
runner.enableControllerService(writer);
- final String customJarPath =
"src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar";
+ final String customJarPath = customTransformJar.toString();
final String spec =
Files.readString(Paths.get("src/test/resources/specs/defaultrSpec.json"));
runner.setProperty(JoltTransformRecord.JOLT_SPEC, spec);
- runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"TestCustomJoltTransform");
+ runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
CUSTOM_CLASS_NAME);
runner.setProperty(JoltTransformRecord.MODULES, customJarPath);
runner.setProperty(JoltTransformRecord.JOLT_TRANSFORM,
JoltTransformStrategy.DEFAULTR);
runner.enqueue(new byte[0]);
@@ -608,12 +614,10 @@ public class TestJoltTransformRecord {
runner.setProperty(writer, SchemaAccessUtils.SCHEMA_TEXT,
outputSchemaText);
runner.setProperty(writer, JsonRecordSetWriter.PRETTY_PRINT_JSON,
"true");
runner.enableControllerService(writer);
- URL t =
getClass().getResource("/TestJoltTransformRecord/TestCustomJoltTransform.jar");
- assertNotNull(t);
- final String customJarPath = t.getPath();
+ final String customJarPath = customTransformJar.toString();
final String spec =
Files.readString(Paths.get("src/test/resources/specs/customChainrSpec.json"));
- final String customJoltTransform = "TestCustomJoltTransform";
- final String customClass = "TestCustomJoltTransform";
+ final String customJoltTransform = CUSTOM_CLASS_NAME;
+ final String customClass = CUSTOM_CLASS_NAME;
runner.setProperty(JoltTransformRecord.JOLT_SPEC, "${JOLT_SPEC}");
runner.setProperty(JoltTransformRecord.MODULES, customJarPath);
runner.setProperty(JoltTransformRecord.CUSTOM_CLASS,
"${CUSTOM_CLASS}");
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar
deleted file mode 100644
index b738658f1c..0000000000
Binary files
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar
and /dev/null differ
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar
deleted file mode 100644
index b738658f1c..0000000000
Binary files
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/TestJoltTransformRecord/TestCustomJoltTransform.jar
and /dev/null differ
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/specs/customChainrSpec.json
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/specs/customChainrSpec.json
index eef0933441..1471b69f20 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/specs/customChainrSpec.json
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/resources/specs/customChainrSpec.json
@@ -1,6 +1,6 @@
[
{
- "operation":"TestCustomJoltTransform",
+ "operation":"org.apache.nifi.processors.jolt.TestCustomJoltTransform",
"spec" :
[
{
@@ -32,4 +32,4 @@
}
]
}
-]
\ No newline at end of file
+]
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java
index 2ae56eedd3..51da7f366a 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java
@@ -17,8 +17,8 @@
package org.apache.nifi.web.standard.api.transformjson;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.JsonUtils;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.JsonUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.attribute.expression.language.PreparedQuery;
import org.apache.nifi.attribute.expression.language.Query;
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
index e8ed4e3bf9..a6e8e7b698 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/processor/TestProcessorResource.java
@@ -16,7 +16,7 @@
*/
package org.apache.nifi.web.standard.api.processor;
-import com.bazaarvoice.jolt.JsonUtils;
+import io.joltcommunity.jolt.JsonUtils;
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.nifi.web.ComponentDescriptor;
import org.apache.nifi.web.ComponentDetails;
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/transformjson/TestTransformJSONResource.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/transformjson/TestTransformJSONResource.java
index 790a33070b..5503263c9c 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/transformjson/TestTransformJSONResource.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-transform-json-ui/src/test/java/org/apache/nifi/web/standard/api/transformjson/TestTransformJSONResource.java
@@ -16,8 +16,8 @@
*/
package org.apache.nifi.web.standard.api.transformjson;
-import com.bazaarvoice.jolt.Diffy;
-import com.bazaarvoice.jolt.JsonUtils;
+import io.joltcommunity.jolt.Diffy;
+import io.joltcommunity.jolt.JsonUtils;
import org.apache.nifi.web.ComponentDetails;
import org.apache.nifi.web.NiFiWebConfigurationContext;
import org.apache.nifi.web.NiFiWebRequestContext;
@@ -52,6 +52,7 @@ import static org.mockito.Mockito.mock;
public class TestTransformJSONResource extends JerseyTest {
public static final ServletContext servletContext =
mock(ServletContext.class);
+ private static final String CUSTOM_CLASS_NAME =
"org.apache.nifi.processors.jolt.TestCustomJoltTransform";
@Override
protected Application configure() {
@@ -165,7 +166,7 @@ public class TestTransformJSONResource extends JerseyTest {
Mockito.when(niFiWebConfigurationContext.getComponentDetails(any(NiFiWebRequestContext.class))).thenReturn(componentDetails);
JoltSpecificationDTO joltSpecificationDTO = new
JoltSpecificationDTO("jolt-transform-custom", "[{ \"operation\": \"default\",
\"spec\":{ \"custom-id\" :4 }}]");
- joltSpecificationDTO.setCustomClass("TestCustomJoltTransform");
+ joltSpecificationDTO.setCustomClass(CUSTOM_CLASS_NAME);
ValidationDTO validate = client().target(getBaseUri())
.path("/standard/transformjson/validate")
.request()
@@ -185,7 +186,7 @@ public class TestTransformJSONResource extends JerseyTest {
Mockito.when(servletContext.getAttribute(Mockito.anyString())).thenReturn(niFiWebConfigurationContext);
Mockito.when(niFiWebConfigurationContext.getComponentDetails(any(NiFiWebRequestContext.class))).thenReturn(componentDetails);
JoltSpecificationDTO joltSpecificationDTO = new
JoltSpecificationDTO("jolt-transform-custom", "[{ \"operation\": \"default\",
\"spec\":{ \"custom-id\" :4 }}]");
- joltSpecificationDTO.setCustomClass("TestCustomJoltTransform");
+ joltSpecificationDTO.setCustomClass(CUSTOM_CLASS_NAME);
ValidationDTO validate = client().target(getBaseUri())
.path("/standard/transformjson/validate")
.request()
@@ -206,7 +207,7 @@ public class TestTransformJSONResource extends JerseyTest {
Mockito.when(niFiWebConfigurationContext.getComponentDetails(any(NiFiWebRequestContext.class))).thenReturn(componentDetails);
JoltSpecificationDTO joltSpecificationDTO = new
JoltSpecificationDTO("jolt-transform-custom", "{ \"operation\": \"default\",
\"spec\":{ \"custom-id\" :4 }}");
- joltSpecificationDTO.setCustomClass("TestCustomJoltTransform");
+ joltSpecificationDTO.setCustomClass(CUSTOM_CLASS_NAME);
ValidationDTO validate = client().target(getBaseUri())
.path("/standard/transformjson/validate")
.request()
@@ -221,7 +222,7 @@ public class TestTransformJSONResource extends JerseyTest {
JoltSpecificationDTO joltSpecificationDTO = new
JoltSpecificationDTO("jolt-transform-custom", "[{ \"operation\": \"default\",
\"spec\":{ \"custom-id\" :4 }}]");
String inputJson = "{\"rating\":{\"quality\":2,\"count\":1}}";
joltSpecificationDTO.setInput(inputJson);
- joltSpecificationDTO.setCustomClass("TestCustomJoltTransform");
+ joltSpecificationDTO.setCustomClass(CUSTOM_CLASS_NAME);
final Response response = client().target(getBaseUri())
.path("/standard/transformjson/execute")
.request()
diff --git a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/pom.xml
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/pom.xml
index 90e8d7bc67..cfc48291e4 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/pom.xml
+++ b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/pom.xml
@@ -28,12 +28,12 @@
<artifactId>nifi-utils</artifactId>
</dependency>
<dependency>
- <groupId>com.bazaarvoice.jolt</groupId>
- <artifactId>jolt-core</artifactId>
+ <groupId>io.github.jolt-community.jolt</groupId>
+ <artifactId>jolt-community-core</artifactId>
</dependency>
<dependency>
- <groupId>com.bazaarvoice.jolt</groupId>
- <artifactId>json-utils</artifactId>
+ <groupId>io.github.jolt-community.jolt</groupId>
+ <artifactId>json-community-utils</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@@ -67,6 +67,18 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformFactory.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformFactory.java
index a25aec4abf..af0655ea01 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformFactory.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformFactory.java
@@ -17,17 +17,18 @@
package org.apache.nifi.jolt.util;
-import com.bazaarvoice.jolt.CardinalityTransform;
-import com.bazaarvoice.jolt.Chainr;
-import com.bazaarvoice.jolt.Defaultr;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.Modifier;
-import com.bazaarvoice.jolt.Removr;
-import com.bazaarvoice.jolt.Shiftr;
-import com.bazaarvoice.jolt.Sortr;
-import com.bazaarvoice.jolt.SpecDriven;
-import com.bazaarvoice.jolt.chainr.spec.ChainrEntry;
-import com.bazaarvoice.jolt.exception.SpecException;
+import io.joltcommunity.jolt.CardinalityTransform;
+import io.joltcommunity.jolt.Chainr;
+import io.joltcommunity.jolt.Defaultr;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.Modifier;
+import io.joltcommunity.jolt.Shiftr;
+import io.joltcommunity.jolt.Sortr;
+import io.joltcommunity.jolt.SpecDriven;
+import io.joltcommunity.jolt.chainr.spec.ChainrEntry;
+import io.joltcommunity.jolt.exception.SpecException;
+import io.joltcommunity.jolt.removr.Removr;
+
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformUtils.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformUtils.java
index cc4eaaa87a..28087fbc50 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformUtils.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/main/java/org/apache/nifi/jolt/util/TransformUtils.java
@@ -16,12 +16,13 @@
*/
package org.apache.nifi.jolt.util;
+import io.joltcommunity.jolt.ContextualTransform;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.Transform;
+
import java.util.Collections;
import java.util.Map;
-import com.bazaarvoice.jolt.ContextualTransform;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.Transform;
public class TransformUtils {
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/jolt/util/TestTransformFactory.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/jolt/util/TestTransformFactory.java
index 8af55748db..c71fe85bae 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/jolt/util/TestTransformFactory.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/jolt/util/TestTransformFactory.java
@@ -17,24 +17,25 @@
package org.apache.nifi.jolt.util;
+import io.joltcommunity.jolt.CardinalityTransform;
+import io.joltcommunity.jolt.Chainr;
+import io.joltcommunity.jolt.Defaultr;
+import io.joltcommunity.jolt.JoltTransform;
+import io.joltcommunity.jolt.JsonUtils;
+import io.joltcommunity.jolt.Modifier;
+import io.joltcommunity.jolt.Shiftr;
+import io.joltcommunity.jolt.Sortr;
+import io.joltcommunity.jolt.removr.Removr;
+import org.apache.nifi.processors.jolt.CustomTransformJarProvider;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import org.junit.jupiter.api.Test;
-
-import com.bazaarvoice.jolt.CardinalityTransform;
-import com.bazaarvoice.jolt.Chainr;
-import com.bazaarvoice.jolt.Defaultr;
-import com.bazaarvoice.jolt.JoltTransform;
-import com.bazaarvoice.jolt.JsonUtils;
-import com.bazaarvoice.jolt.Modifier;
-import com.bazaarvoice.jolt.Removr;
-import com.bazaarvoice.jolt.Shiftr;
-import com.bazaarvoice.jolt.Sortr;
-
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -42,6 +43,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class TestTransformFactory {
+ private static final String CUSTOM_CLASS_NAME =
CustomTransformJarProvider.getCustomTransformClassName();
+ private static final String MISSING_CUSTOM_CLASS_NAME =
"org.apache.nifi.processors.jolt.MissingCustomJoltTransform";
+
+ @TempDir
+ Path tempDir;
+
@Test
void testGetChainTransform() throws Exception {
final String chainrSpec = new
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/chainrSpec.json")));
@@ -113,19 +120,21 @@ class TestTransformFactory {
@Test
void testGetCustomTransformation() throws Exception {
final String chainrSpec = new
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/chainrSpec.json")));
- Path jarFilePath =
Paths.get("src/test/resources/TestTransformFactory/TestCustomJoltTransform.jar");
+ Path jarFilePath =
CustomTransformJarProvider.createCustomTransformJar(tempDir);
URL[] urlPaths = new URL[1];
urlPaths[0] = jarFilePath.toUri().toURL();
- ClassLoader customClassLoader = new URLClassLoader(urlPaths,
this.getClass().getClassLoader());
- JoltTransform transform =
TransformFactory.getCustomTransform(customClassLoader,
"TestCustomJoltTransform", JsonUtils.jsonToObject(chainrSpec));
- assertNotNull(transform);
- assertEquals("TestCustomJoltTransform",
transform.getClass().getName());
+ try (URLClassLoader customClassLoader = new URLClassLoader(urlPaths,
this.getClass().getClassLoader())) {
+ JoltTransform transform =
TransformFactory.getCustomTransform(customClassLoader, CUSTOM_CLASS_NAME,
JsonUtils.jsonToObject(chainrSpec));
+ assertNotNull(transform);
+ assertEquals(CUSTOM_CLASS_NAME, transform.getClass().getName());
+ }
}
@Test
void testGetCustomTransformationNotFound() throws Exception {
final String chainrSpec = new
String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/chainrSpec.json")));
- ClassNotFoundException cnf =
assertThrows(ClassNotFoundException.class, () ->
TransformFactory.getCustomTransform(this.getClass().getClassLoader(),
"TestCustomJoltTransform", chainrSpec));
- assertEquals("TestCustomJoltTransform", cnf.getLocalizedMessage());
+ ClassNotFoundException cnf = assertThrows(ClassNotFoundException.class,
+ () ->
TransformFactory.getCustomTransform(this.getClass().getClassLoader(),
MISSING_CUSTOM_CLASS_NAME, chainrSpec));
+ assertEquals(MISSING_CUSTOM_CLASS_NAME, cnf.getLocalizedMessage());
}
}
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/CustomTransformJarProvider.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/CustomTransformJarProvider.java
new file mode 100644
index 0000000000..acf9db4f74
--- /dev/null
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/CustomTransformJarProvider.java
@@ -0,0 +1,53 @@
+/*
+ * 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.jolt;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+public final class CustomTransformJarProvider {
+ private static final String CLASS_ENTRY =
"org/apache/nifi/processors/jolt/TestCustomJoltTransform.class";
+ private static final String CUSTOM_TRANSFORM_CLASS_NAME =
"org.apache.nifi.processors.jolt.TestCustomJoltTransform";
+
+ private CustomTransformJarProvider() {
+ }
+
+ public static String getCustomTransformClassName() {
+ return CUSTOM_TRANSFORM_CLASS_NAME;
+ }
+
+ public static Path createCustomTransformJar(Path directory) throws
IOException {
+ Files.createDirectories(directory);
+ final Path jarPath = directory.resolve("TestCustomJoltTransform.jar");
+ try (final InputStream classStream =
CustomTransformJarProvider.class.getClassLoader().getResourceAsStream(CLASS_ENTRY))
{
+ if (classStream == null) {
+ throw new IllegalStateException("TestCustomJoltTransform class
not found on classpath");
+ }
+ try (final JarOutputStream jarOutputStream = new
JarOutputStream(Files.newOutputStream(jarPath))) {
+ final JarEntry jarEntry = new JarEntry(CLASS_ENTRY);
+ jarOutputStream.putNextEntry(jarEntry);
+ classStream.transferTo(jarOutputStream);
+ jarOutputStream.closeEntry();
+ }
+ }
+ return jarPath;
+ }
+}
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/TestCustomJoltTransform.java
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/TestCustomJoltTransform.java
similarity index 73%
rename from
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/TestCustomJoltTransform.java
rename to
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/TestCustomJoltTransform.java
index 791bfc106c..d9edefff9b 100644
---
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/TestCustomJoltTransform.java
+++
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/java/org/apache/nifi/processors/jolt/TestCustomJoltTransform.java
@@ -14,27 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import com.bazaarvoice.jolt.Chainr;
-
-import com.bazaarvoice.jolt.SpecDriven;
-import com.bazaarvoice.jolt.Transform;
+package org.apache.nifi.processors.jolt;
+import io.joltcommunity.jolt.Chainr;
+import io.joltcommunity.jolt.SpecDriven;
+import io.joltcommunity.jolt.Transform;
public class TestCustomJoltTransform implements SpecDriven, Transform {
- final private Transform customTransform;
+ private final Transform customTransform;
public TestCustomJoltTransform(Object specJson) {
this.customTransform = Chainr.fromSpec(specJson);
}
@Override
- public Object transform(Object o) {
- return customTransform.transform(o);
- }
-
- public static void main(String[] args) {
- System.out.println("This is a Test Custom Transform");
+ public Object transform(Object objectToTransform) {
+ return customTransform.transform(objectToTransform);
}
-
}
diff --git
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/resources/TestTransformFactory/TestCustomJoltTransform.jar
b/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/resources/TestTransformFactory/TestCustomJoltTransform.jar
deleted file mode 100644
index b738658f1c..0000000000
Binary files
a/nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-utils/src/test/resources/TestTransformFactory/TestCustomJoltTransform.jar
and /dev/null differ
diff --git a/nifi-extension-bundles/nifi-jolt-bundle/pom.xml
b/nifi-extension-bundles/nifi-jolt-bundle/pom.xml
index 448ddc7459..95d7b6215e 100644
--- a/nifi-extension-bundles/nifi-jolt-bundle/pom.xml
+++ b/nifi-extension-bundles/nifi-jolt-bundle/pom.xml
@@ -30,18 +30,18 @@
<module>nifi-jolt-utils</module>
</modules>
<properties>
- <jolt.version>0.1.8</jolt.version>
+ <jolt.version>1.1.0</jolt.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>com.bazaarvoice.jolt</groupId>
- <artifactId>jolt-core</artifactId>
+ <groupId>io.github.jolt-community.jolt</groupId>
+ <artifactId>jolt-community-core</artifactId>
<version>${jolt.version}</version>
</dependency>
<dependency>
- <groupId>com.bazaarvoice.jolt</groupId>
- <artifactId>json-utils</artifactId>
+ <groupId>io.github.jolt-community.jolt</groupId>
+ <artifactId>json-community-utils</artifactId>
<version>${jolt.version}</version>
</dependency>
<dependency>