Skip to content

Commit

Permalink
NIFI-12680 Fixed JAR for DefaultedDynamicClassPathModificationIT
Browse files Browse the repository at this point in the history
- Adjusted test flow to find available version of commons-lang3 instead of depending on a specific version from the default property value

This closes #8307

Signed-off-by: David Handermann <exceptionfactory@apache.org>
  • Loading branch information
exceptionfactory committed Feb 9, 2024
1 parent ba2e24b commit 6612077
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import org.apache.nifi.web.api.entity.ProcessorEntity;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -87,6 +89,15 @@ private void createFlow() throws NiFiClientException, IOException {
ProcessorEntity terminateSuccess = getClientUtil().createProcessor("TerminateFlowFile");
ProcessorEntity terminateFailure = getClientUtil().createProcessor("TerminateFlowFile");

// Find the commons-lang3 jar that is in the bootstrap directory regardless of version number
final File lib = new File(getNiFiInstance().getInstanceDirectory(), "lib");
final File bootstrapLib = new File(lib, "bootstrap");
final File[] listing = bootstrapLib.listFiles(file -> file.getName().endsWith(".jar") && file.getName().startsWith("commons-lang3"));
if (listing != null && listing.length >= 1) {
final File lang3Jar = listing[0];
defaultedModifyClasspathProcessor = getClientUtil().updateProcessorProperties(defaultedModifyClasspathProcessor, Collections.singletonMap("URLs to Load", lang3Jar.getAbsolutePath()));
}

defaultedModifyClasspathInputConnection = getClientUtil().createConnection(generateFlowFileProcessor, defaultedModifyClasspathProcessor, "success");
successConnection = getClientUtil().createConnection(defaultedModifyClasspathProcessor, terminateSuccess, "success");
failureConnection = getClientUtil().createConnection(defaultedModifyClasspathProcessor, terminateFailure, "failure");
Expand Down

0 comments on commit 6612077

Please sign in to comment.