ApiServiceClient extends AppAdminClient { @Override public int actionStop(String appName) throws IOException, YarnException { int result = EXIT_SUCCESS; try { Service service = new Service(); service.setName(appName); service.setState(ServiceState.STOPPED); String buffer = jsonSerDeser.toJson(service); ClientResponse response = getApiClient(getServicePath(appName)) .put(ClientResponse.class, buffer); result = processResponse(response); } catch (Exception e) { LOG.error("Fail to stop application: ", e); result = EXIT_EXCEPTION_THROWN; } return result; } ApiServiceClient();  ApiServiceClient(Configuration c); String getServicePath(String appName); Builder getApiClient(); Builder getApiClient(String requestPath); Service loadAppJsonFromLocalFS(String fileName, String serviceName,
      Long lifetime, String queue); @Override int actionLaunch(String fileName, String appName, Long lifetime,
      String queue); @Override int actionStop(String appName); @Override int actionStart(String appName); @Override int actionSave(String fileName, String appName, Long lifetime,
      String queue); @Override int actionDestroy(String appName); @Override int actionFlex(String appName, Map<String, String> componentCounts); @Override int enableFastLaunch(String destinationFolder); @Override String getStatusString(String appIdOrName); @Override int actionUpgradeExpress(String appName, File path); @Override int initiateUpgrade(String appName,
      String fileName, boolean autoFinalize); @Override int actionUpgradeInstances(String appName, List<String> compInstances); @Override int actionUpgradeComponents(String appName, List<String> components); @Override int actionCleanUp(String appName, String userName); @Override String getInstances(String appName, List<String> components,
      String version, List<String> containerStates); @Override int actionCancelUpgrade(
      String appName); @Override int actionDecommissionInstances(String appName, List<String>
      componentInstances);  }
@Test public void testStop() { String appName = "example-app"; try { int result = asc.actionStop(appName); assertEquals(EXIT_SUCCESS, result); } catch (IOException | YarnException e) { fail(); } }
@Test public void testBadStop() { String appName = "unknown_app"; try { int result = badAsc.actionStop(appName); assertEquals(EXIT_EXCEPTION_THROWN, result); } catch (IOException | YarnException e) { fail(); } }