geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [37/45] geode git commit: GEODE-209: fix ProcessStreamReader and delete unnecessary test
Date Wed, 11 Jan 2017 00:00:37 GMT
GEODE-209: fix ProcessStreamReader and delete unnecessary test


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/35d123f2
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/35d123f2
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/35d123f2

Branch: refs/heads/feature/GEODE-1930-2
Commit: 35d123f235f75a6aab298ed2f4dbb8be4c1740da
Parents: bfa76e9
Author: Kirk Lund <klund@apache.org>
Authored: Mon Jan 9 12:52:58 2017 -0800
Committer: Kirk Lund <klund@apache.org>
Committed: Tue Jan 10 11:24:38 2017 -0800

----------------------------------------------------------------------
 ...hTimeoutOfWaitForOutputToMatchJUnitTest.java | 71 --------------------
 .../golden/GoldenTestFrameworkTestSuite.java    |  6 +-
 .../geode/test/process/ProcessStreamReader.java | 15 +++--
 3 files changed, 13 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/35d123f2/geode-core/src/test/java/org/apache/geode/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
deleted file mode 100755
index eff4234..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/golden/FailWithTimeoutOfWaitForOutputToMatchJUnitTest.java
+++ /dev/null
@@ -1,71 +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.test.golden;
-
-import static org.junit.Assert.*;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.process.ProcessWrapper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
-
-@Category(IntegrationTest.class)
-public class FailWithTimeoutOfWaitForOutputToMatchJUnitTest extends FailOutputTestCase {
-
-  private static final long timeoutMillis = 1000;
-
-  private ProcessWrapper process;
-
-  public void subTearDown() throws Exception {
-    this.process.destroy();
-  }
-
-  @Override
-  String problem() {
-    return "This is an extra line";
-  }
-
-  @Override
-  void outputProblemInProcess(final String message) {
-    System.out.println(message);
-  }
-
-  /**
-   * Process output has an extra line and should fail
-   */
-  @Category(FlakyTest.class) // GEODE-209
-  @Ignore // cause of GEODE-209 is process.destroy() closes the stream
-  @Test
-  public void testFailWithTimeoutOfWaitForOutputToMatch() throws Exception {
-    this.process =
-        createProcessWrapper(new ProcessWrapper.Builder().timeoutMillis(timeoutMillis), getClass());
-    this.process.execute(createProperties());
-    this.process.waitForOutputToMatch("Begin " + name() + "\\.main");
-
-    try {
-      this.process.waitForOutputToMatch(problem());
-      fail("assertOutputMatchesGoldenFile should have failed due to " + problem());
-    } catch (AssertionError expected) {
-      assertTrue(expected.getMessage().contains(problem()));
-    }
-  }
-
-  public static void main(String[] args) throws Exception {
-    new FailWithTimeoutOfWaitForOutputToMatchJUnitTest().executeInProcess();
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/35d123f2/geode-core/src/test/java/org/apache/geode/test/golden/GoldenTestFrameworkTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/golden/GoldenTestFrameworkTestSuite.java
b/geode-core/src/test/java/org/apache/geode/test/golden/GoldenTestFrameworkTestSuite.java
index 2c1579d..f11aa00 100755
--- a/geode-core/src/test/java/org/apache/geode/test/golden/GoldenTestFrameworkTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/test/golden/GoldenTestFrameworkTestSuite.java
@@ -23,9 +23,9 @@ import org.junit.runners.Suite;
     FailWithLineMissingFromMiddleOfOutputJUnitTest.class,
     FailWithLoggerErrorInOutputJUnitTest.class, FailWithLoggerFatalInOutputJUnitTest.class,
     FailWithLoggerWarnInOutputJUnitTest.class, FailWithSevereInOutputJUnitTest.class,
-    FailWithTimeoutOfWaitForOutputToMatchJUnitTest.class, FailWithWarningInOutputJUnitTest.class,
-    PassJUnitTest.class, PassWithExpectedErrorJUnitTest.class,
-    PassWithExpectedSevereJUnitTest.class, PassWithExpectedWarningJUnitTest.class,})
+    FailWithWarningInOutputJUnitTest.class, PassJUnitTest.class,
+    PassWithExpectedErrorJUnitTest.class, PassWithExpectedSevereJUnitTest.class,
+    PassWithExpectedWarningJUnitTest.class,})
 /**
  * Suite of tests for the test.golden Golden Test framework classes.
  */

http://git-wip-us.apache.org/repos/asf/geode/blob/35d123f2/geode-core/src/test/java/org/apache/geode/test/process/ProcessStreamReader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/process/ProcessStreamReader.java
b/geode-core/src/test/java/org/apache/geode/test/process/ProcessStreamReader.java
index 7f5c2e2..efe317c 100755
--- a/geode-core/src/test/java/org/apache/geode/test/process/ProcessStreamReader.java
+++ b/geode-core/src/test/java/org/apache/geode/test/process/ProcessStreamReader.java
@@ -25,18 +25,19 @@ import java.util.Queue;
  * Reads the output from a process stream and stores it for test validation.
  * </p>
  * Extracted from ProcessWrapper.
- * 
  */
+@SuppressWarnings("unused")
 public class ProcessStreamReader extends Thread {
 
   private volatile RuntimeException startStack;
+  private volatile IOException streamClosedStack;
 
   private final String command;
   private final BufferedReader reader;
   private final Queue<String> lineBuffer;
   private final List<String> allLines;
 
-  public int linecount = 0;
+  private int lineCount = 0;
 
   public ProcessStreamReader(final String command, final InputStream stream,
       final Queue<String> lineBuffer, final List<String> allLines) {
@@ -57,7 +58,7 @@ public class ProcessStreamReader extends Thread {
     try {
       String line;
       while ((line = this.reader.readLine()) != null) {
-        this.linecount++;
+        this.lineCount++;
         this.lineBuffer.offer(line);
         this.allLines.add(line);
       }
@@ -65,8 +66,12 @@ public class ProcessStreamReader extends Thread {
       // EOF
       this.reader.close();
     } catch (IOException streamClosed) {
-      this.startStack.initCause(streamClosed);
-      throw this.startStack;
+      this.streamClosedStack = streamClosed;
     }
   }
+
+  // a test can use this to check if stream was closed cleanly or by tear-down
+  public IOException getStreamClosedStack() {
+    return this.streamClosedStack;
+  }
 }


Mime
View raw message