HBASE-24228 Merge the code in hbase-hadoop2-compat module to hbase-hadoop-compat (#1563)

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Duo Zhang 2020-04-29 10:34:53 +08:00 committed by GitHub
parent 8fceec8cb1
commit 6928674eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
118 changed files with 106 additions and 375 deletions

View File

@ -236,10 +236,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>${compat.module}</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-shell</artifactId>

View File

@ -41,7 +41,6 @@
<include>org.apache.hbase:hbase-examples</include>
<include>org.apache.hbase:hbase-external-blockcache</include>
<include>org.apache.hbase:hbase-hadoop-compat</include>
<include>org.apache.hbase:hbase-hadoop2-compat</include>
<include>org.apache.hbase:hbase-http</include>
<include>org.apache.hbase:hbase-it</include>
<include>org.apache.hbase:hbase-mapreduce</include>

View File

@ -41,7 +41,6 @@
<include>org.apache.hbase:hbase-examples</include>
<include>org.apache.hbase:hbase-external-blockcache</include>
<include>org.apache.hbase:hbase-hadoop-compat</include>
<include>org.apache.hbase:hbase-hadoop2-compat</include>
<include>org.apache.hbase:hbase-http</include>
<include>org.apache.hbase:hbase-it</include>
<include>org.apache.hbase:hbase-mapreduce</include>

View File

@ -73,10 +73,6 @@
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop-compat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-hadoop2-compat</artifactId>
<exclusions>
<!-- We don't need MR support classes here. -->
<exclusion>

View File

@ -95,18 +95,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>${compat.module}</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>${compat.module}</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-protocol-shaded</artifactId>

View File

@ -70,17 +70,42 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-metrics</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase.thirdparty</groupId>
<artifactId>hbase-shaded-miscellaneous</artifactId>
</dependency>
<!-- General dependencies -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@ -89,6 +114,18 @@
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-metrics-api</artifactId>
</dependency>
<dependency>
<!--
a missing transitive dependency on JDK9+ (obsoleted by Hadoop-3.3.0+, HADOOP-15775)
-->
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.master;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.MetricsTests;
@ -26,19 +29,18 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
/**
* Test for the CompatibilitySingletonFactory and building MetricsMasterSource
* Test for the CompatibilitySingletonFactory and building MetricsMasterSource
*/
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsMasterSourceFactory {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsMasterSourceFactory.class);
@Test(expected=RuntimeException.class)
public void testGetInstanceNoHadoopCompat() throws Exception {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class);
HBaseClassTestRule.forClass(TestMetricsMasterSourceFactory.class);
@Test
public void testGetInstance() throws Exception {
assertThat(CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class),
instanceOf(MetricsMasterSourceFactoryImpl.class));
}
}

View File

@ -17,8 +17,13 @@
*/
package org.apache.hadoop.hbase.regionserver;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.master.MetricsMasterSourceFactory;
import org.apache.hadoop.hbase.master.MetricsMasterSourceFactoryImpl;
import org.apache.hadoop.hbase.testclassification.MetricsTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.ClassRule;
@ -26,19 +31,18 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
/**
* Test for the CompatibilitySingletonFactory and building MetricsRegionServerSource
* Test for the CompatibilitySingletonFactory and building MetricsRegionServerSource
*/
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsRegionServerSourceFactory {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsRegionServerSourceFactory.class);
@Test(expected=RuntimeException.class)
public void testGetInstanceNoHadoopCompat() throws Exception {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
HBaseClassTestRule.forClass(TestMetricsRegionServerSourceFactory.class);
@Test
public void testGetInstance() throws Exception {
assertThat(CompatibilitySingletonFactory.getInstance(MetricsMasterSourceFactory.class),
instanceOf(MetricsMasterSourceFactoryImpl.class));
}
}

View File

@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.MetricsTests;
@ -25,17 +28,17 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsWALSource {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsWALSource.class);
@Test(expected=RuntimeException.class)
public void testGetInstanceNoHadoopCompat() throws Exception {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
HBaseClassTestRule.forClass(TestMetricsWALSource.class);
@Test
public void testGetInstance() throws Exception {
// This should throw an exception because there is no compat lib on the class path.
assertThat(CompatibilitySingletonFactory.getInstance(MetricsWALSource.class),
instanceOf(MetricsWALSourceImpl.class));
}
}

View File

@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.replication.regionserver;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.MetricsTests;
@ -26,18 +29,18 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
/**
* Test for the CompatibilitySingletonFactory and building MetricsReplicationSource
* Test for the CompatibilitySingletonFactory and building MetricsReplicationSource
*/
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsReplicationSourceFactory {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsReplicationSourceFactory.class);
HBaseClassTestRule.forClass(TestMetricsReplicationSourceFactory.class);
@Test(expected=RuntimeException.class)
public void testGetInstanceNoHadoopCompat() throws Exception {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class);
@Test
public void testGetInstance() throws Exception {
assertThat(CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class),
instanceOf(MetricsReplicationSourceImpl.class));
}
}

View File

@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.rest;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.MetricsTests;
@ -26,18 +29,18 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
/**
* Test of Rest Metrics Source interface.
* Test of Rest Metrics Source interface.
*/
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsRESTSource {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsRESTSource.class);
HBaseClassTestRule.forClass(TestMetricsRESTSource.class);
@Test(expected=RuntimeException.class)
@Test
public void testGetInstanceNoHadoopCompat() throws Exception {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsRESTSource.class);
assertThat(CompatibilitySingletonFactory.getInstance(MetricsRESTSource.class),
instanceOf(MetricsRESTSourceImpl.class));
}
}

Some files were not shown because too many files have changed in this diff Show More