-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-15666 shaded dependencies for hbase-testing-util
HBASE-15666 shaded dependencies for hbase-testing-util Added new artifact hbase-shaded-testing-util. It wraps a whole hbase-server with its testing dependencies. Users should use only the following dependency in pom: <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-shaded-testing-util</artifactId> <version>${hbase.version}</version> <scope>test</scope> </dependency> Added hbase-shaded-testing-util-tester maven module which ensures that hbase-shaded-testing-util works with a shaded client. Signed-off-by: Josh Elser <elserj@apache.org>
- Loading branch information
Showing
10 changed files
with
845 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<!-- | ||
/** | ||
* 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. | ||
*/ | ||
--> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-build-configuration</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>../../hbase-build-configuration</relativePath> | ||
</parent> | ||
|
||
<artifactId>hbase-shaded-testing-util-tester</artifactId> | ||
<name>Apache HBase - Shaded - Testing Util Tester</name> | ||
<description>Ensures that hbase-shaded-testing-util works with hbase-shaded-client.</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-shaded-client</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-shaded-testing-util</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
72 changes: 72 additions & 0 deletions
72
...ting-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* | ||
* 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.hbase.shaded; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
import org.apache.hadoop.hbase.HBaseTestingUtility; | ||
import org.apache.hadoop.hbase.TableName; | ||
import org.apache.hadoop.hbase.client.Put; | ||
import org.apache.hadoop.hbase.client.Table; | ||
import org.apache.hadoop.hbase.testclassification.ClientTests; | ||
import org.apache.hadoop.hbase.testclassification.MediumTests; | ||
import org.apache.hadoop.hbase.util.Bytes; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
|
||
@Category({ ClientTests.class, MediumTests.class }) | ||
public class TestShadedHBaseTestingUtility { | ||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestShadedHBaseTestingUtility.class); | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
TEST_UTIL.startMiniCluster(); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDown() throws Exception { | ||
TEST_UTIL.shutdownMiniCluster(); | ||
} | ||
|
||
@Test | ||
public void testCreateTable() throws Exception { | ||
TableName tableName = TableName.valueOf("test"); | ||
|
||
Table table = TEST_UTIL.createTable(tableName, "cf"); | ||
|
||
Put put1 = new Put(Bytes.toBytes("r1")); | ||
put1.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("c"), Bytes.toBytes(1)); | ||
table.put(put1); | ||
|
||
Put put2 = new Put(Bytes.toBytes("r2")); | ||
put2.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("c"), Bytes.toBytes(2)); | ||
table.put(put2); | ||
|
||
int rows = TEST_UTIL.countRows(tableName); | ||
assertEquals(2, rows); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<!-- | ||
/** | ||
* 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. | ||
*/ | ||
--> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>hbase-shaded</artifactId> | ||
<groupId>org.apache.hbase</groupId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>..</relativePath> | ||
</parent> | ||
|
||
<artifactId>hbase-shaded-testing-util</artifactId> | ||
<name>Apache HBase - Shaded - Testing Util</name> | ||
|
||
<dependencies> | ||
<!-- test-jar dependencies --> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-common</artifactId> | ||
<version>${hadoop.version}</version> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.servlet.jsp</groupId> | ||
<artifactId>jsp-api</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hadoop</groupId> | ||
<artifactId>hadoop-hdfs</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-common</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-server</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-zookeeper</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop-compat</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-hadoop2-compat</artifactId> | ||
<type>test-jar</type> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.hbase</groupId> | ||
<artifactId>hbase-testing-util</artifactId> | ||
<version>${project.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<!--Make it so assembly:single does nothing in here--> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<skipAssembly>true</skipAssembly> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>aggregate-into-a-jar-with-relocated-third-parties</id> | ||
<configuration> | ||
<artifactSet> | ||
<excludes> | ||
<!-- exclude J2EE modules that come in for JDK11+ (since | ||
hadoop-3.2.0) or modules that come in for JDK8+ but | ||
need not be included --> | ||
<exclude>javax.annotation:javax.annotation-api</exclude> | ||
<exclude>javax.activation:javax.activation-api</exclude> | ||
<!-- | ||
Tell the shade plugin that in this case we want to include hadoop | ||
by leaving out the exclude. | ||
--> | ||
<!-- The rest of these should be kept in sync with the parent pom --> | ||
<exclude>org.apache.hbase:hbase-resource-bundle</exclude> | ||
<exclude>org.slf4j:*</exclude> | ||
<exclude>com.google.code.findbugs:*</exclude> | ||
<exclude>com.github.stephenc.findbugs:*</exclude> | ||
<exclude>org.apache.htrace:*</exclude> | ||
<exclude>org.apache.yetus:*</exclude> | ||
<exclude>log4j:*</exclude> | ||
<exclude>commons-logging:*</exclude> | ||
</excludes> | ||
</artifactSet> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.