Package org.cloudfoundry.client.lib.domain

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


    Staging staging = new Staging("node app.js", null);
    File file = SampleProjects.standaloneNode();
    connectedClient.createApplication(appName, staging, 64, uris, services);
    connectedClient.uploadApplication(appName, file.getCanonicalPath());
    connectedClient.startApplication(appName);
    CloudApplication app = connectedClient.getApplication(appName);
    assertNotNull(app);
    assertEquals(CloudApplication.AppState.STARTED, app.getState());
    assertEquals(Collections.singletonList(computeAppUrlNoProtocol(appName)), app.getUris());
  }
View Full Code Here


    String appName = namespacedAppName("standalone-ruby");
    List<String> uris = new ArrayList<String>();
    List<String> services = new ArrayList<String>();
    createStandaloneRubyTestApp(appName, uris, services);
    connectedClient.startApplication(appName);
    CloudApplication app = connectedClient.getApplication(appName);
    assertNotNull(app);
    assertEquals(CloudApplication.AppState.STARTED, app.getState());
    assertEquals(uris, app.getUris());
    assertEquals("ruby simple.rb", app.getStaging().getCommand());
    connectedClient.stopApplication(appName);

    Staging newStaging = new Staging("ruby simple.rb test", "https://github.com/cloudfoundry/heroku-buildpack-ruby");
    connectedClient.updateApplicationStaging(appName, newStaging);
    app = connectedClient.getApplication(appName);
    assertNotNull(app);
    assertEquals(uris, app.getUris());
    assertEquals("ruby simple.rb test", app.getStaging().getCommand());
    assertEquals("https://github.com/cloudfoundry/heroku-buildpack-ruby", app.getStaging().getBuildpackUrl());
  }
View Full Code Here

  }

  @Test
  public void renameApplication() {
    String appName = createSpringTravelApp("5");
    CloudApplication app = connectedClient.getApplication(appName);
    assertNotNull(app);
    assertEquals(appName, app.getName());
    String newName = namespacedAppName("travel_test-6");
    connectedClient.rename(appName, newName);
    CloudApplication newApp = connectedClient.getApplication(newName);
    assertNotNull(newApp);
    assertEquals(newName, newApp.getName());
  }
View Full Code Here

  @Test
  public void getApplicationsMatchGetApplication() {
    String appName = createSpringTravelApp("1");
    List<CloudApplication> apps = connectedClient.getApplications();
    assertEquals(1, apps.size());
    CloudApplication app = connectedClient.getApplication(appName);
    assertEquals(app.getName(), apps.get(0).getName());
    assertEquals(app.getState(), apps.get(0).getState());
    assertEquals(app.getInstances(), apps.get(0).getInstances());
    assertEquals(app.getMemory(), apps.get(0).getMemory());
    assertEquals(app.getMeta().getGuid(), apps.get(0).getMeta().getGuid());
    assertEquals(app.getMeta().getCreated(), apps.get(0).getMeta().getCreated());
    assertEquals(app.getMeta().getUpdated(), apps.get(0).getMeta().getUpdated());
    assertEquals(app.getUris(), apps.get(0).getUris());
  }
View Full Code Here

  }

  @Test
  public void getApplicationInstances() throws Exception {
    String appName = namespacedAppName("instance1");
    CloudApplication app = createAndUploadAndStartSimpleSpringApp(appName);
    assertEquals(1, app.getInstances());

    boolean passSingleInstance = getInstanceInfosWithTimeout(appName, 1, true);
    assertTrue("Couldn't get the right application state in 50 tries", passSingleInstance);

    boolean passSingleMultipleInstances = getInstanceInfosWithTimeout(appName, 3, true);
View Full Code Here

  }

  @Test
  public void accessRandomApplicationUrl() throws Exception {
    String appName = UUID.randomUUID().toString();
    CloudApplication app = createAndUploadAndStartSimpleSpringApp(appName);
    connectedClient.startApplication(appName);
    assertEquals(1, app.getInstances());
    for (int i = 0; i < 100 && app.getRunningInstances() < 1; i++) {
      Thread.sleep(1000);
      app = connectedClient.getApplication(appName);
    }
    assertEquals(1, app.getRunningInstances());
    RestUtil restUtil = new RestUtil();
    RestTemplate rest = restUtil.createRestTemplate(httpProxyConfiguration, false);
    String results = rest.getForObject("http://" + app.getUris().get(0), String.class);
    assertTrue(results.contains("Hello world!"));
  }
View Full Code Here

    final int instanceCount = 3;
    String appName = namespacedAppName("stats2");
    createAndUploadSimpleSpringApp(appName);
    connectedClient.updateApplicationInstances(appName, instanceCount);
    connectedClient.startApplication(appName);
    CloudApplication app = connectedClient.getApplication(appName);

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

    waitForStatsAvailable(appName, instanceCount);

    ApplicationStats stats = connectedClient.getApplicationStats(appName);
    assertNotNull(stats);
View Full Code Here

    String appName = namespacedAppName("upload-non-unsubscribing-callback");
    createSpringApplication(appName);
    File file = SampleProjects.springTravel();
    NonUnsubscribingUploadStatusCallback callback = new NonUnsubscribingUploadStatusCallback();
    connectedClient.uploadApplication(appName, file, callback);
    CloudApplication env = connectedClient.getApplication(appName);
    assertEquals(CloudApplication.AppState.STOPPED, env.getState());
    assertTrue(callback.progressCount > 1); // must have taken at least 10 seconds
  }
View Full Code Here

    String appName = namespacedAppName("upload-unsubscribing-callback");
    createSpringApplication(appName);
    File file = SampleProjects.springTravel();
    UnsubscribingUploadStatusCallback callback = new UnsubscribingUploadStatusCallback();
    connectedClient.uploadApplication(appName, file, callback);
    CloudApplication env = connectedClient.getApplication(appName);
    assertEquals(CloudApplication.AppState.STOPPED, env.getState());
    assertTrue(callback.progressCount == 1);
  }
View Full Code Here

    ClassPathResource cpr = new ClassPathResource("apps/env/");
    File explodedDir = cpr.getFile();
    Staging staging = new Staging();
    createAndUploadExplodedTestApp(appName, explodedDir, staging);
    connectedClient.startApplication(appName);
    CloudApplication env = connectedClient.getApplication(appName);
    assertEquals(CloudApplication.AppState.STARTED, env.getState());
  }
View Full Code Here

TOP

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

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.