From bac539e33381946f8b7aa24f63824f100611d1d4 Mon Sep 17 00:00:00 2001 From: Balazs Meszaros Date: Mon, 15 Jul 2019 11:50:21 +0200 Subject: [PATCH] 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: org.apache.hbase hbase-shaded-testing-util ${hbase.version} test hbase-shaded-testing-util-tester maven module is added which ensures hbase-shaded-testing-util works with a shaded client. Signed-off-by: Sean Busbey --- NOTICE.txt | 3 + .../ensure-jars-have-correct-contents.sh | 2 + .../hbase-shaded-testing-util-tester/pom.xml | 65 +++ .../shaded/TestShadedHBaseTestingUtility.java | 66 +++ .../hbase-shaded-testing-util/pom.xml | 109 +++++ .../org/mortbay/jetty/webapp/webdefault.xml | 426 ++++++++++++++++++ hbase-shaded/pom.xml | 12 +- 7 files changed, 675 insertions(+), 8 deletions(-) create mode 100644 hbase-shaded/hbase-shaded-testing-util-tester/pom.xml create mode 100644 hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java create mode 100644 hbase-shaded/hbase-shaded-testing-util/pom.xml create mode 100644 hbase-shaded/hbase-shaded-testing-util/src/main/resources/org/apache/hadoop/hbase/shaded/org/mortbay/jetty/webapp/webdefault.xml diff --git a/NOTICE.txt b/NOTICE.txt index 753ac0d2cd4f..3d364144758d 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -45,3 +45,6 @@ This product includes portions of the Guava project v14 and v21, specifically Copyright (C) 2007 The Guava Authors Licensed under the Apache License, Version 2.0 +-- +This product includes portions of Jetty project, specially +'hbase-shaded-hbase-shaded-testing-util/src/main/resources/org/apache/hadoop/hbase/shaded/org/mortbay/jetty/webapp/webdefault.xml' diff --git a/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh b/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh index 7c64baacbbfd..beea3d61f2a8 100644 --- a/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh +++ b/hbase-shaded/hbase-shaded-check-invariants/src/test/resources/ensure-jars-have-correct-contents.sh @@ -32,6 +32,8 @@ allowed_expr+="|^org/apache/hadoop/" allowed_expr+="|^META-INF/" # * the folding tables from jcodings allowed_expr+="|^tables/" +# * contents of hbase-webapps +allowed_expr+="|^hbase-webapps/" # * Hadoop's and HBase's default configuration files, which have the form # "_module_-default.xml" allowed_expr+="|^[^-]*-default.xml$" diff --git a/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml b/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml new file mode 100644 index 000000000000..2e7724e18036 --- /dev/null +++ b/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + + hbase + org.apache.hbase + 1.5.0-SNAPSHOT + ../.. + + + hbase-shaded-testing-util-tester + Apache HBase - Shaded - Testing Util Tester + Ensures that hbase-shaded-testing-util works with hbase-shaded-client. + + + + skip + + true + + + true + + + + release + + + + org.apache.hbase + hbase-shaded-client + ${project.version} + + + org.apache.hbase + hbase-shaded-testing-util + ${project.version} + test + + + + + + diff --git a/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java new file mode 100644 index 000000000000..190644d60f8b --- /dev/null +++ b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java @@ -0,0 +1,66 @@ +/** + * + * 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.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.Test; +import org.junit.experimental.categories.Category; + +@Category({ ClientTests.class, MediumTests.class }) +public class TestShadedHBaseTestingUtility { + private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + + @BeforeClass + public static void setUp() throws Exception { + TEST_UTIL.startMiniCluster(1, 2); + } + + @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); + } +} diff --git a/hbase-shaded/hbase-shaded-testing-util/pom.xml b/hbase-shaded/hbase-shaded-testing-util/pom.xml new file mode 100644 index 000000000000..06ea3b41d02d --- /dev/null +++ b/hbase-shaded/hbase-shaded-testing-util/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + + + hbase-shaded + org.apache.hbase + 1.5.0-SNAPSHOT + .. + + + hbase-shaded-testing-util + Apache HBase - Shaded - Testing Util + + + + + org.apache.hadoop + hadoop-hdfs + test-jar + compile + + + org.apache.hbase + hbase-common + test-jar + compile + + + org.apache.hbase + hbase-server + test-jar + compile + + + org.apache.hbase + hbase-hadoop-compat + test-jar + compile + + + org.apache.hbase + hbase-hadoop2-compat + test-jar + compile + + + + org.apache.hbase + hbase-testing-util + ${project.version} + compile + + + + + + + org.apache.maven.plugins + maven-site-plugin + + true + + + + + maven-assembly-plugin + + true + + + + + + + + release + + + + org.apache.maven.plugins + maven-shade-plugin + + + + + + + diff --git a/hbase-shaded/hbase-shaded-testing-util/src/main/resources/org/apache/hadoop/hbase/shaded/org/mortbay/jetty/webapp/webdefault.xml b/hbase-shaded/hbase-shaded-testing-util/src/main/resources/org/apache/hadoop/hbase/shaded/org/mortbay/jetty/webapp/webdefault.xml new file mode 100644 index 000000000000..1b12f34e8704 --- /dev/null +++ b/hbase-shaded/hbase-shaded-testing-util/src/main/resources/org/apache/hadoop/hbase/shaded/org/mortbay/jetty/webapp/webdefault.xml @@ -0,0 +1,426 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Default web.xml file. + This file is applied to a Web application before it's own WEB_INF/web.xml file + + + + + + + + + + org.mortbay.jetty.webapp.NoTLDJarPattern + start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default + org.apache.hadoop.hbase.shaded.org.mortbay.jetty.servlet.DefaultServlet + + acceptRanges + true + + + dirAllowed + true + + + welcomeServlets + false + + + redirectWelcome + false + + + maxCacheSize + 256000000 + + + maxCachedFileSize + 10000000 + + + maxCachedFiles + 1000 + + + cacheType + both + + + gzip + true + + + useFileMappedBuffer + true + + + 0 + + + default / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jsp + org.apache.hadoop.hbase.shaded.org.apache.jasper.servlet.JspServlet + + logVerbosityLevel + DEBUG + + + fork + false + + + xpoweredBy + false + + + 0 + + + + jsp + *.jsp + *.jspf + *.jspx + *.xsp + *.JSP + *.JSPF + *.JSPX + *.XSP + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + + + + + + + + + index.html + index.htm + index.jsp + + + + + arISO-8859-6 + beISO-8859-5 + bgISO-8859-5 + caISO-8859-1 + csISO-8859-2 + daISO-8859-1 + deISO-8859-1 + elISO-8859-7 + enISO-8859-1 + esISO-8859-1 + etISO-8859-1 + fiISO-8859-1 + frISO-8859-1 + hrISO-8859-2 + huISO-8859-2 + isISO-8859-1 + itISO-8859-1 + iwISO-8859-8 + jaShift_JIS + koEUC-KR + ltISO-8859-2 + lvISO-8859-2 + mkISO-8859-5 + nlISO-8859-1 + noISO-8859-1 + plISO-8859-2 + ptISO-8859-1 + roISO-8859-2 + ruISO-8859-5 + shISO-8859-5 + skISO-8859-2 + slISO-8859-2 + sqISO-8859-2 + srISO-8859-5 + svISO-8859-1 + trISO-8859-9 + ukISO-8859-5 + zhGB2312 + zh_TWBig5 + + + + + Disable TRACE + / + TRACE + + + + + + diff --git a/hbase-shaded/pom.xml b/hbase-shaded/pom.xml index 4e235b0c615a..ed87764b72da 100644 --- a/hbase-shaded/pom.xml +++ b/hbase-shaded/pom.xml @@ -40,6 +40,8 @@ hbase-shaded-client hbase-shaded-server + hbase-shaded-testing-util + hbase-shaded-testing-util-tester hbase-shaded-check-invariants @@ -382,6 +384,8 @@ false ${project.name} + + @@ -392,14 +396,6 @@ META-INF/ECLIPSEF.RSA - - - org.apache.hbase:hbase-server - - hbase-webapps/* - hbase-webapps/**/* - - org.apache.hadoop:hadoop-yarn-common