SLIDER-622 process exit codes
diff --git a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
index b801993..9f6b327 100644
--- a/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
+++ b/slider-core/src/main/java/org/apache/slider/server/services/workflow/ForkedProcessService.java
@@ -264,7 +264,7 @@
   }
 
 
-  public int getExitCode() {
+  public Integer getExitCode() {
     return process.getExitCode();
   }
   
diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
index 7e03e7b..a3a0025 100644
--- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/actions/TestActions.groovy
@@ -191,7 +191,7 @@
     queues.renewing("note", renewer)
     assert queues.removeRenewingAction("note")
     queues.stop()
-    queues.waitForServiceToStop(10000)
+    assert queues.waitForServiceToStop(10000)
   }
   
   public class ActionNoteExecuted extends AsyncAction {
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
index ad18c72..3688644 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/SliderTestUtils.groovy
@@ -51,6 +51,8 @@
 import org.junit.Assert
 import org.junit.Assume
 
+import java.util.concurrent.TimeoutException
+
 import static Arguments.ARG_OPTION
 
 /**
@@ -530,7 +532,10 @@
    */
   public static ForkedProcessService exec(int status, List<String> commands) {
     ForkedProcessService process = exec(commands)
-    assert status == process.exitCode
+
+    def exitCode = process.exitCode
+    assert exitCode != null
+    assert status == exitCode
     return process
   }
   /**
@@ -546,7 +551,11 @@
         commands);
     process.init(new Configuration());
     process.start();
-    process.waitForServiceToStop(10000);
+    int timeoutMillis = 5000
+    if (!process.waitForServiceToStop(timeoutMillis)) {
+      throw new TimeoutException(
+          "Process did not stop in " + timeoutMillis + "mS");
+    }
     process
   }
 
diff --git a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
index cf0afc1..01d5ec9 100644
--- a/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
+++ b/slider-core/src/test/java/org/apache/slider/server/services/workflow/TestWorkflowForkedProcessService.java
@@ -69,7 +69,9 @@
     initProcess(commandFactory.ls(testDir));
     exec();
     assertFalse(process.isProcessRunning());
-    assertEquals(0, process.getExitCode());
+    Integer exitCode = process.getExitCode();
+    assertNotNull("null exit code", exitCode);
+    assertEquals(0, exitCode.intValue());
 
     assertStringInOutput("test-classes", getFinalOutput());
     // assert that the service did not fail
@@ -83,7 +85,8 @@
     initProcess(commandFactory.exitFalse());
     exec();
     assertFalse(process.isProcessRunning());
-    int exitCode = process.getExitCode();
+    Integer exitCode = process.getExitCode();
+    assertNotNull("null exit code", exitCode);
     assertTrue(exitCode != 0);
     int corrected = process.getExitCodeSignCorrected();
     assertEquals(1, corrected);
@@ -98,8 +101,9 @@
     String echoText = "hello, world";
     initProcess(commandFactory.echo(echoText));
     exec();
-
-    assertEquals(0, process.getExitCode());
+    Integer exitCode = process.getExitCode();
+    assertNotNull("null exit code", exitCode);
+    assertEquals(0, exitCode.intValue());
     assertStringInOutput(echoText, getFinalOutput());
 
   }
@@ -112,8 +116,9 @@
     env.put(var, val);
     initProcess(commandFactory.env());
     exec();
-
-    assertEquals(0, process.getExitCode());
+    Integer exitCode = process.getExitCode();
+    assertNotNull("null exit code", exitCode);
+    assertEquals(0, exitCode.intValue());
     assertStringInOutput(val, getFinalOutput());
   }
 
@@ -137,7 +142,7 @@
   public void exec() throws InterruptedException, TimeoutException {
     assertNotNull(process);
     process.start();
-    process.waitForServiceToStop(5000);
+    assert process.waitForServiceToStop(5000);
   }
 
 }