mirror of https://github.com/apache/jclouds.git
removed unnecessary wrapping of Task collections
This commit is contained in:
parent
b309dd60df
commit
1f3971fae8
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -28,8 +26,6 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -69,7 +65,7 @@ public class AdminCatalog extends CatalogType<AdminCatalog> {
|
|||
public static class Builder extends CatalogType.Builder<AdminCatalog> {
|
||||
|
||||
public AdminCatalog build() {
|
||||
return new AdminCatalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
return new AdminCatalog(href, type, links, description, tasks, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,11 +128,11 @@ public class AdminCatalog extends CatalogType<AdminCatalog> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -159,23 +155,22 @@ public class AdminCatalog extends CatalogType<AdminCatalog> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
return Builder.class.cast(super.link(link));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromCatalogType(CatalogType<AdminCatalog> in) {
|
||||
return Builder.class.cast(super.fromCatalogType(in));
|
||||
|
@ -190,8 +185,8 @@ public class AdminCatalog extends CatalogType<AdminCatalog> {
|
|||
// For JAXB
|
||||
}
|
||||
|
||||
public AdminCatalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public AdminCatalog(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published);
|
||||
super(href, type, links, description, tasks, id, name, owner, catalogItems, published);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class Catalog extends CatalogType<Catalog> {
|
|||
|
||||
@Override
|
||||
public Catalog build() {
|
||||
return new Catalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
return new Catalog(href, type, links, description, tasks, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,11 +120,11 @@ public class Catalog extends CatalogType<Catalog> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -174,9 +174,9 @@ public class Catalog extends CatalogType<Catalog> {
|
|||
}
|
||||
}
|
||||
|
||||
public Catalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public Catalog(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published);
|
||||
super(href, type, links, description, tasks, id, name, owner, catalogItems, published);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
|
|
@ -46,7 +46,6 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
@ -87,7 +86,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
|
||||
@Override
|
||||
public CatalogItem build() {
|
||||
return new CatalogItem(href, type, links, description, tasksInProgress, id, name, entity, properties);
|
||||
return new CatalogItem(href, type, links, description, tasks, id, name, entity, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,11 +117,11 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -145,21 +144,19 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
return Builder.class.cast(super.link(link));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,8 +169,8 @@ public class CatalogItem extends EntityType<CatalogItem> {
|
|||
}
|
||||
}
|
||||
|
||||
private CatalogItem(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Reference entity, Set<Property> properties) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
private CatalogItem(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name, Reference entity, Set<Property> properties) {
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.entity = entity;
|
||||
this.properties = ImmutableSet.copyOf(properties);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class CatalogType<T extends CatalogType<T>> extends EntityType<T> {
|
|||
|
||||
@Override
|
||||
public CatalogType<T> build() {
|
||||
return new CatalogType<T>(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
return new CatalogType<T>(href, type, links, description, tasks, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,11 +121,11 @@ public class CatalogType<T extends CatalogType<T>> extends EntityType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress(tasksInProgress);
|
||||
public Builder<T> tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -176,9 +176,9 @@ public class CatalogType<T extends CatalogType<T>> extends EntityType<T> {
|
|||
}
|
||||
}
|
||||
|
||||
public CatalogType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public CatalogType(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.owner = owner;
|
||||
this.catalogItems = catalogItems;
|
||||
this.isPublished = published;
|
||||
|
|
|
@ -46,7 +46,7 @@ public class Entity extends EntityType<Entity> {
|
|||
|
||||
@Override
|
||||
public Entity build() {
|
||||
return new Entity(href, type, links, description, tasksInProgress, id, name);
|
||||
return new Entity(href, type, links, description, tasks, id, name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,11 +77,11 @@ public class Entity extends EntityType<Entity> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,8 @@ public class Entity extends EntityType<Entity> {
|
|||
}
|
||||
}
|
||||
|
||||
private Entity(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
private Entity(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name) {
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
}
|
||||
|
||||
private Entity() {
|
||||
|
|
|
@ -22,13 +22,18 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +53,7 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
public static abstract class NewBuilder<T extends NewBuilder<T>> extends ResourceType.NewBuilder<T> {
|
||||
|
||||
protected String description;
|
||||
protected TasksInProgress tasksInProgress;
|
||||
protected Set<Task> tasks;
|
||||
protected String name;
|
||||
protected String id;
|
||||
|
||||
|
@ -77,16 +82,16 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
public T tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public T tasks(Set<Task> tasks) {
|
||||
this.tasks = tasks;
|
||||
return self();
|
||||
}
|
||||
|
||||
public T fromEntityType(EntityType<?> in) {
|
||||
return fromResourceType(in)
|
||||
.description(in.getDescription()).tasksInProgress(in.getTasksInProgress())
|
||||
.description(in.getDescription()).tasks(in.getTasks())
|
||||
.id(in.getId()).name(in.getName());
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +99,7 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
public static abstract class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
|
||||
|
||||
protected String description;
|
||||
protected TasksInProgress tasksInProgress;
|
||||
protected Set<Task> tasks;
|
||||
protected String name;
|
||||
protected String id;
|
||||
|
||||
|
@ -123,10 +128,21 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
public Builder<T> tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder<T> tasks(Set<Task> tasks) {
|
||||
if (checkNotNull(tasks, "tasks").size() > 0)
|
||||
this.tasks = Sets.newLinkedHashSet(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
public Builder<T> task(Task task) {
|
||||
if (tasks == null)
|
||||
tasks = Sets.newLinkedHashSet();
|
||||
this.tasks.add(checkNotNull(task, "task"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -151,19 +167,19 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
return Builder.class.cast(super.link(link));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,24 +193,26 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
|
||||
public Builder<T> fromEntityType(EntityType<T> in) {
|
||||
return fromResourceType(in)
|
||||
.description(in.getDescription()).tasksInProgress(in.getTasksInProgress())
|
||||
.description(in.getDescription()).tasks(in.getTasks())
|
||||
.id(in.getId()).name(in.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@XmlElement(name = "Description")
|
||||
private String description;
|
||||
@XmlElement(name = "Tasks")
|
||||
private TasksInProgress tasksInProgress;
|
||||
@XmlElementWrapper(name = "Tasks")
|
||||
@XmlElement(name = "Task")
|
||||
private Set<Task> tasks;
|
||||
@XmlAttribute
|
||||
private String id;
|
||||
@XmlAttribute(required = true)
|
||||
private String name;
|
||||
|
||||
public EntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
|
||||
public EntityType(URI href, String type, @Nullable Set<Link> links, String description, @Nullable Set<Task> tasks, String id, String name) {
|
||||
super(href, type, links);
|
||||
this.description = description;
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
// nullable so that jaxb wont persist empty collections
|
||||
this.tasks = tasks != null && tasks.size() == 0 ? null : tasks;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -213,8 +231,8 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
/**
|
||||
* A list of queued, running, or recently completed tasks associated with this entity.
|
||||
*/
|
||||
public TasksInProgress getTasksInProgress() {
|
||||
return tasksInProgress;
|
||||
public Set<Task> getTasks() {
|
||||
return tasks == null ? ImmutableSet.<Task>of() : Collections.unmodifiableSet(tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,7 +261,7 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
EntityType<?> that = EntityType.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.id, that.id) && equal(this.description, that.description) &&
|
||||
equal(this.tasksInProgress, that.tasksInProgress) && equal(this.name, that.name);
|
||||
equal(this.tasks, that.tasks) && equal(this.name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,11 +276,11 @@ public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(description, tasksInProgress, id, name);
|
||||
return super.hashCode() + Objects.hashCode(description, tasks, id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("description", description).add("tasksInProgress", tasksInProgress).add("id", id).add("name", name);
|
||||
return super.string().add("description", description).add("tasks", tasks).add("id", id).add("name", name);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -33,7 +32,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -99,7 +97,7 @@ public class File extends EntityType<File> {
|
|||
}
|
||||
|
||||
public File build() {
|
||||
return new File(href, type, links, description, tasksInProgress, id, name, size, bytesTransferred, checksum);
|
||||
return new File(href, type, links, description, tasks, id, name, size, bytesTransferred, checksum);
|
||||
|
||||
}
|
||||
|
||||
|
@ -128,11 +126,11 @@ public class File extends EntityType<File> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress (tasksInProgress);
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks (tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -159,7 +157,7 @@ public class File extends EntityType<File> {
|
|||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -168,7 +166,7 @@ public class File extends EntityType<File> {
|
|||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -186,9 +184,9 @@ public class File extends EntityType<File> {
|
|||
}
|
||||
}
|
||||
|
||||
public File(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public File(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, Long size, Long bytesTransferred, String checksum) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.size = size;
|
||||
this.bytesTransferred = bytesTransferred;
|
||||
this.checksum = checksum;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class Group extends EntityType<Group> {
|
|||
}
|
||||
|
||||
public Group build() {
|
||||
return new Group(href, type, links, description, tasksInProgress, id, name,
|
||||
return new Group(href, type, links, description, tasks, id, name,
|
||||
nameInSource, usersList, role);
|
||||
}
|
||||
|
||||
|
@ -138,11 +138,11 @@ public class Group extends EntityType<Group> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress(tasksInProgress);
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -200,9 +200,9 @@ public class Group extends EntityType<Group> {
|
|||
}
|
||||
|
||||
public Group(URI href, String type, Set<Link> links, String description,
|
||||
TasksInProgress tasksInProgress, String id, String name, String nameInSource,
|
||||
Set<Task> tasks, String id, String name, String nameInSource,
|
||||
UsersList usersList, Reference role) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.nameInSource = nameInSource;
|
||||
this.usersList = usersList;
|
||||
this.role = role;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class Media extends ResourceEntityType<Media> {
|
|||
|
||||
@Override
|
||||
public Media build() {
|
||||
return new Media(href, type, links, description, tasksInProgress, id, name, files, status, owner, imageType, size);
|
||||
return new Media(href, type, links, description, tasks, id, name, files, status, owner, imageType, size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,11 +139,11 @@ public class Media extends ResourceEntityType<Media> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress(tasksInProgress);
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -194,9 +194,9 @@ public class Media extends ResourceEntityType<Media> {
|
|||
}
|
||||
|
||||
|
||||
public Media(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public Media(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, FilesList files, Integer status, Owner owner, String imageType, long size) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, files, status);
|
||||
super(href, type, links, description, tasks, id, name, files, status);
|
||||
this.owner = owner;
|
||||
this.imageType = imageType;
|
||||
this.size = size;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -29,7 +28,6 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
@XmlRootElement(name = "NetworkType")
|
||||
public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
||||
|
@ -57,7 +55,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
|||
|
||||
@Override
|
||||
public NetworkType<T> build() {
|
||||
return new NetworkType<T>(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
|
||||
return new NetworkType<T>(href, type, links, description, tasks, id, name, networkConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,11 +86,11 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder<T> tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -119,7 +117,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
|||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -128,7 +126,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
|||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -146,9 +144,9 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
|
|||
}
|
||||
}
|
||||
|
||||
public NetworkType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
|
||||
public NetworkType(URI href, String type, Set<Link> links, String description, Set<Task> tasks,
|
||||
String id, String name, NetworkConfiguration networkConfiguration) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.networkConfiguration = networkConfiguration;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class Org extends EntityType<Org> {
|
|||
|
||||
@Override
|
||||
public Org build() {
|
||||
return new Org(href, type, links, description, tasksInProgress, id, name, fullName, isEnabled);
|
||||
return new Org(href, type, links, description, tasks, id, name, fullName, isEnabled);
|
||||
}
|
||||
|
||||
public T fromOrg(Org in) {
|
||||
|
@ -143,7 +143,7 @@ public class Org extends EntityType<Org> {
|
|||
|
||||
@Override
|
||||
public Org build() {
|
||||
return new Org(href, type, links, description, tasksInProgress, id, name, fullName, isEnabled);
|
||||
return new Org(href, type, links, description, tasks, id, name, fullName, isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,11 +174,11 @@ public class Org extends EntityType<Org> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -232,8 +232,8 @@ public class Org extends EntityType<Org> {
|
|||
// for JAXB
|
||||
}
|
||||
|
||||
public Org(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String fullName, Boolean enabled) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
public Org(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name, String fullName, Boolean enabled) {
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.fullName = fullName;
|
||||
isEnabled = enabled;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -29,7 +28,6 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
@XmlRootElement(name = "OrgNetwork")
|
||||
public class OrgNetwork extends NetworkType<OrgNetwork> {
|
||||
|
@ -67,7 +65,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
|
|||
|
||||
@Override
|
||||
public OrgNetwork build() {
|
||||
return new OrgNetwork(href, type, links, description, tasksInProgress, id, name, networkConfiguration,
|
||||
return new OrgNetwork(href, type, links, description, tasks, id, name, networkConfiguration,
|
||||
networkPool, allowedExternalIpAddresses);
|
||||
}
|
||||
|
||||
|
@ -107,11 +105,11 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -138,7 +136,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
|
|||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -147,7 +145,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
|
|||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -167,9 +165,9 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
|
|||
// For JAXB
|
||||
}
|
||||
|
||||
private OrgNetwork(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
|
||||
private OrgNetwork(URI href, String type, Set<Link> links, String description, Set<Task> tasks,
|
||||
String id, String name, NetworkConfiguration networkConfiguration, ReferenceType<?> networkPool, IpAddresses allowedExternalIpAddresses) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
|
||||
super(href, type, links, description, tasks, id, name, networkConfiguration);
|
||||
this.networkPool = networkPool;
|
||||
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -30,7 +29,6 @@ import javax.xml.bind.annotation.XmlElement;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Base type that represents a resource entity such as a vApp template or virtual media.
|
||||
|
@ -74,11 +72,11 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder<T> tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -101,20 +99,18 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceEntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceEntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -134,8 +130,8 @@ public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extend
|
|||
@XmlAttribute
|
||||
protected Integer status;
|
||||
|
||||
public ResourceEntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, FilesList files, Integer status) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
public ResourceEntityType(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name, FilesList files, Integer status) {
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.files = files;
|
||||
this.status = status;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.util.Set;
|
|||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -55,7 +57,7 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
|
||||
protected URI href;
|
||||
protected String type;
|
||||
protected Set<Link> links = Sets.newLinkedHashSet();
|
||||
protected Set<Link> links;
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
|
@ -85,6 +87,8 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
public T link(Link link) {
|
||||
if (links == null)
|
||||
links = Sets.newLinkedHashSet();
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return self();
|
||||
}
|
||||
|
@ -102,7 +106,7 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
|
||||
protected URI href;
|
||||
protected String type;
|
||||
protected Set<Link> links = Sets.newLinkedHashSet();
|
||||
protected Set<Link> links;
|
||||
|
||||
/**
|
||||
* @see ResourceType#getHref()
|
||||
|
@ -132,6 +136,8 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
public Builder<T> link(Link link) {
|
||||
if (links == null)
|
||||
links = Sets.newLinkedHashSet();
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
@ -148,12 +154,13 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
@XmlAttribute
|
||||
private String type;
|
||||
@XmlElement(name = "Link")
|
||||
private Set<Link> links = Sets.newLinkedHashSet();
|
||||
private Set<Link> links;
|
||||
|
||||
protected ResourceType(URI href, String type, Set<Link> links) {
|
||||
protected ResourceType(URI href, String type, @Nullable Set<Link> links) {
|
||||
this.href = href;
|
||||
this.type = type;
|
||||
this.links = ImmutableSet.copyOf(links);
|
||||
// nullable so that jaxb wont persist empty collections
|
||||
this.links = links != null && links.size() == 0 ? null : links;
|
||||
}
|
||||
|
||||
protected ResourceType() {
|
||||
|
@ -193,7 +200,7 @@ public abstract class ResourceType<T extends ResourceType<T>> {
|
|||
* Set of optional links to an entity or operation associated with this object.
|
||||
*/
|
||||
public Set<Link> getLinks() {
|
||||
return Collections.unmodifiableSet(links);
|
||||
return links == null ? ImmutableSet.<Link>of() : Collections.unmodifiableSet(links);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
|
@ -35,7 +34,6 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents an asynchronous or long-running task in the vCloud environment.
|
||||
|
@ -44,6 +42,8 @@ import com.google.common.collect.Sets;
|
|||
* <xs:complexType name="TaskType">
|
||||
* </pre>
|
||||
*
|
||||
* TODO: this object and the hierarchy is wrong. it is literally a Task with a Task container. please review class diagram
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "Task")
|
||||
|
@ -188,7 +188,7 @@ public class Task extends EntityType<Task> {
|
|||
|
||||
@Override
|
||||
public Task build() {
|
||||
return new Task(href, type, links, description, tasksInProgress, id, name,
|
||||
return new Task(href, type, links, description, tasks, id, name,
|
||||
error, org, progress, owner, user, params, status, operation, operationName, startTime, endTime, expiryTime);
|
||||
}
|
||||
|
||||
|
@ -220,11 +220,11 @@ public class Task extends EntityType<Task> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -247,23 +247,22 @@ public class Task extends EntityType<Task> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
return Builder.class.cast(super.link(link));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<Task> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
|
@ -276,11 +275,11 @@ public class Task extends EntityType<Task> {
|
|||
}
|
||||
}
|
||||
|
||||
public Task(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
|
||||
public Task(URI href, String type, Set<Link> links, String description, Set<Task> tasks,
|
||||
String id, String name, Error error, Reference org, Integer progress, Reference owner,
|
||||
Reference user, Object params, String status, String operation, String operationName,
|
||||
Date startTime, Date endTime, Date expiryTime) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.error = error;
|
||||
this.org = org;
|
||||
this.progress = progress;
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIOXMLNS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "TasksInProgress")
|
||||
public class TasksInProgress {
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
protected Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see TasksInProgress#getTasks()
|
||||
*/
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
this.tasks = ImmutableSet.copyOf(checkNotNull(tasks, "tasks"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TasksInProgress#getTasks()
|
||||
*/
|
||||
public Builder task(Task task) {
|
||||
this.tasks.add(checkNotNull(task, "task"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TasksInProgress build() {
|
||||
return new TasksInProgress(tasks);
|
||||
}
|
||||
|
||||
public Builder fromTasksInProgress(TasksInProgress in) {
|
||||
return tasks(in.getTasks());
|
||||
}
|
||||
}
|
||||
|
||||
private TasksInProgress() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
private TasksInProgress(Collection<Task> tasks) {
|
||||
this.tasks = ImmutableSet.copyOf(tasks);
|
||||
}
|
||||
|
||||
@XmlElement(name = "Task")
|
||||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<Task> getTasks() {
|
||||
return Collections.unmodifiableSet(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
TasksInProgress that = TasksInProgress.class.cast(o);
|
||||
return equal(this.tasks, that.tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("").add("tasks", tasks).toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -22,13 +22,16 @@ import static com.google.common.base.Objects.equal;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
@ -36,33 +39,36 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* A list of tasks.
|
||||
* Task List
|
||||
*
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@XmlRootElement(name = "TasksList")
|
||||
public class TasksList extends EntityType<TasksList> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASKS_LIST;
|
||||
|
||||
public class TasksList extends ResourceType<TasksList> implements Set<Task> {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
public static class Builder extends ResourceType.Builder<TasksList> {
|
||||
protected String name;
|
||||
|
||||
private Set<Task> tasks;
|
||||
|
||||
/**
|
||||
* @see TasksList#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<TasksList> {
|
||||
|
||||
protected Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see TasksList#getTasks()
|
||||
*/
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
this.tasks = Sets.newLinkedHashSet(checkNotNull(tasks, "tasks"));
|
||||
if (checkNotNull(tasks, "tasks").size() > 0)
|
||||
this.tasks = Sets.newLinkedHashSet(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -70,111 +76,86 @@ public class TasksList extends EntityType<TasksList> {
|
|||
* @see TasksList#getTasks()
|
||||
*/
|
||||
public Builder task(Task task) {
|
||||
if (tasks == null)
|
||||
tasks = Sets.newLinkedHashSet();
|
||||
this.tasks.add(checkNotNull(task, "task"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TasksList build() {
|
||||
return new TasksList(href, type, links, description, tasksInProgress, id, name, tasks);
|
||||
return new TasksList(href, type, links, name, tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
* @see ResourceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder href(URI href) {
|
||||
this.href = href;
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
* @see ResourceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
return Builder.class.cast(super.links(links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
* @see ResourceType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<TasksList> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
public Builder fromTasksList(TasksList in) {
|
||||
return fromResourceType(in).tasks(in);
|
||||
}
|
||||
|
||||
public Builder fromTasksList(TasksList in) {
|
||||
return fromEntityType(in).tasks(in.getTasks());
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Builder fromResourceType(ResourceType<TasksList> in) {
|
||||
return Builder.class.cast(super.fromResourceType(in));
|
||||
}
|
||||
}
|
||||
|
||||
@XmlAttribute(required = true)
|
||||
private String name;
|
||||
@XmlElement(name = "Task")
|
||||
private Set<Task> tasks;
|
||||
|
||||
public TasksList(URI href, String type, @Nullable Set<Link> links, String name, @Nullable Set<Task> tasks) {
|
||||
super(href, type, links);
|
||||
this.tasks = tasks;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
protected TasksList() {
|
||||
// for JAXB
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
public TasksList(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Set<Task> tasks) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
this.tasks = ImmutableSet.copyOf(tasks);
|
||||
}
|
||||
|
||||
@XmlElement(name = "Task")
|
||||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<Task> getTasks() {
|
||||
return Collections.unmodifiableSet(tasks);
|
||||
/**
|
||||
* Contains the name of the the entity.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,16 +165,91 @@ public class TasksList extends EntityType<TasksList> {
|
|||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
TasksList that = TasksList.class.cast(o);
|
||||
return super.equals(that) && equal(this.tasks, that.tasks);
|
||||
return super.equals(that) && equal(this.delegate(), that.delegate()) && equal(this.name, that.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + Objects.hashCode(tasks);
|
||||
return super.hashCode() + Objects.hashCode(delegate(), name);
|
||||
}
|
||||
|
||||
private Set<Task> delegate() {
|
||||
return tasks == null ? ImmutableSet.<Task>of() : Collections.unmodifiableSet(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("tasks", tasks);
|
||||
return super.string().add("name", name).add("tasks", delegate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromTasksList(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Task> iterator() {
|
||||
return delegate().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return delegate().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> collection) {
|
||||
return delegate().removeAll(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return delegate().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object object) {
|
||||
return delegate().contains(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Task element) {
|
||||
return delegate().add(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object object) {
|
||||
return delegate().remove(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> collection) {
|
||||
return delegate().containsAll(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends Task> collection) {
|
||||
return delegate().addAll(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> collection) {
|
||||
return delegate().retainAll(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
delegate().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return delegate().toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] array) {
|
||||
return delegate().toArray(array);
|
||||
}
|
||||
|
||||
}
|
|
@ -270,7 +270,7 @@ public class User
|
|||
|
||||
|
||||
public User build() {
|
||||
return new User(href, type, links, description, tasksInProgress, id,
|
||||
return new User(href, type, links, description, tasks, id,
|
||||
name, fullName, emailAddress, telephone, isEnabled, isLocked,
|
||||
im, nameInSource, isAlertEnabled, alertEmailPrefix, alertEmail,
|
||||
isExternal, isDefaultCached, isGroupRole, storedVmQuota, deployedVmQuota,
|
||||
|
@ -288,11 +288,11 @@ public class User
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -398,12 +398,12 @@ public class User
|
|||
@XmlElement(name = "GroupReferences")
|
||||
protected Object /* GroupsList */ groupReferences;
|
||||
|
||||
public User(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
public User(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id,
|
||||
String name, String fullName, String emailAddress, String telephone, Boolean enabled, Boolean locked,
|
||||
String im, String nameInSource, Boolean alertEnabled, String alertEmailPrefix, String alertEmail,
|
||||
Boolean external, Boolean defaultCached, Boolean groupRole, Integer storedVmQuota, Integer deployedVmQuota,
|
||||
Reference role, String password, Object groupReferences) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.fullName = fullName;
|
||||
this.emailAddress = emailAddress;
|
||||
this.telephone = telephone;
|
||||
|
|
|
@ -145,7 +145,7 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
|
|||
|
||||
@Override
|
||||
public VAppTemplate build() {
|
||||
return new VAppTemplate(href, type, links, description, tasksInProgress, id, name, files, status, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
|
||||
return new VAppTemplate(href, type, links, description, tasks, id, name, files, status, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -210,11 +210,11 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress(tasksInProgress);
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -268,10 +268,10 @@ public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
|
|||
@XmlAttribute
|
||||
protected Boolean goldMaster;
|
||||
|
||||
private VAppTemplate(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
|
||||
private VAppTemplate(URI href, String type, Set<Link> links, String description, Set<Task> tasks,
|
||||
String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children,
|
||||
Set<? extends SectionType<?>> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, files, status);
|
||||
super(href, type, links, description, tasks, id, name, files, status);
|
||||
this.owner = owner;
|
||||
this.children = VAppTemplateChildren.builder().vms(children).build();
|
||||
this.sections = ImmutableSet.copyOf(sections);
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -32,7 +31,6 @@ import javax.xml.bind.annotation.XmlSeeAlso;
|
|||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -199,7 +197,7 @@ public class Vdc
|
|||
|
||||
public Vdc build() {
|
||||
return new Vdc(
|
||||
href, type, links, description, tasksInProgress, id, name, allocationModel, storageCapacity,
|
||||
href, type, links, description, tasks, id, name, allocationModel, storageCapacity,
|
||||
computeCapacity, resourceEntities, availableNetworks, capabilities, nicQuota, networkQuota,
|
||||
vmQuota, isEnabled, status);
|
||||
}
|
||||
|
@ -230,11 +228,11 @@ public class Vdc
|
|||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
@Override
|
||||
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
this.tasksInProgress = tasksInProgress;
|
||||
public Builder tasks(Set<Task> tasks) {
|
||||
super.tasks(tasks);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -261,7 +259,7 @@ public class Vdc
|
|||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -270,11 +268,10 @@ public class Vdc
|
|||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<Vdc> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
|
@ -296,8 +293,8 @@ public class Vdc
|
|||
}
|
||||
}
|
||||
|
||||
public Vdc(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String allocationModel, CapacityWithUsage storageCapacity, ComputeCapacity computeCapacity, ResourceEntities resourceEntities, AvailableNetworks availableNetworks, Capabilities capabilities, int nicQuota, int networkQuota, Integer vmQuota, Boolean enabled, Integer status) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
public Vdc(URI href, String type, Set<Link> links, String description, Set<Task> tasks, String id, String name, String allocationModel, CapacityWithUsage storageCapacity, ComputeCapacity computeCapacity, ResourceEntities resourceEntities, AvailableNetworks availableNetworks, Capabilities capabilities, int nicQuota, int networkQuota, Integer vmQuota, Boolean enabled, Integer status) {
|
||||
super(href, type, links, description, tasks, id, name);
|
||||
this.allocationModel = allocationModel;
|
||||
this.storageCapacity = storageCapacity;
|
||||
this.computeCapacity = computeCapacity;
|
||||
|
|
|
@ -23,3 +23,4 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CI
|
|||
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
|
|
|
@ -30,3 +30,4 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
|
|||
import javax.xml.bind.annotation.XmlNs;
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
|
|
|
@ -30,3 +30,4 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
|
|||
import javax.xml.bind.annotation.XmlNs;
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
|
|
|
@ -29,3 +29,4 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CI
|
|||
import javax.xml.bind.annotation.XmlNs;
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
|
|
|
@ -31,3 +31,4 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
|
|||
import javax.xml.bind.annotation.XmlNs;
|
||||
import javax.xml.bind.annotation.XmlNsForm;
|
||||
import javax.xml.bind.annotation.XmlSchema;
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@ public class Checks {
|
|||
|
||||
// Check optional fields
|
||||
// NOTE description cannot be checked
|
||||
TasksInProgress tasksInProgress = entity.getTasksInProgress();
|
||||
if (tasksInProgress != null && tasksInProgress.getTasks() != null && !tasksInProgress.getTasks().isEmpty()) {
|
||||
for (Task task : tasksInProgress.getTasks()) checkTask(task);
|
||||
Set<Task> tasks = entity.getTasks();
|
||||
if (tasks != null && tasks != null && !tasks.isEmpty()) {
|
||||
for (Task task : tasks) checkTask(task);
|
||||
}
|
||||
|
||||
// Check parent type
|
||||
|
|
|
@ -38,10 +38,11 @@ import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksInProgress;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Allows us to test a client via its side effects.
|
||||
*
|
||||
|
@ -415,8 +416,8 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.href(URI.create("https://mycloud.greenhousedata.com/api/media/a6b023f2-7f90-4e89-a24d-56e0eba83a5a"))
|
||||
.build())
|
||||
.description("copied by testCloneMedia()")
|
||||
.tasksInProgress(TasksInProgress.builder()
|
||||
.task(Task.builder()
|
||||
.tasks(ImmutableSet.<Task>builder()
|
||||
.add(Task.builder()
|
||||
.status("running")
|
||||
.startTime(dateService.iso8601DateParse("2012-03-02T04:58:48.754-07:00"))
|
||||
.operationName("vdcCopyMedia")
|
||||
|
|
|
@ -143,7 +143,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
|
||||
Task task = Iterables.getOnlyElement(media.getTasksInProgress().getTasks());
|
||||
Task task = Iterables.getOnlyElement(media.getTasks());
|
||||
|
||||
assertEquals(task.getStatus(), "running");
|
||||
|
||||
|
@ -192,8 +192,8 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
Checks.checkMediaFor(VDC, media);
|
||||
|
||||
if (media.getTasksInProgress() != null) {
|
||||
Task copyTask = getFirst(media.getTasksInProgress().getTasks(), null);
|
||||
if (media.getTasks() != null) {
|
||||
Task copyTask = getFirst(media.getTasks(), null);
|
||||
if (copyTask != null) {
|
||||
Checks.checkTask(copyTask);
|
||||
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
|
||||
|
@ -216,8 +216,8 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
Checks.checkMediaFor(VDC, media);
|
||||
|
||||
if (media.getTasksInProgress() != null) {
|
||||
Task copyTask = getFirst(media.getTasksInProgress().getTasks(), null);
|
||||
if (media.getTasks() != null) {
|
||||
Task copyTask = getFirst(media.getTasks(), null);
|
||||
if (copyTask != null) {
|
||||
Checks.checkTask(copyTask);
|
||||
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
|
||||
|
|
|
@ -81,11 +81,11 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.name("Tasks Lists")
|
||||
.type("application/vnd.vmware.vcloud.tasksList+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.task(taskOne())
|
||||
.task(taskTwo())
|
||||
.task(taskOne())
|
||||
.build();
|
||||
|
||||
assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")), expected);
|
||||
assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")).toString(), expected.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -198,6 +198,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
|
||||
|
||||
//TODO: incorrect relationship, as task should not have a nested task container!!
|
||||
Task expected = taskOne();
|
||||
|
||||
assertEquals(client.getTaskClient().getTask(taskUri), expected);
|
||||
|
|
|
@ -80,9 +80,9 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), String.format(NOT_EMPTY_OBJECT_FMT, "Task", "TaskList"));
|
||||
assertFalse(Iterables.isEmpty(taskList), String.format(NOT_EMPTY_OBJECT_FMT, "Task", "TaskList"));
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
for (Task task : taskList) {
|
||||
checkTask(task);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
public void testGetTask() {
|
||||
//TODO: upload media or something so you can get a fresh cancellable task?
|
||||
|
||||
Task taskRef = Iterables.getFirst(taskList.getTasks(), null);
|
||||
Task taskRef = Iterables.getFirst(taskList, null);
|
||||
taskURI = taskRef.getHref();
|
||||
|
||||
// Call the method being tested
|
||||
|
|
Loading…
Reference in New Issue