Package org.cloudfoundry.client.lib.domain

Examples of org.cloudfoundry.client.lib.domain.ApplicationStats


      StringBuilder launchLabel = new StringBuilder();
      launchLabel.append(getCloudFoundryServer().getServer().getName());
      launchLabel.append(" - "); //$NON-NLS-1$
      launchLabel.append(appModule.getDeployedApplicationName());

      ApplicationStats stats = appModule.getApplicationStats();
      if (stats != null) {
        List<InstanceStats> instanceStats = stats.getRecords();
        if (instanceStats != null && instanceIndex < instanceStats.size()) {
          InstanceStats stat = instanceStats.get(instanceIndex);
          launchLabel.append(" - "); //$NON-NLS-1$
          launchLabel.append(stat.getId());
        }
View Full Code Here


    if (application == null) {
      throw CloudErrorUtil.toCoreException(Messages.ERROR_NO_CLOUD_APPLICATION_FOUND);
    }

    InstancesInfo info = internalUpdateInstancesInfo(appModule, monitor);
    ApplicationStats stats = internalUpdateStats(appModule, monitor);
    return info != null && stats != null;
  }
View Full Code Here

    return info != null && stats != null;
  }

  protected ApplicationStats internalUpdateStats(CloudFoundryApplicationModule appModule, IProgressMonitor monitor)
      throws CoreException {
    ApplicationStats stats = getApplicationStats(appModule.getDeployedApplicationName(), monitor);
    appModule.setApplicationStats(stats);

    return stats;
  }
View Full Code Here

    List<String> currentURIs = null;
    if (cloudApplication != null) {
      currentURIs = cloudApplication.getUris();

      ApplicationStats applicationStats = appModule.getApplicationStats();
      InstancesInfo instancesInfo = appModule.getInstancesInfo();
      if (applicationStats != null) {
        List<InstanceStats> statss = applicationStats.getRecords();
        List<InstanceInfo> infos = instancesInfo != null ? instancesInfo.getInstances() : null;
        InstanceStatsAndInfo[] statsAndInfos = new InstanceStatsAndInfo[statss.size()];

        for (int i = 0; i < statss.size(); i++) {
          InstanceStats stats = statss.get(i);
View Full Code Here

  @Override
  protected void doExecute() {
    try {
      final CloudApplication application = getClient().getApplication(getAppname());
      final ApplicationStats stats = getClient().getApplicationStats(getAppname());
      getLog().info("\n" + UiUtils.renderCloudApplicationDataAsTable(application, stats));
    } catch (CloudFoundryException e) {
      getLog().info(String.format("Application '%s' doesn't exist", getAppname()));
    }
  }
View Full Code Here

    assertEquals(CloudApplication.AppState.STARTED, app.getState());

    waitForStatsAvailable(appName, instanceCount);

    ApplicationStats stats = connectedClient.getApplicationStats(appName);
    assertNotNull(stats);
    assertNotNull(stats.getRecords());
    assertEquals(instanceCount, stats.getRecords().size());

    for (InstanceStats instanceStats : stats.getRecords()) {
      assertNotNull(instanceStats.getUris());
      assertNotNull(instanceStats.getHost());
      assertTrue(instanceStats.getPort() > 0);
      assertTrue(instanceStats.getDiskQuota() > 0);
      assertTrue(instanceStats.getMemQuota() > 0);
View Full Code Here

    }
  }

  private void waitForStatsAvailable(String appName, int instanceCount) throws InterruptedException {
    // TODO: Make this pattern reusable
    ApplicationStats stats = connectedClient.getApplicationStats(appName);
    for (int retries = 0; retries < 10 && stats.getRecords().size() < instanceCount; retries++) {
      Thread.sleep(1000);
      stats = connectedClient.getApplicationStats(appName);
    }

    InstanceStats firstInstance = stats.getRecords().get(0);
    assertEquals("0", firstInstance.getId());
    for (int retries = 0; retries < 50 && firstInstance.getUsage() == null; retries++) {
      Thread.sleep(1000);
      stats = connectedClient.getApplicationStats(appName);
      firstInstance = stats.getRecords().get(0);
    }
  }
View Full Code Here

  public void getApplicationStatsStoppedApp() throws IOException {
    String appName = namespacedAppName("stats2");
    createAndUploadAndStartSimpleSpringApp(appName);
    connectedClient.stopApplication(appName);

    ApplicationStats stats = connectedClient.getApplicationStats(appName);
    assertTrue(stats.getRecords().isEmpty());
  }
View Full Code Here

    return cloudApp;
  }

  private int getRunningInstances(UUID appId, CloudApplication.AppState appState) {
    int running = 0;
    ApplicationStats appStats = doGetApplicationStats(appId, appState);
    if (appStats != null && appStats.getRecords() != null) {
      for (InstanceStats inst : appStats.getRecords()) {
        if (InstanceState.RUNNING == inst.getState()){
          running++;
        }
      }
    }
View Full Code Here

        InstanceStats instanceStats =
            new InstanceStats(instanceId, (Map<String, Object>) respMap.get(instanceId));
        instanceList.add(instanceStats);
      }
    }
    return new ApplicationStats(instanceList);
  }
View Full Code Here

TOP

Related Classes of org.cloudfoundry.client.lib.domain.ApplicationStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.