/** * Create a process command factory for this OS * @return */ public static ProcessCommandFactory createProcessCommandFactory() { return new ProcessCommandFactory(); } }
@Before public void setupProcesses() { commandFactory = ProcessCommandFactory.createProcessCommandFactory(); }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); exec(); assertFalse(process.isProcessRunning()); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); // assert that the service did not fail assertNull(process.getFailureCause()); }
@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); exec(); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; env.put(var, val); initProcess(commandFactory.env()); exec(); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); assertStringInOutput(val, getFinalOutput()); }
@Test public void testExitCodes() throws Throwable { SliderTestUtils.skipOnWindows(); initProcess(commandFactory.exitFalse()); process.start(); //in-thread wait process.run(); //here stopped assertFalse(process.isRunning()); int exitCode = process.getExitCode(); assertTrue(exitCode != 0); int corrected = process.getExitCodeSignCorrected(); assertEquals(1, corrected); }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process start callback not received", started); assertTrue("process stop callback not received", stopped); assertFalse(process.isRunning()); assertEquals(0, process.getExitCode().intValue()); }
@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); exec(); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; env.put(var, val); initProcess(commandFactory.env()); exec(); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); assertStringInOutput(val, getFinalOutput()); }
@Test public void testExitCodes() throws Throwable { SliderTestUtils.skipOnWindows(); initProcess(commandFactory.exitFalse()); process.start(); //in-thread wait process.run(); //here stopped assertFalse(process.isRunning()); int exitCode = process.getExitCode(); assertTrue(exitCode != 0); int corrected = process.getExitCodeSignCorrected(); assertEquals(1, corrected); }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); exec(); assertFalse(process.isProcessRunning()); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertEquals(0, exitCode.intValue()); // assert that the service did not fail assertNull(process.getFailureCause()); }
@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }
@Before public void setupProcesses() { commandFactory = ProcessCommandFactory.createProcessCommandFactory(); }
@Test public void testExitCodes() throws Throwable { SliderTestUtils.skipOnWindows(); initProcess(commandFactory.exitFalse()); exec(); assertFalse(process.isProcessRunning()); Integer exitCode = process.getExitCode(); assertNotNull("null exit code", exitCode); assertTrue(exitCode != 0); int corrected = process.getExitCodeSignCorrected(); assertEquals(1, corrected); // assert that the exit code was uprated to a service failure assertNotNull(process.getFailureCause()); }
/** * Create a process command factory for this OS * @return */ public static ProcessCommandFactory createProcessCommandFactory() { return new ProcessCommandFactory(); } }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process start callback not received", started); assertTrue("process stop callback not received", stopped); assertFalse(process.isRunning()); assertEquals(0, process.getExitCode().intValue()); }
@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }
@Before public void setupProcesses() { commandFactory = ProcessCommandFactory.createProcessCommandFactory(); }