mirror of https://github.com/apache/jclouds.git
add common request/response methods
This commit is contained in:
parent
c35794e8c7
commit
90153df2d1
|
@ -49,12 +49,12 @@ public class OrgList {
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private Set<Link> orgs = Sets.newLinkedHashSet();
|
private Set<Reference> orgs = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see OrgList#getOrgs
|
* @see OrgList#getOrgs
|
||||||
*/
|
*/
|
||||||
public Builder orgs(Set<Link> orgs) {
|
public Builder orgs(Set<Reference> orgs) {
|
||||||
this.orgs = Sets.newLinkedHashSet(checkNotNull(orgs, "orgs"));
|
this.orgs = Sets.newLinkedHashSet(checkNotNull(orgs, "orgs"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class OrgList {
|
||||||
/**
|
/**
|
||||||
* @see OrgList#getOrgs
|
* @see OrgList#getOrgs
|
||||||
*/
|
*/
|
||||||
public Builder addOrg(Link org) {
|
public Builder org(Reference org) {
|
||||||
orgs.add(checkNotNull(org, "org"));
|
orgs.add(checkNotNull(org, "org"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -80,14 +80,14 @@ public class OrgList {
|
||||||
// For JAXB and builder use
|
// For JAXB and builder use
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrgList(Set<Link> orgs) {
|
private OrgList(Set<Reference> orgs) {
|
||||||
this.orgs = ImmutableSet.copyOf(orgs);
|
this.orgs = ImmutableSet.copyOf(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(namespace = NS, name = "Org")
|
@XmlElement(namespace = NS, name = "Org")
|
||||||
private Set<Link> orgs = Sets.newLinkedHashSet();
|
private Set<Reference> orgs = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
public Set<Link> getOrgs() {
|
public Set<Reference> getOrgs() {
|
||||||
return ImmutableSet.copyOf(orgs);
|
return ImmutableSet.copyOf(orgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,4 +57,18 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
||||||
credential = password;
|
credential = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected HttpRequest getStandardRequest(String method, URI uri) {
|
||||||
|
return HttpRequest.builder().method(method).endpoint(uri).headers(
|
||||||
|
ImmutableMultimap.<String, String> builder()
|
||||||
|
.put("Accept", "*/*")
|
||||||
|
.put("x-vcloud-authorization",token)
|
||||||
|
.build()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HttpResponse getStandardPaylodResponse(String relativeFilePath) {
|
||||||
|
return HttpResponse.builder().statusCode(200)
|
||||||
|
.payload(payloadFromResourceWithContentType(relativeFilePath, VCloudDirectorMediaType.ORGLIST_XML
|
||||||
|
+ ";version=1.5")).build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue