godfreyhe commented on a change in pull request #12431:
URL: https://github.com/apache/flink/pull/12431#discussion_r434317689
##########
File path:
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
##########
@@ -166,6 +167,64 @@ public void write(int b) throws IOException {
}
}
+ @Test
+ public void testUseCatalog() throws Exception {
+ TestingExecutor executor = new TestingExecutorBuilder()
+ .setUseCatalogConsumer((ignored1, catalogName)
-> {
+ if (!catalogName.equals("cat")) {
+ throw new
SqlExecutionException("unexpected catalog name: " + catalogName);
+ }
+ })
+ .build();
+
+ InputStream inputStream = new ByteArrayInputStream("use catalog
cat;\n".getBytes());
+ ByteArrayOutputStream outputStream = new
ByteArrayOutputStream(256);
+ CliClient cliClient = null;
+ SessionContext sessionContext = new
SessionContext("test-session", new Environment());
+ String sessionId = executor.openSession(sessionContext);
+
+ try (Terminal terminal = new DumbTerminal(inputStream,
outputStream)) {
Review comment:
`CliClient` does not inherit from `AutoCloseable`, so we can put
`CliClient` into `try-with-resource` block
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]