You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/01/31 13:03:04 UTC
hbase git commit: HBASE-19887 Do not overwrite the surefire junit
listener property in the pom of sub modules
Repository: hbase
Updated Branches:
refs/heads/master 2e6bc1244 -> 7c318cead
HBASE-19887 Do not overwrite the surefire junit listener property in the pom of sub modules
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7c318cea
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7c318cea
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7c318cea
Branch: refs/heads/master
Commit: 7c318cead902d8aa7c6defe67a6e76509c854d52
Parents: 2e6bc12
Author: zhangduo <zh...@apache.org>
Authored: Tue Jan 30 22:29:13 2018 +0800
Committer: zhangduo <zh...@apache.org>
Committed: Wed Jan 31 20:49:18 2018 +0800
----------------------------------------------------------------------
hbase-archetypes/hbase-client-project/pom.xml | 13 -
.../hbase-shaded-client-project/pom.xml | 13 -
.../hadoop/hbase/util/PoolMapTestBase.java | 61 +++++
.../hadoop/hbase/util/TestReusablePoolMap.java | 90 +++++++
.../hbase/util/TestRoundRobinPoolMap.java | 102 ++++++++
.../hbase/util/TestThreadLocalPoolMap.java | 84 +++++++
.../hbase/ResourceCheckerJUnitListener.java | 23 +-
hbase-external-blockcache/pom.xml | 11 -
hbase-http/pom.xml | 6 -
hbase-mapreduce/pom.xml | 12 -
hbase-replication/pom.xml | 17 --
hbase-rest/pom.xml | 6 -
hbase-server/pom.xml | 6 -
.../ServerResourceCheckerJUnitListener.java | 27 ---
.../apache/hadoop/hbase/util/TestPoolMap.java | 238 -------------------
hbase-shell/pom.xml | 12 -
hbase-zookeeper/pom.xml | 12 -
17 files changed, 347 insertions(+), 386 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-archetypes/hbase-client-project/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-archetypes/hbase-client-project/pom.xml b/hbase-archetypes/hbase-client-project/pom.xml
index 489446a..17aed9b 100644
--- a/hbase-archetypes/hbase-client-project/pom.xml
+++ b/hbase-archetypes/hbase-client-project/pom.xml
@@ -40,19 +40,6 @@
<surefire.version>2.19</surefire.version>
<junit.version>4.12</junit.version>
</properties>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
<dependencies>
<!-- Dependency for hbase-testing-util must precede compile-scoped dependencies. -->
<dependency>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-archetypes/hbase-shaded-client-project/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-archetypes/hbase-shaded-client-project/pom.xml b/hbase-archetypes/hbase-shaded-client-project/pom.xml
index 59acf94..37f5e22 100644
--- a/hbase-archetypes/hbase-shaded-client-project/pom.xml
+++ b/hbase-archetypes/hbase-shaded-client-project/pom.xml
@@ -40,19 +40,6 @@
<surefire.version>2.19</surefire.version>
<junit.version>4.12</junit.version>
</properties>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
<dependencies>
<!-- Dependency for hbase-testing-util must precede compile-scoped dependencies. -->
<dependency>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-client/src/test/java/org/apache/hadoop/hbase/util/PoolMapTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/PoolMapTestBase.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/PoolMapTestBase.java
new file mode 100644
index 0000000..1b24252
--- /dev/null
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/PoolMapTestBase.java
@@ -0,0 +1,61 @@
+/**
+ * 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.hadoop.hbase.util;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.hadoop.hbase.util.PoolMap.PoolType;
+import org.junit.After;
+import org.junit.Before;
+
+public abstract class PoolMapTestBase {
+
+ protected PoolMap<String, String> poolMap;
+
+ protected static final int POOL_SIZE = 3;
+
+ @Before
+ public void setUp() throws Exception {
+ this.poolMap = new PoolMap<>(getPoolType(), POOL_SIZE);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ this.poolMap.clear();
+ }
+
+ protected abstract PoolType getPoolType();
+
+ protected void runThread(final String randomKey, final String randomValue,
+ final String expectedValue) throws InterruptedException {
+ final AtomicBoolean matchFound = new AtomicBoolean(false);
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ poolMap.put(randomKey, randomValue);
+ String actualValue = poolMap.get(randomKey);
+ matchFound
+ .set(expectedValue == null ? actualValue == null : expectedValue.equals(actualValue));
+ }
+ });
+ thread.start();
+ thread.join();
+ assertTrue(matchFound.get());
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestReusablePoolMap.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestReusablePoolMap.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestReusablePoolMap.java
new file mode 100644
index 0000000..3fcaebb
--- /dev/null
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestReusablePoolMap.java
@@ -0,0 +1,90 @@
+/**
+ * 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.hadoop.hbase.util;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.testclassification.MiscTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.PoolMap.PoolType;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({ MiscTests.class, SmallTests.class })
+public class TestReusablePoolMap extends PoolMapTestBase {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ HBaseClassTestRule.forClass(TestReusablePoolMap.class);
+
+ @Override
+ protected PoolType getPoolType() {
+ return PoolType.Reusable;
+ }
+
+ @Test
+ public void testSingleThreadedClient() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ // As long as we poll values we put, the pool size should remain zero
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(0, poolMap.size(randomKey));
+ }
+
+ @Test
+ public void testMultiThreadedClients() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ // As long as we poll values we put, the pool size should remain zero
+ for (int i = 0; i < POOL_SIZE; i++) {
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(0, poolMap.size(randomKey));
+ }
+ poolMap.clear();
+ String randomKey = String.valueOf(rand.nextInt());
+ for (int i = 0; i < POOL_SIZE - 1; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(0, poolMap.size(randomKey));
+ }
+ assertEquals(0, poolMap.size(randomKey));
+ }
+
+ @Test
+ public void testPoolCap() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ // As long as we poll values we put, the pool size should remain zero
+ String randomKey = String.valueOf(rand.nextInt());
+ List<String> randomValues = new ArrayList<>();
+ for (int i = 0; i < POOL_SIZE * 2; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ randomValues.add(randomValue);
+ runThread(randomKey, randomValue, randomValue);
+ }
+ assertEquals(0, poolMap.size(randomKey));
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
new file mode 100644
index 0000000..a71cf29
--- /dev/null
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestRoundRobinPoolMap.java
@@ -0,0 +1,102 @@
+/**
+ * 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.hadoop.hbase.util;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.testclassification.MiscTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.PoolMap.PoolType;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({ MiscTests.class, SmallTests.class })
+public class TestRoundRobinPoolMap extends PoolMapTestBase {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ HBaseClassTestRule.forClass(TestRoundRobinPoolMap.class);
+
+ @Override
+ protected PoolType getPoolType() {
+ return PoolType.RoundRobin;
+ }
+
+ @Test
+ public void testSingleThreadedClient() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ // As long as the pool is not full, we'll get null back.
+ // This forces the user to create new values that can be used to populate
+ // the pool.
+ runThread(randomKey, randomValue, null);
+ assertEquals(1, poolMap.size(randomKey));
+ }
+
+ @Test
+ public void testMultiThreadedClients() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ for (int i = 0; i < POOL_SIZE; i++) {
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ // As long as the pool is not full, we'll get null back
+ runThread(randomKey, randomValue, null);
+ // As long as we use distinct keys, each pool will have one value
+ assertEquals(1, poolMap.size(randomKey));
+ }
+ poolMap.clear();
+ String randomKey = String.valueOf(rand.nextInt());
+ for (int i = 0; i < POOL_SIZE - 1; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ // As long as the pool is not full, we'll get null back
+ runThread(randomKey, randomValue, null);
+ // since we use the same key, the pool size should grow
+ assertEquals(i + 1, poolMap.size(randomKey));
+ }
+ // at the end of the day, there should be as many values as we put
+ assertEquals(POOL_SIZE - 1, poolMap.size(randomKey));
+ }
+
+ @Test
+ public void testPoolCap() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ String randomKey = String.valueOf(rand.nextInt());
+ List<String> randomValues = new ArrayList<>();
+ for (int i = 0; i < POOL_SIZE * 2; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ randomValues.add(randomValue);
+ if (i < POOL_SIZE - 1) {
+ // As long as the pool is not full, we'll get null back
+ runThread(randomKey, randomValue, null);
+ } else {
+ // when the pool becomes full, we expect the value we get back to be
+ // what we put earlier, in round-robin order
+ runThread(randomKey, randomValue, randomValues.get((i - POOL_SIZE + 1) % POOL_SIZE));
+ }
+ }
+ assertEquals(POOL_SIZE, poolMap.size(randomKey));
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
new file mode 100644
index 0000000..5f047c4
--- /dev/null
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/util/TestThreadLocalPoolMap.java
@@ -0,0 +1,84 @@
+/**
+ * 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.hadoop.hbase.util;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Random;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.testclassification.MiscTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.PoolMap.PoolType;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category({ MiscTests.class, SmallTests.class })
+public class TestThreadLocalPoolMap extends PoolMapTestBase {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ HBaseClassTestRule.forClass(TestThreadLocalPoolMap.class);
+
+ @Override
+ protected PoolType getPoolType() {
+ return PoolType.ThreadLocal;
+ }
+
+ @Test
+ public void testSingleThreadedClient() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ // As long as the pool is not full, we should get back what we put
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(1, poolMap.size(randomKey));
+ }
+
+ @Test
+ public void testMultiThreadedClients() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ // As long as the pool is not full, we should get back what we put
+ for (int i = 0; i < POOL_SIZE; i++) {
+ String randomKey = String.valueOf(rand.nextInt());
+ String randomValue = String.valueOf(rand.nextInt());
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(1, poolMap.size(randomKey));
+ }
+ String randomKey = String.valueOf(rand.nextInt());
+ for (int i = 0; i < POOL_SIZE; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ runThread(randomKey, randomValue, randomValue);
+ assertEquals(i + 1, poolMap.size(randomKey));
+ }
+ }
+
+ @Test
+ public void testPoolCap() throws InterruptedException, ExecutionException {
+ Random rand = ThreadLocalRandom.current();
+ String randomKey = String.valueOf(rand.nextInt());
+ for (int i = 0; i < POOL_SIZE * 2; i++) {
+ String randomValue = String.valueOf(rand.nextInt());
+ // as of HBASE-4150, pool limit is no longer used with ThreadLocalPool
+ runThread(randomKey, randomValue, randomValue);
+ }
+ assertEquals(POOL_SIZE * 2, poolMap.size(randomKey));
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
index 709646b..225d94f 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
@@ -1,5 +1,4 @@
-/*
- *
+/**
* 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
@@ -19,25 +18,24 @@
package org.apache.hadoop.hbase;
-
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-
import org.apache.hadoop.hbase.ResourceChecker.Phase;
import org.apache.hadoop.hbase.util.JVM;
import org.junit.runner.notification.RunListener;
/**
* Listen to the test progress and check the usage of:
- * - threads
- * - open file descriptor
- * - max open file descriptor
- * <p/>
+ * <ul>
+ * <li>threads</li>
+ * <li>open file descriptor</li>
+ * <li>max open file descriptor</li>
+ * </ul>
+ * <p>
* When surefire forkMode=once/always/perthread, this code is executed on the forked process.
*/
public class ResourceCheckerJUnitListener extends RunListener {
@@ -91,7 +89,7 @@ public class ResourceCheckerJUnitListener extends RunListener {
return 0;
}
JVM jvm = new JVM();
- return (int)jvm.getOpenFileDescriptorCount();
+ return (int) jvm.getOpenFileDescriptorCount();
}
@Override
@@ -107,7 +105,7 @@ public class ResourceCheckerJUnitListener extends RunListener {
return 0;
}
JVM jvm = new JVM();
- return (int)jvm.getMaxFileDescriptorCount();
+ return (int) jvm.getMaxFileDescriptorCount();
}
}
@@ -117,7 +115,7 @@ public class ResourceCheckerJUnitListener extends RunListener {
if (!JVM.isUnix()) {
return 0;
}
- return (int)(new JVM().getSystemLoadAverage()*100);
+ return (int) (new JVM().getSystemLoadAverage() * 100);
}
}
@@ -193,4 +191,3 @@ public class ResourceCheckerJUnitListener extends RunListener {
end(descriptionToShortTestName(description));
}
}
-
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-external-blockcache/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-external-blockcache/pom.xml b/hbase-external-blockcache/pom.xml
index ce79e1a..630650f 100644
--- a/hbase-external-blockcache/pom.xml
+++ b/hbase-external-blockcache/pom.xml
@@ -79,17 +79,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ResourceCheckerJUnitListener</value>
- </property>
- </properties>
- </configuration>
- </plugin>
<!-- Make a jar and put the sources in the jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-http/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-http/pom.xml b/hbase-http/pom.xml
index f1951e8..84f098a 100644
--- a/hbase-http/pom.xml
+++ b/hbase-http/pom.xml
@@ -122,12 +122,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ResourceCheckerJUnitListener</value>
- </property>
- </properties>
<systemPropertyVariables>
<test.build.webapps>target/test-classes/webapps</test.build.webapps>
</systemPropertyVariables>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-mapreduce/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-mapreduce/pom.xml b/hbase-mapreduce/pom.xml
index 0b3724b..4a416dc 100644
--- a/hbase-mapreduce/pom.xml
+++ b/hbase-mapreduce/pom.xml
@@ -66,18 +66,6 @@
</archive>
</configuration>
</plugin>
- <!-- Testing plugins -->
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ServerResourceCheckerJUnitListener</value>
- </property>
- </properties>
- </configuration>
- </plugin>
<!-- Make a jar and put the sources in the jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-replication/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-replication/pom.xml b/hbase-replication/pom.xml
index 6bcbf8d..86a844a 100644
--- a/hbase-replication/pom.xml
+++ b/hbase-replication/pom.xml
@@ -47,23 +47,6 @@
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <!-- Always skip the second part executions, since we only run
- simple unit tests in this module -->
- <executions>
- <execution>
- <id>secondPartTestsExecution</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>true</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- Make a jar and put the sources in the jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-rest/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml
index d1036f2..d4ab0b4 100644
--- a/hbase-rest/pom.xml
+++ b/hbase-rest/pom.xml
@@ -125,12 +125,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ServerResourceCheckerJUnitListener</value>
- </property>
- </properties>
<systemPropertyVariables>
<test.build.webapps>target/test-classes/webapps</test.build.webapps>
</systemPropertyVariables>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-server/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml
index 49052ef..20186a7 100644
--- a/hbase-server/pom.xml
+++ b/hbase-server/pom.xml
@@ -237,12 +237,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ServerResourceCheckerJUnitListener</value>
- </property>
- </properties>
<systemPropertyVariables>
<test.build.webapps>target/test-classes/webapps</test.build.webapps>
</systemPropertyVariables>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-server/src/test/java/org/apache/hadoop/hbase/ServerResourceCheckerJUnitListener.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ServerResourceCheckerJUnitListener.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ServerResourceCheckerJUnitListener.java
deleted file mode 100644
index 4b750e4..0000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ServerResourceCheckerJUnitListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * 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.hadoop.hbase;
-
-/**
- * Monitor the resources. use by the tests All resources in {@link ResourceCheckerJUnitListener}
- * plus the number of connection.
- */
-public class ServerResourceCheckerJUnitListener extends ResourceCheckerJUnitListener {
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestPoolMap.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestPoolMap.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestPoolMap.java
deleted file mode 100644
index dcca330..0000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestPoolMap.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/**
- * 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.hadoop.hbase.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import junit.framework.TestCase;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.util.PoolMap.PoolType;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({TestPoolMap.TestRoundRobinPoolType.class, TestPoolMap.TestThreadLocalPoolType.class,
- TestPoolMap.TestReusablePoolType.class})
-@Category({MiscTests.class, SmallTests.class})
-public class TestPoolMap {
-
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestPoolMap.class);
-
- public abstract static class TestPoolType extends TestCase {
- protected PoolMap<String, String> poolMap;
- protected Random random = new Random();
-
- protected static final int POOL_SIZE = 3;
-
- @Override
- protected void setUp() throws Exception {
- this.poolMap = new PoolMap<>(getPoolType(), POOL_SIZE);
- }
-
- protected abstract PoolType getPoolType();
-
- @Override
- protected void tearDown() throws Exception {
- this.poolMap.clear();
- }
-
- protected void runThread(final String randomKey, final String randomValue,
- final String expectedValue) throws InterruptedException {
- final AtomicBoolean matchFound = new AtomicBoolean(false);
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- poolMap.put(randomKey, randomValue);
- String actualValue = poolMap.get(randomKey);
- matchFound.set(expectedValue == null ? actualValue == null
- : expectedValue.equals(actualValue));
- }
- });
- thread.start();
- thread.join();
- assertTrue(matchFound.get());
- }
- }
-
- @Category({MiscTests.class, SmallTests.class})
- public static class TestRoundRobinPoolType extends TestPoolType {
- @Override
- protected PoolType getPoolType() {
- return PoolType.RoundRobin;
- }
-
- public void testSingleThreadedClient() throws InterruptedException,
- ExecutionException {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- // As long as the pool is not full, we'll get null back.
- // This forces the user to create new values that can be used to populate
- // the pool.
- runThread(randomKey, randomValue, null);
- assertEquals(1, poolMap.size(randomKey));
- }
-
- public void testMultiThreadedClients() throws InterruptedException,
- ExecutionException {
- for (int i = 0; i < POOL_SIZE; i++) {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- // As long as the pool is not full, we'll get null back
- runThread(randomKey, randomValue, null);
- // As long as we use distinct keys, each pool will have one value
- assertEquals(1, poolMap.size(randomKey));
- }
- poolMap.clear();
- String randomKey = String.valueOf(random.nextInt());
- for (int i = 0; i < POOL_SIZE - 1; i++) {
- String randomValue = String.valueOf(random.nextInt());
- // As long as the pool is not full, we'll get null back
- runThread(randomKey, randomValue, null);
- // since we use the same key, the pool size should grow
- assertEquals(i + 1, poolMap.size(randomKey));
- }
- // at the end of the day, there should be as many values as we put
- assertEquals(POOL_SIZE - 1, poolMap.size(randomKey));
- }
-
- public void testPoolCap() throws InterruptedException, ExecutionException {
- String randomKey = String.valueOf(random.nextInt());
- List<String> randomValues = new ArrayList<>();
- for (int i = 0; i < POOL_SIZE * 2; i++) {
- String randomValue = String.valueOf(random.nextInt());
- randomValues.add(randomValue);
- if (i < POOL_SIZE - 1) {
- // As long as the pool is not full, we'll get null back
- runThread(randomKey, randomValue, null);
- } else {
- // when the pool becomes full, we expect the value we get back to be
- // what we put earlier, in round-robin order
- runThread(randomKey, randomValue,
- randomValues.get((i - POOL_SIZE + 1) % POOL_SIZE));
- }
- }
- assertEquals(POOL_SIZE, poolMap.size(randomKey));
- }
-
- }
-
- @Category({MiscTests.class, SmallTests.class})
- public static class TestThreadLocalPoolType extends TestPoolType {
- @Override
- protected PoolType getPoolType() {
- return PoolType.ThreadLocal;
- }
-
- public void testSingleThreadedClient() throws InterruptedException,
- ExecutionException {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- // As long as the pool is not full, we should get back what we put
- runThread(randomKey, randomValue, randomValue);
- assertEquals(1, poolMap.size(randomKey));
- }
-
- public void testMultiThreadedClients() throws InterruptedException,
- ExecutionException {
- // As long as the pool is not full, we should get back what we put
- for (int i = 0; i < POOL_SIZE; i++) {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- runThread(randomKey, randomValue, randomValue);
- assertEquals(1, poolMap.size(randomKey));
- }
- String randomKey = String.valueOf(random.nextInt());
- for (int i = 0; i < POOL_SIZE; i++) {
- String randomValue = String.valueOf(random.nextInt());
- runThread(randomKey, randomValue, randomValue);
- assertEquals(i + 1, poolMap.size(randomKey));
- }
- }
-
- public void testPoolCap() throws InterruptedException, ExecutionException {
- String randomKey = String.valueOf(random.nextInt());
- for (int i = 0; i < POOL_SIZE * 2; i++) {
- String randomValue = String.valueOf(random.nextInt());
- // as of HBASE-4150, pool limit is no longer used with ThreadLocalPool
- runThread(randomKey, randomValue, randomValue);
- }
- assertEquals(POOL_SIZE * 2, poolMap.size(randomKey));
- }
-
- }
-
- @Category({MiscTests.class, SmallTests.class})
- public static class TestReusablePoolType extends TestPoolType {
- @Override
- protected PoolType getPoolType() {
- return PoolType.Reusable;
- }
-
- public void testSingleThreadedClient() throws InterruptedException,
- ExecutionException {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- // As long as we poll values we put, the pool size should remain zero
- runThread(randomKey, randomValue, randomValue);
- assertEquals(0, poolMap.size(randomKey));
- }
-
- public void testMultiThreadedClients() throws InterruptedException,
- ExecutionException {
- // As long as we poll values we put, the pool size should remain zero
- for (int i = 0; i < POOL_SIZE; i++) {
- String randomKey = String.valueOf(random.nextInt());
- String randomValue = String.valueOf(random.nextInt());
- runThread(randomKey, randomValue, randomValue);
- assertEquals(0, poolMap.size(randomKey));
- }
- poolMap.clear();
- String randomKey = String.valueOf(random.nextInt());
- for (int i = 0; i < POOL_SIZE - 1; i++) {
- String randomValue = String.valueOf(random.nextInt());
- runThread(randomKey, randomValue, randomValue);
- assertEquals(0, poolMap.size(randomKey));
- }
- assertEquals(0, poolMap.size(randomKey));
- }
-
- public void testPoolCap() throws InterruptedException, ExecutionException {
- // As long as we poll values we put, the pool size should remain zero
- String randomKey = String.valueOf(random.nextInt());
- List<String> randomValues = new ArrayList<>();
- for (int i = 0; i < POOL_SIZE * 2; i++) {
- String randomValue = String.valueOf(random.nextInt());
- randomValues.add(randomValue);
- runThread(randomKey, randomValue, randomValue);
- }
- assertEquals(0, poolMap.size(randomKey));
- }
-
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-shell/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-shell/pom.xml b/hbase-shell/pom.xml
index 0f623d6..deb2fe4 100644
--- a/hbase-shell/pom.xml
+++ b/hbase-shell/pom.xml
@@ -123,18 +123,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
- <!-- Testing plugins -->
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ServerResourceCheckerJUnitListener</value>
- </property>
- </properties>
- </configuration>
- </plugin>
</plugins>
<!-- General Resources -->
<pluginManagement>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7c318cea/hbase-zookeeper/pom.xml
----------------------------------------------------------------------
diff --git a/hbase-zookeeper/pom.xml b/hbase-zookeeper/pom.xml
index 24364f7..8fb5b15 100644
--- a/hbase-zookeeper/pom.xml
+++ b/hbase-zookeeper/pom.xml
@@ -98,18 +98,6 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
- <!-- Testing plugins -->
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <properties>
- <property>
- <name>listener</name>
- <value>org.apache.hadoop.hbase.ResourceCheckerJUnitListener</value>
- </property>
- </properties>
- </configuration>
- </plugin>
</plugins>
<!-- General Resources -->
<pluginManagement>