flesh out/first pass live tests

This commit is contained in:
danikov 2012-02-23 11:04:01 +00:00
parent 54b3c01377
commit 7d5dbbef59
1 changed files with 170 additions and 18 deletions

View File

@ -29,13 +29,23 @@ import static org.testng.Assert.assertTrue;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
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;
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.Media;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
@ -49,26 +59,26 @@ import com.google.common.collect.Iterables;
public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String VDC = "vdc";
/*
* Convenience reference to API client.
*/
protected VdcClient vdcClient;
private Reference vdcRef;
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" })
public void before() {
String vdcId = ""; // TODO: inject
@BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() {
vdcRef = Reference.builder()
.type("application/vnd.vmware.vcloud.vdc+xml")
.name("")
.href(URI.create(endpoint+"/vdc/"+vdcId))
.id(vdcId)
.href(URI.create(endpoint+"/vdc/"+vDCId))
.id(vDCId)
.build();
vdcClient = context.getApi().getVdcClient();
}
@Test(testName = "GET /vdc/{id}")
public void testGetVdc() {
// required for testing
@ -116,14 +126,157 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
}
// POST /vdc/{id}/action/captureVApp
// POST /vdc/{id}/action/cloneMedia
// POST /vdc/{id}/action/cloneVApp
// POST /vdc/{id}/action/cloneVAppTemplate
// POST /vdc/{id}/action/composeVApp
// POST /vdc/{id}/action/instantiateVAppTemplate
// POST /vdc/{id}/action/uploadVAppTemplate
// POST /vdc/{id}/media
@Test(testName = "POST /vdc/{id}/action/captureVApp", enabled = false)
public void testCaptureVApp() {
Reference templateSource = null; // TODO: vApp reference
VAppTemplate template = vdcClient.captureVApp(vdcRef, CaptureVAppParams.builder()
.source(templateSource)
// TODO: test optional params
//.name("")
//.description("")
//.sections(sections) // TODO: ovf sections
.build());
Checks.checkVAppTemplate(template);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/cloneMedia")
public void testCloneMedia() {
Reference mediaSource = null; // TODO: media reference
Media media = vdcClient.cloneMedia(vdcRef, CloneMediaParams.builder()
.source(mediaSource)
// TODO: test optional params
//.name("")
//.description("")
//.isSourceDelete(true)
.build());
Checks.checkMediaFor(VDC, media);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/cloneVApp", enabled = false)
public void testCloneVApp() {
Reference vAppSource = null; // TODO: vApp reference
VApp vApp = vdcClient.cloneVApp(vdcRef, CloneVAppParams.builder()
.source(vAppSource)
// TODO: test optional params
//.name("")
//.description("")
//.deploy(true)
//.isSourceDelete(true)
//.powerOn(true)
//.instantiationParams(InstantiationParams.builder()
// .sections(sections) // TODO: ovf sections? various tests?
// .build())
// Reserved. Unimplemented params; may test eventually when implemented
//.vAppParent(vAppParentRef)
//.linkedClone(true)
.build());
Checks.checkVApp(vApp);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/cloneVAppTemplate", enabled = false)
public void testCloneVAppTemplate() {
Reference templateSource = null; // TODO: vAppTemplate reference
VAppTemplate template = vdcClient.cloneVAppTemplate(vdcRef, CloneVAppTemplateParams.builder()
.source(templateSource)
// TODO: test optional params
//.name("")
//.description("")
//.isSourceDelete(true)
//.sections(sections) // TODO: ovf sections
.build());
Checks.checkVAppTemplate(template);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/composeVApp", enabled = false)
public void testComposeVApp() {
VApp vApp = vdcClient.composeVApp(vdcRef, ComposeVAppParams.builder()
// TODO: test optional params
//.name("")
//.description("")
//.deploy(true)
//.isSourceDelete(true)
//.powerOn(true)
//.instantiationParams(InstantiationParams.builder()
// .sections(sections) // TODO: ovf sections? various tests?
// .build())
// Reserved. Unimplemented params; may test eventually when implemented
//.linkedClone()
.build());
Checks.checkVApp(vApp);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/instantiateVAppTemplate", enabled = false)
public void testInstantiateVAppTemplate() {
Reference templateSource = null; // TODO: vApp or vAppTemplate reference
VApp vApp = vdcClient.instantiateVApp(vdcRef, InstantiateVAppParams.builder()
.source(templateSource)
// TODO: test optional params
//.name("")
//.description("")
//.isSourceDelete(true)
.build());
Checks.checkVApp(vApp);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/action/uploadVAppTemplate", enabled = false)
public void testUploadVAppTemplate() {
VAppTemplate template = vdcClient.uploadVAppTemplate(vdcRef, UploadVAppTemplateParams.builder()
// TODO: test optional params
//.name("")
//.description("")
//.transferFormat("")
//.manifestRequired(true)
.build());
Checks.checkVAppTemplate(template);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "POST /vdc/{id}/media")
public void testCreateMedia() {
Media media = vdcClient.createMedia(vdcRef, Media.builder()
.name("")
.imageType(Media.ImageType.ISO)
.size(0)
// TODO: test optional params
//.name("")
//.description("")
//.isSourceDelete(true)
.build());
Checks.checkMediaFor(VDC, media);
// TODO: await task to complete
// TODO: make assertions that the task was successful
}
@Test(testName = "GET /network/{id}/metadata")
public void testGetMetadata() {
@ -141,5 +294,4 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
Checks.checkMetadataValueFor(VDC, metadataValue);
}
}