repackaged savvis and got tests passing

This commit is contained in:
Adrian Cole 2011-03-04 16:49:36 -05:00
parent 3e8321aa8f
commit 16304e5301
17 changed files with 178 additions and 181 deletions

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import java.net.URI;
@ -29,6 +29,8 @@ import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.savvis.vpdc.xml.SymphonyVPDCNetworkHandler;
import org.jclouds.savvis.vpdc.xml.SymphonyVPDCVAppHandler;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.domain.Org;
@ -39,8 +41,6 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
import org.jclouds.vcloud.functions.OrgNameAndVDCNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameToEndpoint;
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
import org.jclouds.vcloud.savvis.xml.SymphonyVPDCNetworkHandler;
import org.jclouds.vcloud.savvis.xml.SymphonyVPDCVAppHandler;
import org.jclouds.vcloud.xml.OrgHandler;
import org.jclouds.vcloud.xml.VDCHandler;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import java.util.concurrent.TimeUnit;

View File

@ -17,14 +17,14 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import java.util.List;
import java.util.Properties;
import org.jclouds.compute.ComputeServiceContextBuilder;
import org.jclouds.savvis.compute.config.SymphonyVPDCComputeServiceContextModule;
import org.jclouds.savvis.config.SymphonyVPDCRestClientModule;
import org.jclouds.savvis.vpdc.compute.config.SymphonyVPDCComputeServiceContextModule;
import org.jclouds.savvis.vpdc.config.SymphonyVPDCRestClientModule;
import com.google.inject.Module;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis.compute.config;
package org.jclouds.savvis.vpdc.compute.config;
import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis.config;
package org.jclouds.savvis.vpdc.config;
import java.net.URI;
@ -27,9 +27,9 @@ import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.savvis.SymphonyVPDCAsyncClient;
import org.jclouds.savvis.SymphonyVPDCClient;
import org.jclouds.savvis.handlers.SymphonyVPDCErrorHandler;
import org.jclouds.savvis.vpdc.SymphonyVPDCAsyncClient;
import org.jclouds.savvis.vpdc.SymphonyVPDCClient;
import org.jclouds.savvis.vpdc.handlers.SymphonyVPDCErrorHandler;
import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.config.BaseVCloudExpressRestClientModule;

View File

@ -17,13 +17,14 @@
* ====================================================================
*/
package org.jclouds.vcloud.domain.network;
package org.jclouds.savvis.vpdc.domain;
import java.util.Set;
import javax.annotation.Nullable;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule;

View File

@ -17,17 +17,17 @@
* ====================================================================
*/
package org.jclouds.vcloud.domain.network.internal;
package org.jclouds.savvis.vpdc.domain.internal;
import java.net.URI;
import java.util.Set;
import javax.annotation.Nullable;
import org.jclouds.savvis.vpdc.domain.SymphonyVPDCNetwork;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.SymphonyVPDCNetwork;
import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule;
@ -151,7 +151,7 @@ public class SymphonyVPDCNetworkImpl extends ReferenceTypeImpl implements Sympho
return false;
if (getClass() != obj.getClass())
return false;
VCloudExpressNetworkImpl other = (VCloudExpressNetworkImpl) obj;
SymphonyVPDCNetworkImpl other = (SymphonyVPDCNetworkImpl) obj;
if (description == null) {
if (other.description != null)
return false;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis.handlers;
package org.jclouds.savvis.vpdc.handlers;
import java.io.IOException;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.vcloud.savvis.xml;
package org.jclouds.savvis.vpdc.xml;
import static org.jclouds.vcloud.util.Utils.cleanseAttributes;
import static org.jclouds.vcloud.util.Utils.newReferenceType;
@ -29,12 +29,12 @@ import javax.annotation.Resource;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger;
import org.jclouds.savvis.vpdc.domain.SymphonyVPDCNetwork;
import org.jclouds.savvis.vpdc.domain.internal.SymphonyVPDCNetworkImpl;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.network.FenceMode;
import org.jclouds.vcloud.domain.network.SymphonyVPDCNetwork;
import org.jclouds.vcloud.domain.network.firewall.FirewallPolicy;
import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
import org.jclouds.vcloud.domain.network.internal.SymphonyVPDCNetworkImpl;
import org.jclouds.vcloud.domain.network.nat.NatProtocol;
import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule;
import org.xml.sax.Attributes;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.vcloud.savvis.xml;
package org.jclouds.savvis.vpdc.xml;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.vcloud.util.Utils.cleanseAttributes;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_IDENTITY;
@ -47,7 +47,9 @@ import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.savvis.config.SymphonyVPDCRestClientModule;
import org.jclouds.savvis.vpdc.config.SymphonyVPDCRestClientModule;
import org.jclouds.savvis.vpdc.xml.SymphonyVPDCNetworkHandler;
import org.jclouds.savvis.vpdc.xml.SymphonyVPDCVAppHandler;
import org.jclouds.util.Strings2;
import org.jclouds.vcloud.CommonVCloudClient;
import org.jclouds.vcloud.VCloudExpressAsyncClient;
@ -71,7 +73,6 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.jclouds.vcloud.xml.CatalogHandler;
import org.jclouds.vcloud.xml.CatalogItemHandler;
import org.jclouds.vcloud.xml.OrgHandler;
import org.jclouds.vcloud.xml.OrgNetworkFromVCloudExpressNetworkHandler;
import org.jclouds.vcloud.xml.TaskHandler;
import org.jclouds.vcloud.xml.TasksListHandler;
import org.jclouds.vcloud.xml.VCloudExpressVAppHandler;
@ -136,10 +137,9 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
assertRequestLineEquals(request,
"POST https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
assertPayloadEquals(
request,
Strings2.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hostingcpumemdisk.xml")).replace(
"vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
assertPayloadEquals(request,
Strings2.toStringAndClose(getClass().getResourceAsStream("/express/newvapp-hostingcpumemdisk.xml"))
.replace("vcloud.safesecureweb.com/api", "api.sandbox.symphonyVPDC.savvis.net/rest/api"),
"application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml", false);
assertResponseParserClassEquals(method, request, ParseSax.class);
@ -283,11 +283,11 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
assertRequestLineEquals(request,
"GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/network/2 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, OrgNetworkFromVCloudExpressNetworkHandler.class);
assertSaxResponseParserClassEquals(method, SymphonyVPDCNetworkHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request);
@ -366,7 +366,7 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
HttpRequest request = processor.createRequest(method, "org", "vdc");
assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
@ -393,7 +393,7 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
HttpRequest request = processor.createRequest(method, null, "vdc");
assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
@ -408,7 +408,7 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
HttpRequest request = processor.createRequest(method, null, null);
assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
@ -424,7 +424,7 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1"));
assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vdc/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
@ -490,11 +490,11 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
URI.create("https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1"));
assertRequestLineEquals(request, "GET https://api.sandbox.symphonyVPDC.savvis.net/rest/api/v0.8/vApp/1 HTTP/1.1");
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
assertNonPayloadHeadersEqual(request, "");
assertPayloadEquals(request, null, null, false);
assertResponseParserClassEquals(method, request, ParseSax.class);
assertSaxResponseParserClassEquals(method, VCloudExpressVAppHandler.class);
assertSaxResponseParserClassEquals(method, SymphonyVPDCVAppHandler.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(request);
@ -672,10 +672,9 @@ public class SymphonyVPDCAsyncClientTest extends RestClientTest<SymphonyVPDCAsyn
@Override
public RestContextSpec<?, ?> createContextSpec() {
Properties restProperties = new Properties();
restProperties
.setProperty("savvis-symphony-vpdc.contextbuilder", "org.jclouds.savvis.SymphonyVPDCContextBuilder");
restProperties.setProperty("savvis-symphony-vpdc.contextbuilder", SymphonyVPDCContextBuilder.class.getName());
restProperties.setProperty("savvis-symphony-vpdc.propertiesbuilder",
"org.jclouds.savvis.SymphonyVPDCPropertiesBuilder");
SymphonyVPDCPropertiesBuilder.class.getName());
Properties overrides = new Properties();
overrides.setProperty("savvis-symphony-vpdc.endpoint",

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis;
package org.jclouds.savvis.vpdc;
import java.util.Properties;
@ -42,22 +42,13 @@ public class SymphonyVPDCClientLiveTest extends VCloudExpressClientLiveTest {
// TODO remove these lines when this is registered under jclouds-core/rest.properties
Properties restProperties = new Properties();
restProperties
.setProperty("savvis-symphony-vpdc.contextbuilder", "org.jclouds.savvis.SymphonyVPDCContextBuilder");
restProperties.setProperty("savvis-symphony-vpdc.contextbuilder", SymphonyVPDCContextBuilder.class.getName());
restProperties.setProperty("savvis-symphony-vpdc.propertiesbuilder",
"org.jclouds.savvis.SymphonyVPDCPropertiesBuilder");
SymphonyVPDCPropertiesBuilder.class.getName());
context = new ComputeServiceContextFactory(restProperties).createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
connection = context.getApi();
System.out.println(context);
/*System.out.println(connection);
Org org = connection.getOrg(URI.create("https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0"));
System.out.println(connection.getVDC(URI.create("https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826")).getAvailableNetworks());
System.out.println(org.getVDCs().get(0));
System.out.println(org.getTasksList());
System.out.println(org.getTasks());*/
}
}

View File

@ -0,0 +1,57 @@
/**
*
* Copyright (C) 2010 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.compute;
import java.util.Properties;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.savvis.vpdc.SymphonyVPDCContextBuilder;
import org.jclouds.savvis.vpdc.SymphonyVPDCPropertiesBuilder;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.Test;
/**
*
*
* @author Kedar Dave
*/
@Test(groups = "live", enabled = true, sequential = true)
public class SymphonyVPDCComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public SymphonyVPDCComputeServiceLiveTest() {
provider = "savvis-symphony-vpdc";
group = "savvis.jclouds";
}
@Override
protected Properties getRestProperties() {
// TODO remove these lines when this is registered under jclouds-core/rest.properties
Properties restProperties = new Properties();
restProperties.setProperty("savvis-symphony-vpdc.contextbuilder", SymphonyVPDCContextBuilder.class.getName());
restProperties.setProperty("savvis-symphony-vpdc.propertiesbuilder",
SymphonyVPDCPropertiesBuilder.class.getName());
return restProperties;
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
}

View File

@ -0,0 +1,77 @@
package org.jclouds.savvis.vpdc.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.compute.BaseTemplateBuilderLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.os.OsFamilyVersion64Bit;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.savvis.vpdc.SymphonyVPDCContextBuilder;
import org.jclouds.savvis.vpdc.SymphonyVPDCPropertiesBuilder;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live")
public class SymphonyVPDCTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public SymphonyVPDCTemplateBuilderLiveTest() {
provider = "savvis-symphony-vpdc";
}
@Override
@BeforeClass
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
setupCredentials();
// TODO remove these lines when this is registered under jclouds-core/rest.properties
Properties restProperties = new Properties();
restProperties.setProperty("savvis-symphony-vpdc.contextbuilder", SymphonyVPDCContextBuilder.class.getName());
restProperties.setProperty("savvis-symphony-vpdc.propertiesbuilder",
SymphonyVPDCPropertiesBuilder.class.getName());
context = new ComputeServiceContextFactory(restProperties).createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), setupProperties());
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
// TODO it seems there are no base vApp Templates available in Savvis
return true;
}
};
}
@Test
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.5");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("US-FL", "NL-NH");
}
}

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.jclouds.savvis.handlers;
package org.jclouds.savvis.vpdc.handlers;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.reportMatcher;

View File

@ -1,128 +0,0 @@
/**
*
* Copyright (C) 2010 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.vcloud.savvis.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.rest.RestContext;
import org.jclouds.savvis.SymphonyVPDCAsyncClient;
import org.jclouds.savvis.SymphonyVPDCClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.testng.annotations.Test;
/**
*
*
* @author Kedar Dave
*/
@Test(groups = "live", enabled = true, sequential = true)
public class SymphonyVPDCComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public SymphonyVPDCComputeServiceLiveTest() {
provider = "savvis-symphony-vpdc";
}
@Override
public void setServiceDefaults() {
group = "savvis.jclouds";
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.5");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
assert defaultTemplate.getLocation().getDescription() != null;// different per org
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<SymphonyVPDCClient, SymphonyVPDCAsyncClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
}
@Override
protected Template buildTemplate(TemplateBuilder templateBuilder) {
Template template = super.buildTemplate(templateBuilder);
Image image = template.getImage();
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().identity != null : image;
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().credential != null : image;
return template;
}
// currently, the wrong CIM OSType data is coming back.
@Override
protected void checkOsMatchesTemplate(NodeMetadata node) {
if (node.getOperatingSystem() != null)
assertEquals(node.getOperatingSystem().getFamily(), null);
}
@Override
public void testListImages() throws Exception {
for (Image image : client.listImages()) {
assert image.getProviderId() != null : image;
// image.getLocationId() can be null, if it is a location-free image
assertEquals(image.getType(), ComputeType.IMAGE);
if (image.getOperatingSystem().getFamily() != OsFamily.WINDOWS
&& image.getOperatingSystem().getFamily() != OsFamily.SOLARIS) {
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().identity != null : image;
assert image.getDefaultCredentials().credential != null : image;
}
}
}
@Override
public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) {
assert node.getProviderId() != null;
assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId());
System.out.println(allData.getHardware());
RestContext<SymphonyVPDCClient, SymphonyVPDCClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
VCloudExpressVApp vApp = tmContext.getApi().findVAppInOrgVDCNamed(null, null, allData.getName());
assertEquals(vApp.getName(), allData.getName());
}
}
@Override
public void testDestroyNodes() {
super.testDestroyNodes();
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
}