drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhe...@apache.org
Subject [01/14] drill git commit: DRILL-5091: Handle new Java 8 JDBC functions and add missing test config parameter
Date Tue, 13 Dec 2016 00:39:58 GMT
Repository: drill
Updated Branches:
  refs/heads/master 351dea61b -> cf2b7c70e


DRILL-5091: Handle new Java 8 JDBC functions and add missing test config parameter

* JDBC unit test fails to set up test storage plugin config on Java 8
* Cleans up compiler warnings seen in Eclipse.
* Added TODO's based on code reviews

closes #676


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

Branch: refs/heads/master
Commit: a6a0f2f070ff48d622916beb97d6da6f0b5faad1
Parents: d9077a0
Author: Paul Rogers <progers@maprtech.com>
Authored: Fri Dec 2 14:02:03 2016 -0800
Committer: Sudheesh Katkam <sudheesh@apache.org>
Committed: Mon Dec 12 15:40:01 2016 -0800

----------------------------------------------------------------------
 .../org/apache/drill/exec/server/Drillbit.java  |  2 +-
 .../exec/store/StoragePluginRegistryImpl.java   |  8 +++
 .../exec/store/sys/PersistentStoreConfig.java   |  2 +-
 .../store/sys/store/LocalPersistentStore.java   | 17 ++---
 .../CachingPersistentStoreProvider.java         |  3 +-
 .../provider/LocalPersistentStoreProvider.java  |  8 +--
 .../org/apache/drill/jdbc/JdbcTestBase.java     |  7 +-
 ...l2489CallsAfterCloseThrowExceptionsTest.java | 71 +++++++++++++-------
 ...69UnsupportedReportsUseSqlExceptionTest.java | 66 ++++++++++--------
 .../org/apache/drill/jdbc/test/JdbcAssert.java  |  8 ++-
 10 files changed, 119 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
index 3f74268..a28dc91 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/Drillbit.java
@@ -101,7 +101,7 @@ public class Drillbit implements AutoCloseable {
       storeProvider = new CachingPersistentStoreProvider(new LocalPersistentStoreProvider(config));
     } else {
       coord = new ZKClusterCoordinator(config);
-      storeProvider = new PersistentStoreRegistry(this.coord, config).newPStoreProvider();
+      storeProvider = new PersistentStoreRegistry<ClusterCoordinator>(this.coord, config).newPStoreProvider();
       isDistributedMode = true;
     }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
index ad38586..bf4affd 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/StoragePluginRegistryImpl.java
@@ -115,10 +115,12 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
         });
   }
 
+  @Override
   public PersistentStore<StoragePluginConfig> getStore() {
     return pluginSystemTable;
   }
 
+  @Override
   public void init() throws DrillbitStartupException {
     availablePlugins = findAvailablePlugins(classpathScan);
 
@@ -188,6 +190,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     plugins.put(name, plugin);
   }
 
+  @Override
   public void deletePlugin(String name) {
     StoragePlugin plugin = plugins.remove(name);
     closePlugin(plugin);
@@ -206,6 +209,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     }
   }
 
+  @Override
   public StoragePlugin createOrUpdate(String name, StoragePluginConfig config, boolean persist)
       throws ExecutionSetupException {
     for (;;) {
@@ -243,6 +247,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     }
   }
 
+  @Override
   public StoragePlugin getPlugin(String name) throws ExecutionSetupException {
     StoragePlugin plugin = plugins.get(name);
     if (name.equals(SYS_PLUGIN) || name.equals(INFORMATION_SCHEMA_PLUGIN)) {
@@ -267,6 +272,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
   }
 
 
+  @Override
   public StoragePlugin getPlugin(StoragePluginConfig config) throws ExecutionSetupException
{
     if (config instanceof NamedStoragePluginConfig) {
       return getPlugin(((NamedStoragePluginConfig) config).name);
@@ -293,6 +299,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     }
   }
 
+  @Override
   public FormatPlugin getFormatPlugin(StoragePluginConfig storageConfig, FormatPluginConfig
formatConfig)
       throws ExecutionSetupException {
     StoragePlugin p = getPlugin(storageConfig);
@@ -332,6 +339,7 @@ public class StoragePluginRegistryImpl implements StoragePluginRegistry
{
     return plugins.iterator();
   }
 
+  @Override
   public SchemaFactory getSchemaFactory() {
     return schemaFactory;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
index ca319f2..00a75a2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PersistentStoreConfig.java
@@ -65,7 +65,7 @@ public class PersistentStoreConfig<V> {
   @Override
   public boolean equals(Object obj) {
     if (obj instanceof PersistentStoreConfig) {
-      final PersistentStoreConfig other = PersistentStoreConfig.class.cast(obj);
+      final PersistentStoreConfig<?> other = PersistentStoreConfig.class.cast(obj);
       return Objects.equal(name, other.name)
           && Objects.equal(valueSerializer, other.valueSerializer)
           && Objects.equal(mode, other.mode);

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/LocalPersistentStore.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/LocalPersistentStore.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/LocalPersistentStore.java
index 1ef8d12..b9a4b59 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/LocalPersistentStore.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/LocalPersistentStore.java
@@ -31,27 +31,25 @@ import java.util.Map.Entry;
 
 import javax.annotation.Nullable;
 
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
 import org.apache.commons.io.IOUtils;
 import org.apache.drill.common.collections.ImmutableEntry;
 import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
 import org.apache.drill.exec.store.sys.BasePersistentStore;
-import org.apache.drill.exec.store.sys.PersistentStore;
 import org.apache.drill.exec.store.sys.PersistentStoreConfig;
 import org.apache.drill.exec.store.sys.PersistentStoreMode;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 
 public class LocalPersistentStore<V> extends BasePersistentStore<V> {
-  private static final Logger logger = LoggerFactory.getLogger(LocalPersistentStore.class);
+//  private static final Logger logger = LoggerFactory.getLogger(LocalPersistentStore.class);
 
   private final Path basePath;
   private final PersistentStoreConfig<V> config;
@@ -140,6 +138,7 @@ public class LocalPersistentStore<V> extends BasePersistentStore<V>
{
     return path;
   }
 
+  @Override
   public V get(String key) {
     try{
       Path path = makePath(key);
@@ -158,6 +157,7 @@ public class LocalPersistentStore<V> extends BasePersistentStore<V>
{
     }
   }
 
+  @Override
   public void put(String key, V value) {
     try (OutputStream os = fs.create(makePath(key))) {
       IOUtils.write(config.getSerializer().serialize(value), os);
@@ -181,6 +181,7 @@ public class LocalPersistentStore<V> extends BasePersistentStore<V>
{
     }
   }
 
+  @Override
   public void delete(String key) {
     try {
       fs.delete(makePath(key), false);

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/CachingPersistentStoreProvider.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/CachingPersistentStoreProvider.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/CachingPersistentStoreProvider.java
index 99ccc8e..771005f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/CachingPersistentStoreProvider.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/CachingPersistentStoreProvider.java
@@ -29,7 +29,7 @@ import org.apache.drill.exec.store.sys.PersistentStoreConfig;
 import org.apache.drill.exec.store.sys.PersistentStoreProvider;
 
 public class CachingPersistentStoreProvider extends BasePersistentStoreProvider {
-  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CachingPersistentStoreProvider.class);
+//  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CachingPersistentStoreProvider.class);
 
   private final ConcurrentMap<PersistentStoreConfig<?>, PersistentStore<?>>
storeCache = Maps.newConcurrentMap();
   private final PersistentStoreProvider provider;
@@ -38,6 +38,7 @@ public class CachingPersistentStoreProvider extends BasePersistentStoreProvider
     this.provider = provider;
   }
 
+  @Override
   @SuppressWarnings("unchecked")
   public <V> PersistentStore<V> getOrCreateStore(final PersistentStoreConfig<V>
config) throws StoreException {
     final PersistentStore<?> store = storeCache.get(config);

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/LocalPersistentStoreProvider.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/LocalPersistentStoreProvider.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/LocalPersistentStoreProvider.java
index 9bf18ab..0b4a201 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/LocalPersistentStoreProvider.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/store/provider/LocalPersistentStoreProvider.java
@@ -23,20 +23,18 @@ import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.exception.StoreException;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
-import org.apache.drill.exec.store.sys.PersistentStoreRegistry;
 import org.apache.drill.exec.store.sys.PersistentStore;
 import org.apache.drill.exec.store.sys.PersistentStoreConfig;
+import org.apache.drill.exec.store.sys.PersistentStoreRegistry;
 import org.apache.drill.exec.store.sys.store.LocalPersistentStore;
 import org.apache.drill.exec.testing.store.NoWriteLocalStore;
 import org.apache.hadoop.fs.Path;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * A really simple provider that stores data in the local file system, one value per file.
  */
 public class LocalPersistentStoreProvider extends BasePersistentStoreProvider {
-  private static final Logger logger = LoggerFactory.getLogger(LocalPersistentStoreProvider.class);
+//  private static final Logger logger = LoggerFactory.getLogger(LocalPersistentStoreProvider.class);
 
   private final Path path;
   private final DrillFileSystem fs;
@@ -44,7 +42,7 @@ public class LocalPersistentStoreProvider extends BasePersistentStoreProvider
{
   // how to handle this flag.
   private final boolean enableWrite;
 
-  public LocalPersistentStoreProvider(final PersistentStoreRegistry registry) throws StoreException
{
+  public LocalPersistentStoreProvider(final PersistentStoreRegistry<?> registry) throws
StoreException {
     this(registry.getConfig());
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/jdbc/src/test/java/org/apache/drill/jdbc/JdbcTestBase.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/JdbcTestBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/JdbcTestBase.java
index 7fb601d..b9e8392 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/JdbcTestBase.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/JdbcTestBase.java
@@ -114,7 +114,8 @@ public class JdbcTestBase extends ExecTest {
 
   protected static void changeSchema(Connection conn, String schema) {
     final String query = String.format("use %s", schema);
-    try ( Statement s = conn.createStatement() ) {
+    try (Statement s = conn.createStatement()) {
+      @SuppressWarnings("unused")
       ResultSet r = s.executeQuery(query);
       // TODO:  Purge nextUntilEnd(...) and calls when remaining fragment
       // race conditions are fixed (not just DRILL-2245 fixes).
@@ -147,10 +148,10 @@ public class JdbcTestBase extends ExecTest {
    * (Note:  Not a guaranteed test--depends on order in which test methods are
    * run.)
    */
-  @Ignore( "Usually disabled; enable temporarily to check tests" )
+  @Ignore("Usually disabled; enable temporarily to check tests")
   @Test
   public void testJdbcTestConnectionResettingCompatibility() {
-    fail( "Intentional failure--did other test methods still run?" );
+    fail("Intentional failure--did other test methods still run?");
   }
 
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2489CallsAfterCloseThrowExceptionsTest.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2489CallsAfterCloseThrowExceptionsTest.java
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2489CallsAfterCloseThrowExceptionsTest.java
index ee94fd2..b8a7895 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2489CallsAfterCloseThrowExceptionsTest.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2489CallsAfterCloseThrowExceptionsTest.java
@@ -38,6 +38,7 @@ import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLClientInfoException;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.sql.Statement;
 import java.sql.Struct;
 import java.util.ArrayList;
@@ -81,7 +82,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
   private static ResultSetMetaData resultSetMetaDataOfClosedStmt;
   private static DatabaseMetaData databaseMetaDataOfClosedConn;
 
-
   @BeforeClass
   public static void setUpClosedObjects() throws Exception {
     // (Note: Can't use JdbcTest's connect(...) for this test class.)
@@ -135,15 +135,14 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     resultSetMetaDataOfClosedStmt = rsmdForClosedStmt;
     databaseMetaDataOfClosedConn = dbmd;
 
-
     // Self-check that member variables are set (and objects are in right open
     // or closed state):
-    assertTrue( "Test setup error", closedConn.isClosed());
+    assertTrue("Test setup error", closedConn.isClosed());
     assertFalse("Test setup error", openConn.isClosed());
-    assertTrue( "Test setup error", closedPlainStmtOfOpenConn.isClosed());
-    assertTrue( "Test setup error", closedPreparedStmtOfOpenConn.isClosed());
-    assertTrue( "Test setup error", closedResultSetOfClosedStmt.isClosed());
-    assertTrue( "Test setup error", closedResultSetOfOpenStmt.isClosed());
+    assertTrue("Test setup error", closedPlainStmtOfOpenConn.isClosed());
+    assertTrue("Test setup error", closedPreparedStmtOfOpenConn.isClosed());
+    assertTrue("Test setup error", closedResultSetOfClosedStmt.isClosed());
+    assertTrue("Test setup error", closedResultSetOfOpenStmt.isClosed());
     // (No ResultSetMetaData.isClosed() or DatabaseMetaData.isClosed():)
     assertNotNull("Test setup error", resultSetMetaDataOfClosedResultSet);
     assertNotNull("Test setup error", resultSetMetaDataOfClosedStmt);
@@ -155,7 +154,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     openConn.close();
   }
 
-
   ///////////////////////////////////////////////////////////////
   // 1.  Check that isClosed() and close() do not throw, and isClosed() returns
   //     true.
@@ -200,12 +198,10 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     assertThat(closedResultSetOfOpenStmt.isClosed(), equalTo(true));
   }
 
-
   ///////////////////////////////////////////////////////////////
   // 2.  Check that all methods throw or not appropriately (either as specified
   //     by JDBC or currently intended as partial Avatica workaround).
 
-
   /**
    * Reflection-based checker of throwing of "already closed" exception by JDBC
    * interfaces' implementation methods.
@@ -405,17 +401,14 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
           + ")";
       return report;
     }
-
   } // class ThrowsClosedChecker<INTF>
 
-
   private static class ClosedConnectionChecker
       extends ThrowsClosedBulkChecker<Connection> {
 
     private static final String STATEMENT_CLOSED_MESSAGE =
         "Connection is already closed.";
 
-
     ClosedConnectionChecker(Class<Connection> intf, Connection jdbcObject) {
       super(intf, jdbcObject, STATEMENT_CLOSED_MESSAGE);
     }
@@ -449,7 +442,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
       }
       return result;
     }
-
   } // class ClosedConnectionChecker
 
   @Test
@@ -465,7 +457,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     }
   }
 
-
   private static class ClosedPlainStatementChecker
       extends ThrowsClosedBulkChecker<Statement> {
 
@@ -477,11 +468,24 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     }
 
     @Override
+    protected boolean isOkayNonthrowingMethod(Method method) {
+      // TODO: Java 8 method
+      if ("getLargeUpdateCount".equals(method.getName())) {
+        return true; }
+      return super.isOkayNonthrowingMethod(method);
+    }
+
+    @Override
     protected boolean isOkaySpecialCaseException(Method method, Throwable cause) {
       final boolean result;
       if (super.isOkaySpecialCaseException(method, cause)) {
         result = true;
       }
+      else if (   method.getName().equals("executeLargeBatch")
+               || method.getName().equals("executeLargeUpdate")) {
+        // TODO: New Java 8 methods not implemented in Avatica.
+        result = true;
+      }
       else if (RuntimeException.class == cause.getClass()
                && normalClosedExceptionText.equals(cause.getMessage())
                && (false
@@ -489,6 +493,7 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
                    || method.getName().equals("getFetchDirection")
                    || method.getName().equals("getFetchSize")
                    || method.getName().equals("getMaxRows")
+                   || method.getName().equals("getLargeMaxRows") // TODO: Java 8
                    )) {
         // Special good-enough case--we had to use RuntimeException for now.
         result = true;
@@ -498,7 +503,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
       }
       return result;
     }
-
   } // class ClosedPlainStatementChecker
 
   @Test
@@ -513,7 +517,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     }
   }
 
-
   private static class ClosedPreparedStatementChecker
       extends ThrowsClosedBulkChecker<PreparedStatement> {
 
@@ -526,6 +529,15 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     }
 
     @Override
+    protected boolean isOkayNonthrowingMethod(Method method) {
+      // TODO: Java 8 methods not yet supported by Avatica.
+      if (method.getName().equals("getLargeUpdateCount")) {
+        return true;
+      }
+      return super.isOkayNonthrowingMethod(method);
+    }
+
+    @Override
     protected boolean isOkaySpecialCaseException(Method method, Throwable cause) {
       final boolean result;
       if (super.isOkaySpecialCaseException(method, cause)) {
@@ -543,12 +555,19 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
         // Special good-enough case--we had to use RuntimeException for now.
         result = true;
       }
+      else if (  method.getName().equals("setObject")
+              || method.getName().equals("executeLargeUpdate")
+              || method.getName().equals("executeLargeBatch")
+              || method.getName().equals("getLargeMaxRows")
+              ) {
+        // TODO: Java 8 methods not yet supported by Avatica.
+        result = true;
+      }
       else {
         result = false;
       }
       return result;
     }
-
   } // class closedPreparedStmtOfOpenConnChecker
 
   @Test
@@ -564,7 +583,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
     }
   }
 
-
   private static class ClosedResultSetChecker
       extends ThrowsClosedBulkChecker<ResultSet> {
 
@@ -587,12 +605,16 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
         // Special good-enough case--we had to use RuntimeException for now.
         result = true;
       }
+      else if (SQLFeatureNotSupportedException.class == cause.getClass()
+               && (method.getName().equals("updateObject"))) {
+        // TODO: Java 8 methods not yet supported by Avatica.
+        result = true;
+      }
       else {
         result = false;
       }
       return result;
     }
-
   } // class ClosedResultSetChecker
 
   @Test
@@ -630,7 +652,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
                                    ResultSetMetaData jdbcObject) {
       super(intf, jdbcObject, RESULTSETMETADATA_CLOSED_MESSAGE);
     }
-
   } // class ClosedResultSetMetaDataChecker
 
   @Test
@@ -671,12 +692,16 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
       super(intf, jdbcObject, DATABASEMETADATA_CLOSED_MESSAGE);
     }
 
+    @Override
     protected boolean isOkayNonthrowingMethod(Method method) {
       return
           super.isOkayNonthrowingMethod(method)
           || method.getName().equals("getDriverMajorVersion")
           || method.getName().equals("getDriverMinorVersion")
-          || method.getName().equals("getConnection");
+          || method.getName().equals("getConnection")
+          // TODO: New Java 8 methods not implemented in Avatica.
+          || method.getName().equals("getMaxLogicalLobSize")
+          || method.getName().equals("supportsRefCursors");
     }
 
     @Override
@@ -696,7 +721,6 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
       }
       return result;
     }
-
   } // class ClosedDatabaseMetaDataChecker
 
 
@@ -712,5 +736,4 @@ public class Drill2489CallsAfterCloseThrowExceptionsTest extends JdbcTestBase
{
       fail("Already-closed exception error(s): \n" + checker.getReport());
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2769UnsupportedReportsUseSqlExceptionTest.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2769UnsupportedReportsUseSqlExceptionTest.java
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2769UnsupportedReportsUseSqlExceptionTest.java
index 8bc03aa..1de737a 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2769UnsupportedReportsUseSqlExceptionTest.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/Drill2769UnsupportedReportsUseSqlExceptionTest.java
@@ -17,38 +17,33 @@
  */
 package org.apache.drill.jdbc.test;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.slf4j.Logger;
-
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 import static org.slf4j.LoggerFactory.getLogger;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.sql.Array;
-import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
-import java.sql.SQLClientInfoException;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.sql.Struct;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.drill.common.util.TestTools;
+import org.apache.drill.jdbc.AlreadyClosedSqlException;
 import org.apache.drill.jdbc.Driver;
 import org.apache.drill.jdbc.JdbcTestBase;
-import org.apache.drill.jdbc.AlreadyClosedSqlException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.slf4j.Logger;
 
 
 /**
@@ -84,7 +79,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
   private static ResultSetMetaData resultSetMetaData;
   private static DatabaseMetaData databaseMetaData;
 
-
   @BeforeClass
   public static void setUpObjects() throws Exception {
     // (Note: Can't use JdbcTest's connect(...) for this test class.)
@@ -117,7 +111,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     resultSetMetaData = resultSet.getMetaData();
     databaseMetaData = connection.getMetaData();
 
-
     // Self-check that member variables are set:
     assertFalse("Test setup error", connection.isClosed());
     assertFalse("Test setup error", plainStatement.isClosed());
@@ -133,7 +126,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     connection.close();
   }
 
-
   /**
    * Reflection-based checker that exceptions thrown by JDBC interfaces'
    * implementation methods for unsupported-operation cases are SQLExceptions
@@ -148,7 +140,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     private final StringBuilder failureLinesBuf = new StringBuilder();
     private final StringBuilder successLinesBuf = new StringBuilder();
 
-
     NoNonSqlExceptionsChecker(final Class<INTF> jdbcIntf,
                               final INTF jdbcObject) {
       this.jdbcIntf = jdbcIntf;
@@ -280,6 +271,10 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
           // code implements them.
           successLinesBuf.append(resultLine);
         }
+        else if (isOkaySpecialCaseException(method, cause)) {
+          successLinesBuf.append(resultLine);
+        }
+
         else {
           final String badResultLine =
               "- " + methodLabel + " threw <" + cause + "> instead"
@@ -319,6 +314,15 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
       }
     }
 
+    /**
+     * Reports whether it's okay if given method throw given exception (that is
+     * not preferred AlreadyClosedException with regular message).
+     */
+    protected boolean isOkaySpecialCaseException(Method method,
+                                                 Throwable cause) {
+      return false;
+    }
+
     public boolean hadAnyFailures() {
       return 0 != failureLinesBuf.length();
     }
@@ -340,10 +344,8 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
           + ")";
       return report;
     }
-
   } // class NoNonSqlExceptionsChecker<INTF>
 
-
   @Test
   public void testConnectionMethodsThrowRight() {
     NoNonSqlExceptionsChecker<Connection> checker =
@@ -357,7 +359,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     }
   }
 
-
   private static class PlainStatementChecker
       extends NoNonSqlExceptionsChecker<Statement> {
 
@@ -368,10 +369,18 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends
JdbcTestBase
       this.factoryConnection = factoryConnection;
     }
 
+    @Override
     protected Statement getJdbcObject() throws SQLException {
       return factoryConnection.createStatement();
     }
 
+    @Override
+    protected boolean isOkaySpecialCaseException(Method method,
+                                                 Throwable cause) {
+       // New Java 8 method not supported by Avatica
+
+      return method.getName().equals( "executeLargeBatch" );
+    }
   } // class PlainStatementChecker
 
   @Test
@@ -386,7 +395,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     }
   }
 
-
   private static class PreparedStatementChecker
       extends NoNonSqlExceptionsChecker<PreparedStatement> {
 
@@ -397,10 +405,18 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends
JdbcTestBase
       this.factoryConnection = factoryConnection;
     }
 
+    @Override
     protected PreparedStatement getJdbcObject() throws SQLException {
       return factoryConnection.prepareStatement("VALUES 1");
     }
 
+    @Override
+    protected boolean isOkaySpecialCaseException(Method method,
+                                                 Throwable cause) {
+       // New Java 8 method not supported by Avatica
+
+      return method.getName().equals( "executeLargeBatch" );
+    }
   } // class PlainStatementChecker
 
   @Test
@@ -415,7 +431,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     }
   }
 
-
   @Test
   public void testResultSetMethodsThrowRight() {
     NoNonSqlExceptionsChecker<ResultSet> checker =
@@ -428,7 +443,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     }
   }
 
-
   @Test
   public void testResultSetMetaDataMethodsThrowRight() {
     NoNonSqlExceptionsChecker<ResultSetMetaData> checker =
@@ -442,7 +456,6 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
     }
   }
 
-
   @Test
   public void testDatabaseMetaDataMethodsThrowRight() {
     NoNonSqlExceptionsChecker<DatabaseMetaData> checker =
@@ -455,5 +468,4 @@ public class Drill2769UnsupportedReportsUseSqlExceptionTest extends JdbcTestBase
       fail("Non-SQLException exception error(s): \n" + checker.getReport());
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/a6a0f2f0/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java
index 3f8514e..caa09b8 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcAssert.java
@@ -66,6 +66,11 @@ public class JdbcAssert {
   public static Properties getDefaultProperties() {
     final Properties properties = new Properties();
     properties.setProperty("drillJDBCUnitTests", "true");
+
+    // Must set this to false to ensure that the tests ignore any existing
+    // plugin configurations stored in /tmp/drill.
+
+    properties.setProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, "false");
     properties.setProperty(ExecConstants.HTTP_ENABLE, "false");
     return properties;
   }
@@ -246,7 +251,6 @@ public class JdbcAssert {
       }
     }
 
-
     /**
      * Checks that the current SQL statement returns the expected result lines. Lines are
compared unordered; the test
      * succeeds if the query returns these lines in any order.
@@ -291,7 +295,6 @@ public class JdbcAssert {
           connection.close();
         }
       }
-
     }
 
     private SortedSet<String> unsortedList(List<String> strings) {
@@ -353,7 +356,6 @@ public class JdbcAssert {
   private static interface ConnectionFactoryAdapter {
     Connection createConnection() throws Exception;
   }
-
 }
 
 // End JdbcAssert.java


Mime
View raw message