tidy test, add missing test, remove leftovers

This commit is contained in:
danikov 2012-03-02 14:13:03 +00:00
parent fe31db7eea
commit 2433ec1d3f
1 changed files with 35 additions and 11 deletions

View File

@ -30,7 +30,6 @@ import org.jclouds.vcloud.director.v1_5.domain.AvailableNetworks;
import org.jclouds.vcloud.director.v1_5.domain.Capabilities;
import org.jclouds.vcloud.director.v1_5.domain.CapacityWithUsage;
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
@ -57,14 +56,14 @@ import org.testng.annotations.Test;
*
* @author danikov
*/
@Test(groups = { "unit", "apitests", "user" }, singleThreaded = true, testName = "VdcClientExpectTest")
@Test(groups = { "unit", "user", "vdc" }, singleThreaded = true, testName = "VdcClientExpectTest")
public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
private Reference vdcRef;
@BeforeClass
public void before() {
String vdcId = "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f";
String vdcId = "e9cd3387-ac57-4d27-a481-9bee75e0690f";
vdcRef = Reference.builder()
.type("application/vnd.vmware.vcloud.vdc+xml")
.name("")
@ -73,7 +72,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.build();
}
@Test(enabled = false)
@Test
public void testGetVdc() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
@ -89,8 +88,10 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
assertEquals(client.getVdcClient().getVdc(vdcRef), expected);
}
@Test(enabled = false)
@Test
public void testResponse400ForInvalidVdcId() {
URI vdcUri = URI.create(endpoint + "/vdc/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/NOTAUUID")
@ -106,6 +107,8 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.minorErrorCode("BAD_REQUEST")
.build();
Reference vdcRef = Reference.builder().href(vdcUri).build();
try {
client.getVdcClient().getVdc(vdcRef);
fail("Should give HTTP 400 error");
@ -116,8 +119,10 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
}
}
@Test(enabled = false)
@Test
public void testResponse403ForFakeVdcId() {
URI vdcUri = URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
@ -133,6 +138,8 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
.build();
Reference vdcRef = Reference.builder().href(vdcUri).build();
try {
client.getVdcClient().getVdc(vdcRef);
fail("Should give HTTP 403 error");
@ -193,6 +200,28 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
}
}
@Test(enabled = false)
public void testCloneVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")
.xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_V_APP_PARAMS)
.acceptAnyMedia()
.httpRequestBuilder().build(),
new VcloudHttpResponsePrimer()
.xmlFilePayload("/vdc/cloneVApp.xml", VCloudDirectorMediaType.V_APP)
.httpResponseBuilder().build());
VApp expected = cloneVApp();
// TODO: configure params
CloneVAppParams params = CloneVAppParams.builder()
.build();
assertEquals(client.getVdcClient().cloneVApp(vdcRef, params), expected);
}
@Test(enabled = false)
public void testCloneVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
@ -478,11 +507,6 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
return null;
}
private Media cloneMedia() {
// TODO Auto-generated method stub
return null;
}
private VApp cloneVApp() {
// TODO Auto-generated method stub
return null;