mirror of https://github.com/apache/jclouds.git
Issue 131: regression
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2413 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
8023ccefff
commit
b55d2165d0
|
@ -82,7 +82,7 @@ public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
|
|||
vDC = newNamedResource(attributes);
|
||||
} else if (qName.equals("Network")) {
|
||||
putNamedResource(availableNetworks, attributes);
|
||||
} else if (qName.equals("ResourcePayload")) {
|
||||
} else if (qName.equals("ResourceEntity")) {
|
||||
putNamedResource(resourceEntities, attributes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,22 +38,22 @@
|
|||
</DeployedVmsQuota>
|
||||
</ComputeCapacity>
|
||||
<ResourceEntities>
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Plesk (Linux) 64-bit Template" />
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows 2008 Datacenter 64 Bit Template" />
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Cent OS 64 Bit Template" />
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"
|
||||
type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="cPanel (Linux) 64 Bit Template" />
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-1" />
|
||||
<ResourcePayload
|
||||
<ResourceEntity
|
||||
href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"
|
||||
type="application/vnd.vmware.vcloud.vApp+xml" name="188849-2" />
|
||||
</ResourceEntities>
|
||||
|
|
|
@ -72,7 +72,9 @@ public class TerremarkVCloudComputeService implements ComputeService {
|
|||
public CreateServerResponse createServer(String name, Profile profile, Image image) {
|
||||
String id = computeClient.start(name, 1, 512, image);
|
||||
VApp vApp = tmClient.getVApp(id);
|
||||
InetAddress publicIp = computeClient.createPublicAddressMappedToPorts(vApp, 22, 80, 8080);
|
||||
// bug creating more than one internet service returns 503 or 500
|
||||
// InetAddress publicIp = computeClient.createPublicAddressMappedToPorts(vApp, 22, 80, 8080);
|
||||
InetAddress publicIp = computeClient.createPublicAddressMappedToPorts(vApp, 22);
|
||||
return new CreateServerResponseImpl(vApp.getId(), vApp.getName(), ImmutableSet
|
||||
.<InetAddress> of(publicIp), vApp.getNetworkToAddresses().values(), 22,
|
||||
LoginType.SSH, new Credentials("vcloud", "p4ssw0rd"));
|
||||
|
|
|
@ -56,11 +56,11 @@ public class ReturnVoidOnDeleteDefaultIp implements Function<Exception, Void> {
|
|||
if (from instanceof HttpResponseException) {
|
||||
HttpResponseException hre = (HttpResponseException) from;
|
||||
if (hre.getResponse().getStatusCode() == 503
|
||||
|| hre.getResponse().getStatusCode() == 401
|
||||
|| hre.getMessage().matches(
|
||||
".*Cannot release this Public IP as it is default oubound IP.*"))
|
||||
return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -62,29 +62,18 @@ public class InternetServiceLiveTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAddInternetService() {
|
||||
|
||||
public void testAddInternetService() throws InterruptedException {
|
||||
InternetService is = tmClient.addInternetService("test-" + 22, Protocol.TCP, 22);
|
||||
services.add(is);
|
||||
PublicIpAddress ip = is.getPublicIpAddress();
|
||||
for (int port : new int[] { 80, 8080 }) {
|
||||
services.add(tmClient.addInternetServiceToExistingIp(ip.getId(), "test-" + port,
|
||||
Protocol.HTTP, port));
|
||||
}
|
||||
// current bug in terremark
|
||||
// for (int port : new int[] { 80, 8080 }) {
|
||||
// services.add(tmClient.addInternetServiceToExistingIp(ip.getId(), "test-" + port,
|
||||
// Protocol.HTTP, port));
|
||||
// }
|
||||
print(tmClient.getInternetServicesOnPublicIp(ip.getId()));
|
||||
}
|
||||
|
||||
private void print(SortedSet<InternetService> set) {
|
||||
for (InternetService service : set) {
|
||||
System.out.printf("%d (%s:%d%n)", service.getId(), service.getPublicIpAddress()
|
||||
.getAddress().getHostAddress(), service.getPort());
|
||||
for (Node node : tmClient.getNodes(service.getId())) {
|
||||
System.out.printf(" %d (%s:%d%n)", node.getId(),
|
||||
node.getIpAddress().getHostAddress(), node.getPort());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void delete(SortedSet<InternetService> set) {
|
||||
for (InternetService service : set) {
|
||||
for (Node node : tmClient.getNodes(service.getId())) {
|
||||
|
@ -120,4 +109,14 @@ public class InternetServiceLiveTest {
|
|||
|
||||
}
|
||||
|
||||
private void print(SortedSet<InternetService> set) {
|
||||
for (InternetService service : set) {
|
||||
System.out.printf("%d (%s:%d%n)", service.getId(), service.getPublicIpAddress()
|
||||
.getAddress().getHostAddress(), service.getPort());
|
||||
for (Node node : tmClient.getNodes(service.getId())) {
|
||||
System.out.printf(" %d (%s:%d%n)", node.getId(),
|
||||
node.getIpAddress().getHostAddress(), node.getPort());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,9 +118,11 @@ public class TerremarkVCloudComputeClientLiveTest {
|
|||
|
||||
@Test(dependsOnMethods = "testGetAnyPrivateAddress")
|
||||
public void testSshLoadBalanceIp() {
|
||||
|
||||
InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22, 80,
|
||||
8080);
|
||||
// bug creating more than one internet service returns 503 or 500
|
||||
// InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22,
|
||||
// 80,
|
||||
// 8080);
|
||||
InetAddress publicIp = client.createPublicAddressMappedToPorts(tmClient.getVApp(id), 22);
|
||||
assert addressTester.apply(publicIp);
|
||||
// client.exec(publicIp, "uname -a");
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.jclouds.http.functions.config.ParserModule;
|
|||
import org.jclouds.rest.domain.NamedResource;
|
||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||
import org.jclouds.rest.internal.NamedResourceImpl;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.endpoints.VCloudApi;
|
||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -53,66 +54,69 @@ import com.google.inject.Provides;
|
|||
@Test(groups = "unit", testName = "vcloud.TerremarkVDCHandlerTest")
|
||||
public class TerremarkVDCHandlerTest {
|
||||
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/terremark/vdc.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(),
|
||||
new AbstractModule() {
|
||||
public void testApplyInputStream() {
|
||||
InputStream is = getClass().getResourceAsStream("/terremark/vdc.xml");
|
||||
Injector injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
@Override
|
||||
protected void configure() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloudApi
|
||||
URI provide() {
|
||||
return URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@VCloudApi
|
||||
URI provide() {
|
||||
return URI.create("https://services.vcloudexpress.terremark.com/api/v0.8");
|
||||
}
|
||||
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
});
|
||||
Factory factory = injector.getInstance(ParseSax.Factory.class);
|
||||
|
||||
TerremarkVDC result = (TerremarkVDC) factory.create(
|
||||
injector.getInstance(TerremarkVDCHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assertEquals(
|
||||
result.getLocation(),
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
|
||||
assertEquals(result.getResourceEntities(), ImmutableMap
|
||||
.<String, NamedResource> of());
|
||||
assertEquals(
|
||||
result.getAvailableNetworks(),
|
||||
ImmutableMap
|
||||
.of(
|
||||
"10.114.34.128/26",
|
||||
new NamedResourceImpl(
|
||||
"1708",
|
||||
"10.114.34.128/26",
|
||||
"application/vnd.vmware.vcloud.network+xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
|
||||
assertEquals(
|
||||
result.getCatalog(),
|
||||
new NamedLinkImpl(
|
||||
"Miami Environment 1",
|
||||
CATALOG_XML,
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||
assertEquals(
|
||||
result.getPublicIps(),
|
||||
new NamedLinkImpl(
|
||||
"Public IPs",
|
||||
"application/xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps")));
|
||||
assertEquals(
|
||||
result.getInternetServices(),
|
||||
new NamedLinkImpl(
|
||||
"Internet Services",
|
||||
"application/xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices")));
|
||||
}
|
||||
TerremarkVDC result = (TerremarkVDC) factory.create(
|
||||
injector.getInstance(TerremarkVDCHandler.class)).parse(is);
|
||||
assertEquals(result.getName(), "Miami Environment 1");
|
||||
assertEquals(result.getLocation(), URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
|
||||
assertEquals(
|
||||
result.getResourceEntities(),
|
||||
ImmutableMap
|
||||
.<String, NamedResource> of(
|
||||
"adriantest",
|
||||
new NamedResourceImpl(
|
||||
"15124",
|
||||
"adriantest",
|
||||
VCloudMediaType.VAPP_XML,
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")),
|
||||
"centos-53",
|
||||
new NamedResourceImpl(
|
||||
"15120",
|
||||
"centos-53",
|
||||
VCloudMediaType.VAPP_XML,
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120"))));
|
||||
|
||||
assertEquals(
|
||||
result.getAvailableNetworks(),
|
||||
ImmutableMap
|
||||
.of(
|
||||
"10.114.34.128/26",
|
||||
new NamedResourceImpl(
|
||||
"1708",
|
||||
"10.114.34.128/26",
|
||||
"application/vnd.vmware.vcloud.network+xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
|
||||
assertEquals(result.getCatalog(), new NamedLinkImpl("Miami Environment 1", CATALOG_XML, URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
|
||||
assertEquals(result.getPublicIps(), new NamedLinkImpl("Public IPs", "application/xml", URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps")));
|
||||
assertEquals(
|
||||
result.getInternetServices(),
|
||||
new NamedLinkImpl(
|
||||
"Internet Services",
|
||||
"application/xml",
|
||||
URI
|
||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
<Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps" type="application/xml" name="Public IPs"/>
|
||||
<Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices" type="application/xml" name="Internet Services"/>
|
||||
<Description/>
|
||||
<ResourceEntities/>
|
||||
<ResourceEntities>
|
||||
<ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124" type="application/vnd.vmware.vcloud.vApp+xml" name="adriantest"/>
|
||||
<ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120" type="application/vnd.vmware.vcloud.vApp+xml" name="centos-53"/>
|
||||
</ResourceEntities>
|
||||
<AvailableNetworks>
|
||||
<Network href="https://services.vcloudexpress.terremark.com/api/v0.8/network/1708" type="application/vnd.vmware.vcloud.network+xml" name="10.114.34.128/26"/>
|
||||
</AvailableNetworks>
|
||||
|
|
Loading…
Reference in New Issue