Package org.cloudfoundry.client.lib.domain

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


    orgIDtoOrg = new HashMap<String, CloudOrganization>();
    // Parse the orgs and restructure the spaces per org for quick lookup,
    // as the original list of spaces is flat and does
    // not convey the org -> spaces structure.
    for (CloudSpace clSpace : originalSpaces) {
      CloudOrganization org = clSpace.getOrganization();
      List<CloudSpace> spaces = orgIDtoSpaces.get(org.getName());
      if (spaces == null) {
        spaces = new ArrayList<CloudSpace>();
        orgIDtoSpaces.put(org.getName(), spaces);
        orgIDtoOrg.put(org.getName(), org);
      }

      spaces.add(clSpace);
    }
  }
View Full Code Here


    HashMap<String, Object> info = new HashMap<String, Object>(1);
    info.put("version", "2");
    when(client.getCloudInfo()).thenReturn(new CloudInfo(info));

    Date date = new Date();
    CloudOrganization org = new CloudOrganization(new CloudEntity.Meta(UUID.randomUUID(), date, date), "my-org");
    CloudSpace space = new CloudSpace(new CloudEntity.Meta(UUID.randomUUID(), date, date), "my-space", org);
    List<CloudSpace> spaces = Arrays.asList(space);
    when(client.getSpaces()).thenReturn(spaces);

    login.doExecute();
View Full Code Here

  @Test
  public void setQuotaToOrg() throws Exception {
    assumeTrue(CCNG_USER_IS_ADMIN);

    // get old quota to restore after test
    CloudOrganization org = connectedClient.getOrgByName(CCNG_USER_ORG, true);
    CloudQuota oldQuota = org.getQuota();

    // create and set test_quota to org
    CloudQuota cloudQuota = new CloudQuota(null, CCNG_QUOTA_NAME_TEST);
    connectedClient.createQuota(cloudQuota);
    connectedClient.setQuotaToOrg(CCNG_USER_ORG, CCNG_QUOTA_NAME_TEST);

    // get the bound quota of org
    org = connectedClient.getOrgByName(CCNG_USER_ORG, true);
    CloudQuota newQuota = org.getQuota();

    // bound quota should be equals to test_quota
    assertEquals(CCNG_QUOTA_NAME_TEST, newQuota.getName());

    // restore org to default quota
View Full Code Here

        "Error during mapping - unsupported class for entity mapping " + targetClass.getName());
  }

  private CloudSpace mapSpaceResource(Map<String, Object> resource) {
    Map<String, Object> organizationMap = getEmbeddedResource(resource, "organization");
    CloudOrganization organization = null;
    if (organizationMap != null) {
      organization = mapOrganizationResource(organizationMap);
    }
    return new CloudSpace(getMeta(resource), getNameOfResource(resource), organization);
  }
View Full Code Here

                "quota_definition");
    CloudQuota quota = null;
    if (quotaDefinition != null) {
      quota = mapQuotaResource(quotaDefinition);
        }
        return new CloudOrganization(getMeta(resource),
                getNameOfResource(resource), quota,billingEnabled);
    }
View Full Code Here

    }

  private CloudDomain mapDomainResource(Map<String, Object> resource) {
    @SuppressWarnings("unchecked")
    Map<String, Object> ownerResource = getEntityAttribute(resource, "owning_organization", Map.class);
    CloudOrganization owner;
    if (ownerResource == null) {
      owner = new CloudOrganization(CloudEntity.Meta.defaultMeta(), "none");
    } else {
      owner = mapOrganizationResource(ownerResource);
    }
    return new CloudDomain(getMeta(resource), getNameOfResource(resource), owner);
  }
View Full Code Here

  private CloudSpace validateSpaceAndOrg(String spaceName, String orgName, CloudControllerClientImpl client) {
    List<CloudSpace> spaces = client.getSpaces();

    for (CloudSpace space : spaces) {
      if (space.getName().equals(spaceName)) {
        CloudOrganization org = space.getOrganization();
        if (orgName == null || org.getName().equals(orgName)) {
          return space;
        }
      }
    }
View Full Code Here

   * @param orgName
   * @param quotaName
   */
  public void setQuotaToOrg(String orgName, String quotaName) {
    CloudQuota quota = this.getQuotaByName(quotaName, true);
    CloudOrganization org = this.getOrgByName(orgName, true);

    doSetQuotaToOrg(org.getMeta().getGuid(), quota.getMeta().getGuid());
  }
View Full Code Here

   */
  public CloudOrganization getOrgByName(String orgName, boolean required) {
    Map<String, Object> urlVars = new HashMap<String, Object>();
    String urlPath = "/v2/organizations?inline-relations-depth=1&q=name:{name}";
    urlVars.put("name", orgName);
    CloudOrganization org = null;
    List<Map<String, Object>> resourceList = getAllResources(urlPath,
        urlVars);
    if (resourceList.size() > 0) {
      Map<String, Object> resource = resourceList.get(0);
      org = resourceMapper.mapResource(resource, CloudOrganization.class);
View Full Code Here

TOP

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

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.