Skip to content

Commit

Permalink
HBASE-24228 Merge the code in hbase-hadoop2-compat module to hbase-ha…
Browse files Browse the repository at this point in the history
…doop-compat (apache#1563)

Signed-off-by: stack <stack@apache.org>
  • Loading branch information
Apache9 committed Apr 29, 2020
1 parent 8fceec8 commit 6928674
Show file tree
Hide file tree
Showing 118 changed files with 106 additions and 375 deletions.
4 changes: 0 additions & 4 deletions hbase-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion hbase-assembly/src/main/assembly/hadoop-three-compat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion hbase-assembly/src/main/assembly/hadoop-two-compat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 0 additions & 4 deletions hbase-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
12 changes: 0 additions & 12 deletions hbase-endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
39 changes: 38 additions & 1 deletion hbase-hadoop-compat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,19 +29,18 @@
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@
*/
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;
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,17 +28,17 @@
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,18 +29,18 @@
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,18 +29,18 @@
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.thrift;

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;
Expand All @@ -28,18 +31,16 @@
/**
* Test for the interface of MetricsThriftServerSourceFactory
*/
@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsThriftServerSourceFactory {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsThriftServerSourceFactory.class);

HBaseClassTestRule.forClass(TestMetricsThriftServerSourceFactory.class);

@Test(expected=RuntimeException.class)
public void testGetInstanceNoHadoopCompat() throws RuntimeException {
//This should throw an exception because there is no compat lib on the class path.
CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class);
@Test
public void testGetInstance() {
assertThat(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class),
instanceOf(MetricsThriftServerSourceFactoryImpl.class));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/
package org.apache.hadoop.hbase.zookeeper;

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;
Expand All @@ -25,16 +28,16 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category({MetricsTests.class, SmallTests.class})
@Category({ MetricsTests.class, SmallTests.class })
public class TestMetricsZooKeeperSource {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsZooKeeperSource.class);
HBaseClassTestRule.forClass(TestMetricsZooKeeperSource.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(MetricsZooKeeperSource.class);
assertThat(CompatibilitySingletonFactory.getInstance(MetricsZooKeeperSource.class),
instanceOf(MetricsZooKeeperSourceImpl.class));
}
}
Loading

0 comments on commit 6928674

Please sign in to comment.