Package org.cloudfoundry.client.lib

Examples of org.cloudfoundry.client.lib.CloudFoundryClient


    // therefore it is not critical to set the proxy in the client on
    // client
    // creation

    HttpProxyConfiguration proxyConfiguration = getProxy(url);
    return session != null ? new CloudFoundryClient(credentials, url, session, selfSigned)
        : new CloudFoundryClient(credentials, url, proxyConfiguration, selfSigned);
  }
View Full Code Here


    // handler
    // therefore it is not critical to set the proxy in the client on
    // client
    // creation
    HttpProxyConfiguration proxyConfiguration = getProxy(url);
    return new CloudFoundryClient(credentials, url, orgName, spaceName, proxyConfiguration, selfsigned);
  }
View Full Code Here

    // CloudFoundryServerBehaviour Request as well as the client login
    // handler
    // therefore it is not critical to set the proxy in the client on client
    // creation
    HttpProxyConfiguration proxyConfiguration = getProxy(url);
    return new CloudFoundryClient(url, proxyConfiguration);
  }
View Full Code Here

    //read the password, without echoing the output
    if (vcap_passwd == null) {
      vcap_passwd = new String(console.readPassword("Password? "));
        }

    CloudFoundryClient client =  clientInit();

    String version = client.getCloudInfo().getVersion();
    if (Float.valueOf(version) >= 2.0) {
      //read org, using java.util.Formatter syntax :
      if (vcap_org == null) {
        vcap_org = console.readLine("Org to use? ");
      }
      //read space, using java.util.Formatter syntax :
      if (vcap_space == null) {
        vcap_space = console.readLine("Space to use? ");
      }

      client =  clientOrgSpace(client);
    }

    CloudApplication serverApp = null;
    try {
      serverApp = client.getApplication(TunnelHelper.getTunnelAppName());
    }
    catch (CloudFoundryException e) {}
    if (serverApp == null) {
      System.out.println("Deploying Caldecott server app");
      TunnelHelper.deployTunnelApp(client);
    }
    try {
      serverApp = client.getApplication(TunnelHelper.getTunnelAppName());
    }
    catch (CloudFoundryException e) {
      System.err.println("Unable to deploy Caldecott server app: " + e.getMessage());
      throw e;
    }
    if (!serverApp.getState().equals(CloudApplication.AppState.STARTED)) {
      System.out.println("Starting Caldecott server app");
      client.startApplication(serverApp.getName());
    }

    while (vcap_service == null) {
      System.out.println("You have the following services defined:");
      List<CloudService> services = client.getServices();
      int i = 0;
      for (CloudService svc : services) {
        i++;
        System.out.println(i + ": " + svc.getName());
      }
View Full Code Here

    finalize(client);
    System.out.println("DONE!");
  }

  public static CloudFoundryClient clientInit() {
    CloudFoundryClient client = null;
    try {
      client = new CloudFoundryClient(new CloudCredentials(vcap_email, vcap_passwd), new URL(CC_URL));
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    client.login();
    return client;
  }
View Full Code Here

    }
    if (useSpace == null) {
      System.err.println("The specified org '" + vcap_org + "' and space '" + vcap_space + "' not found!");
      System.exit(1);
    }
    CloudFoundryClient spaceClient = null;
    try {
      client = new CloudFoundryClient(new CloudCredentials(vcap_email, vcap_passwd), new URL(CC_URL), useSpace);
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
    client.login();
    return client;
View Full Code Here

     * Injecting some test values as expressions are not evaluated.
     */
    setVariableValueToObject( mojo, "artifactId", "cf-maven-tests" );
    setVariableValueToObject( mojo, "artifact", "someGAV");

    CloudFoundryClient client = mock(CloudFoundryClient.class);
    doReturn(new CloudDomain(null, "apps.cloudfoundry.com", null)).when(client).getDefaultDomain();
    doReturn(client).when(mojo).getClient();

    doReturn(null).when(mojo).getCommandlineProperty(any(SystemProperties.class));

View Full Code Here

    return mojo;
  }

  private void setupClient(Push mojo) {
    CloudFoundryClient client = mock(CloudFoundryClient.class);
    doReturn(new CloudDomain(null, "apps.cloudfoundry.com", null)).when(client).getDefaultDomain();
    doReturn(client).when(mojo).getClient();
  }
View Full Code Here

    getLog().debug(String.format(
        "Connecting to Cloud Foundry at '%s' with username: '%s'",
        target, username));

    final CloudCredentials credentials = new CloudCredentials(username, password);
    CloudFoundryClient client = createConnection(credentials, target, org, space, trustSelfSignedCerts);
    connectToCloudFoundry(client);
    return client;
  }
View Full Code Here

  }

  private CloudFoundryClient createConnection(CloudCredentials credentials, URI target, String org, String space, boolean trustSelfSignedCert)
      throws MojoExecutionException {
    try {
      CloudFoundryClient cloudFoundryClient =
          new CloudFoundryClient(credentials, target.toURL(), org, space, getHttpProxyConfiguration(target), trustSelfSignedCert);
      cloudFoundryClient.setResponseErrorHandler(responseErrorHandler);
      return cloudFoundryClient;
    } catch (MalformedURLException e) {
      throw new MojoExecutionException(
          String.format("Incorrect Cloud Foundry target URL '%s'. Make sure the URL contains a scheme, e.g. http://...", target), e);
    }
View Full Code Here

TOP

Related Classes of org.cloudfoundry.client.lib.CloudFoundryClient

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.