Exemplo n.º 1
0
 @Override
 public Task build() {
   Task task = new Task(href, name);
   task.setError(error);
   task.setOrg(org);
   task.setProgress(progress);
   task.setStatus(status);
   task.setOperation(operation);
   task.setOperationName(operationName);
   task.setStartTime(startTime);
   task.setEndTime(endTime);
   task.setExpiryTime(expiryTime);
   return task;
 }
Exemplo n.º 2
0
  public static void checkTask(Task task) {
    // Check required fields
    assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJECT_FMT, "Status", "Task"));
    assertTrue(
        Task.Status.ALL.contains(task.getStatus()),
        String.format(
            REQUIRED_VALUE_OBJECT_FMT,
            "Status",
            "Task",
            task.getStatus(),
            Iterables.toString(Task.Status.ALL)));

    // Check optional fields
    // NOTE operation cannot be checked
    // NOTE operationName cannot be checked
    // NOTE startTime cannot be checked
    // NOTE endTime cannot be checked
    // NOTE expiryTimecannot be checked
    ReferenceType<?> owner = task.getOwner();
    if (owner != null) checkReferenceType(owner);
    Error error = task.getError();
    if (error != null) checkError(error);
    ReferenceType<?> user = task.getUser();
    if (user != null) checkReferenceType(user);
    ReferenceType<?> org = task.getOrg();
    if (org != null) checkReferenceType(org);
    Integer progress = task.getProgress();
    if (progress != null) checkProgress(progress);
    // NOTE params cannot be checked

    // Check parent type
    checkEntityType(task);
  }
Exemplo n.º 3
0
  /** Used by other methods to add a custom {@link Task} object. */
  private static Task task(
      String taskId,
      String name,
      String description,
      String status,
      String operation,
      String operationName,
      String startTime) {
    Task task =
        Task.builder()
            .error(Error.builder().build())
            .org(Reference.builder().build())
            .owner(Reference.builder().build())
            .user(Reference.builder().build())
            .params(null)
            .progress(0)
            .status(status)
            .operation(operation)
            .operationName(operationName)
            .startTime(dateService.iso8601DateParse(startTime))
            .endTime(null)
            .expiryTime(null)
            .tasks(Sets.<Task>newLinkedHashSet())
            .description(description)
            .name(name)
            .id("urn:vcloud:" + taskId)
            .href(URI.create(endpoint + "/task/" + taskId))
            .links(Sets.<Link>newLinkedHashSet())
            .build();

    return task;
  }
Exemplo n.º 4
0
 public static Task rebootTask() {
   return Task.builder()
       .id("urn:vcloud:task:5bc25a1b-79cb-4904-b53f-4ca09088e434")
       .name("task")
       .href(
           URI.create(
               "https://vcloudbeta.bluelock.com/api/task/5bc25a1b-79cb-4904-b53f-4ca09088e434"))
       .link(
           Link.builder()
               .rel(Link.Rel.TASK_CANCEL)
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/task/5bc25a1b-79cb-4904-b53f-4ca09088e434/action/cancel"))
               .build())
       .org(
           Reference.builder()
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/org/4559b367-8af2-4ee1-8429-a0d39e7df3de"))
               .name("jclouds")
               .type(VCloudDirectorMediaType.ORG)
               .build())
       .operation("Rebooting Virtual Machine damn small(b7e995a7-1468-4873-af39-bc703feefd63)")
       .operationName("vappReboot")
       .progress(0)
       .startTime(dateService.cDateParse("Thu Oct 25 13:39:25 EDT 2012"))
       .expiryTime(dateService.cDateParse("Wed Jan 23 13:39:25 EST 2013"))
       .status(Task.Status.RUNNING)
       .type(VCloudDirectorMediaType.TASK)
       .build();
 }
Exemplo n.º 5
0
 public Builder fromTask(Task in) {
   return fromEntityType(in)
       .error(in.getError())
       .org(in.getOrg())
       .progress(in.getProgress())
       .status(in.getStatus())
       .operation(in.getOperation())
       .operationName(in.getOperationName());
 }
 public final Task updateNetworkTask() {
   return Task.builder()
       .status("running")
       .startTime(dateService.iso8601DateParse("2012-03-14T12:39:23.720-04:00"))
       .operationName("networkUpdateNetwork")
       .operation("Updating Network ilsolation01-Jclouds(f3ba8256-6f48-4512-aad6-600e85b4dc38)")
       .expiryTime(dateService.iso8601DateParse("2012-06-12T12:39:23.720-04:00"))
       .name("task")
       .id("urn:vcloud:task:49d2e180-7921-4902-ac39-b4ff5406bb94")
       .type("application/vnd.vmware.vcloud.task+xml")
       .href(
           URI.create(
               "https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94"))
       .link(
           Link.builder()
               .rel("task:cancel")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/task/49d2e180-7921-4902-ac39-b4ff5406bb94/action/cancel"))
               .build())
       .owner(
           Reference.builder()
               .type("application/vnd.vmware.vcloud.network+xml")
               .name("ilsolation01-Jclouds")
               .href(
                   URI.create(
                       "https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
               .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();
 }
Exemplo n.º 7
0
  public static Task editProductSectionsTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 8
0
  public static Task editOperatingSystemSectionTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 9
0
  public static Task editOwnerTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 10
0
  public static Task insertMediaTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 11
0
  public static Task editNetworkConnectionSectionTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 12
0
  public static Task recomposeVAppTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 13
0
  public static Task editLeaseSettingsSectionTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 14
0
  public static Task editVirtualHardwareSectionNetworkCardsTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 15
0
  public static Task editVirtualHardwareSectionMemoryTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 16
0
  public static Task discardSuspendedStateTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 17
0
  public static Task consolidateVAppTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 18
0
  public static Task powerOnTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 19
0
  public static Task upgradeHardwareVersionTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 20
0
  public static Task undeployTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 21
0
 public final Task resetNetworkTask() {
   return Task.builder().build();
 }
Exemplo n.º 22
0
  public static Task editGuestCustomizationSectionTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 23
0
  public static Task resetTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 24
0
  public static Task installVMwareToolsTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 25
0
  public static Task shutdownTask() {
    Task task = Task.builder().build();

    return task;
  }
Exemplo n.º 26
0
  public static Task suspendTask() {
    Task task = Task.builder().build();

    return task;
  }
 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();
 }
Exemplo n.º 28
0
  public static Task editStartupSectionTask() {
    Task task = Task.builder().build();

    return task;
  }