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 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.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.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; 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.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.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; 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 org.testng.annotations.Test;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -57,14 +67,14 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private Reference vdcRef; private Reference vdcRef;
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" }) @BeforeClass(inheritGroups = true)
public void before() { @Override
String vdcId = ""; // TODO: inject public void setupRequiredClients() {
vdcRef = Reference.builder() vdcRef = Reference.builder()
.type("application/vnd.vmware.vcloud.vdc+xml") .type("application/vnd.vmware.vcloud.vdc+xml")
.name("") .name("")
.href(URI.create(endpoint+"/vdc/"+vdcId)) .href(URI.create(endpoint+"/vdc/"+vDCId))
.id(vdcId) .id(vDCId)
.build(); .build();
vdcClient = context.getApi().getVdcClient(); vdcClient = context.getApi().getVdcClient();
} }
@ -116,14 +126,157 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
} }
} }
// POST /vdc/{id}/action/captureVApp @Test(testName = "POST /vdc/{id}/action/captureVApp", enabled = false)
// POST /vdc/{id}/action/cloneMedia public void testCaptureVApp() {
// POST /vdc/{id}/action/cloneVApp Reference templateSource = null; // TODO: vApp reference
// POST /vdc/{id}/action/cloneVAppTemplate VAppTemplate template = vdcClient.captureVApp(vdcRef, CaptureVAppParams.builder()
// POST /vdc/{id}/action/composeVApp .source(templateSource)
// POST /vdc/{id}/action/instantiateVAppTemplate // TODO: test optional params
// POST /vdc/{id}/action/uploadVAppTemplate //.name("")
// POST /vdc/{id}/media //.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") @Test(testName = "GET /network/{id}/metadata")
public void testGetMetadata() { public void testGetMetadata() {
@ -141,5 +294,4 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
Checks.checkMetadataValueFor(VDC, metadataValue); Checks.checkMetadataValueFor(VDC, metadataValue);
} }
} }