You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2020/08/15 08:07:44 UTC
[kylin] branch 3.0.x updated (a75c70e -> 40e430b)
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a change to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/kylin.git.
from a75c70e KYLIN-4543 fix compilation error
new 81995ca minor, update restclient
new eb43eeb Revert "KYLIN-4543 Remove the usage for jackson enableDefaultTyping()"
new 40e430b Revert "KYLIN-4543 fix compilation error"
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/kylin/common/restclient/RestClient.java | 13 +++++++++----
.../java/org/apache/kylin/common/util/JsonUtil.java | 10 ++++++++++
.../apache/kylin/restclient/ITRestClientTest.java | 20 ++++++++++++++++++++
.../kylin/tool/metrics/systemcube/SCCreator.java | 2 +-
4 files changed, 40 insertions(+), 5 deletions(-)
[kylin] 02/03: Revert "KYLIN-4543 Remove the usage for jackson
enableDefaultTyping()"
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit eb43eeb3245caf87210c0d2fb820c62193a0542f
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Aug 15 15:28:24 2020 +0800
Revert "KYLIN-4543 Remove the usage for jackson enableDefaultTyping()"
This reverts commit a3df4f3bf69e3910aecb486e953332fbb9dd0c95.
---
.../src/main/java/org/apache/kylin/common/util/JsonUtil.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/core-common/src/main/java/org/apache/kylin/common/util/JsonUtil.java b/core-common/src/main/java/org/apache/kylin/common/util/JsonUtil.java
index 1a8e7cc..8cb7f65 100644
--- a/core-common/src/main/java/org/apache/kylin/common/util/JsonUtil.java
+++ b/core-common/src/main/java/org/apache/kylin/common/util/JsonUtil.java
@@ -45,10 +45,12 @@ public class JsonUtil {
// reuse the object mapper to save memory footprint
private static final ObjectMapper mapper = new ObjectMapper();
private static final ObjectMapper indentMapper = new ObjectMapper();
+ private static final ObjectMapper typeMapper = new ObjectMapper();
static {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
indentMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
+ typeMapper.enableDefaultTyping();
}
public static <T> T readValue(File src, Class<T> valueType)
@@ -91,6 +93,10 @@ public class JsonUtil {
return mapper.readTree(content);
}
+ public static <T> T readValueWithTyping(InputStream src, Class<T> valueType) throws IOException {
+ return typeMapper.readValue(src, valueType);
+ }
+
public static void writeValueIndent(OutputStream out, Object value)
throws IOException, JsonGenerationException, JsonMappingException {
indentMapper.writeValue(out, value);
@@ -112,4 +118,8 @@ public class JsonUtil {
public static String writeValueAsIndentString(Object value) throws JsonProcessingException {
return indentMapper.writeValueAsString(value);
}
+
+ public static void writeValueWithTyping(OutputStream out, Object value) throws IOException {
+ typeMapper.writeValue(out, value);
+ }
}
\ No newline at end of file
[kylin] 03/03: Revert "KYLIN-4543 fix compilation error"
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 40e430b801bc3f4abbac5e3a6d5417b57b2be294
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Aug 15 15:29:44 2020 +0800
Revert "KYLIN-4543 fix compilation error"
This reverts commit a75c70ee2c75738e8f8224bd807a6a7409d6cca7.
---
.../main/java/org/apache/kylin/tool/metrics/systemcube/SCCreator.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tool/src/main/java/org/apache/kylin/tool/metrics/systemcube/SCCreator.java b/tool/src/main/java/org/apache/kylin/tool/metrics/systemcube/SCCreator.java
index bdb1f7f..8a6c98c 100644
--- a/tool/src/main/java/org/apache/kylin/tool/metrics/systemcube/SCCreator.java
+++ b/tool/src/main/java/org/apache/kylin/tool/metrics/systemcube/SCCreator.java
@@ -118,7 +118,7 @@ public class SCCreator extends AbstractApplication {
output += "/";
}
- Set<SinkTool> sourceToolSet = JsonUtil.readValue(
+ Set<SinkTool> sourceToolSet = JsonUtil.readValueWithTyping(
new BufferedInputStream(new FileInputStream(new File(inputConfig))), HashSet.class);
run(owner, output, sourceToolSet);
}
[kylin] 01/03: minor, update restclient
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 81995ca99394d64ff4bc304a47abf9dd60792d25
Author: shaofengshi <sh...@apache.org>
AuthorDate: Sat Aug 15 10:14:17 2020 +0800
minor, update restclient
---
.../apache/kylin/common/restclient/RestClient.java | 13 +++++++++----
.../apache/kylin/restclient/ITRestClientTest.java | 20 ++++++++++++++++++++
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java b/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java
index 955b0ff..bf13059 100644
--- a/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java
+++ b/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java
@@ -201,24 +201,29 @@ public class RestClient {
}
public String getKylinProperties() throws IOException {
- String url = baseUrl + "/admin/config";
- HttpGet request = new HttpGet(url);
+ return getConfiguration(baseUrl + "/admin/config", true);
+ }
+
+ private String getConfiguration(String url, boolean ifAuth) throws IOException {
+ HttpGet request = ifAuth ? newGet(url) : new HttpGet(url);
HttpResponse response = null;
try {
response = client.execute(request);
String msg = EntityUtils.toString(response.getEntity());
- Map<String, String> map = JsonUtil.readValueAsMap(msg);
- msg = map.get("config");
if (response.getStatusLine().getStatusCode() != 200)
throw new IOException(INVALID_RESPONSE + response.getStatusLine().getStatusCode()
+ " with cache wipe url " + url + "\n" + msg);
+
+ Map<String, String> map = JsonUtil.readValueAsMap(msg);
+ msg = map.get("config");
return msg;
} finally {
cleanup(request, response);
}
}
+
public boolean enableCache() throws IOException {
return setCache(true);
}
diff --git a/kylin-it/src/test/java/org/apache/kylin/restclient/ITRestClientTest.java b/kylin-it/src/test/java/org/apache/kylin/restclient/ITRestClientTest.java
index adf98fa..b73f7b4 100644
--- a/kylin-it/src/test/java/org/apache/kylin/restclient/ITRestClientTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/restclient/ITRestClientTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Random;
@@ -104,6 +105,25 @@ public class ITRestClientTest extends HBaseMetadataTestCase {
HttpResponse result = client.query(sql, PROJECT_NAME);
}
+ @Test
+ public void testGetConfigByAdmin() throws Exception {
+ RestClient client = new RestClient(HOST, PORT, USERNAME, PASSWD);
+ String result = client.getKylinProperties();
+ assertTrue(result != null && result.length() > 0);
+ }
+
+ @Test(expected = IOException.class)
+ public void testGetConfigUnauthorized() throws Exception {
+ RestClient client = new RestClient(HOST, PORT, "", "");
+ client.getKylinProperties();
+ }
+
+ @Test(expected = IOException.class)
+ public void testGetConfigNonAdmin() throws Exception {
+ RestClient client = new RestClient(HOST, PORT, "MODELER", "MODELER");
+ client.getKylinProperties();
+ }
+
protected static void stopJetty() throws Exception {
if (server != null)
server.stop();