@Test(description = "POST /admin/org/{id}/catalogs")
  public void testAddCatalog() {
    AdminCatalog newCatalog =
        AdminCatalog.builder()
            .name(name("Test Catalog "))
            .description("created by testAddCatalog()")
            .build();
    catalog = catalogApi.addCatalogToOrg(newCatalog, org.getId());

    Checks.checkAdminCatalog(catalog);

    // FIXME: documentation suggests we should wait for a task here
  }
  @Test(
      description = "DELETE /admin/catalog/{id}",
      dependsOnMethods = {"testAddCatalog"})
  public void testRemoveCatalog() {
    // assertEquals(catalog.getCatalogItems().getCatalogItems().size(), 0,
    // String.format(OBJ_FIELD_EMPTY_TO_DELETE, "Catalog", "CatalogItems",
    // catalog.getCatalogItems().getCatalogItems().toString()));
    AdminCatalog removeCatalog =
        AdminCatalog.builder()
            .name(name("Test Catalog "))
            .description("created by testAddCatalog()")
            .build();
    removeCatalog = catalogApi.addCatalogToOrg(removeCatalog, org.getId());
    catalogApi.remove(removeCatalog.getId());

    removeCatalog = catalogApi.get(removeCatalog.getId());
    assertNull(
        removeCatalog,
        String.format(OBJ_DEL, CATALOG, removeCatalog != null ? removeCatalog.toString() : ""));
  }
 public static final AdminCatalog catalog() {
   return AdminCatalog.builder()
       .name("QunyingTestCatalog")
       .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
       .type("application/vnd.vmware.admin.catalog+xml")
       .href(
           URI.create(
               "https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
       .link(
           Link.builder()
               .rel("up")
               .type("application/vnd.vmware.admin.organization+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
               .build())
       .link(
           Link.builder()
               .rel("alternate")
               .type("application/vnd.vmware.vcloud.catalog+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
               .build())
       .link(
           Link.builder()
               .rel("down")
               .type("application/vnd.vmware.vcloud.owner+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
               .build())
       .link(
           Link.builder()
               .rel("add")
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
               .build())
       .link(
           Link.builder()
               .rel("edit")
               .type("application/vnd.vmware.admin.catalog+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
               .build())
       .link(
           Link.builder()
               .rel("remove")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
               .build())
       .link(
           Link.builder()
               .rel("down")
               .type("application/vnd.vmware.vcloud.metadata+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
               .build())
       .description("Testing")
       .owner(owner())
       .item(
           Reference.builder()
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .name("image")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
               .build())
       .item(
           Reference.builder()
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .name("ubuntu10")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
               .build())
       .item(
           Reference.builder()
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .name("imageTesting")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
               .build())
       .item(
           Reference.builder()
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .name("TestCase")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
               .build())
       .isPublished(false)
       .build();
 }
 public static final AdminCatalog addCatalogToOrg() {
   return AdminCatalog.builder()
       .name("Test Catalog")
       .id("urn:vcloud:catalog:c56d9159-7838-446f-bb35-9ee12dfbbef3")
       .type("application/vnd.vmware.admin.catalog+xml")
       .description("created by testCreateCatalog()")
       .href(
           URI.create(
               "https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
       .link(
           Link.builder()
               .rel("up")
               .type("application/vnd.vmware.admin.organization+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
               .build())
       .link(
           Link.builder()
               .rel("alternate")
               .type("application/vnd.vmware.vcloud.catalog+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
               .build())
       .link(
           Link.builder()
               .rel("down")
               .type("application/vnd.vmware.vcloud.owner+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/owner"))
               .build())
       .link(
           Link.builder()
               .rel("add")
               .type("application/vnd.vmware.vcloud.catalogItem+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/catalogItems"))
               .build())
       .link(
           Link.builder()
               .rel("edit")
               .type("application/vnd.vmware.admin.catalog+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
               .build())
       .link(
           Link.builder()
               .rel("remove")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/admin/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
               .build())
       .link(
           Link.builder()
               .rel("down")
               .type("application/vnd.vmware.vcloud.metadata+xml")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3/metadata"))
               .build())
       .tasks(
           ImmutableSet.<Task>builder()
               .add(
                   Task.builder()
                       .status("running")
                       .startTime(dateService.iso8601DateParse("2012-03-11T18:43:02.429-04:00"))
                       .operationName("catalogCreateCatalog")
                       .operation(
                           "Creating Catalog Test Catalog(c56d9159-7838-446f-bb35-9ee12dfbbef3)")
                       .expiryTime(dateService.iso8601DateParse("2012-06-09T18:43:02.429-04:00"))
                       .name("task")
                       .id("urn:vcloud:task:20f556f9-9125-4090-9092-0da9f72bedf4")
                       .type("application/vnd.vmware.vcloud.task+xml")
                       .href(
                           URI.create(
                               "https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4"))
                       .link(
                           Link.builder()
                               .rel("task:cancel")
                               .href(
                                   URI.create(
                                       "https://vcloudbeta.bluelock.com/api/task/20f556f9-9125-4090-9092-0da9f72bedf4/action/cancel"))
                               .build())
                       .owner(
                           Reference.builder()
                               .type("application/vnd.vmware.vcloud.catalog+xml")
                               .name("Test Catalog")
                               .href(
                                   URI.create(
                                       "https://vcloudbeta.bluelock.com/api/catalog/c56d9159-7838-446f-bb35-9ee12dfbbef3"))
                               .build())
                       .user(
                           Reference.builder()
                               .type("application/vnd.vmware.admin.user+xml")
                               .name("*****@*****.**")
                               .href(
                                   URI.create(
                                       "https://vcloudbeta.bluelock.com/api/admin/user/ae75edd2-12de-414c-8e85-e6ea10442c08"))
                               .build())
                       .org(
                           Reference.builder()
                               .type("application/vnd.vmware.vcloud.org+xml")
                               .name("JClouds")
                               .href(
                                   URI.create(
                                       "https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
                               .build())
                       .build())
               .build())
       .isPublished(false)
       .build();
 }
 public static final AdminCatalog addCatalogToOrgSource() {
   return AdminCatalog.builder()
       .name("Test Catalog")
       .description("created by testCreateCatalog()")
       .build();
 }