From 13ffe551de22f9bdc0d58d5a5921462880978b5f Mon Sep 17 00:00:00 2001 From: Sijie Guo Date: Thu, 14 Jun 2018 02:02:01 -0700 Subject: [PATCH] Move TimedOutTestsListener from dlog to bookkeeper-common *Motiviation* To debugging CI problem observed at #1516 dlog uses a `TimedOutTestsListener` to dump the jvm stack when a junit test timed out. move this class to bookkeeper-common and built with `test-jar`, so it can be used across the project. *Changes* relocate `TimedOutTestsListener` and its related classes from distributedlog-common to bookkeeper-common. --- .../util/TestTimedOutTestsListener.java | 15 ++++++------ .../testing}/util/TimedOutTestsListener.java | 17 +++++++------- .../common/testing/util/package-info.java | 23 +++++++++++++++++++ bookkeeper-server/pom.xml | 18 +++++++++++++++ stream/distributedlog/core/pom.xml | 2 +- 5 files changed, 59 insertions(+), 16 deletions(-) rename {stream/distributedlog/common/src/test/java/org/apache/distributedlog/common => bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing}/util/TestTimedOutTestsListener.java (92%) rename {stream/distributedlog/common/src/test/java/org/apache/distributedlog/common => bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing}/util/TimedOutTestsListener.java (93%) create mode 100644 bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/package-info.java diff --git a/stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TestTimedOutTestsListener.java b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TestTimedOutTestsListener.java similarity index 92% rename from stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TestTimedOutTestsListener.java rename to bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TestTimedOutTestsListener.java index d38fcdf42d8..09f2ca5e798 100644 --- a/stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TestTimedOutTestsListener.java +++ b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TestTimedOutTestsListener.java @@ -7,15 +7,16 @@ * "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 + * 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. + * 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.distributedlog.common.util; +package org.apache.bookkeeper.common.testing.util; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TimedOutTestsListener.java b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TimedOutTestsListener.java similarity index 93% rename from stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TimedOutTestsListener.java rename to bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TimedOutTestsListener.java index 1f61038aa26..e6f8fe4482a 100644 --- a/stream/distributedlog/common/src/test/java/org/apache/distributedlog/common/util/TimedOutTestsListener.java +++ b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/TimedOutTestsListener.java @@ -1,4 +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 @@ -7,15 +7,16 @@ * "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 + * 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. + * 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.distributedlog.common.util; +package org.apache.bookkeeper.common.testing.util; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/package-info.java b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/package-info.java new file mode 100644 index 00000000000..310961d6671 --- /dev/null +++ b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/util/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * Common testing related utils. + */ +package org.apache.bookkeeper.common.testing.util; \ No newline at end of file diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml index 85f5bd62d31..89f2881eb05 100644 --- a/bookkeeper-server/pom.xml +++ b/bookkeeper-server/pom.xml @@ -183,6 +183,24 @@ com.github.spotbugs spotbugs-maven-plugin + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + -Xmx2G -Djava.net.preferIPv4Stack=true + ${redirectTestOutputToFile} + false + 1800 + 2 + + + listener + org.apache.bookkeeper.common.testing.util.TimedOutTestsListener + + + + org.apache.maven.plugins maven-javadoc-plugin diff --git a/stream/distributedlog/core/pom.xml b/stream/distributedlog/core/pom.xml index 8140eeab317..ce7009464de 100644 --- a/stream/distributedlog/core/pom.xml +++ b/stream/distributedlog/core/pom.xml @@ -104,7 +104,7 @@ listener - org.apache.distributedlog.common.util.TimedOutTestsListener + org.apache.bookkeeper.common.testing.util.TimedOutTestsListener