mirror of https://github.com/apache/jclouds.git
fixed pattern to id windows 2008
This commit is contained in:
parent
b351223f5e
commit
c8d4008c98
|
@ -63,7 +63,7 @@ public class VCloudComputeUtils {
|
|||
}
|
||||
|
||||
public static CIMOperatingSystem toComputeOs(org.jclouds.vcloud.domain.ovf.OperatingSystemSection os) {
|
||||
return new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(os.getId()), null, null, os.getDescription());
|
||||
return new CIMOperatingSystem(CIMOperatingSystem.OSType.fromValue(os.getId()), "", null, os.getDescription());
|
||||
}
|
||||
|
||||
public static Credentials getCredentialsFrom(VApp vApp) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.jclouds.compute.config.BindComputeStrategiesByClass;
|
|||
import org.jclouds.compute.config.BindComputeSuppliersByClass;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.internal.RestContextImpl;
|
||||
|
@ -33,6 +34,7 @@ import org.jclouds.vcloud.VCloudExpressClient;
|
|||
import org.jclouds.vcloud.compute.CommonVCloudComputeClient;
|
||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
||||
import org.jclouds.vcloud.compute.functions.ImagesInVCloudExpressOrg;
|
||||
import org.jclouds.vcloud.compute.functions.ParseOsFromVAppTemplateName;
|
||||
import org.jclouds.vcloud.compute.functions.VCloudExpressVAppToNodeMetadata;
|
||||
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
||||
import org.jclouds.vcloud.domain.Org;
|
||||
|
@ -64,6 +66,8 @@ public class VCloudExpressComputeServiceContextModule extends CommonVCloudComput
|
|||
bind(new TypeLiteral<Function<Org, Iterable<? extends Image>>>() {
|
||||
}).to(new TypeLiteral<ImagesInVCloudExpressOrg>() {
|
||||
});
|
||||
bind(new TypeLiteral<Function<String, OperatingSystem>>() {
|
||||
}).to(ParseOsFromVAppTemplateName.class);
|
||||
}
|
||||
|
||||
protected void bindVAppConverter() {
|
||||
|
|
|
@ -51,19 +51,33 @@ import org.jclouds.vcloud.terremark.options.AddNodeOptions;
|
|||
*/
|
||||
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
||||
public interface TerremarkVCloudClient extends VCloudExpressClient {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
TerremarkCatalogItem getCatalogItem(URI catalogItem);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
TerremarkVDC getVDC(URI catalogItem);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
TerremarkCatalogItem findCatalogItemInOrgCatalogNamed(String orgName, String catalogName, String itemName);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
TerremarkOrg getOrg(URI orgId);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
TerremarkOrg findOrgNamed(String orgName);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.InsufficientResourcesException;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
||||
|
@ -61,6 +62,9 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
|
|||
|| (response.getMessage().indexOf("because it is already powered off") != -1)
|
||||
|| (response.getMessage().indexOf("exists") != -1)))
|
||||
exception = new IllegalStateException(response.getMessage(), exception);
|
||||
else if (response.getMessage() != null
|
||||
&& ((response.getMessage().indexOf("There are no additional Public IPs available") != -1)))
|
||||
exception = new InsufficientResourcesException(response.getMessage(), exception);
|
||||
else
|
||||
switch (response.getStatusCode()) {
|
||||
case 400:
|
||||
|
|
|
@ -220,16 +220,13 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
|||
|
||||
abstract TerremarkInstantiateVAppTemplateOptions createInstantiateOptions();
|
||||
|
||||
protected abstract Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(URI vdc);
|
||||
protected abstract Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(VCloudExpressVApp vApp);
|
||||
|
||||
@Test
|
||||
@Test(enabled = true, dependsOnMethods = "testInstantiateAndPowerOn")
|
||||
public void testAddInternetService() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
||||
|
||||
Entry<InternetService, PublicIpAddress> entry = getNewInternetServiceAndIpForSSH(tmClient.findVDCInOrgNamed(null,
|
||||
null).getHref());
|
||||
Entry<InternetService, PublicIpAddress> entry = getNewInternetServiceAndIpForSSH(vApp);
|
||||
is = entry.getKey();
|
||||
publicIp = entry.getValue().getAddress();
|
||||
|
||||
}
|
||||
|
||||
@Test(enabled = true, dependsOnMethods = "testInstantiateAndPowerOn")
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.net.URI;
|
|||
import org.jclouds.http.BaseHttpErrorHandlerTest;
|
||||
import org.jclouds.http.HttpErrorHandler;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.InsufficientResourcesException;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -71,6 +72,12 @@ public class ParseTerremarkVCloudErrorFromHttpResponseTest extends BaseHttpError
|
|||
"", "", AuthorizationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test403SetsInsufficientResourcesException() {
|
||||
assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 403,
|
||||
"There are no additional Public IPs available", "", InsufficientResourcesException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test501SetsNotImplementedMakesUnsupportedOperationException() {
|
||||
assertCodeMakes("POST", URI
|
||||
|
@ -87,11 +94,12 @@ public class ParseTerremarkVCloudErrorFromHttpResponseTest extends BaseHttpError
|
|||
|
||||
@Test
|
||||
public void testKeyAlreadyExistsSetsIllegalStateException() {
|
||||
assertCodeMakes("POST", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys"), 400,
|
||||
assertCodeMakes("POST", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys"), 400,
|
||||
"Security key with name livetest exists.", "Security key with name livetest exists.",
|
||||
IllegalStateException.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Class<? extends HttpErrorHandler> getHandlerClass() {
|
||||
return ParseTerremarkVCloudErrorFromHttpResponse.class;
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.jclouds.vcloud.util.Utils.putReferenceType;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
|||
private StringBuilder currentText = new StringBuilder();
|
||||
|
||||
private ReferenceType catalog;
|
||||
private SortedMap<String, ReferenceType> contents = Maps.newTreeMap();
|
||||
private Map<String, ReferenceType> contents = Maps.newLinkedHashMap();
|
||||
protected List<Task> tasks = Lists.newArrayList();
|
||||
private String description;
|
||||
private ReferenceType org;
|
||||
|
|
|
@ -58,7 +58,7 @@ public interface ComputeServiceConstants {
|
|||
public static class ReferenceData {
|
||||
@Inject(optional = true)
|
||||
@Named(PROPERTY_OS_VERSION_MAP_JSON)
|
||||
public String osVersionMapJson = "{\"centos\":{\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"rhel\":{\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"ubuntu\":{\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\"},\"windows\":{\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"Server 2008\":\"2008\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}";
|
||||
public String osVersionMapJson = "{\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\"},\"windows\":{\"\":\"\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}";
|
||||
}
|
||||
|
||||
@Singleton
|
||||
|
|
|
@ -201,7 +201,7 @@ public class ComputeServiceUtils {
|
|||
"node does not have IP addresses configured: " + node);
|
||||
}
|
||||
|
||||
public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, final String in,
|
||||
public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in,
|
||||
Map<OsFamily, Map<String, String>> osVersionMap) {
|
||||
if (osVersionMap.containsKey(family)) {
|
||||
if (osVersionMap.get(family).containsKey(in))
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<properties>
|
||||
<test.trmk-ecloud.endpoint>https://services.enterprisecloud.terremark.com/api</test.trmk-ecloud.endpoint>
|
||||
<test.trmk-ecloud.apiversion>0.8b-ext2.6</test.trmk-ecloud.apiversion>
|
||||
<test.trmk-ecloud.apiversion>0.8b-ext2.7</test.trmk-ecloud.apiversion>
|
||||
<test.trmk-ecloud.identity>FIXME</test.trmk-ecloud.identity>
|
||||
<test.trmk-ecloud.credential>FIXME</test.trmk-ecloud.credential>
|
||||
</properties>
|
||||
|
|
|
@ -44,6 +44,8 @@ public interface TerremarkECloudClient extends TerremarkVCloudClient {
|
|||
*
|
||||
* @param vDCId
|
||||
* @return
|
||||
* @throws org.jclouds.rest.InsufficientResourcesException
|
||||
* if there's no additional ips available
|
||||
*/
|
||||
PublicIpAddress activatePublicIpInVDC(URI vDCId);
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@ public class TerremarkECloudPropertiesBuilder extends TerremarkVCloudPropertiesB
|
|||
@Override
|
||||
protected Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
properties.setProperty(PROPERTY_API_VERSION, "0.8b-ext2.6");
|
||||
properties.setProperty(PROPERTY_API_VERSION, "0.8b-ext2.7");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://services.enterprisecloud.terremark.com/api");
|
||||
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_NAME, "eCloudExtensions");
|
||||
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_VERSION, "2.6");
|
||||
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_VERSION, "2.7");
|
||||
// for some reason the centos template is very slow to deploy
|
||||
properties.setProperty(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED, 720l * 1000l + "");
|
||||
return properties;
|
||||
|
|
|
@ -22,6 +22,8 @@ package org.jclouds.vcloud.terremark.compute.config;
|
|||
import static org.jclouds.compute.domain.OsFamily.CENTOS;
|
||||
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.vcloud.compute.functions.ParseOsFromVAppTemplateName;
|
||||
import org.jclouds.vcloud.terremark.compute.functions.TerremarkECloudParseOsFromVAppTemplateName;
|
||||
import org.jclouds.vcloud.terremark.suppliers.InternetServiceAndPublicIpAddressSupplier;
|
||||
import org.jclouds.vcloud.terremark.suppliers.TerremarkECloudInternetServiceAndPublicIpAddressSupplier;
|
||||
|
||||
|
@ -32,6 +34,14 @@ import com.google.inject.Injector;
|
|||
*/
|
||||
public class TerremarkECloudComputeServiceContextModule extends TerremarkVCloudComputeServiceContextModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(InternetServiceAndPublicIpAddressSupplier.class).to(
|
||||
TerremarkECloudInternetServiceAndPublicIpAddressSupplier.class);
|
||||
bind(ParseOsFromVAppTemplateName.class).to(TerremarkECloudParseOsFromVAppTemplateName.class);
|
||||
super.configure();
|
||||
}
|
||||
|
||||
// as of 6-nov-2010 only centos has ssh key injection in the images.
|
||||
// ssh key injection in ubuntu is targeted for dec-2010 or sooner
|
||||
@Override
|
||||
|
@ -39,10 +49,4 @@ public class TerremarkECloudComputeServiceContextModule extends TerremarkVCloudC
|
|||
return template.osFamily(CENTOS).os64Bit(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(InternetServiceAndPublicIpAddressSupplier.class).to(
|
||||
TerremarkECloudInternetServiceAndPublicIpAddressSupplier.class);
|
||||
super.configure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,14 +31,13 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.rest.InsufficientResourcesException;
|
||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
||||
import org.jclouds.vcloud.terremark.TerremarkECloudClient;
|
||||
import org.jclouds.vcloud.terremark.domain.InternetService;
|
||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||
import org.jclouds.vcloud.terremark.suppliers.InternetServiceAndPublicIpAddressSupplier;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -64,28 +63,22 @@ public class TerremarkECloudInternetServiceAndPublicIpAddressSupplier implements
|
|||
public Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VCloudExpressVApp vApp, int port,
|
||||
Protocol protocol) {
|
||||
logger.debug(">> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getName(), protocol, port);
|
||||
// http://support.theenterprisecloud.com/kb/default.asp?id=706&Lang=1&SID=
|
||||
// response with a 500 error code means we should look for an existing public ip to
|
||||
// use
|
||||
InternetService is = null;
|
||||
PublicIpAddress ip = null;
|
||||
try {
|
||||
ip = client.activatePublicIpInVDC(vApp.getVDC().getHref());
|
||||
} catch (HttpResponseException e) {
|
||||
if (e.getResponse().getStatusCode() == 500) {
|
||||
logger.warn(">> no more ip addresses available, looking for one to re-use");
|
||||
for (PublicIpAddress existingIp : client.getPublicIpsAssociatedWithVDC(vApp.getVDC().getHref())) {
|
||||
Set<InternetService> services = client.getInternetServicesOnPublicIp(existingIp.getId());
|
||||
if (services.size() == 0) {
|
||||
ip = existingIp;
|
||||
break;
|
||||
}
|
||||
} catch (InsufficientResourcesException e) {
|
||||
logger.warn(">> no more ip addresses available, looking for one to re-use");
|
||||
for (PublicIpAddress existingIp : client.getPublicIpsAssociatedWithVDC(vApp.getVDC().getHref())) {
|
||||
Set<InternetService> services = client.getInternetServicesOnPublicIp(existingIp.getId());
|
||||
if (services.size() == 0) {
|
||||
ip = existingIp;
|
||||
break;
|
||||
}
|
||||
if (ip == null)
|
||||
throw e;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
if (ip == null)
|
||||
throw e;
|
||||
|
||||
}
|
||||
is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
|
||||
withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(), vApp
|
||||
|
|
|
@ -285,7 +285,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.internetService+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(
|
||||
getClass().getResourceAsStream("/terremark/CreateInternetService-test2.xml")).replace(
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.6"),
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.7"),
|
||||
"application/vnd.tmrk.ecloud.internetService+xml", false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
|
@ -305,7 +305,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.ecloud.internetService+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(
|
||||
getClass().getResourceAsStream("/terremark/CreateInternetService-options-test.xml")).replace(
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.6"),
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.7"),
|
||||
"application/vnd.tmrk.ecloud.internetService+xml", false);
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, InternetServiceHandler.class);
|
||||
|
@ -324,7 +324,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.vCloud.nodeService+xml\n");
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(
|
||||
getClass().getResourceAsStream("/terremark/CreateNodeService-test2.xml")).replace(
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.6"), "application/vnd.tmrk.vCloud.nodeService+xml",
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.7"), "application/vnd.tmrk.vCloud.nodeService+xml",
|
||||
false);
|
||||
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
|
@ -345,7 +345,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
|
||||
assertPayloadEquals(request, Strings2.toStringAndClose(
|
||||
getClass().getResourceAsStream("/terremark/CreateNodeService-options-test.xml")).replace(
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.6"), "application/vnd.tmrk.vCloud.nodeService+xml",
|
||||
"vCloudExpressExtensions-1.6", "eCloudExtensions-2.7"), "application/vnd.tmrk.vCloud.nodeService+xml",
|
||||
false);
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, NodeHandler.class);
|
||||
|
@ -380,7 +380,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.vCloud.nodeService+xml\n");
|
||||
assertPayloadEquals(
|
||||
request,
|
||||
"<NodeService xmlns=\"urn:tmrk:eCloudExtensions-2.6\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Name>name</Name><Enabled>true</Enabled><Description>eggs</Description></NodeService>",
|
||||
"<NodeService xmlns=\"urn:tmrk:eCloudExtensions-2.7\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Name>name</Name><Enabled>true</Enabled><Description>eggs</Description></NodeService>",
|
||||
"application/vnd.tmrk.vCloud.nodeService+xml", false);
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, NodeHandler.class);
|
||||
|
@ -399,7 +399,7 @@ public class TerremarkECloudAsyncClientTest extends RestClientTest<TerremarkEClo
|
|||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.vCloud.nodeService+xml\n");
|
||||
assertPayloadEquals(
|
||||
request,
|
||||
"<NodeService xmlns=\"urn:tmrk:eCloudExtensions-2.6\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Name>name</Name><Enabled>true</Enabled></NodeService>",
|
||||
"<NodeService xmlns=\"urn:tmrk:eCloudExtensions-2.7\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Name>name</Name><Enabled>true</Enabled></NodeService>",
|
||||
"application/vnd.tmrk.vCloud.nodeService+xml", false);
|
||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||
assertSaxResponseParserClassEquals(method, NodeHandler.class);
|
||||
|
|
|
@ -21,34 +21,32 @@ package org.jclouds.vcloud.terremark;
|
|||
|
||||
import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
||||
import org.jclouds.vcloud.terremark.domain.InternetService;
|
||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.terremark.suppliers.TerremarkECloudInternetServiceAndPublicIpAddressSupplier;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TerremarkVCloudClient}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", enabled = false, sequential = true)
|
||||
@Test(groups = "live", enabled = true, sequential = true)
|
||||
public class TerremarkECloudClientLiveTestDisabled extends TerremarkClientLiveTest {
|
||||
@BeforeClass
|
||||
void setProvider() {
|
||||
this.provider = "trmk-ecloud";
|
||||
this.itemName = "Ubuntu 8.04 LTS (x86)";
|
||||
expectedOs = "Ubuntu Linux (32-bit)";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,13 +60,9 @@ public class TerremarkECloudClientLiveTestDisabled extends TerremarkClientLiveTe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(URI vdc) {
|
||||
PublicIpAddress ip = TerremarkECloudClient.class.cast(tmClient).activatePublicIpInVDC(
|
||||
tmClient.findVDCInOrgNamed(null, null).getHref());
|
||||
InternetService is = tmClient.addInternetServiceToExistingIp(ip.getId(), "SSH", Protocol.TCP, 22);
|
||||
Map<InternetService, PublicIpAddress> result = ImmutableMap.<InternetService, PublicIpAddress> of(is, ip);
|
||||
Entry<InternetService, PublicIpAddress> entry = Iterables.getOnlyElement(result.entrySet());
|
||||
return entry;
|
||||
protected Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(VCloudExpressVApp vApp) {
|
||||
return new TerremarkECloudInternetServiceAndPublicIpAddressSupplier(TerremarkECloudClient.class.cast(tmClient))
|
||||
.getNewInternetServiceAndIp(vApp, 22, Protocol.TCP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTempl
|
|||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -33,18 +31,17 @@ import java.util.concurrent.TimeoutException;
|
|||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
||||
import org.jclouds.vcloud.terremark.domain.InternetService;
|
||||
import org.jclouds.vcloud.terremark.domain.KeyPair;
|
||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||
import org.jclouds.vcloud.terremark.domain.TerremarkOrg;
|
||||
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
||||
import org.jclouds.vcloud.terremark.suppliers.TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TerremarkVCloudClient}
|
||||
*
|
||||
|
@ -53,16 +50,6 @@ import com.google.common.collect.Iterables;
|
|||
@Test(groups = "live", sequential = true)
|
||||
public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest {
|
||||
|
||||
@Override
|
||||
protected Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(URI vdc) {
|
||||
InternetService is = TerremarkVCloudExpressClient.class.cast(tmClient).addInternetServiceToVDC(
|
||||
tmClient.findVDCInOrgNamed(null, null).getHref(), "SSH", Protocol.TCP, 22);
|
||||
PublicIpAddress ip = is.getPublicIpAddress();
|
||||
Map<InternetService, PublicIpAddress> result = ImmutableMap.<InternetService, PublicIpAddress> of(is, ip);
|
||||
Entry<InternetService, PublicIpAddress> entry = Iterables.getOnlyElement(result.entrySet());
|
||||
return entry;
|
||||
}
|
||||
|
||||
KeyPair key;
|
||||
|
||||
@Test
|
||||
|
@ -114,4 +101,10 @@ public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTes
|
|||
protected TerremarkInstantiateVAppTemplateOptions createInstantiateOptions() {
|
||||
return processorCount(1).memory(512).sshKeyFingerprint(key.getFingerPrint());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(VCloudExpressVApp vApp) {
|
||||
return new TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier(TerremarkVCloudExpressClient.class
|
||||
.cast(tmClient)).getNewInternetServiceAndIp(vApp, 22, Protocol.TCP);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue