Merge branch 'master' of github.com:kedardave/jclouds

This commit is contained in:
Kedar Dave 2011-06-03 00:47:05 -05:00
commit 31df3c48b0
3 changed files with 48 additions and 29 deletions

View File

@ -0,0 +1 @@
org.jclouds.savvis.vpdc.SavvisSymphonyVPDCProviderMetadata

View File

@ -0,0 +1,36 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.savvis.vpdc;
import org.jclouds.providers.BaseProviderMetadataTest;
import org.jclouds.providers.ProviderMetadata;
import org.testng.annotations.Test;
/**
* The SavvisSymphonyVPDCProviderTest tests the org.jclouds.savvis.vpdc.SavvisSymphonyVPDCProviderMetadata class.
*
* @author Kedar Dave
*/
@Test(groups = "unit", testName = "SavvisSymphonyVPDCProviderTest")
public class SavvisSymphonyVPDCProviderTest extends BaseProviderMetadataTest {
public SavvisSymphonyVPDCProviderTest() {
super(new SavvisSymphonyVPDCProviderMetadata(), ProviderMetadata.COMPUTE_TYPE);
}
}

View File

@ -21,11 +21,9 @@ package org.jclouds.savvis.vpdc.features;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.cim.OSType; import org.jclouds.cim.OSType;
import org.jclouds.compute.domain.CIMOperatingSystem; import org.jclouds.compute.domain.CIMOperatingSystem;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
@ -131,7 +129,7 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
// conditionallyCheckSSH(); // conditionallyCheckSSH();
} }
@Test @Test(dependsOnMethods="testCloneVApp")
public void testZCreateMultipleVMs() throws Exception { public void testZCreateMultipleVMs() throws Exception {
billingSiteId = restContext.getApi().getBrowsingClient().getOrg(null).getId();// default billingSiteId = restContext.getApi().getBrowsingClient().getOrg(null).getId();// default
vpdcId = Iterables.find(restContext.getApi().getBrowsingClient().getOrg(billingSiteId).getVDCs(), vpdcId = Iterables.find(restContext.getApi().getBrowsingClient().getOrg(billingSiteId).getVDCs(),
@ -194,8 +192,8 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
// fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished // fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished
task = restContext.getApi().getBrowsingClient().getTask(task.getId()); task = restContext.getApi().getBrowsingClient().getTask(task.getId());
vm = restContext.getApi().getBrowsingClient().getVM(task.getOwner().getHref(), GetVMOptions.NONE); VM newVM = restContext.getApi().getBrowsingClient().getVM(task.getOwner().getHref(), GetVMOptions.NONE);
assert vm.getHref() != null : vm; assert newVM.getHref() != null : newVM;
} }
} }
@ -242,7 +240,7 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
} }
} }
@Test(dependsOnMethods="testPowerOnVM") @Test(dependsOnMethods="testCreateVirtualMachine")
public void testCloneVApp() throws Exception { public void testCloneVApp() throws Exception {
billingSiteId = restContext.getApi().getBrowsingClient().getOrg(null).getId();// default billingSiteId = restContext.getApi().getBrowsingClient().getOrg(null).getId();// default
vpdcId = Iterables.find(restContext.getApi().getBrowsingClient().getOrg(billingSiteId).getVDCs(), vpdcId = Iterables.find(restContext.getApi().getBrowsingClient().getOrg(billingSiteId).getVDCs(),
@ -264,7 +262,11 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
restContext.getApi().getBrowsingClient().getVDCInOrg(billingSiteId, vpdcId).getAvailableNetworks(), 0) restContext.getApi().getBrowsingClient().getVDCInOrg(billingSiteId, vpdcId).getAvailableNetworks(), 0)
.getId(); .getId();
Task task = client.cloneVApp(vm.getHref(), "clonedvm", networkTierName); String clonedVMName = vm.getName() + "clone";
System.out.printf("Cloning vm - name %s in vpdcId %s in network %s, newVM name is %s%n", vm.getName(), vpdcId, networkTierName, clonedVMName);
Task task = client.cloneVApp(vm.getHref(), clonedVMName, networkTierName);
// make sure there's no error // make sure there's no error
assert task.getId() != null && task.getError() == null : task; assert task.getId() != null && task.getError() == null : task;
@ -273,8 +275,8 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
// fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished // fetch the task again, in savvis, task.getOwner is populated with vApp after task has finished
task = restContext.getApi().getBrowsingClient().getTask(task.getId()); task = restContext.getApi().getBrowsingClient().getTask(task.getId());
vm = restContext.getApi().getBrowsingClient().getVM(task.getOwner().getHref(), GetVMOptions.NONE); VM clonedVM = restContext.getApi().getBrowsingClient().getVM(task.getOwner().getHref(), GetVMOptions.NONE);
assert vm.getHref() != null : vm; assert clonedVM.getHref() != null : clonedVM;
} }
private void conditionallyCheckSSH() { private void conditionallyCheckSSH() {
@ -304,26 +306,6 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
} }
} }
@Test(dependsOnMethods="testCreateVirtualMachine")
public void testPowerOffVM() throws Exception {
Task task = client.powerOffVM(vm.getHref());
// make sure there's no error
assert task.getId() != null && task.getError() == null : task;
assert this.taskTester.apply(task.getId());
}
@Test(dependsOnMethods="testPowerOffVM")
public void testPowerOnVM() throws Exception {
Task task = client.powerOnVM(vm.getHref());
// make sure there's no error
assert task.getId() != null && task.getError() == null : task;
assert this.taskTester.apply(task.getId());
}
@AfterGroups(groups = "live") @AfterGroups(groups = "live")
protected void tearDown() { protected void tearDown() {
if (vm != null) { if (vm != null) {