[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-09-24 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16625506#comment-16625506
 ] 

ASF subversion and git services commented on KYLIN-3497:


Commit 715f819f7f8013578cbe392c7f3e2ace1bf97b38 in kylin's branch 
refs/heads/update_travis_maven from hujixu
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=715f819 ]

KYLIN-3497 Make JDBC Module more testable

De-coupling IRemoteClient with KylinConnection.
Add dependencies mocking to improve test coverage.


> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
> Fix For: v2.6.0
>
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-09-21 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16623341#comment-16623341
 ] 

ASF GitHub Bot commented on KYLIN-3497:
---

shaofengshi closed pull request #199: KYLIN-3497 Make JDBC Module more testable
URL: https://github.com/apache/kylin/pull/199
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/jdbc/pom.xml b/jdbc/pom.xml
index 661356c412..a04d81b4c5 100644
--- a/jdbc/pom.xml
+++ b/jdbc/pom.xml
@@ -52,6 +52,13 @@
 test
 
 
+
+org.mockito
+mockito-core
+${mockito.version}
+test
+
+
 
 
 
diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/IRemoteClient.java 
b/jdbc/src/main/java/org/apache/kylin/jdbc/IRemoteClient.java
index dfd8d76719..630eedd1fc 100644
--- a/jdbc/src/main/java/org/apache/kylin/jdbc/IRemoteClient.java
+++ b/jdbc/src/main/java/org/apache/kylin/jdbc/IRemoteClient.java
@@ -23,13 +23,12 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.calcite.avatica.AvaticaParameter;
 import org.apache.calcite.avatica.ColumnMetaData;
 import org.apache.kylin.jdbc.KylinMeta.KMetaProject;
 
 public interface IRemoteClient extends Closeable {
 
-public static class QueryResult {
+class QueryResult {
 public final List columnMeta;
 public final Iterable iterable;
 
@@ -42,16 +41,16 @@ public QueryResult(List columnMeta, 
Iterable iterable) {
 /**
  * Connect to Kylin restful service. IOException will be thrown if 
authentication failed.
  */
-public void connect() throws IOException;
+void connect() throws IOException;
 
 /**
  * Retrieve meta data of given project.
  */
-public KMetaProject retrieveMetaData(String project) throws IOException;
+KMetaProject retrieveMetaData(String project) throws IOException;
 
 /**
  * Execute query remotely and get back result.
  */
-public QueryResult executeQuery(String sql, List params, 
List paramValues, Map queryToggles) throws IOException;
+QueryResult executeQuery(String sql, List paramValues, Map queryToggles) throws IOException;
 
 }
diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/JdbcFactory.java 
b/jdbc/src/main/java/org/apache/kylin/jdbc/JdbcFactory.java
new file mode 100644
index 00..f95a30125a
--- /dev/null
+++ b/jdbc/src/main/java/org/apache/kylin/jdbc/JdbcFactory.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+package org.apache.kylin.jdbc;
+
+import org.apache.calcite.avatica.AvaticaFactory;
+
+public interface JdbcFactory extends RemoteClientFactory, AvaticaFactory {
+}
diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java 
b/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java
index 9f8c7dd24e..b98b2d108c 100644
--- a/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java
+++ b/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java
@@ -34,11 +34,11 @@
 
 import javax.xml.bind.DatatypeConverter;
 
-import org.apache.calcite.avatica.AvaticaParameter;
 import org.apache.calcite.avatica.ColumnMetaData;
 import org.apache.calcite.avatica.ColumnMetaData.Rep;
 import org.apache.calcite.avatica.ColumnMetaData.ScalarType;
 import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpRequestBase;
@@ -64,19 +64,20 @@
 
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.annotations.VisibleForTesting;
 
 public class KylinClient implements IRemoteClient {
 
 private static final Logger logger = 
LoggerFactory.getLogger(KylinClient.class);
 
-private final KylinConnection conn;
+private final KylinConnectionInfo connInfo;
 private final 

[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-09-21 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16623342#comment-16623342
 ] 

ASF subversion and git services commented on KYLIN-3497:


Commit 715f819f7f8013578cbe392c7f3e2ace1bf97b38 in kylin's branch 
refs/heads/master from hujixu
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=715f819 ]

KYLIN-3497 Make JDBC Module more testable

De-coupling IRemoteClient with KylinConnection.
Add dependencies mocking to improve test coverage.


> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
> Fix For: v2.6.0
>
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-08-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16579576#comment-16579576
 ] 

ASF GitHub Bot commented on KYLIN-3497:
---

codecov-io commented on issue #199: KYLIN-3497 Make JDBC Module more testable
URL: https://github.com/apache/kylin/pull/199#issuecomment-412819042
 
 
   # [Codecov](https://codecov.io/gh/apache/kylin/pull/199?src=pr=h1) Report
   > :exclamation: No coverage uploaded for pull request base 
(`master@ddfed27`). [Click here to learn what that 
means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
   > The diff coverage is `76.92%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/kylin/pull/199/graphs/tree.svg?height=150=650=JawVgbgsVo=pr)](https://codecov.io/gh/apache/kylin/pull/199?src=pr=tree)
   
   ```diff
   @@Coverage Diff@@
   ## master #199   +/-   ##
   =
 Coverage  ?   21.45%   
 Complexity? 4357   
   =
 Files ? 1069   
 Lines ?67824   
 Branches  ? 9836   
   =
 Hits  ?14553   
 Misses?51889   
 Partials  ? 1382
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/kylin/pull/199?src=pr=tree) | Coverage Δ 
| Complexity Δ | |
   |---|---|---|---|
   | 
[...main/java/org/apache/kylin/jdbc/IRemoteClient.java](https://codecov.io/gh/apache/kylin/pull/199/diff?src=pr=tree#diff-amRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3lsaW4vamRiYy9JUmVtb3RlQ2xpZW50LmphdmE=)
 | `100% <ø> (ø)` | `0 <0> (?)` | |
   | 
[...n/java/org/apache/kylin/jdbc/KylinJdbcFactory.java](https://codecov.io/gh/apache/kylin/pull/199/diff?src=pr=tree#diff-amRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3lsaW4vamRiYy9LeWxpbkpkYmNGYWN0b3J5LmphdmE=)
 | `72.22% <ø> (ø)` | `7 <0> (?)` | |
   | 
[...ain/java/org/apache/kylin/jdbc/KylinResultSet.java](https://codecov.io/gh/apache/kylin/pull/199/diff?src=pr=tree#diff-amRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3lsaW4vamRiYy9LeWxpblJlc3VsdFNldC5qYXZh)
 | `86.95% <100%> (ø)` | `5 <0> (?)` | |
   | 
[...in/java/org/apache/kylin/jdbc/KylinConnection.java](https://codecov.io/gh/apache/kylin/pull/199/diff?src=pr=tree#diff-amRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3lsaW4vamRiYy9LeWxpbkNvbm5lY3Rpb24uamF2YQ==)
 | `73.91% <50%> (ø)` | `12 <2> (?)` | |
   | 
[...c/main/java/org/apache/kylin/jdbc/KylinClient.java](https://codecov.io/gh/apache/kylin/pull/199/diff?src=pr=tree#diff-amRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3lsaW4vamRiYy9LeWxpbkNsaWVudC5qYXZh)
 | `67.67% <80%> (ø)` | `33 <8> (?)` | |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/kylin/pull/199?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/kylin/pull/199?src=pr=footer). Last 
update 
[ddfed27...c23a8c0](https://codecov.io/gh/apache/kylin/pull/199?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-08-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16579493#comment-16579493
 ] 

ASF GitHub Bot commented on KYLIN-3497:
---

asfgit commented on issue #199: KYLIN-3497 Make JDBC Module more testable
URL: https://github.com/apache/kylin/pull/199#issuecomment-412808466
 
 
   Can one of the admins verify this patch?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-08-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16579492#comment-16579492
 ] 

ASF GitHub Bot commented on KYLIN-3497:
---

ian4hu opened a new pull request #199: KYLIN-3497 Make JDBC Module more testable
URL: https://github.com/apache/kylin/pull/199
 
 
   De-coupling IRemoteClient with KylinConnection.
   Add dependencies mocking to improve test coverage.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (KYLIN-3497) Make JDBC Module more testable

2018-08-13 Thread Billy Liu (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16579134#comment-16579134
 ] 

Billy Liu commented on KYLIN-3497:
--

+1. If you need any help, please let the community know.

> Make JDBC Module more testable
> --
>
> Key: KYLIN-3497
> URL: https://issues.apache.org/jira/browse/KYLIN-3497
> Project: Kylin
>  Issue Type: Improvement
>  Components: Driver - JDBC
>Reporter: Ian Hu
>Assignee: Ian Hu
>Priority: Minor
>
> While I am trying my work about KYLIN-3496, I found it is difficult to test. 
> I would offer a work to make it more testable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)