This is an automated email from the ASF dual-hosted git repository. jongyoul pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new ed2b00f [ZEPPELIN-5523] Activate interpreter tests ed2b00f is described below commit ed2b00ff1a68c30c484d2b8bb8a909d9000784f3 Author: Philipp Dallig <philipp.dal...@gmail.com> AuthorDate: Wed Sep 15 15:21:57 2021 +0200 [ZEPPELIN-5523] Activate interpreter tests ### What is this PR for? This PR adds influxdb, ksql and scalding to our ci job. ### What type of PR is it? - Improvement ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-5523 ### How should this be tested? * CI ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Philipp Dallig <philipp.dal...@gmail.com> Closes #4225 from Reamer/activateInterpreterTests and squashes the following commits: b1ffa3943 [Philipp Dallig] Fix KSQL tests 5e0fd90c9 [Philipp Dallig] Activate more interpreter tests --- .github/workflows/core.yml | 2 +- .../apache/zeppelin/ksql/BasicKSQLHttpClient.java | 10 ++++---- .../apache/zeppelin/ksql/KSQLInterpreterTest.java | 2 ++ ksql/src/test/resources/log4j.properties | 30 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 81e0822..154cd24 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -73,7 +73,7 @@ jobs: test-interpreter-modules: runs-on: ubuntu-20.04 env: - INTERPRETERS: 'beam,hbase,pig,jdbc,file,flink,flink-cmd,ignite,kylin,lens,cassandra,elasticsearch,bigquery,alluxio,scio,livy,groovy,sap,java,geode,neo4j,hazelcastjet,submarine,sparql,mongodb' + INTERPRETERS: 'beam,hbase,pig,jdbc,file,flink,flink-cmd,ignite,kylin,lens,cassandra,elasticsearch,bigquery,alluxio,scio,livy,groovy,sap,java,geode,neo4j,hazelcastjet,submarine,sparql,mongodb,influxdb,ksql,scalding' steps: - name: Checkout uses: actions/checkout@v2 diff --git a/ksql/src/main/java/org/apache/zeppelin/ksql/BasicKSQLHttpClient.java b/ksql/src/main/java/org/apache/zeppelin/ksql/BasicKSQLHttpClient.java index 72e41db..937a5d3 100644 --- a/ksql/src/main/java/org/apache/zeppelin/ksql/BasicKSQLHttpClient.java +++ b/ksql/src/main/java/org/apache/zeppelin/ksql/BasicKSQLHttpClient.java @@ -26,14 +26,13 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; public class BasicKSQLHttpClient implements Closeable { - public static final String UTF_8 = "utf-8"; - interface BasicHTTPClientResponse { void onMessage(int status, String message); @@ -72,7 +71,7 @@ public class BasicKSQLHttpClient implements Closeable { private void writeOutput(String data) throws IOException { try (OutputStream os = connection.getOutputStream()) { - byte[] input = data.getBytes(UTF_8); + byte[] input = data.getBytes(StandardCharsets.UTF_8); os.write(input); } } @@ -81,7 +80,7 @@ public class BasicKSQLHttpClient implements Closeable { int status = createConnection(); boolean isStatusOk = isStatusOk(status); return IOUtils.toString(isStatusOk ? - connection.getInputStream() : connection.getErrorStream(), UTF_8); + connection.getInputStream() : connection.getErrorStream(), StandardCharsets.UTF_8.name()); } public void connectAsync(BasicHTTPClientResponse onResponse) throws IOException { @@ -89,7 +88,8 @@ public class BasicKSQLHttpClient implements Closeable { boolean isStatusOk = isStatusOk(status); long start = System.currentTimeMillis(); - try (InputStreamReader in = new InputStreamReader(connection.getInputStream(), UTF_8); + try (InputStreamReader in = new InputStreamReader(connection.getInputStream(), + StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(in)) { while (connected && (timeout == -1 || System.currentTimeMillis() - start < timeout)) { if (br.ready()) { diff --git a/ksql/src/test/java/org/apache/zeppelin/ksql/KSQLInterpreterTest.java b/ksql/src/test/java/org/apache/zeppelin/ksql/KSQLInterpreterTest.java index 93bba35..0fd01fd 100644 --- a/ksql/src/test/java/org/apache/zeppelin/ksql/KSQLInterpreterTest.java +++ b/ksql/src/test/java/org/apache/zeppelin/ksql/KSQLInterpreterTest.java @@ -101,6 +101,7 @@ public class KSQLInterpreterTest { "value 1\n" + "value 2\n" + "value 3\n"; + context.out.flush(); assertEquals(1, context.out.toInterpreterResultMessage().size()); assertEquals(expected, context.out.toInterpreterResultMessage().get(0).toString()); assertEquals(InterpreterResult.Type.TABLE, context.out @@ -147,6 +148,7 @@ public class KSQLInterpreterTest { // then List<Map<String, Object>> expected = Arrays.asList(row1, row2); + context.out.flush(); String[] lines = context.out.toInterpreterResultMessage() .get(0).toString() .replace("%table ", "") diff --git a/ksql/src/test/resources/log4j.properties b/ksql/src/test/resources/log4j.properties new file mode 100644 index 0000000..4f78acf --- /dev/null +++ b/ksql/src/test/resources/log4j.properties @@ -0,0 +1,30 @@ +# +# 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. +# + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p [%t] %c:%L - %m%n +#log4j.appender.stdout.layout.ConversionPattern= +#%5p [%t] (%F:%L) - %m%n +#%-4r [%t] %-5p %c %x - %m%n +# + +# Root logger option +log4j.rootLogger=INFO, stdout +#log4j.logger.org.apache.zeppelin.interpreter=DEBUG