ServiceClient extends AppAdminClient implements SliderExitCodes,
    YarnServiceConstants { @Override public int initiateUpgrade(String appName, String fileName, boolean autoFinalize) throws IOException, YarnException { Service upgradeService = loadAppJsonFromLocalFS(fileName, appName, null, null); if (autoFinalize) { upgradeService.setState(ServiceState.UPGRADING_AUTO_FINALIZE); } else { upgradeService.setState(ServiceState.UPGRADING); } return initiateUpgrade(upgradeService); }  Service loadAppJsonFromLocalFS(String fileName, String serviceName,
      Long lifetime, String queue); @Override int actionSave(String fileName, String serviceName, Long lifetime,
      String queue); int actionBuild(Service service); @Override int actionUpgradeExpress(String appName, File path); int actionUpgradeExpress(Service service); @Override int initiateUpgrade(String appName, String fileName,
      boolean autoFinalize); int initiateUpgrade(Service service); @Override int actionUpgradeInstances(String appName,
      List<String> componentInstances); @Override int actionUpgradeComponents(String appName,
      List<String> components); @Override int actionCancelUpgrade(String appName); @Override int actionCleanUp(String appName, String userName); @Override String getInstances(String appName,
      List<String> components, String version, List<String> containerStates); Container[] getContainers(String appName, List<String> components,
      String version, List<ContainerState> containerStates); int actionUpgrade(Service service, List<Container> compInstances); int actionLaunch(String fileName, String serviceName, Long lifetime,
      String queue); ApplicationId actionCreate(Service service); int actionFlex(String serviceName, Map<String, String>
      componentCountStrings); Map<String, Long> flexByRestService(String serviceName,
      Map<String, Long> componentCounts); @Override int actionStop(String serviceName); int actionStop(String serviceName, boolean waitForAppStopped); @Override int actionDestroy(String serviceName); @Override int actionStart(String serviceName); ApplicationId actionStartAndGetId(String serviceName); String updateLifetime(String serviceName, long lifetime); ServiceState convertState(YarnApplicationState state); @Override String getStatusString(String appIdOrName); Service getStatus(String serviceName); YarnClient getYarnClient(); int enableFastLaunch(String destinationFolder); int actionDependency(String destinationFolder, boolean overwrite); synchronized ApplicationId getAppId(String serviceName);  }
@Test public void testUpgradeDisabledByDefault() throws Exception { Service service = createService(); ServiceClient client = MockServiceClient.create(rule, service, false); service.setVersion("v2"); try { client.initiateUpgrade(service); } catch (YarnException ex) { Assert.assertEquals(ErrorStrings.SERVICE_UPGRADE_DISABLED, ex.getMessage()); return; } Assert.fail(); }
@Test public void testActionServiceUpgrade() throws Exception { Service service = createService(); ServiceClient client = MockServiceClient.create(rule, service, true); service.setVersion("v2"); client.initiateUpgrade(service); Service fromFs = ServiceApiUtil.loadServiceUpgrade(rule.getFs(), service.getName(), service.getVersion()); Assert.assertEquals(service.getName(), fromFs.getName()); Assert.assertEquals(service.getVersion(), fromFs.getVersion()); client.stop(); }