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);
  }
Пример #2
0
  /** {@inheritDoc} */
  @Override
  public List<String> getMachines() throws CLIException {

    Map<String, Object> map;
    try {
      map = client.getAdminData("machines/HostsByAddress");
    } catch (final ErrorStatusException e) {
      throw new CLIStatusException(e, e.getReasonCode(), e.getArgs());
    } catch (final RestException e) {
      throw new CLIException(e);
    }
    @SuppressWarnings("unchecked")
    final List<String> list = (List<String>) map.get("HostsByAddress-Elements");
    final List<String> result = new ArrayList<String>(list.size());
    for (final String host : list) {
      final String[] parts = host.split("/");
      final String ip = parts[parts.length - 1];
      result.add(ip);
    }
    return result;
  }