Merge pull request #404 from aplowe/master

Issue 830: vCloud Director fixing vAppTemplate tests
This commit is contained in:
Adrian Cole 2012-03-06 13:22:07 -08:00
commit b8d2ead8ee
1 changed files with 7 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import java.net.URI;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.*; import org.jclouds.vcloud.director.v1_5.domain.*;
@ -42,6 +43,10 @@ import com.google.common.collect.ImmutableSet;
@Test(groups = {"unit", "user"}, testName = "VAppTemplateClientExpectTest") @Test(groups = {"unit", "user"}, testName = "VAppTemplateClientExpectTest")
public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
public VAppTemplateClientExpectTest() {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
}
public void testVAppTemplate() { public void testVAppTemplate() {
final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"; final String templateId = "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
@ -186,7 +191,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse, VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vappTemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build() new VcloudHttpResponsePrimer().xmlFilePayload("/task/task.xml", TASK).httpResponseBuilder().build()
).getVAppTemplateClient(); ).getVAppTemplateClient();
@ -205,7 +210,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
URI uri = URI.create(endpoint + templateId); URI uri = URI.create(endpoint + templateId);
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vappTemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(), new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/relocate").xmlFilePayload("/vapptemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient(); new VcloudHttpResponsePrimer().xmlFilePayload("/vapptemplate/error400.xml", ERROR).httpResponseBuilder().statusCode(400).build()).getVAppTemplateClient();
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build(); Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();