Repository: zeppelin
Updated Branches:
  refs/heads/master b9d2f40bd -> 6919c4ad3


ZEPPELIN-3159. Fixed Checkstyle errors and warnings in jdbc module

### What is this PR for?
Fixed the Checkstyle errors and warnings in the jdbc module.

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-3159

### How should this be tested?
* CI pass

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Jan Hentschel <jan.hentsc...@ultratendency.com>

Closes #2801 from HorizonNet/ZEPPELIN-3159 and squashes the following commits:

7771c26 [Jan Hentschel] ZEPPELIN-3159. Fixed Checkstyle errors and warnings in 
jdbc module


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6919c4ad
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6919c4ad
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6919c4ad

Branch: refs/heads/master
Commit: 6919c4ad32e872f3658506c74447ab353d89c89e
Parents: b9d2f40
Author: Jan Hentschel <jan.hentsc...@ultratendency.com>
Authored: Wed Feb 14 14:38:58 2018 +0100
Committer: Jeff Zhang <zjf...@apache.org>
Committed: Wed Mar 14 09:59:53 2018 +0800

----------------------------------------------------------------------
 jdbc/pom.xml                                    |   7 +
 .../apache/zeppelin/jdbc/JDBCInterpreter.java   |  65 ++++---
 .../zeppelin/jdbc/JDBCUserConfigurations.java   |   5 +-
 .../org/apache/zeppelin/jdbc/SqlCompleter.java  |  58 +++----
 .../jdbc/security/JDBCSecurityImpl.java         |  12 +-
 .../zeppelin/jdbc/JDBCInterpreterTest.java      |  74 ++++----
 .../apache/zeppelin/jdbc/SqlCompleterTest.java  | 171 +++++++++++--------
 7 files changed, 214 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/jdbc/pom.xml b/jdbc/pom.xml
index ba745dd..eef9aa8 100644
--- a/jdbc/pom.xml
+++ b/jdbc/pom.xml
@@ -362,6 +362,13 @@
       <plugin>
         <artifactId>maven-resources-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index 0265e2d..56afe6f 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -14,6 +14,27 @@
  */
 package org.apache.zeppelin.jdbc;
 
+import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
+import static org.apache.commons.lang.StringUtils.isEmpty;
+import static org.apache.commons.lang.StringUtils.isNotEmpty;
+import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
+
+import org.apache.commons.dbcp2.ConnectionFactory;
+import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
+import org.apache.commons.dbcp2.PoolableConnectionFactory;
+import org.apache.commons.dbcp2.PoolingDriver;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.apache.commons.lang.mutable.MutableBoolean;
+import org.apache.commons.pool2.ObjectPool;
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.alias.CredentialProvider;
+import org.apache.hadoop.security.alias.CredentialProviderFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
@@ -33,19 +54,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.dbcp2.ConnectionFactory;
-import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
-import org.apache.commons.dbcp2.PoolableConnectionFactory;
-import org.apache.commons.dbcp2.PoolingDriver;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.exception.ExceptionUtils;
-import org.apache.commons.lang.mutable.MutableBoolean;
-import org.apache.commons.pool2.ObjectPool;
-import org.apache.commons.pool2.impl.GenericObjectPool;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.alias.CredentialProvider;
-import org.apache.hadoop.security.alias.CredentialProviderFactory;
 import org.apache.zeppelin.interpreter.InterpreterContext;
 import org.apache.zeppelin.interpreter.InterpreterException;
 import org.apache.zeppelin.interpreter.InterpreterResult;
@@ -58,13 +66,6 @@ import org.apache.zeppelin.scheduler.Scheduler;
 import org.apache.zeppelin.scheduler.SchedulerFactory;
 import org.apache.zeppelin.user.UserCredentials;
 import org.apache.zeppelin.user.UsernamePassword;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
-import static org.apache.commons.lang.StringUtils.isEmpty;
-import static org.apache.commons.lang.StringUtils.isNotEmpty;
-import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
 
 /**
  * JDBC interpreter for Zeppelin. This interpreter can also be used for 
accessing HAWQ,
@@ -89,7 +90,6 @@ import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMeth
  * </p>
  */
 public class JDBCInterpreter extends KerberosInterpreter {
-
   private Logger logger = LoggerFactory.getLogger(JDBCInterpreter.class);
 
   static final String INTERPRETER_NAME = "jdbc";
@@ -128,9 +128,10 @@ public class JDBCInterpreter extends KerberosInterpreter {
 
   static final String EMPTY_COLUMN_VALUE = "";
 
-  private final String CONCURRENT_EXECUTION_KEY = 
"zeppelin.jdbc.concurrent.use";
-  private final String CONCURRENT_EXECUTION_COUNT = 
"zeppelin.jdbc.concurrent.max_connection";
-  private final String DBCP_STRING = "jdbc:apache:commons:dbcp:";
+  private static final String CONCURRENT_EXECUTION_KEY = 
"zeppelin.jdbc.concurrent.use";
+  private static final String CONCURRENT_EXECUTION_COUNT =
+          "zeppelin.jdbc.concurrent.max_connection";
+  private static final String DBCP_STRING = "jdbc:apache:commons:dbcp:";
 
   private final HashMap<String, Properties> basePropretiesMap;
   private final HashMap<String, JDBCUserConfigurations> 
jdbcUserConfigurationsMap;
@@ -206,7 +207,6 @@ public class JDBCInterpreter extends KerberosInterpreter {
     setMaxLineResults();
   }
 
-
   protected boolean isKerboseEnabled() {
     if (!isEmpty(getProperty("zeppelin.jdbc.auth.type"))) {
       UserGroupInformation.AuthenticationMethod authType = 
JDBCSecurityImpl.getAuthtype(properties);
@@ -217,7 +217,6 @@ public class JDBCInterpreter extends KerberosInterpreter {
     return false;
   }
 
-
   private void setMaxLineResults() {
     if (basePropretiesMap.containsKey(COMMON_KEY) &&
         basePropretiesMap.get(COMMON_KEY).containsKey(MAX_LINE_KEY)) {
@@ -334,8 +333,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
   }
 
   public JDBCUserConfigurations getJDBCConfiguration(String user) {
-    JDBCUserConfigurations jdbcUserConfigurations =
-      jdbcUserConfigurationsMap.get(user);
+    JDBCUserConfigurations jdbcUserConfigurations = 
jdbcUserConfigurationsMap.get(user);
 
     if (jdbcUserConfigurations == null) {
       jdbcUserConfigurations = new JDBCUserConfigurations();
@@ -357,8 +355,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
 
     String user = interpreterContext.getAuthenticationInfo().getUser();
 
-    JDBCUserConfigurations jdbcUserConfigurations =
-      getJDBCConfiguration(user);
+    JDBCUserConfigurations jdbcUserConfigurations = getJDBCConfiguration(user);
     if (basePropretiesMap.get(propertyKey).containsKey(USER_KEY) &&
         !basePropretiesMap.get(propertyKey).getProperty(USER_KEY).isEmpty()) {
       String password = getPassword(basePropretiesMap.get(propertyKey));
@@ -373,7 +370,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
     jdbcUserConfigurations.cleanUserProperty(propertyKey);
 
     UsernamePassword usernamePassword = getUsernamePassword(interpreterContext,
-      getEntityName(interpreterContext.getReplName()));
+            getEntityName(interpreterContext.getReplName()));
     if (usernamePassword != null) {
       jdbcUserConfigurations.setUserProperty(propertyKey, usernamePassword);
     } else {
@@ -384,10 +381,10 @@ public class JDBCInterpreter extends KerberosInterpreter {
   private void createConnectionPool(String url, String user, String 
propertyKey,
       Properties properties) throws SQLException, ClassNotFoundException {
     ConnectionFactory connectionFactory =
-      new DriverManagerConnectionFactory(url, properties);
+            new DriverManagerConnectionFactory(url, properties);
 
     PoolableConnectionFactory poolableConnectionFactory = new 
PoolableConnectionFactory(
-      connectionFactory, null);
+            connectionFactory, null);
     ObjectPool connectionPool = new 
GenericObjectPool(poolableConnectionFactory);
 
     poolableConnectionFactory.setPool(connectionPool);
@@ -803,7 +800,7 @@ public class JDBCInterpreter extends KerberosInterpreter {
     logger.info("Cancel current query statement.");
     String paragraphId = context.getParagraphId();
     JDBCUserConfigurations jdbcUserConfigurations =
-      getJDBCConfiguration(context.getAuthenticationInfo().getUser());
+            getJDBCConfiguration(context.getAuthenticationInfo().getUser());
     try {
       jdbcUserConfigurations.cancelStatement(paragraphId);
     } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
----------------------------------------------------------------------
diff --git 
a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
index 0579380..4eac9fc 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
@@ -15,15 +15,15 @@
 package org.apache.zeppelin.jdbc;
 
 import org.apache.commons.dbcp2.PoolingDriver;
-import org.apache.zeppelin.user.UsernamePassword;
 
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.zeppelin.user.UsernamePassword;
+
 /**
  * UserConfigurations for JDBC impersonation.
  */
@@ -106,5 +106,4 @@ public class JDBCUserConfigurations {
     }
     return false;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
index 6103fc7..9f52ecb 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/SqlCompleter.java
@@ -4,6 +4,11 @@ package org.apache.zeppelin.jdbc;
  * This source file is based on code taken from SQLLine 1.0.2 See SQLLine 
notice in LICENSE
  */
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -22,28 +27,22 @@ import java.util.StringTokenizer;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
+import jline.console.completer.ArgumentCompleter.ArgumentList;
+import jline.console.completer.ArgumentCompleter.WhitespaceArgumentDelimiter;
+
 import org.apache.zeppelin.completer.CachedCompleter;
 import org.apache.zeppelin.completer.CompletionType;
 import org.apache.zeppelin.completer.StringsCompleter;
 import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import jline.console.completer.ArgumentCompleter.ArgumentList;
-import jline.console.completer.ArgumentCompleter.WhitespaceArgumentDelimiter;
 
 /**
  * SQL auto complete functionality for the JdbcInterpreter.
  */
 public class SqlCompleter {
-
   private static Logger logger = LoggerFactory.getLogger(SqlCompleter.class);
 
-
   /**
-   * Delimiter that can split SQL statement in keyword list
+   * Delimiter that can split SQL statement in keyword list.
    */
   private WhitespaceArgumentDelimiter sqlDelimiter = new 
WhitespaceArgumentDelimiter() {
 
@@ -57,35 +56,33 @@ public class SqlCompleter {
   };
 
   /**
-   * Schema completer
+   * Schema completer.
    */
   private CachedCompleter schemasCompleter;
 
   /**
-   * Contain different completer with table list for every schema name
+   * Contain different completer with table list for every schema name.
    */
   private Map<String, CachedCompleter> tablesCompleters = new HashMap<>();
 
   /**
    * Contains different completer with column list for every table name
-   * Table names store as schema_name.table_name
+   * Table names store as schema_name.table_name.
    */
   private Map<String, CachedCompleter> columnsCompleters = new HashMap<>();
 
   /**
-   * Completer for sql keywords
+   * Completer for sql keywords.
    */
   private CachedCompleter keywordCompleter;
 
   private int ttlInSeconds;
 
-
   public SqlCompleter(int ttlInSeconds) {
     this.ttlInSeconds = ttlInSeconds;
   }
 
   public int complete(String buffer, int cursor, List<InterpreterCompletion> 
candidates) {
-
     logger.debug("Complete with buffer = " + buffer + ", cursor = " + cursor);
 
     // The delimiter breaks the buffer into separate words (arguments), 
separated by the
@@ -110,7 +107,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Return list of schema names within the database
+   * Return list of schema names within the database.
    *
    * @param meta metadata from connection to database
    * @param schemaFilters a schema name patterns; must match the schema name
@@ -146,7 +143,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Return list of catalog names within the database
+   * Return list of catalog names within the database.
    *
    * @param meta metadata from connection to database
    * @param schemaFilters a catalog name patterns; must match the catalog name
@@ -177,7 +174,6 @@ public class SqlCompleter {
     return res;
   }
 
-
   private static void fillTableNames(String schema, DatabaseMetaData meta, 
Set<String> tables) {
     try (ResultSet tbls = meta.getTables(schema, schema, "%",
         new String[]{"TABLE", "VIEW", "ALIAS", "SYNONYM", "GLOBAL TEMPORARY", 
"LOCAL TEMPORARY"})) {
@@ -191,7 +187,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Fill two map with list of tables and list of columns
+   * Fill two map with list of tables and list of columns.
    *
    * @param schema name of a scheme
    * @param table name of a table
@@ -213,7 +209,6 @@ public class SqlCompleter {
 
   public static Set<String> getSqlKeywordsCompletions(DatabaseMetaData meta) 
throws IOException,
           SQLException {
-
     // Add the default SQL completions
     String keywords =
             new BufferedReader(new InputStreamReader(
@@ -222,7 +217,6 @@ public class SqlCompleter {
     Set<String> completions = new TreeSet<>();
 
     if (null != meta) {
-
       // Add the driver specific SQL completions
       String driverSpecificKeywords =
               "/" + meta.getDriverName().replace(" ", "-").toLowerCase() + 
"-sql.keywords";
@@ -240,7 +234,6 @@ public class SqlCompleter {
                 driverSpecificKeywords + " : " + e, e);
       }
 
-
       // Add the keywords from the current JDBC connection
       try {
         keywords += "," + meta.getSQLKeywords();
@@ -270,7 +263,6 @@ public class SqlCompleter {
 
       // Set all keywords to lower-case versions
       keywords = keywords.toLowerCase();
-
     }
 
     StringTokenizer tok = new StringTokenizer(keywords, ", ");
@@ -282,7 +274,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Initializes all local completers from database connection
+   * Initializes all local completers from database connection.
    *
    * @param connection database connection
    * @param schemaFiltersString a comma separated schema name patterns, 
supports '%'  symbol;
@@ -350,8 +342,6 @@ public class SqlCompleter {
     }
   }
 
-
-
   public void initKeywords(Set<String> keywords) {
     if (keywords != null && !keywords.isEmpty()) {
       keywordCompleter = new CachedCompleter(new StringsCompleter(keywords), 
0);
@@ -380,7 +370,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Find aliases in sql command
+   * Find aliases in sql command.
    *
    * @param sqlArguments sql command divided on arguments
    * @return for every alias contains table name in format 
schema_name.table_name
@@ -397,7 +387,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Complete buffer in case it is a keyword
+   * Complete buffer in case it is a keyword.
    *
    * @return -1 in case of no candidates found, 0 otherwise
    */
@@ -406,7 +396,7 @@ public class SqlCompleter {
   }
 
   /**
-   * Complete buffer in case it is a schema name
+   * Complete buffer in case it is a schema name.
    *
    * @return -1 in case of no candidates found, 0 otherwise
    */
@@ -415,22 +405,22 @@ public class SqlCompleter {
   }
 
   /**
-   * Complete buffer in case it is a table name
+   * Complete buffer in case it is a table name.
    *
    * @return -1 in case of no candidates found, 0 otherwise
    */
   private int completeTable(String schema, String buffer, int cursor,
                             List<CharSequence> candidates) {
     // Wrong schema
-    if (schema == null || !tablesCompleters.containsKey(schema))
+    if (schema == null || !tablesCompleters.containsKey(schema)) {
       return -1;
-    else {
+    } else {
       return tablesCompleters.get(schema).getCompleter().complete(buffer, 
cursor, candidates);
     }
   }
 
   /**
-   * Complete buffer in case it is a column name
+   * Complete buffer in case it is a column name.
    *
    * @return -1 in case of no candidates found, 0 otherwise
    */

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java
----------------------------------------------------------------------
diff --git 
a/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java 
b/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java
index 6e9470f..ef2c729 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/security/JDBCSecurityImpl.java
@@ -16,24 +16,23 @@
  */
 package org.apache.zeppelin.jdbc.security;
 
+import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
+import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.SIMPLE;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
-import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.KERBEROS;
-import static 
org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod.SIMPLE;
-
 /**
  * Created for org.apache.zeppelin.jdbc.security on 09/07/16.
  */
 public class JDBCSecurityImpl {
-
-  private static Logger LOGGER = 
LoggerFactory.getLogger(JDBCSecurityImpl.class);
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(JDBCSecurityImpl.class);
 
   /***
    * @param properties
@@ -70,5 +69,4 @@ public class JDBCSecurityImpl {
     }
     return authType;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java
----------------------------------------------------------------------
diff --git 
a/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java 
b/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java
index 6441267..a6e394f 100644
--- a/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java
+++ b/jdbc/src/test/java/org/apache/zeppelin/jdbc/JDBCInterpreterTest.java
@@ -14,15 +14,23 @@
  */
 package org.apache.zeppelin.jdbc;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import static java.lang.String.format;
+
+import static org.apache.zeppelin.jdbc.JDBCInterpreter.COMMON_MAX_LINE;
 import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_DRIVER;
 import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_PASSWORD;
-import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_USER;
-import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_URL;
 import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_PRECODE;
+import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_URL;
+import static org.apache.zeppelin.jdbc.JDBCInterpreter.DEFAULT_USER;
 import static org.apache.zeppelin.jdbc.JDBCInterpreter.PRECODE_KEY_TEMPLATE;
-import static org.apache.zeppelin.jdbc.JDBCInterpreter.COMMON_MAX_LINE;
-import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
 
 import java.io.IOException;
 import java.nio.file.Files;
@@ -35,6 +43,8 @@ import java.sql.Statement;
 import java.util.List;
 import java.util.Properties;
 
+import com.mockrunner.jdbc.BasicJDBCTestCaseAdapter;
+
 import org.apache.zeppelin.completer.CompletionType;
 import org.apache.zeppelin.interpreter.InterpreterContext;
 import org.apache.zeppelin.interpreter.InterpreterException;
@@ -46,21 +56,16 @@ import org.apache.zeppelin.scheduler.Scheduler;
 import org.apache.zeppelin.user.AuthenticationInfo;
 import org.apache.zeppelin.user.UserCredentials;
 import org.apache.zeppelin.user.UsernamePassword;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.mockrunner.jdbc.BasicJDBCTestCaseAdapter;
 
 /**
- * JDBC interpreter unit tests
+ * JDBC interpreter unit tests.
  */
 public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
-
   static String jdbcConnection;
   InterpreterContext interpreterContext;
 
   private static String getJdbcConnection() throws IOException {
-    if(null == jdbcConnection) {
+    if (null == jdbcConnection) {
       Path tmpDir = Files.createTempDirectory("h2-test-");
       tmpDir.toFile().deleteOnExit();
       jdbcConnection = format("jdbc:h2:%s", tmpDir);
@@ -88,11 +93,12 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
         "DROP TABLE IF EXISTS test_table; " +
         "CREATE TABLE test_table(id varchar(255), name varchar(255));");
 
-    PreparedStatement insertStatement = connection.prepareStatement("insert 
into test_table(id, name) values ('a', 'a_name'),('b', 'b_name'),('c', ?);");
+    PreparedStatement insertStatement = connection.prepareStatement(
+            "insert into test_table(id, name) values ('a', 'a_name'),('b', 
'b_name'),('c', ?);");
     insertStatement.setString(1, null);
     insertStatement.execute();
     interpreterContext = new InterpreterContext("", "1", null, "", "",
-        new AuthenticationInfo("testUser"), null, null, null,null, null, null, 
null);
+        new AuthenticationInfo("testUser"), null, null, null, null, null, 
null, null);
   }
 
 
@@ -110,8 +116,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
         "default");
 
     // when you use a %jdbc(prefix1), prefix1 is the propertyKey as form part 
of the cmd string
-    assertEquals(t.getPropertyKey("(prefix1)\n select max(cant) from 
test_table where id >= 2452640"),
-        "prefix1");
+    assertEquals(t.getPropertyKey(
+            "(prefix1)\n select max(cant) from test_table where id >= 
2452640"), "prefix1");
 
     assertEquals(t.getPropertyKey("(prefix2) select max(cant) from test_table 
where id >= 2452640"),
             "prefix2");
@@ -201,7 +207,7 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
   }
 
   @Test
-  public void testQueryWithEs√ϬĀapedCharacters() throws SQLException, 
IOException {
+  public void testQueryWithEscapedCharacters() throws SQLException, 
IOException {
     String sqlQuery = "select '\\n', ';';" +
         "select replace('A\\;B', '\\', 'text');" +
         "select '\\', ';';" +
@@ -229,7 +235,6 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     assertEquals("'Atext;B'\nAtext;B\n", 
interpreterResult.message().get(1).getData());
     assertEquals("'\\'\t';'\n\\\t;\n", 
interpreterResult.message().get(2).getData());
     assertEquals("''''\t';'\n'\t;\n", 
interpreterResult.message().get(3).getData());
-
   }
 
   @Test
@@ -252,7 +257,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     assertEquals(2, interpreterResult.message().size());
 
     assertEquals(InterpreterResult.Type.TABLE, 
interpreterResult.message().get(0).getType());
-    assertEquals("ID\tNAME\na\ta_name\nb\tb_name\nc\tnull\n", 
interpreterResult.message().get(0).getData());
+    assertEquals("ID\tNAME\na\ta_name\nb\tb_name\nc\tnull\n",
+            interpreterResult.message().get(0).getData());
 
     assertEquals(InterpreterResult.Type.TABLE, 
interpreterResult.message().get(1).getType());
     assertEquals("ID\tNAME\n", interpreterResult.message().get(1).getData());
@@ -277,7 +283,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     assertEquals(1, interpreterResult.message().size());
 
     assertEquals(InterpreterResult.Type.TABLE, 
interpreterResult.message().get(0).getType());
-    assertEquals("ID\tNAME\na\ta_name\nb\tb_name\nc\tnull\n", 
interpreterResult.message().get(0).getData());
+    assertEquals("ID\tNAME\na\ta_name\nb\tb_name\nc\tnull\n",
+            interpreterResult.message().get(0).getData());
   }
 
   @Test
@@ -304,7 +311,6 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
 
   @Test
   public void testSelectQueryMaxResult() throws SQLException, IOException {
-
     Properties properties = new Properties();
     properties.setProperty("common.max_count", "1");
     properties.setProperty("common.max_retry", "3");
@@ -363,9 +369,11 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
 
     jdbcInterpreter.interpret("", interpreterContext);
 
-    List<InterpreterCompletion> completionList = 
jdbcInterpreter.completion("sel", 3, interpreterContext);
+    List<InterpreterCompletion> completionList = 
jdbcInterpreter.completion("sel", 3,
+            interpreterContext);
 
-    InterpreterCompletion correctCompletionKeyword = new 
InterpreterCompletion("select", "select", CompletionType.keyword.name());
+    InterpreterCompletion correctCompletionKeyword = new 
InterpreterCompletion("select", "select",
+            CompletionType.keyword.name());
 
     assertEquals(1, completionList.size());
     assertEquals(true, completionList.contains(correctCompletionKeyword));
@@ -386,7 +394,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     return properties;
   }
 
-  private AuthenticationInfo getUserAuth(String user, String entityName, 
String dbUser, String dbPassword){
+  private AuthenticationInfo getUserAuth(String user, String entityName, 
String dbUser,
+      String dbPassword) {
     UserCredentials userCredentials = new UserCredentials();
     if (entityName != null && dbUser != null && dbPassword != null) {
       UsernamePassword up = new UsernamePassword(dbUser, dbPassword);
@@ -400,8 +409,7 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
 
   @Test
   public void testMultiTenant() throws SQLException, IOException {
-
-    /**
+    /*
      * assume that the database user is 'dbuser' and password is 'dbpassword'
      * 'jdbc1' interpreter has user('dbuser')/password('dbpassword') property
      * 'jdbc2' interpreter doesn't have user/password property
@@ -413,12 +421,12 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     JDBCInterpreter jdbc2 = new JDBCInterpreter(getDBProperty("", ""));
 
     AuthenticationInfo user1Credential = getUserAuth("user1", null, null, 
null);
-    AuthenticationInfo user2Credential = getUserAuth("user2", "jdbc.jdbc2", 
"user2Id","user2Pw");
+    AuthenticationInfo user2Credential = getUserAuth("user2", "jdbc.jdbc2", 
"user2Id", "user2Pw");
 
     // user1 runs jdbc1
     jdbc1.open();
     InterpreterContext ctx1 = new InterpreterContext("", "1", "jdbc1", "", "", 
user1Credential,
-      null, null, null, null, null, null, null);
+            null, null, null, null, null, null, null);
     jdbc1.interpret("", ctx1);
 
     JDBCUserConfigurations user1JDBC1Conf = 
jdbc1.getJDBCConfiguration("user1");
@@ -429,7 +437,7 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     // user1 runs jdbc2
     jdbc2.open();
     InterpreterContext ctx2 = new InterpreterContext("", "1", "jdbc2", "", "", 
user1Credential,
-      null, null, null, null, null, null, null);
+            null, null, null, null, null, null, null);
     jdbc2.interpret("", ctx2);
 
     JDBCUserConfigurations user1JDBC2Conf = 
jdbc2.getJDBCConfiguration("user1");
@@ -440,7 +448,7 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     // user2 runs jdbc1
     jdbc1.open();
     InterpreterContext ctx3 = new InterpreterContext("", "1", "jdbc1", "", "", 
user2Credential,
-      null, null, null, null, null, null, null);
+            null, null, null, null, null, null, null);
     jdbc1.interpret("", ctx3);
 
     JDBCUserConfigurations user2JDBC1Conf = 
jdbc1.getJDBCConfiguration("user2");
@@ -451,7 +459,7 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     // user2 runs jdbc2
     jdbc2.open();
     InterpreterContext ctx4 = new InterpreterContext("", "1", "jdbc2", "", "", 
user2Credential,
-      null, null, null, null, null, null, null);
+            null, null, null, null, null, null, null);
     jdbc2.interpret("", ctx4);
 
     JDBCUserConfigurations user2JDBC2Conf = 
jdbc2.getJDBCConfiguration("user2");
@@ -467,7 +475,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     properties.setProperty("default.url", getJdbcConnection());
     properties.setProperty("default.user", "");
     properties.setProperty("default.password", "");
-    properties.setProperty(DEFAULT_PRECODE, "create table test_precode (id 
int); insert into test_precode values (1);");
+    properties.setProperty(DEFAULT_PRECODE,
+            "create table test_precode (id int); insert into test_precode 
values (1);");
     JDBCInterpreter jdbcInterpreter = new JDBCInterpreter(properties);
     jdbcInterpreter.open();
     jdbcInterpreter.executePrecode(interpreterContext);
@@ -509,7 +518,8 @@ public class JDBCInterpreterTest extends 
BasicJDBCTestCaseAdapter {
     properties.setProperty("anotherPrefix.url", getJdbcConnection());
     properties.setProperty("anotherPrefix.user", "");
     properties.setProperty("anotherPrefix.password", "");
-    properties.setProperty(String.format(PRECODE_KEY_TEMPLATE, 
"anotherPrefix"), "create table test_precode_2 (id int); insert into 
test_precode_2 values (2);");
+    properties.setProperty(String.format(PRECODE_KEY_TEMPLATE, 
"anotherPrefix"),
+            "create table test_precode_2 (id int); insert into test_precode_2 
values (2);");
     JDBCInterpreter jdbcInterpreter = new JDBCInterpreter(properties);
     jdbcInterpreter.open();
     jdbcInterpreter.executePrecode(interpreterContext);

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6919c4ad/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java
----------------------------------------------------------------------
diff --git a/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java 
b/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java
index 19150cc..1ec3ae4 100644
--- a/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java
+++ b/jdbc/src/test/java/org/apache/zeppelin/jdbc/SqlCompleterTest.java
@@ -14,6 +14,20 @@
  */
 package org.apache.zeppelin.jdbc;
 
+import static com.google.common.collect.Sets.newHashSet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.base.Joiner;
+
+import org.apache.commons.lang.StringUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
@@ -23,29 +37,16 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.zeppelin.completer.CompletionType;
-import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Joiner;
 import jline.console.completer.ArgumentCompleter;
 
-import static com.google.common.collect.Sets.newHashSet;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.apache.zeppelin.completer.CompletionType;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
 
 /**
- * SQL completer unit tests
+ * SQL completer unit tests.
  */
 public class SqlCompleterTest {
-
   public class CompleterTester {
-
     private SqlCompleter completer;
 
     private String buffer;
@@ -133,7 +134,7 @@ public class SqlCompleterTest {
 
   private Logger logger = LoggerFactory.getLogger(SqlCompleterTest.class);
 
-  private final static Set<String> EMPTY = new HashSet<>();
+  private static final Set<String> EMPTY = new HashSet<>();
 
   private CompleterTester tester;
 
@@ -162,35 +163,35 @@ public class SqlCompleterTest {
 
     sqlCompleter.initSchemas(schemas);
 
-    Set<String> prod_dds_tables = new HashSet<>();
-    prod_dds_tables.add("financial_account");
-    prod_dds_tables.add("customer");
+    Set<String> prodDdsTables = new HashSet<>();
+    prodDdsTables.add("financial_account");
+    prodDdsTables.add("customer");
 
-    sqlCompleter.initTables("prod_dds", prod_dds_tables);
+    sqlCompleter.initTables("prod_dds", prodDdsTables);
 
-    Set<String> prod_emart_tables = new HashSet<>();
-    prod_emart_tables.add("financial_account");
+    Set<String> prodEmartTables = new HashSet<>();
+    prodEmartTables.add("financial_account");
 
-    sqlCompleter.initTables("prod_emart", prod_emart_tables);
+    sqlCompleter.initTables("prod_emart", prodEmartTables);
 
-    Set<String> prod_dds_financial_account_columns = new HashSet<>();
-    prod_dds_financial_account_columns.add("account_rk");
-    prod_dds_financial_account_columns.add("account_id");
+    Set<String> prodDdsFinancialAccountColumns = new HashSet<>();
+    prodDdsFinancialAccountColumns.add("account_rk");
+    prodDdsFinancialAccountColumns.add("account_id");
 
-    sqlCompleter.initColumns("prod_dds.financial_account", 
prod_dds_financial_account_columns);
+    sqlCompleter.initColumns("prod_dds.financial_account", 
prodDdsFinancialAccountColumns);
 
-    Set<String> prod_dds_customer_columns = new HashSet<>();
-    prod_dds_customer_columns.add("customer_rk");
-    prod_dds_customer_columns.add("name");
-    prod_dds_customer_columns.add("birth_dt");
+    Set<String> prodDdsCustomerColumns = new HashSet<>();
+    prodDdsCustomerColumns.add("customer_rk");
+    prodDdsCustomerColumns.add("name");
+    prodDdsCustomerColumns.add("birth_dt");
 
-    sqlCompleter.initColumns("prod_dds.customer", prod_dds_customer_columns);
+    sqlCompleter.initColumns("prod_dds.customer", prodDdsCustomerColumns);
 
-    Set<String> prod_emart_financial_account_columns = new HashSet<>();
-    prod_emart_financial_account_columns.add("account_rk");
-    prod_emart_financial_account_columns.add("balance_amt");
+    Set<String> prodEmartFinancialAccountColumns = new HashSet<>();
+    prodEmartFinancialAccountColumns.add("account_rk");
+    prodEmartFinancialAccountColumns.add("balance_amt");
 
-    sqlCompleter.initColumns("prod_emart.financial_account", 
prod_emart_financial_account_columns);
+    sqlCompleter.initColumns("prod_emart.financial_account", 
prodEmartFinancialAccountColumns);
 
     tester = new CompleterTester(sqlCompleter);
   }
@@ -198,7 +199,8 @@ public class SqlCompleterTest {
   @Test
   public void testFindAliasesInSQL_Simple() {
     String sql = "select * from prod_emart.financial_account a";
-    Map<String, String> res = 
sqlCompleter.findAliasesInSQL(delimiter.delimit(sql, 0).getArguments());
+    Map<String, String> res = sqlCompleter.findAliasesInSQL(
+            delimiter.delimit(sql, 0).getArguments());
     assertEquals(1, res.size());
     assertTrue(res.get("a").equals("prod_emart.financial_account"));
   }
@@ -206,7 +208,8 @@ public class SqlCompleterTest {
   @Test
   public void testFindAliasesInSQL_Two() {
     String sql = "select * from prod_dds.financial_account a, 
prod_dds.customer b";
-    Map<String, String> res = 
sqlCompleter.findAliasesInSQL(sqlCompleter.getSqlDelimiter().delimit(sql, 
0).getArguments());
+    Map<String, String> res = sqlCompleter.findAliasesInSQL(
+            sqlCompleter.getSqlDelimiter().delimit(sql, 0).getArguments());
     assertEquals(2, res.size());
     assertTrue(res.get("a").equals("prod_dds.financial_account"));
     assertTrue(res.get("b").equals("prod_dds.customer"));
@@ -215,7 +218,8 @@ public class SqlCompleterTest {
   @Test
   public void testFindAliasesInSQL_WrongTables() {
     String sql = "select * from prod_ddsxx.financial_account a, 
prod_dds.customerxx b";
-    Map<String, String> res = 
sqlCompleter.findAliasesInSQL(sqlCompleter.getSqlDelimiter().delimit(sql, 
0).getArguments());
+    Map<String, String> res = sqlCompleter.findAliasesInSQL(
+            sqlCompleter.getSqlDelimiter().delimit(sql, 0).getArguments());
     assertEquals(0, res.size());
   }
 
@@ -227,15 +231,24 @@ public class SqlCompleterTest {
     Map<String, String> aliases = new HashMap<>();
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(9, candidates.size());
-    assertTrue(candidates.contains(new InterpreterCompletion("prod_dds", 
"prod_dds", CompletionType.schema.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("prod_emart", 
"prod_emart", CompletionType.schema.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("SUM", "SUM", 
CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("SUBSTRING", 
"SUBSTRING", CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new 
InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN", 
CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("SELECT", 
"SELECT", CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("ORDER", "ORDER", 
CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("LIMIT", "LIMIT", 
CompletionType.keyword.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("FROM", "FROM", 
CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("prod_dds", 
"prod_dds",
+            CompletionType.schema.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("prod_emart", 
"prod_emart",
+            CompletionType.schema.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("SUM", "SUM",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("SUBSTRING", 
"SUBSTRING",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new 
InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("SELECT", 
"SELECT",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("ORDER", "ORDER",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("LIMIT", "LIMIT",
+            CompletionType.keyword.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("FROM", "FROM",
+            CompletionType.keyword.name())));
   }
 
   @Test
@@ -246,8 +259,10 @@ public class SqlCompleterTest {
     Map<String, String> aliases = new HashMap<>();
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(2, candidates.size());
-    assertTrue(candidates.contains(new InterpreterCompletion("prod_dds", 
"prod_dds", CompletionType.schema.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("prod_emart", 
"prod_emart", CompletionType.schema.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("prod_dds", 
"prod_dds",
+            CompletionType.schema.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("prod_emart", 
"prod_emart",
+            CompletionType.schema.name())));
   }
 
   @Test
@@ -258,7 +273,9 @@ public class SqlCompleterTest {
     Map<String, String> aliases = new HashMap<>();
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(1, candidates.size());
-    assertTrue(candidates.contains(new 
InterpreterCompletion("financial_account", "financial_account", 
CompletionType.table.name())));
+    assertTrue(candidates.contains(
+            new InterpreterCompletion("financial_account", "financial_account",
+                    CompletionType.table.name())));
   }
 
   @Test
@@ -269,8 +286,10 @@ public class SqlCompleterTest {
     Map<String, String> aliases = new HashMap<>();
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(2, candidates.size());
-    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk", CompletionType.column.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id", CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk",
+            CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id",
+            CompletionType.column.name())));
   }
 
   @Test
@@ -282,8 +301,10 @@ public class SqlCompleterTest {
     aliases.put("a", "prod_dds.financial_account");
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(2, candidates.size());
-    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk", CompletionType.column.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id", CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk",
+            CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id",
+            CompletionType.column.name())));
   }
 
   @Test
@@ -295,24 +316,32 @@ public class SqlCompleterTest {
     aliases.put("a", "prod_dds.financial_account");
     sqlCompleter.completeName(buffer, cursor, candidates, aliases);
     assertEquals(2, candidates.size());
-    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk", CompletionType.column.name())));
-    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id", CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_rk", 
"account_rk",
+            CompletionType.column.name())));
+    assertTrue(candidates.contains(new InterpreterCompletion("account_id", 
"account_id",
+            CompletionType.column.name())));
   }
 
   @Test
   public void testSchemaAndTable() {
     String buffer = "select * from prod_emart.fi";
-    tester.buffer(buffer).from(20).to(23).expect(newHashSet(new 
InterpreterCompletion("prod_emart", "prod_emart", 
CompletionType.schema.name()))).test();
-    tester.buffer(buffer).from(25).to(27).expect(newHashSet(new 
InterpreterCompletion("financial_account", "financial_account", 
CompletionType.table.name()))).test();
+    tester.buffer(buffer).from(20).to(23).expect(newHashSet(
+            new InterpreterCompletion("prod_emart", "prod_emart",
+                    CompletionType.schema.name()))).test();
+    tester.buffer(buffer).from(25).to(27).expect(newHashSet(
+            new InterpreterCompletion("financial_account", "financial_account",
+                    CompletionType.table.name()))).test();
   }
 
   @Test
   public void testEdges() {
     String buffer = "  ORDER  ";
-    tester.buffer(buffer).from(3).to(7).expect(newHashSet(new 
InterpreterCompletion("ORDER", "ORDER", CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(3).to(7).expect(newHashSet(
+            new InterpreterCompletion("ORDER", "ORDER", 
CompletionType.keyword.name()))).test();
     tester.buffer(buffer).from(0).to(1).expect(newHashSet(
         new InterpreterCompletion("ORDER", "ORDER", 
CompletionType.keyword.name()),
-        new InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN", 
CompletionType.keyword.name()),
+        new InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN",
+                CompletionType.keyword.name()),
         new InterpreterCompletion("SUBSTRING", "SUBSTRING", 
CompletionType.keyword.name()),
         new InterpreterCompletion("prod_emart", "prod_emart", 
CompletionType.schema.name()),
         new InterpreterCompletion("LIMIT", "LIMIT", 
CompletionType.keyword.name()),
@@ -326,23 +355,29 @@ public class SqlCompleterTest {
   @Test
   public void testMultipleWords() {
     String buffer = "SELE FRO LIM";
-    tester.buffer(buffer).from(2).to(4).expect(newHashSet(new 
InterpreterCompletion("SELECT", "SELECT", 
CompletionType.keyword.name()))).test();
-    tester.buffer(buffer).from(6).to(8).expect(newHashSet(new 
InterpreterCompletion("FROM", "FROM", CompletionType.keyword.name()))).test();
-    tester.buffer(buffer).from(10).to(12).expect(newHashSet(new 
InterpreterCompletion("LIMIT", "LIMIT", CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(2).to(4).expect(newHashSet(
+            new InterpreterCompletion("SELECT", "SELECT", 
CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(6).to(8).expect(newHashSet(
+            new InterpreterCompletion("FROM", "FROM", 
CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(10).to(12).expect(newHashSet(
+            new InterpreterCompletion("LIMIT", "LIMIT", 
CompletionType.keyword.name()))).test();
   }
 
   @Test
   public void testMultiLineBuffer() {
     String buffer = " \n SELE\nFRO";
-    tester.buffer(buffer).from(5).to(7).expect(newHashSet(new 
InterpreterCompletion("SELECT", "SELECT", 
CompletionType.keyword.name()))).test();
-    tester.buffer(buffer).from(9).to(11).expect(newHashSet(new 
InterpreterCompletion("FROM", "FROM", CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(5).to(7).expect(newHashSet(
+            new InterpreterCompletion("SELECT", "SELECT", 
CompletionType.keyword.name()))).test();
+    tester.buffer(buffer).from(9).to(11).expect(newHashSet(
+            new InterpreterCompletion("FROM", "FROM", 
CompletionType.keyword.name()))).test();
   }
 
   @Test
   public void testMultipleCompletionSuggestions() {
     String buffer = "SU";
     tester.buffer(buffer).from(2).to(2).expect(newHashSet(
-        new InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN", 
CompletionType.keyword.name()),
+        new InterpreterCompletion("SUBCLASS_ORIGIN", "SUBCLASS_ORIGIN",
+                CompletionType.keyword.name()),
         new InterpreterCompletion("SUM", "SUM", CompletionType.keyword.name()),
         new InterpreterCompletion("SUBSTRING", "SUBSTRING", 
CompletionType.keyword.name()))
     ).test();

Reply via email to