On 6 January 2016 at 13:10,  <sgoes...@apache.org> wrote:
> Author: sgoeschl
> Date: Wed Jan  6 13:10:09 2016
> New Revision: 1723311
>
> URL: http://svn.apache.org/viewvc?rev=1723311&view=rev
> Log:
> [EXEC-65] Add test with plain vanilla "Runtime" usage to show that we can 
> indeed kill the sleeping process

-1 - please fix the missing Jaav method

> Modified:
>     
> commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
>
> Modified: 
> commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec65Test.java?rev=1723311&r1=1723310&r2=1723311&view=diff
> ==============================================================================
> --- 
> commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
>  (original)
> +++ 
> commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
>  Wed Jan  6 13:10:09 2016
> @@ -22,6 +22,8 @@ import org.junit.Test;
>
>  import java.io.File;
>
> +import static org.junit.Assert.assertTrue;
> +
>  /**
>   * Test to show that watchdog can destroy 'sudo' and 'sleep'.
>   *
> @@ -60,6 +62,21 @@ public class Exec65Test {
>          executor.execute(command);
>      }
>
> +    @Test(timeout = 15000)
> +    public void testExec65WithSleepUsingShellScriptAndRuntimeDirectly() 
> throws Exception
> +    {
> +        Process process = 
> Runtime.getRuntime().exec(TestUtil.resolveScriptForOS(testDir + 
> "/sleep").getAbsolutePath());
> +        Thread.sleep(3000);
> +
> +        process.destroy();
> +
> +        while(process.isAlive()) {

This requires Java 8; EXEC currently targets 1.5 I think.
As this is a test case, I think it should not force a Java update.

> +            Thread.sleep(50);
> +        }
> +
> +        assertTrue(process.exitValue() != 0);
> +    }
> +
>      /**
>       * Please note that this tests make assumptions about the environment. 
> It assumes
>       * that user "root" exists and that the current user is not a "sudoer" 
> already.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to