You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2023/01/09 12:20:03 UTC
[GitHub] [ignite-3] Flaugh24 opened a new pull request, #1502: IGNITE-18491: Add tests for completers
Flaugh24 opened a new pull request, #1502:
URL: https://github.com/apache/ignite-3/pull/1502
JdbcUrlDynamicCompleterFactory, ClusterUrlDynamicCompleterFactory, FilePathCompleter
https://issues.apache.org/jira/browse/IGNITE-18491
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] Flaugh24 commented on a diff in pull request #1502: IGNITE-18491: Add tests for completers
Posted by GitBox <gi...@apache.org>.
Flaugh24 commented on code in PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502#discussion_r1072405813
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
Review Comment:
done
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
+
+ // Search in the folder for files which starts with 'scrpit'
+ List<String> completions2 = complete(words("sql", "--script-file", folder.getPath() + File.separator + "script"));
+ // Contains script1 and script2 files
+ assertThat(completions2, contains(script1, script2));
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] Flaugh24 commented on a diff in pull request #1502: IGNITE-18491: Add tests for completers
Posted by GitBox <gi...@apache.org>.
Flaugh24 commented on code in PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502#discussion_r1072405500
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
Review Comment:
done
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
+
+ // Search in the folder for files which starts with 'scrpit'
+ List<String> completions2 = complete(words("sql", "--script-file", folder.getPath() + File.separator + "script"));
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] Flaugh24 commented on a diff in pull request #1502: IGNITE-18491: Add tests for completers
Posted by GitBox <gi...@apache.org>.
Flaugh24 commented on code in PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502#discussion_r1072406356
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] PakhomovAlexander commented on a diff in pull request #1502: IGNITE-18491: Add tests for completers
Posted by GitBox <gi...@apache.org>.
PakhomovAlexander commented on code in PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502#discussion_r1071011567
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
Review Comment:
// Given files
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
+
+ // Search in the folder for files which starts with 'scrpit'
+ List<String> completions2 = complete(words("sql", "--script-file", folder.getPath() + File.separator + "script"));
+ // Contains script1 and script2 files
+ assertThat(completions2, contains(script1, script2));
Review Comment:
// Then ...
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
Review Comment:
// Then completions contain all given files
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
Review Comment:
looks like this empty line is not needed.
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
Review Comment:
Could you please add the test case for the folder that contains only folders but not files? Would it be completed correctly?
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
+
+ // Search in the folder for files which starts with 'scrpit'
+ List<String> completions2 = complete(words("sql", "--script-file", folder.getPath() + File.separator + "script"));
Review Comment:
// When complete --script-file with partial path to script
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
Review Comment:
// When complete --script-file with folder typed
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] Flaugh24 commented on a diff in pull request #1502: IGNITE-18491: Add tests for completers
Posted by GitBox <gi...@apache.org>.
Flaugh24 commented on code in PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502#discussion_r1072407243
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
Review Comment:
done
##########
modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java:
##########
@@ -356,6 +359,76 @@ void startStopNodeWhenCompleteNodeName() {
await().until(() -> complete(givenParsedLine), containsInAnyOrder(allNodeNames().toArray()));
}
+ @Test
+ @DisplayName("jdbc url suggested after --jdbc-url option")
+ void suggestedJdbcUrl() {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> jdbcUrlRegistry.jdbcUrls(), not(empty()));
+
+ // Then
+ List<String> completions = complete(words("sql", "--jdbc-url", ""));
+ assertThat(completions, containsInAnyOrder(jdbcUrlRegistry.jdbcUrls().toArray()));
+ }
+
+ private Stream<Arguments> clusterUrlSource() {
+ return Stream.of(
+ words("cluster", "config", "show", "--cluster-endpoint-url", ""),
+ words("cluster", "config", "update", "--cluster-endpoint-url", ""),
+ words("cluster", "status", "--cluster-endpoint-url", ""),
+ words("cluster", "init", "--cluster-endpoint-url", "")
+ ).map(this::named).map(Arguments::of);
+ }
+
+ @ParameterizedTest
+ @MethodSource("clusterUrlSource")
+ @DisplayName("cluster url suggested after --cluster-endpoint-url option")
+ void suggestedClusterUrl(ParsedLine parsedLine) {
+ // Given
+ connected();
+ // And the first update is fetched
+ await().until(() -> nodeNameRegistry.urls(), not(empty()));
+
+ // Then
+ String[] expectedUrls = nodeNameRegistry.urls().stream().map(URL::toString).toArray(String[]::new);
+ assertThat("For given parsed words: " + parsedLine.words(),
+ complete(parsedLine),
+ containsInAnyOrder(expectedUrls));
+ }
+
+ @Test
+ @DisplayName("files suggested after -script-file option")
+ void suggestedScriptFile() {
+
+ // Given
+
+ // Create temp folder
+ File folder = Files.newTemporaryFolder();
+
+ // Create temp files
+ String script1 = folder.getPath() + File.separator + "script1.sql";
+ Files.newFile(script1).deleteOnExit();
+
+ String script2 = folder.getPath() + File.separator + "script2.sql";
+ Files.newFile(script2).deleteOnExit();
+
+ String someFile = folder.getPath() + File.separator + "someFile.sql";
+ Files.newFile(someFile).deleteOnExit();
+
+ // Then
+
+ // Search in the folder
+ List<String> completions1 = complete(words("sql", "--script-file", folder.getPath()));
+ // Contains all files
+ assertThat(completions1, contains(script1, script2, someFile));
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [ignite-3] ptupitsyn merged pull request #1502: IGNITE-18491 Add tests for CLI completers
Posted by GitBox <gi...@apache.org>.
ptupitsyn merged PR #1502:
URL: https://github.com/apache/ignite-3/pull/1502
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org