Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 656ce76aa -> cdca9377e
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cdca9377/phoenix-server/src/test/java/org/apache/phoenix/DriverCohabitationTest.java ---------------------------------------------------------------------- diff --git a/phoenix-server/src/test/java/org/apache/phoenix/DriverCohabitationTest.java b/phoenix-server/src/test/java/org/apache/phoenix/DriverCohabitationTest.java new file mode 100644 index 0000000..1df6d2c --- /dev/null +++ b/phoenix-server/src/test/java/org/apache/phoenix/DriverCohabitationTest.java @@ -0,0 +1,65 @@ +/* + * 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.phoenix; + +import org.apache.phoenix.queryserver.client.ThinClientUtil; +import org.apache.phoenix.util.QueryUtil; +import org.junit.Test; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Collections; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * Ensure the "thick" Phoenix driver and it's "thin" counterpart can coexist on + * the same classpath. + */ +public class DriverCohabitationTest { + + @Test + public void testDriverCohabitation() throws SQLException { + Driver thickDriver = null; + Driver thinDriver = null; + + for (Driver d : Collections.list(DriverManager.getDrivers())) { + if (d instanceof org.apache.phoenix.jdbc.PhoenixDriver) { + thickDriver = d; + } else if (d instanceof org.apache.phoenix.queryserver.client.Driver) { + thinDriver = d; + } + } + assertNotNull("Thick driver not registered with DriverManager.", thickDriver); + assertNotNull("Thin driver not registered with DriverManager.", thinDriver); + + final String thickUrl = QueryUtil.getUrl("localhost"); + final String thinUrl = ThinClientUtil.getConnectionUrl("localhost", 1234); + assertTrue("Thick driver should accept connections like " + thickUrl, + thickDriver.acceptsURL(thickUrl)); + assertFalse("Thick driver should reject connections like " + thinUrl, + thickDriver.acceptsURL(thinUrl)); + assertTrue("Thin driver should accept connections like " + thinUrl, + thinDriver.acceptsURL(thinUrl)); + assertFalse("Thin driver should reject connections like " + thickUrl, + thinDriver.acceptsURL(thickUrl)); + } +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/cdca9377/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 14e1837..8672d17 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,8 @@ <module>phoenix-core</module> <module>phoenix-flume</module> <module>phoenix-pig</module> + <module>phoenix-server-client</module> + <module>phoenix-server</module> <module>phoenix-assembly</module> <module>phoenix-pherf</module> <module>phoenix-spark</module> @@ -91,7 +93,7 @@ <commons-configuration.version>1.6</commons-configuration.version> <commons-io.version>2.1</commons-io.version> <commons-lang.version>2.5</commons-lang.version> - <commons-logging.version>1.1.1</commons-logging.version> + <commons-logging.version>1.2</commons-logging.version> <commons-csv.version>1.0</commons-csv.version> <sqlline.version>1.1.8</sqlline.version> <guava.version>12.0.1</guava.version> @@ -106,6 +108,7 @@ <collections.version>3.2.1</collections.version> <jodatime.version>2.7</jodatime.version> <joni.version>2.1.2</joni.version> + <calcite.version>1.2.0-incubating</calcite.version> <!-- Test Dependencies --> <mockito-all.version>1.8.5</mockito-all.version> @@ -161,7 +164,7 @@ </goals> </pluginExecutionFilter> <action> - <ignore></ignore> + <ignore /> </action> </pluginExecution> </pluginExecutions> @@ -210,6 +213,7 @@ <exclude>.classpath</exclude> <exclude>.settings/**</exclude> <exclude>**/*Protos.java</exclude> + <exclude>**/java.sql.Driver</exclude> </excludes> </configuration> </plugin> @@ -435,6 +439,16 @@ <artifactId>phoenix-spark</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.phoenix</groupId> + <artifactId>phoenix-server-client</artifactId> + <version>${project.version}</version> + </dependency> <!-- HBase dependencies --> <dependency> @@ -452,6 +466,19 @@ </dependency> <dependency> <groupId>org.apache.hbase</groupId> + <artifactId>hbase-it</artifactId> + <version>${hbase.version}</version> + <type>test-jar</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.jruby</groupId> + <artifactId>jruby-complete</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.hbase</groupId> <artifactId>hbase-protocol</artifactId> <version>${hbase.version}</version> </dependency> @@ -526,6 +553,16 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-avatica</artifactId> + <version>${calcite.version}</version> + </dependency> + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-avatica-server</artifactId> + <version>${calcite.version}</version> + </dependency> <!-- Make sure we have all the antlr dependencies --> <dependency> @@ -640,6 +677,11 @@ <version>${htrace.version}</version> </dependency> <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging.version}</version> + </dependency> + <dependency> <groupId>io.netty</groupId> <artifactId>netty</artifactId> <version>${netty.version}</version>
