You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2018/08/28 19:57:38 UTC
[geode] branch develop updated: GEODE-5637: move
SingleHopClientExecutorSubmitTaskWithExceptionTest to integrationTest
This is an automated email from the ASF dual-hosted git repository.
klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new b66beba GEODE-5637: move SingleHopClientExecutorSubmitTaskWithExceptionTest to integrationTest
b66beba is described below
commit b66beba19c8457eaa684a3d03100c2755c68aab0
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Mon Aug 27 09:55:40 2018 -0700
GEODE-5637: move SingleHopClientExecutorSubmitTaskWithExceptionTest to integrationTest
* Increase Awaitility timeout due to flaky failure
* Cleanup test and use AssertJ
---
...opClientExecutorWithLoggingIntegrationTest.java | 60 ++++++++++++++++++++++
...pClientExecutorSubmitTaskWithExceptionTest.java | 60 ----------------------
2 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorWithLoggingIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorWithLoggingIntegrationTest.java
new file mode 100644
index 0000000..0967a70
--- /dev/null
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorWithLoggingIntegrationTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.geode.cache.client.internal;
+
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.contrib.java.lang.system.SystemErrRule;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.test.junit.categories.ClientServerTest;
+
+/**
+ * Test if exceptions are logged when thread is submitted using
+ * {@code SingleHopClientExecutor#submitTask} method.
+ */
+@Category(ClientServerTest.class)
+public class SingleHopClientExecutorWithLoggingIntegrationTest {
+
+ @Rule
+ public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
+
+ /**
+ * Refer: GEODE-2109 This test verifies that any exception thrown from forked thread is logged
+ * into log.
+ */
+ @Test
+ public void submittedTaskShouldLogFailure() {
+ String message = "I am expecting this to be logged";
+
+ SingleHopClientExecutor.submitTask(() -> {
+ // test piece throwing exception
+ throw new RuntimeException(message);
+ });
+
+ /*
+ * Sometimes need to wait for more than sec as thread execution takes time.
+ */
+ await().atMost(2, MINUTES)
+ .untilAsserted(() -> assertThat(systemErrRule.getLog()).contains(message));
+ }
+
+}
diff --git a/geode-core/src/test/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorSubmitTaskWithExceptionTest.java b/geode-core/src/test/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorSubmitTaskWithExceptionTest.java
deleted file mode 100644
index e8e4e02..0000000
--- a/geode-core/src/test/java/org/apache/geode/cache/client/internal/SingleHopClientExecutorSubmitTaskWithExceptionTest.java
+++ /dev/null
@@ -1,60 +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.geode.cache.client.internal;
-
-import static java.util.concurrent.TimeUnit.MINUTES;
-
-import org.awaitility.Awaitility;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.SystemErrRule;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.ClientServerTest;
-
-/**
- * Test if exceptions are logged when thread is submitted using
- * {@code SingleHopClientExecutor#submitTask} method.
- */
-@Category({ClientServerTest.class})
-public class SingleHopClientExecutorSubmitTaskWithExceptionTest {
-
- @Rule
- public SystemErrRule systemErrRule = new SystemErrRule().enableLog();
-
- /**
- * Refer: GEODE-2109 This test verifies that any exception thrown from forked thread is logged
- * into log.
- */
- @Test
- public void submittedTaskShouldLogFailure() {
- String erroMsg = "I am expecting this to be logged";
-
- SingleHopClientExecutor.submitTask(new Runnable() {
- @Override
- public void run() {
- // test piece throwing exception
- throw new RuntimeException(erroMsg);
- }
- });
-
- /*
- * Sometimes need to wait for more than sec as thread execution takes time.
- */
- Awaitility.await("Waiting for exception").atMost(1, MINUTES)
- .until(() -> systemErrRule.getLog().contains(erroMsg));
- }
-
-}