cleanup tests, added ProviderMetadata implementation for savis-symphonyvpdc

This commit is contained in:
Kedar Dave 2011-06-02 17:47:45 -05:00
parent eef22241f4
commit a069981e74
3 changed files with 158 additions and 9 deletions

View File

@ -0,0 +1,141 @@
/**
*
* 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 com.google.common.collect.ImmutableSet;
import java.net.URI;
import java.util.Set;
import org.jclouds.providers.BaseProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Savvis Symphony VPDC services.
*
* @author Kedar Dave
*/
public class SavvisSymphonyVPDCProviderMetadata extends BaseProviderMetadata {
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "savvis-symphonyvpdc";
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return ProviderMetadata.COMPUTE_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Savvis Symphony VPDC";
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentityName() {
return "username";
}
/**
* {@inheritDoc}
*/
@Override
public String getCredentialName() {
return "password";
}
/**
* {@inheritDoc}
*/
@Override
public URI getHomepage() {
return URI.create("http://www.savvis.com/en-US/infrastructure-services/Cloud/Pages/SavvisSymphonyVPDC.aspx");
}
/**
* {@inheritDoc}
*/
@Override
public URI getConsole() {
return URI.create("https://www.savvisstation.com");
}
/**
* {@inheritDoc}
*/
@Override
public URI getApiDocumentation() {
return URI.create("https://api.symphonyvpdc.savvis.net/doc/spec/api/index.html");
}
/**
* {@inheritDoc}
* list of data centers from savvisstation colocation guide
* https://www.savvisstation.com/DocumentViewer?GUID=a95f0387-cbfe-43eb-b25b-4f2b0f68498f&sessionid=SavvisCCC%3ac9a8984b9655b01916be587e5204b2cf
* Once we have confirmation from Savvis as to what data centers are used for vpdc deployments,
* iso codes for those will be entered here
*
* City Code
* Lithia Springs, GA AT1
* Waltham, MA BO1
* Waltham, MA BO2
* Waltham, MA B03
* Elk Grove Village, IL CH3
* Chicago, IL CH4
* Sterling, VA DC2
* Sterling, VA DC3
* Sterling, VA DC4 Phase I
* Sterling, VA DC4 Phase II
* Fort Worth, TX DL1
* Fort Worth, TX DL2
* El Segundo, CA LA1
* Jersey City, NJ NJ1
* Weehawken, NJ NJ2
* Piscataway, NJ NJ3
* Piscataway, NJ 2nd floor NJ3
* Weehawken, NJ NJ2X
* Irvine, CA OC2
* Santa Clara, CA SC4
* Santa Clara, CA SC5
* Santa Clara, CA SC8
* Santa Clara, CA SC9
* Tukwila, WA 1st floor SE2
* Montreal, Canada MR1
* Toronto, Canada TR1
* Vancouver, Canada VC1
*/
@Override
public Set<String> getIso3166Codes() {
return ImmutableSet.of("");
}
}

View File

@ -115,11 +115,13 @@ public class BrowsingClientLiveTest extends BaseVPDCClientLiveTest {
}
}
// test for a single vm, as savvis response times are very slow. So if there are multiple vpdc's with numerous vm's,
// test execution will invariably take a long time
@Test
public void testVM() throws Exception {
for (Resource org1 : restContext.getApi().listOrgs()) {
Org org = client.getOrg(org1.getId());
for (Resource vdc : org.getVDCs()) {
VDC_LOOP : for (Resource vdc : org.getVDCs()) {
VDC VDC = client.getVDCInOrg(org.getId(), vdc.getId());
for (Resource vApp : Iterables.filter(VDC.getResourceEntities(), new Predicate<Resource>() {
@ -158,8 +160,8 @@ public class BrowsingClientLiveTest extends BaseVPDCClientLiveTest {
assert HostSpecifier.isValid(ip) : response;
}
}
break VDC_LOOP;
}
}
}
}

View File

@ -27,6 +27,7 @@ import java.util.concurrent.TimeoutException;
import org.jclouds.savvis.vpdc.domain.Org;
import org.jclouds.savvis.vpdc.domain.Resource;
import org.jclouds.savvis.vpdc.domain.Task;
import org.jclouds.savvis.vpdc.domain.VDC;
import org.jclouds.savvis.vpdc.domain.VM;
import org.jclouds.savvis.vpdc.reference.VCloudMediaType;
@ -47,11 +48,13 @@ public class ServiceManagementClientLiveTest extends BaseVPDCClientLiveTest {
super.setupClient();
client = restContext.getApi().getServiceManagementClient();
}
// test for a single vm, as savvis response times are very slow. So if there are multiple vpdc's with numerous vm's,
// test execution will invariably take a long time
public void testLifeCycle() throws InterruptedException, ExecutionException, TimeoutException, IOException {
for (Resource org1 : restContext.getApi().listOrgs()) {
Org org = restContext.getApi().getBrowsingClient().getOrg(org1.getId());
for (Resource vdc : org.getVDCs()) {
VDC_LOOP : for (Resource vdc : org.getVDCs()) {
VDC VDC = restContext.getApi().getBrowsingClient().getVDCInOrg(org.getId(), vdc.getId());
for (Resource vmHandle : Iterables.filter(VDC.getResourceEntities(), new Predicate<Resource>() {
@ -61,18 +64,21 @@ public class ServiceManagementClientLiveTest extends BaseVPDCClientLiveTest {
}
})) {
assert taskTester.apply(client.powerOffVM(vmHandle.getHref()).getId());
Task powerOffTask = client.powerOffVM(vmHandle.getHref());
assert taskTester.apply(powerOffTask.getId());
VM vm = restContext.getApi().getBrowsingClient().getVM(vmHandle.getHref(), withPowerState());
assertEquals(vm.getStatus(), VM.Status.OFF);
assert taskTester.apply(client.powerOnVM(vmHandle.getHref()).getId());
Task powerOnTask = client.powerOnVM(vmHandle.getHref());
assert taskTester.apply(powerOnTask.getId());
vm = restContext.getApi().getBrowsingClient().getVM(vmHandle.getHref(), withPowerState());
assertEquals(vm.getStatus(), VM.Status.ON);
break VDC_LOOP;
}
}
}