HBASE-22574 hbase-filesystem does not build against HBase 1 (#5)
Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
diff --git a/hbase-oss/pom.xml b/hbase-oss/pom.xml
index 1a06965..d9e3c00 100644
--- a/hbase-oss/pom.xml
+++ b/hbase-oss/pom.xml
@@ -290,6 +290,13 @@
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-hdfs</artifactId>
+ <version>${hadoop.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-distcp</artifactId>
<version>${hadoop.version}</version>
<type>test-jar</type>
@@ -311,6 +318,7 @@
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
<version>${hadoop.version}</version>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
@@ -359,20 +367,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-zookeeper</artifactId>
- <version>${hbase.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hbase</groupId>
- <artifactId>hbase-zookeeper</artifactId>
- <version>${hbase.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
diff --git a/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/EmbeddedZK.java b/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/EmbeddedZK.java
index c50940c..4987913 100644
--- a/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/EmbeddedZK.java
+++ b/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/EmbeddedZK.java
@@ -21,7 +21,6 @@
import java.net.InetAddress;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseZKTestingUtility;
import org.apache.hadoop.hbase.oss.Constants;
import org.apache.hadoop.hbase.oss.sync.TreeLockManager;
import org.apache.hadoop.hbase.oss.sync.ZKTreeLockManager;
@@ -32,17 +31,24 @@
@InterfaceStability.Unstable
public class EmbeddedZK {
- private static HBaseZKTestingUtility util = null;
+ private static Object testUtil = null;
public static synchronized void conditionalStart(Configuration conf) throws Exception {
- Class implementation = conf.getClass(Constants.SYNC_IMPL, TreeLockManager.class);
+ Class<?> implementation = conf.getClass(Constants.SYNC_IMPL, TreeLockManager.class);
boolean notConfigured = StringUtils.isEmpty(conf.get(Constants.ZK_CONN_STRING));
if (implementation == ZKTreeLockManager.class && notConfigured) {
- if (util == null) {
- util = new HBaseZKTestingUtility(conf);
- util.startMiniZKCluster();
+ if (testUtil == null) {
+ Class<?> testUtilImpl;
+ try {
+ testUtilImpl = Class.forName("org.apache.hadoop.hbase.HBaseZKTestingUtility");
+ } catch (ClassNotFoundException ex) {
+ testUtilImpl = Class.forName("org.apache.hadoop.hbase.HBaseTestingUtility");
+ }
+ testUtil = testUtilImpl.getDeclaredConstructor(Configuration.class).newInstance(conf);
+ testUtil.getClass().getDeclaredMethod("startMiniZKCluster").invoke(testUtil);
}
- int port = util.getZkCluster().getClientPort();
+ Object zkCluster = testUtil.getClass().getDeclaredMethod("getZkCluster").invoke(testUtil);
+ int port = (int) zkCluster.getClass().getDeclaredMethod("getClientPort").invoke(zkCluster);
String hostname = InetAddress.getLocalHost().getHostName();
String connectionString = hostname + ":" + port;
conf.set(Constants.ZK_CONN_STRING, connectionString);
@@ -50,9 +56,9 @@
}
public static synchronized void conditionalStop() throws Exception {
- if (util != null) {
- util.shutdownMiniZKCluster();
- util = null;
+ if (testUtil != null) {
+ testUtil.getClass().getDeclaredMethod("shutdownMiniZKCluster").invoke(testUtil);
+ testUtil = null;
}
}
}
diff --git a/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/sync/TestTreeLockManager.java b/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/sync/TestTreeLockManager.java
index 6fb3285..bafc121 100644
--- a/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/sync/TestTreeLockManager.java
+++ b/hbase-oss/src/test/java/org/apache/hadoop/hbase/oss/sync/TestTreeLockManager.java
@@ -16,14 +16,14 @@
* limitations under the License.
*/
-package org.apache.hadoop.hbase.oss;
+package org.apache.hadoop.hbase.oss.sync;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.hadoop.hbase.oss.HBaseObjectStoreSemanticsTest;
import org.apache.hadoop.hbase.oss.sync.AutoLock;
import org.apache.hadoop.hbase.oss.sync.NullTreeLockManager;
-import org.apache.hadoop.hbase.oss.sync.TreeLockManager;
import org.apache.hadoop.hbase.oss.sync.TreeLockManager.Depth;
import org.apache.hadoop.fs.Path;
import org.junit.Assert;
diff --git a/pom.xml b/pom.xml
index b25f878..6de859e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,9 @@
<guava.version>23.0</guava.version>
<hadoop2.version>2.9.2</hadoop2.version>
<hadoop3.version>3.2.0</hadoop3.version>
- <hbase.version>2.1.4</hbase.version>
+ <hbase1.version>1.4.10</hbase1.version>
+ <hbase2.version>2.1.4</hbase2.version>
+ <hbase-thirdparty.version>2.2.1</hbase-thirdparty.version>
<junit.version>4.12</junit.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.25</slf4j.version>
@@ -93,15 +95,6 @@
<properties>
<hadoop.version>${hadoop2.version}</hadoop.version>
</properties>
- <dependencies>
- <!-- TestHBOSSContractDistCp hard-codes some HDFS classes in Hadoop 2 -->
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-hdfs</artifactId>
- <version>${hadoop.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
</profile>
<profile>
<id>hadoop3</id>
@@ -126,5 +119,106 @@
<hadoop.version>${hadoop3.version}</hadoop.version>
</properties>
</profile>
+ <profile>
+ <id>hbase-default</id>
+ <activation>
+ <property>
+ <name>!hbase.profile</name>
+ </property>
+ </activation>
+ <properties>
+ <hbase.version>${hbase2.version}</hbase.version>
+ </properties>
+ <!-- For testing against ZK -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-zookeeper</artifactId>
+ <version>${hbase2.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-zookeeper</artifactId>
+ <version>${hbase2.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>hbase2</id>
+ <activation>
+ <property>
+ <name>hbase.profile</name>
+ <value>2</value>
+ </property>
+ </activation>
+ <properties>
+ <hbase.version>${hbase2.version}</hbase.version>
+ </properties>
+ <!-- For testing against ZK -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-zookeeper</artifactId>
+ <version>${hbase2.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-zookeeper</artifactId>
+ <version>${hbase2.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>hbase1</id>
+ <activation>
+ <property>
+ <name>hbase.profile</name>
+ <value>1</value>
+ </property>
+ </activation>
+ <properties>
+ <hbase.version>${hbase1.version}</hbase.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hbase.thirdparty</groupId>
+ <artifactId>hbase-shaded-miscellaneous</artifactId>
+ <version>${hbase-thirdparty.version}</version>
+ </dependency>
+ <!-- For testing against ZK -->
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase1.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hbase</groupId>
+ <artifactId>hbase-testing-util</artifactId>
+ <version>${hbase1.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-minikdc</artifactId>
+ <version>${hadoop.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.directory.jdbm</groupId>
+ <artifactId>apacheds-jdbm1</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
+
</project>