add common request/response methods

This commit is contained in:
danikov 2012-02-07 10:27:22 +00:00
parent c35794e8c7
commit 90153df2d1
2 changed files with 20 additions and 6 deletions

View File

@ -49,12 +49,12 @@ public class OrgList {
public static class Builder {
private Set<Link> orgs = Sets.newLinkedHashSet();
private Set<Reference> orgs = Sets.newLinkedHashSet();
/**
* @see OrgList#getOrgs
*/
public Builder orgs(Set<Link> orgs) {
public Builder orgs(Set<Reference> orgs) {
this.orgs = Sets.newLinkedHashSet(checkNotNull(orgs, "orgs"));
return this;
}
@ -62,7 +62,7 @@ public class OrgList {
/**
* @see OrgList#getOrgs
*/
public Builder addOrg(Link org) {
public Builder org(Reference org) {
orgs.add(checkNotNull(org, "org"));
return this;
}
@ -80,14 +80,14 @@ public class OrgList {
// For JAXB and builder use
}
private OrgList(Set<Link> orgs) {
private OrgList(Set<Reference> orgs) {
this.orgs = ImmutableSet.copyOf(orgs);
}
@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);
}

View File

@ -57,4 +57,18 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
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();
}
}