You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2010/10/05 02:39:51 UTC

svn commit: r1004486 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java

Author: sebb
Date: Tue Oct  5 00:39:50 2010
New Revision: 1004486

URL: http://svn.apache.org/viewvc?rev=1004486&view=rev
Log:
Ensure forever file is deleted at end of test
Minor adjustmemts for VMS testing

Modified:
    commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java

Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java?rev=1004486&r1=1004485&r2=1004486&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java Tue Oct  5 00:39:50 2010
@@ -85,6 +85,7 @@ public class DefaultExecutorTest extends
 
     protected void tearDown() throws Exception {
         this.baos.close();
+        foreverOutputFile.delete();
     }
 
     // ======================================================================
@@ -316,10 +317,11 @@ public class DefaultExecutorTest extends
         handler.waitFor(WAITFOR_TIMEOUT);
 
         assertTrue("Killed process should be true", executor.getWatchdog().killedProcess() );
-        int nrOfInvocations = getOccurrences(readFile(this.foreverOutputFile), '.');
-        assertTrue("Killing the process did not work : " + nrOfInvocations, nrOfInvocations > 5 && nrOfInvocations <= 11);
         assertTrue("ResultHandler received a result", handler.hasResult());
         assertNotNull("ResultHandler received an exception as result", handler.getException());
+
+        int nrOfInvocations = getOccurrences(readFile(this.foreverOutputFile), '.');
+        assertTrue("Killing the process did not work : " + nrOfInvocations, nrOfInvocations > 5 && nrOfInvocations <= 11);
     }
 
     /**
@@ -612,7 +614,7 @@ public class DefaultExecutorTest extends
         myEnvVars.put("NEW_VAR","NEW_VAL");
         exec.execute(new CommandLine(environmentSript), myEnvVars);
         String environment = baos.toString().trim();
-        assertTrue(environment.indexOf("NEW_VAR") >= 0);
+        assertTrue("Expecting NEW_VAR in "+environment,environment.indexOf("NEW_VAR") >= 0);
     }
 
     // ======================================================================