Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion exec/jdbc-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,16 @@
<exclude>**/logback.xml</exclude>
<exclude>**/LICENSE.txt</exclude>
<exclude>**/*.java</exclude>
<exclude>**/META-INF/**</exclude>
<exclude>META-INF/ASL2.0</exclude>
<exclude>META-INF/NOTICE.txt</exclude>
<exclude>META-INF/drill-module-scan/**</exclude>
<exclude>META-INF/jboss-beans.xml</exclude>
<exclude>META-INF/license/**</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/native/**</exclude>
<exclude>META-INF/services/com.fasterxml.*</exclude>
<exclude>META-INF/services/javax.ws.*</exclude>
<exclude>META-INF/**/*.properties</exclude>
<exclude>**/org.codehaus.commons.compiler.properties</exclude>
<exclude>**/*.SF</exclude>
<exclude>**/*.RSA</exclude>
Expand Down
1 change: 1 addition & 0 deletions exec/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<exclude>**/donuts-output-data.txt</exclude>
<exclude>**/*.tbl</exclude>
<exclude>**/derby.log</exclude>
<exclude>src/main/resources/META-INF/services/**</exclude>
</excludes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.apache.drill.jdbc.Driver
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

import java.io.IOException;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Iterator;
import java.util.Map;
import java.util.ServiceLoader;

import org.apache.calcite.rel.core.JoinRelType;
import org.apache.drill.common.logical.LogicalPlan;
import org.apache.drill.common.logical.PlanProperties;
import org.apache.drill.common.logical.StoragePluginConfig;
Expand All @@ -37,7 +41,6 @@
import org.apache.drill.common.logical.data.Union;
import org.apache.drill.jdbc.JdbcTestBase;
import org.apache.drill.jdbc.test.JdbcAssert.TestDataConnection;
import org.apache.calcite.rel.core.JoinRelType;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
Expand Down Expand Up @@ -80,6 +83,22 @@ public void testLoadDriver() throws ClassNotFoundException {
Class.forName("org.apache.drill.jdbc.Driver");
}

/**
* Load the driver using ServiceLoader
*/
@Test
public void testLoadDriverServiceLoader() {
ServiceLoader<Driver> sl = ServiceLoader.load(Driver.class);
for(Iterator<Driver> it = sl.iterator(); it.hasNext(); ) {
Driver driver = it.next();
if (driver instanceof org.apache.drill.jdbc.Driver) {
return;
}
}

Assert.fail("org.apache.drill.jdbc.Driver not found using ServiceLoader");
}

/** Load driver and make a connection. */
@Test
public void testConnect() throws Exception {
Expand All @@ -92,6 +111,7 @@ public void testConnect() throws Exception {
@Test
public void testPrepare() throws Exception {
JdbcAssert.withModel(MODEL, "DONUTS").withConnection(new Function<Connection, Void>() {
@Override
public Void apply(Connection connection) {
try {
final Statement statement = connection.prepareStatement("select * from donuts");
Expand Down