public void testService(
      String serviceFolderPath, String overrideServiceName, final int timeoutMins)
      throws IOException, InterruptedException, RestException, PackagingException, DSLException {
    LogUtils.log("Reading Service from file : " + serviceFolderPath);
    Service service = ServiceReader.readService(new File(serviceFolderPath));
    LogUtils.log("Succesfully read Service : " + service);

    serviceName = service.getName();

    if (overrideServiceName != null) {
      LogUtils.log("Overriding service name with " + overrideServiceName);
      serviceName = overrideServiceName;
    }

    installServiceAndWait(serviceFolderPath, serviceName, timeoutMins);
    String restUrl = getRestUrl();
    GSRestClient client =
        new GSRestClient("", "", new URL(restUrl), PlatformVersion.getVersionNumber());
    Map<String, Object> entriesJsonMap =
        client.getAdminData("ProcessingUnits/Names/default." + serviceName + "/Status");
    String serviceStatus = (String) entriesJsonMap.get(STATUS_PROPERTY);

    AssertUtils.assertTrue("service is not intact", serviceStatus.equalsIgnoreCase("INTACT"));

    uninstallServiceAndWait(serviceName);
  }
Ejemplo n.º 2
0
 /**
  * Checks if the latest version is used.
  *
  * @param session the command session.
  */
 public static void doVersionCheck(final CommandSession session) {
   String currentBuildStr = PlatformVersion.getBuildNumber();
   if (currentBuildStr.contains("-")) {
     currentBuildStr = currentBuildStr.substring(0, currentBuildStr.indexOf("-"));
   }
   final int currentVersion = Integer.parseInt(currentBuildStr);
   final int latestBuild = getLatestBuildNumber(currentVersion);
   String message;
   if (latestBuild == -1) {
     message = ShellUtils.getFormattedMessage("could_not_get_version");
   } else if (latestBuild > currentVersion) {
     message = ShellUtils.getFormattedMessage("newer_version_exists");
   } else {
     message = ShellUtils.getFormattedMessage("version_up_to_date");
   }
   session.getConsole().println(message);
   session.getConsole().println();
 }