SLIDER-622 kill operation tested for at class load time; used to skip kill() operations.Tests that use the kill explicilty must then be made to skip if not kill_supported
diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAMKill.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAMKill.groovy
index bad2715..d6b3929 100644
--- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAMKill.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneAMKill.groovy
@@ -27,6 +27,7 @@
 import org.apache.slider.common.SliderXmlConfKeys
 import org.apache.slider.common.params.Arguments
 import org.apache.slider.core.main.ServiceLauncher
+import org.junit.Assume
 import org.junit.Test
 
 /**
@@ -38,9 +39,9 @@
 
 class TestStandaloneAMKill extends AgentMiniClusterTestBase {
 
-
   @Test
   public void testKillStandaloneAM() throws Throwable {
+    Assume.assumeTrue(kill_supported)
     String clustername = createMiniCluster("", configuration, 1, true)
 
     describe "kill a Standalone AM and verify that it shuts down"
@@ -54,6 +55,7 @@
     SliderClient sliderClient = launcher.service
     addToTeardown(sliderClient);
     ApplicationReport report = waitForClusterLive(sliderClient)
+    assert report.yarnApplicationState == YarnApplicationState.RUNNING
 
     describe("listing Java processes")
     lsJavaProcesses();
diff --git a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
index 25b7c57..9b383f4 100644
--- a/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/common/tools/TestWindowsSupport.groovy
@@ -28,15 +28,15 @@
 import org.apache.hadoop.service.ServiceStateException
 import org.apache.hadoop.util.Shell
 import org.apache.slider.providers.agent.AgentUtils
-import org.apache.slider.server.services.workflow.ForkedProcessService
 import org.apache.slider.test.SliderTestBase
+import org.apache.slider.test.YarnMiniClusterTestBase
 import org.junit.Test
 
 import java.util.regex.Pattern
 
 @CompileStatic
 @Slf4j
-class TestWindowsSupport extends SliderTestBase {
+class TestWindowsSupport extends YarnMiniClusterTestBase {
 
   private static final Pattern hasDriveLetterSpecifier =
       Pattern.compile("^/?[a-zA-Z]:");
@@ -121,18 +121,28 @@
   @Test
   public void testExecNonexistentBinary() throws Throwable {
     assume(Shell.WINDOWS, "not windows")
+    def commands = ["undefined-application", "--version"]
     try {
-      exec(2, ["undefined-application", "--version"])
+      exec(0, commands)
+      fail("expected an exception")
     } catch (ServiceStateException e) {
       if (!(e.cause instanceof FileNotFoundException)) {
         throw e;
       }
     }
   }
+  @Test
+  public void testExecNonexistentBinary2() throws Throwable {
+    assume(Shell.WINDOWS, "not windows")
+    assert !doesWindowsAppExist(["undefined-application", "--version"])
+  }
 
   @Test
   public void testEmitKillCommand() throws Throwable {
-    killJavaProcesses("regionserver", 9)
+
+    def result = killJavaProcesses("regionserver", 9)
+    // we know the exit code if there is no supported kill operation
+    assert kill_supported || result == -1
   }
 
   @Test
@@ -159,34 +169,4 @@
     exec(0, [winUtilsPath, "systeminfo"])
   }
 
-
-  /**
-   * Exec a set of commands, wait a few seconds for it to finish.
-   * @param status code
-   * @param commands
-   * @return the process
-   */
-  public ForkedProcessService exec(int status, List<String> commands) {
-    ForkedProcessService process = exec(commands)
-    assert status == process.exitCode
-    return process
-  }
-  
-  /**
-     * Exec a set of commands, wait a few seconds for it to finish.
-     * @param commands
-     * @return
-     */
-  
-  public ForkedProcessService exec(List<String> commands) {
-    ForkedProcessService process;
-    process = new ForkedProcessService(
-        methodName.methodName,
-        [:],
-        commands);
-    process.init(new Configuration());
-    process.start();
-    process.waitForServiceToStop(10000);
-    process
-  }
 }
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 8d6c036..ad18c72 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
@@ -925,44 +925,6 @@
   }
 
   /**
-   * Kill any java process with the given grep pattern
-   * @param grepString string to grep for
-   */
-  public int killJavaProcesses(String grepString, int signal) {
-
-    def commandString
-    if (!Shell.WINDOWS) {
-      GString killCommand = "jps -l| grep ${grepString} | awk '{print \$1}' | xargs kill $signal"
-      log.info("Command command = $killCommand")
-
-      commandString = ["bash", "-c", killCommand]
-    } else {
-      /*
-      "jps -l | grep "String" | awk "{print $1}" | xargs -n 1 taskkill /PID"
-       */
-      GString killCommand = "\"jps -l | grep \"${grepString}\" | gawk \"{print \$1}\" | xargs -n 1 taskkill /f /PID\""
-      commandString = ["CMD", "/C", killCommand]
-    }
-    Process command = commandString.execute()
-    def exitCode = command.waitFor()
-
-    log.info(command.in.text)
-    log.error(command.err.text)
-    return exitCode
-  }
-
-  /**
-   * Kill all processes which match one of the list of grepstrings
-   * @param greps
-   * @param signal
-   */
-  public void killJavaProcesses(List<String> greps, int signal) {
-    for (String grep : greps) {
-      killJavaProcesses(grep, signal)
-    }
-  }
-
-  /**
    * Convert a file to a URI suitable for use in an argument
    * @param file file
    * @return a URI string valid on all platforms
diff --git a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
index 73b81ab..88fac06 100644
--- a/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
+++ b/slider-core/src/test/groovy/org/apache/slider/test/YarnMiniClusterTestBase.groovy
@@ -28,6 +28,7 @@
 import org.apache.hadoop.fs.Path
 import org.apache.hadoop.hdfs.MiniDFSCluster
 import org.apache.hadoop.service.ServiceOperations
+import org.apache.hadoop.util.Shell
 import org.apache.hadoop.yarn.api.records.ApplicationReport
 import org.apache.hadoop.yarn.api.records.YarnApplicationState
 import org.apache.hadoop.yarn.conf.YarnConfiguration
@@ -83,6 +84,9 @@
 
 
   public static final YarnConfiguration SLIDER_CONFIG = SliderUtils.createConfiguration();
+  
+  public static boolean kill_supported;
+  
   static {
     SLIDER_CONFIG.setInt(SliderXmlConfKeys.KEY_AM_RESTART_LIMIT, 1)
     SLIDER_CONFIG.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 100)
@@ -91,7 +95,6 @@
     SLIDER_CONFIG.setBoolean(SliderXmlConfKeys.KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED,
         true)
     SLIDER_CONFIG.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 1)
-    
   }
 
 
@@ -194,6 +197,7 @@
   protected void addToTeardown(SliderClient client) {
     clustersToTeardown << client;
   }
+
   protected void addToTeardown(ServiceLauncher<SliderClient> launcher) {
     SliderClient sliderClient = launcher?.service
     if (sliderClient) {
@@ -201,6 +205,60 @@
     }
   }
 
+  /**
+   * Work out if kill is supported
+   */
+  @BeforeClass 
+  public static void checkKillSupport() {
+    if (!Shell.WINDOWS) {
+      kill_supported = true;
+    } else {
+      kill_supported = doesWindowsAppExist(["xargs", "--version"])
+    }
+  }
+
+  /**
+   * Kill any java process with the given grep pattern
+   * @param grepString string to grep for
+   */
+  public int killJavaProcesses(String grepString, int signal) {
+
+    def commandString
+    if (!Shell.WINDOWS) {
+      GString killCommand = "jps -l| grep ${grepString} | awk '{print \$1}' | xargs kill $signal"
+      log.info("Command command = $killCommand")
+
+      commandString = ["bash", "-c", killCommand]
+    } else {
+      // windows
+      if (!kill_supported) {
+        return -1;
+      }
+
+      /*
+      "jps -l | grep "String" | awk "{print $1}" | xargs -n 1 taskkill /PID"
+       */
+      GString killCommand = "\"jps -l | grep \"${grepString}\" | gawk \"{print \$1}\" | xargs -n 1 taskkill /f /PID\""
+      commandString = ["CMD", "/C", killCommand]
+    }
+    Process command = commandString.execute()
+    def exitCode = command.waitFor()
+
+    log.info(command.in.text)
+    log.error(command.err.text)
+    return exitCode
+  }
+
+  /**
+   * Kill all processes which match one of the list of grepstrings
+   * @param greps
+   * @param signal
+   */
+  public void killJavaProcesses(List<String> greps, int signal) {
+    for (String grep : greps) {
+      killJavaProcesses(grep, signal)
+    }
+  }
 
   protected YarnConfiguration getConfiguration() {
     return SLIDER_CONFIG;
diff --git a/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/AccumuloTestBase.groovy b/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/AccumuloTestBase.groovy
index 3c5606b..2a87cf0 100644
--- a/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/AccumuloTestBase.groovy
+++ b/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/AccumuloTestBase.groovy
@@ -71,7 +71,7 @@
   @Override
   void teardown() {
     super.teardown();
-    if (teardownKillall) {
+    if (teardownKillall && kill_supported) {
       try {
         killAllAccumuloProcesses();
       } catch (AssumptionViolatedException e) {
diff --git a/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/live/TestAccFreezeThaw.groovy b/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/live/TestAccFreezeThaw.groovy
index 3d0c03f..fcb73e0 100644
--- a/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/live/TestAccFreezeThaw.groovy
+++ b/slider-providers/accumulo/slider-accumulo-provider/src/test/groovy/org/apache/slider/providers/accumulo/live/TestAccFreezeThaw.groovy
@@ -87,7 +87,9 @@
       log.debug("expected exception", expected)
     }
     //force kill any accumulo processes
-    killAllAccumuloProcesses()
+    if (kill_supported) {
+      killAllAccumuloProcesses()
+    }
 
     sleepForAccumuloClusterLive();