Issue #830 vcloud-director: fix failing tests

This commit is contained in:
Aled Sage 2012-03-15 11:32:34 +00:00
parent a862b53fe5
commit a89905bd98
5 changed files with 51 additions and 17 deletions

View File

@ -73,13 +73,11 @@ import com.google.common.collect.ImmutableList;
"fromEmailAddress",
"defaultSubjectPrefix",
"isAlertEmailToAllAdmins",
"alertEmailsTo",
"alertEmailTo",
"smtpServerSettings"
})
public class OrgEmailSettings extends ResourceType {
// FIXME Should it be getAlertEmailsTo or getAlertEmailTo
public static Builder<?> builder() {
return new ConcreteBuilder();
}
@ -144,8 +142,8 @@ public class OrgEmailSettings extends ResourceType {
/**
* @see OrgEmailSettings#getAlertEmailTo()
*/
public B alertEmailsTo(List<String> alertEmailsTo) {
this.alertEmailTo = alertEmailsTo == null ? null : ImmutableList.copyOf(alertEmailsTo);
public B alertEmailTo(List<String> alertEmailTo) {
this.alertEmailTo = alertEmailTo == null ? null : ImmutableList.copyOf(alertEmailTo);
return self();
}
@ -176,7 +174,7 @@ public class OrgEmailSettings extends ResourceType {
.fromEmailAddress(in.getFromEmailAddress())
.defaultSubjectPrefix(in.getDefaultSubjectPrefix())
.isAlertEmailToAllAdmins(in.isAlertEmailToAllAdmins())
.alertEmailsTo(in.getAlertEmailsTo())
.alertEmailTo(in.getAlertEmailTo())
.smtpServerSettings(in.getSmtpServerSettings());
}
}
@ -281,7 +279,7 @@ public class OrgEmailSettings extends ResourceType {
*
*
*/
public List<String> getAlertEmailsTo() {
public List<String> getAlertEmailTo() {
return this.alertEmailTo;
}
@ -334,7 +332,7 @@ public class OrgEmailSettings extends ResourceType {
.add("fromEmailAddress", fromEmailAddress)
.add("defaultSubjectPrefix", defaultSubjectPrefix)
.add("isAlertEmailToAllAdmins", isAlertEmailToAllAdmins)
.add("alertEmailsTo", alertEmailTo)
.add("alertEmailTo", alertEmailTo)
.add("smtpServerSettings", smtpServerSettings);
}

View File

@ -23,9 +23,8 @@ import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.jclouds.logging.Logger;
@ -43,7 +42,10 @@ import com.google.common.base.Objects.ToStringHelper;
*
* @author grkvlt@apache.org
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({
CatalogReference.class
})
//@XmlAccessorType(XmlAccessType.FIELD)
public class Reference {
@javax.annotation.Resource

View File

@ -132,7 +132,18 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.xmlFilePayload("/catalog/admin/owner.xml", VCloudDirectorMediaType.OWNER)
.httpResponseBuilder().build());
Owner expected = owner();
Owner expected = owner().toBuilder()
.link(Link.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.type("application/vnd.vmware.vcloud.catalog+xml")
.rel("up")
.build())
.link(Link.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
.type("application/vnd.vmware.vcloud.owner+xml")
.rel("edit")
.build())
.build();
assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getHref()), expected);
}
@ -345,7 +356,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.isPublished(false)
.build();
}
private static Owner owner() {
return Owner.builder()
.type("application/vnd.vmware.vcloud.owner+xml")

View File

@ -358,7 +358,13 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
.xmlFilePayload("/media/owner.xml", VCloudDirectorMediaType.OWNER)
.httpResponseBuilder().build());
Owner expected = owner();
Owner expected = owner().toBuilder()
.link(Link.builder()
.rel("up")
.type("application/vnd.vmware.vcloud.media+xml")
.href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"))
.build())
.build();
assertEquals(client.getMediaClient().getOwner(mediaUri), expected);
}

View File

@ -67,7 +67,7 @@ import com.google.common.collect.Multimaps;
@Test(groups = { "unit", "user", "vapp" }, singleThreaded = true, testName = "VAppClientExpectTest")
public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
private String vAppId = "";
private String vAppId = "vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be";
private URI vAppURI = URI.create(endpoint + vAppId);
@BeforeClass
@ -79,7 +79,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId)
.acceptAnyMedia()
.acceptMedia(VCloudDirectorMediaType.VAPP)
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/vApp/vApp.xml", VCloudDirectorMediaType.VAPP)
@ -1084,9 +1084,26 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
}
public static VApp getVApp() {
// FIXME Does not match XML
VApp vApp = VApp.builder()
.href(URI.create("https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"))
// .link(Link.builder()
// .href(URI.create())
// .build())
.build();
// <Link rel="power:powerOn" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/power/action/powerOn"/>
// <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/action/deploy"/>
// <Link rel="down" type="application/vnd.vmware.vcloud.vAppNetwork+xml" name="orgNet-cloudsoft-External" href="https://mycloud.greenhousedata.com/api/network/2a2e2da4-446a-4ebc-a086-06df7c9570f0"/>
// <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/controlAccess/"/>
// <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/action/controlAccess"/>
// <Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/action/recomposeVApp"/>
// <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"/>
// <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"/>
// <Link rel="remove" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"/>
// <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/owner"/>
// <Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://mycloud.greenhousedata.com/api/vApp/vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be/metadata"/>
return vApp;
}
@ -1496,4 +1513,4 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
return task;
}
}
}