This is an automated email from the ASF dual-hosted git repository.
pvillard 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 b09a778 NIFI-9685 Upgraded JNA to 5.10.0
b09a778 is described below
commit b09a778d9016e09f23c3aa065f740bb7156e07ec
Author: exceptionfactory <[email protected]>
AuthorDate: Mon Feb 14 15:54:27 2022 -0600
NIFI-9685 Upgraded JNA to 5.10.0
- Upgraded nifi-bootstrap-utils JNA from 4.4.0 to 5.10.0
- Upgraded nifi-windows-event-log-processors JNA from 4.5.2 to 5.10.0
- Upgraded nifi-toolkit-cli JLine from 3.5.2 to 3.21.0
Signed-off-by: Pierre Villard <[email protected]>
This closes #5766.
---
nifi-commons/nifi-bootstrap-utils/pom.xml | 2 +-
.../nifi-windows-event-log-processors/pom.xml | 2 +-
nifi-toolkit/nifi-toolkit-cli/pom.xml | 8 ++-
.../apache/nifi/toolkit/cli/TestCLICompleter.java | 80 ++++++++++++++++------
4 files changed, 67 insertions(+), 25 deletions(-)
diff --git a/nifi-commons/nifi-bootstrap-utils/pom.xml
b/nifi-commons/nifi-bootstrap-utils/pom.xml
index 8cb3ca1..c27062b 100644
--- a/nifi-commons/nifi-bootstrap-utils/pom.xml
+++ b/nifi-commons/nifi-bootstrap-utils/pom.xml
@@ -29,7 +29,7 @@ language governing permissions and limitations under the
License. -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
- <version>4.4.0</version>
+ <version>5.10.0</version>
</dependency>
</dependencies>
</project>
diff --git
a/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/pom.xml
b/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/pom.xml
index 7d6be6e..59b3a0e 100644
---
a/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/pom.xml
+++
b/nifi-nar-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/pom.xml
@@ -21,7 +21,7 @@ language governing permissions and limitations under the
License. -->
<packaging>jar</packaging>
<properties>
- <jna.version>4.5.2</jna.version>
+ <jna.version>5.10.0</jna.version>
<javassist.version>3.23.1-GA</javassist.version>
</properties>
diff --git a/nifi-toolkit/nifi-toolkit-cli/pom.xml
b/nifi-toolkit/nifi-toolkit-cli/pom.xml
index 4bba01c..58e2f02 100644
--- a/nifi-toolkit/nifi-toolkit-cli/pom.xml
+++ b/nifi-toolkit/nifi-toolkit-cli/pom.xml
@@ -23,6 +23,10 @@
<artifactId>nifi-toolkit-cli</artifactId>
<description>Tooling to make tls configuration easier</description>
+ <properties>
+ <jline.version>3.21.0</jline.version>
+ </properties>
+
<build>
<resources>
<resource>
@@ -90,12 +94,12 @@
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
- <version>3.5.2</version>
+ <version>${jline.version}</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jna</artifactId>
- <version>3.5.2</version>
+ <version>${jline.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
diff --git
a/nifi-toolkit/nifi-toolkit-cli/src/test/java/org/apache/nifi/toolkit/cli/TestCLICompleter.java
b/nifi-toolkit/nifi-toolkit-cli/src/test/java/org/apache/nifi/toolkit/cli/TestCLICompleter.java
index 35e1ee0..b0ebac1 100644
---
a/nifi-toolkit/nifi-toolkit-cli/src/test/java/org/apache/nifi/toolkit/cli/TestCLICompleter.java
+++
b/nifi-toolkit/nifi-toolkit-cli/src/test/java/org/apache/nifi/toolkit/cli/TestCLICompleter.java
@@ -31,9 +31,10 @@ import
org.apache.nifi.toolkit.cli.impl.command.registry.NiFiRegistryCommandGrou
import org.apache.nifi.toolkit.cli.impl.context.StandardContext;
import org.apache.nifi.toolkit.cli.impl.session.InMemorySession;
import org.apache.nifi.toolkit.cli.impl.session.SessionVariable;
+import org.apache.nifi.util.StringUtils;
import org.jline.reader.Candidate;
import org.jline.reader.LineReader;
-import org.jline.reader.impl.DefaultParser;
+import org.jline.reader.ParsedLine;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -76,8 +77,7 @@ public class TestCLICompleter {
@Test
public void testCompletionWithWordIndexNegative() {
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Collections.emptyList(), -1, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Collections.emptyList(), -1);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -86,8 +86,7 @@ public class TestCLICompleter {
@Test
public void testCompletionWithWordIndexZero() {
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Collections.emptyList(), 0, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Collections.emptyList(), 0);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -98,8 +97,7 @@ public class TestCLICompleter {
public void testCompletionWithWordIndexOneAndMatching() {
final String topCommand =
NiFiRegistryCommandGroup.REGISTRY_COMMAND_GROUP;
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Collections.singletonList(topCommand), 1, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Collections.singletonList(topCommand), 1);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -110,8 +108,7 @@ public class TestCLICompleter {
public void testCompletionWithWordIndexOneAndNotMatching() {
final String topCommand = "NOT-A-TOP-LEVEL-COMMAND";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Collections.singletonList(topCommand), 1, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Collections.singletonList(topCommand), 1);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -123,8 +120,7 @@ public class TestCLICompleter {
final String topCommand =
NiFiRegistryCommandGroup.REGISTRY_COMMAND_GROUP;
final String subCommand = "list-buckets";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Arrays.asList(topCommand, subCommand), 2, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Arrays.asList(topCommand, subCommand), 2);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -137,8 +133,7 @@ public class TestCLICompleter {
final String topCommand =
NiFiRegistryCommandGroup.REGISTRY_COMMAND_GROUP;
final String subCommand = "NOT-A-TOP-LEVEL-COMMAND";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Arrays.asList(topCommand, subCommand), 2, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Arrays.asList(topCommand, subCommand), 2);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -150,8 +145,7 @@ public class TestCLICompleter {
final String topCommand =
NiFiRegistryCommandGroup.REGISTRY_COMMAND_GROUP;
final String subCommand = "list-buckets";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Arrays.asList(topCommand, subCommand, "-ks", "foo",
"-kst", "JKS"), 6, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Arrays.asList(topCommand, subCommand, "-ks", "foo", "-kst",
"JKS"), 5);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -164,8 +158,7 @@ public class TestCLICompleter {
final String topCommand =
NiFiRegistryCommandGroup.REGISTRY_COMMAND_GROUP;
final String subCommand = "list-buckets";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Arrays.asList(topCommand, subCommand, "-p",
"src/test/resources/"), 3, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Arrays.asList(topCommand, subCommand, "-p",
"src/test/resources/"), 3);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -187,8 +180,7 @@ public class TestCLICompleter {
final String topCommand = "session";
final String subCommand = "set";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList(
- "", Arrays.asList(topCommand, subCommand), 2, -1, -1);
+ final ParsedLine parsedLine = new
TestParsedLine(Arrays.asList(topCommand, subCommand), 2);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -201,13 +193,13 @@ public class TestCLICompleter {
final String topCommand = "session";
final String subCommand = "set";
- final DefaultParser.ArgumentList parsedLine = new
DefaultParser.ArgumentList("",
+ final ParsedLine parsedLine = new TestParsedLine(
Arrays.asList(
topCommand,
subCommand,
SessionVariable.NIFI_CLIENT_PROPS.getVariableName(),
"src/test/resources/"),
- 3, -1, -1);
+ 3);
final List<Candidate> candidates = new ArrayList<>();
completer.complete(lineReader, parsedLine, candidates);
@@ -224,4 +216,50 @@ public class TestCLICompleter {
assertTrue(found);
}
+ private static class TestParsedLine implements ParsedLine {
+ private final List<String> words;
+
+ private final int wordIndex;
+
+ private TestParsedLine(
+ final List<String> words,
+ final int wordIndex
+ ) {
+ this.words = words;
+ this.wordIndex = wordIndex;
+ }
+
+ @Override
+ public String word() {
+ if (wordIndex >= words.size()) {
+ return StringUtils.EMPTY;
+ }
+ return words.get(wordIndex);
+ }
+
+ @Override
+ public int wordCursor() {
+ return 0;
+ }
+
+ @Override
+ public int wordIndex() {
+ return wordIndex;
+ }
+
+ @Override
+ public List<String> words() {
+ return words;
+ }
+
+ @Override
+ public String line() {
+ return StringUtils.join(words, " ");
+ }
+
+ @Override
+ public int cursor() {
+ return 0;
+ }
+ }
}