mirror of https://github.com/apache/jclouds.git
Issue 440: reorganized terremark and added trmk-common, trmk-ecloud, trmk-vcloudexpress
This commit is contained in:
parent
3d9a4070fb
commit
e71d412a0a
|
@ -69,6 +69,26 @@
|
||||||
<artifactId>vcloudexpress</artifactId>
|
<artifactId>vcloudexpress</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.provider</groupId>
|
||||||
|
<artifactId>trmk-vcloudexpress</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.provider</groupId>
|
||||||
|
<artifactId>trmk-ecloud</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.provider</groupId>
|
||||||
|
<artifactId>trmk-vcloudexpress</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.provider</groupId>
|
||||||
|
<artifactId>trmk-ecloud</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.provider</groupId>
|
<groupId>org.jclouds.provider</groupId>
|
||||||
<artifactId>bluelock-vcdirector</artifactId>
|
<artifactId>bluelock-vcdirector</artifactId>
|
||||||
|
|
|
@ -35,5 +35,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>aws</module>
|
<module>aws</module>
|
||||||
<module>openstack</module>
|
<module>openstack</module>
|
||||||
|
<module>vcloud</module>
|
||||||
|
<module>trmk</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -26,38 +26,59 @@
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-project</artifactId>
|
<artifactId>jclouds-project</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<relativePath>../project/pom.xml</relativePath>
|
<relativePath>../../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>jclouds-vcloud-project</artifactId>
|
<groupId>org.jclouds.common</groupId>
|
||||||
<packaging>pom</packaging>
|
<artifactId>trmk-common</artifactId>
|
||||||
<name>jclouds vcloud project</name>
|
<name>common Terremark components</name>
|
||||||
<modules>
|
<description>common Terremark components</description>
|
||||||
<module>core</module>
|
|
||||||
<module>terremark</module>
|
|
||||||
<module>bluelock</module>
|
|
||||||
</modules>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>org.jclouds.api</groupId>
|
||||||
|
<artifactId>vcloudexpress</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.common</groupId>
|
||||||
|
<artifactId>vcloud-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-core</artifactId>
|
<artifactId>jclouds-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-compute</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-compute</artifactId>
|
<artifactId>jclouds-compute</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>org.jclouds.common</groupId>
|
||||||
|
<artifactId>vcloud-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds.api</groupId>
|
||||||
|
<artifactId>vcloudexpress</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<artifactId>jclouds-log4j</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-jsch</artifactId>
|
<artifactId>jclouds-jsch</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
@ -65,14 +86,9 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.14</version>
|
<version>1.2.16</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>jclouds-log4j</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -30,6 +30,7 @@ import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
*/
|
*/
|
||||||
public interface TerremarkVCloudMediaType extends VCloudExpressMediaType {
|
public interface TerremarkVCloudMediaType extends VCloudExpressMediaType {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "application/vnd.tmrk.vCloud.publicIp+xml"
|
* "application/vnd.tmrk.vCloud.publicIp+xml"
|
||||||
*/
|
*/
|
|
@ -80,7 +80,7 @@ public class BindVAppConfigurationToXmlPayload implements MapBinder, Function<Ob
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
|
public <R extends HttpRequest> R bindToRequest(R request, Map<String, String> postParams) {
|
||||||
checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
|
checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest<?>,
|
||||||
"this binder is only valid for GeneratedHttpRequests!");
|
"this binder is only valid for GeneratedHttpRequests!");
|
||||||
GeneratedHttpRequest<?> gRequest = (GeneratedHttpRequest<?>) request;
|
GeneratedHttpRequest<?> gRequest = (GeneratedHttpRequest<?>) request;
|
||||||
checkState(gRequest.getArgs() != null, "args should be initialized at this point");
|
checkState(gRequest.getArgs() != null, "args should be initialized at this point");
|
|
@ -27,6 +27,7 @@ import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -37,7 +38,6 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl;
|
||||||
import org.jclouds.vcloud.domain.Status;
|
import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
|
@ -46,14 +46,13 @@ import org.jclouds.vcloud.domain.TasksList;
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkECloudClient;
|
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
|
||||||
import org.jclouds.vcloud.terremark.domain.InternetService;
|
import org.jclouds.vcloud.terremark.domain.InternetService;
|
||||||
import org.jclouds.vcloud.terremark.domain.Node;
|
import org.jclouds.vcloud.terremark.domain.Node;
|
||||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||||
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
||||||
|
import org.jclouds.vcloud.terremark.suppliers.InternetServiceAndPublicIpAddressSupplier;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -69,17 +68,20 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
||||||
protected final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
protected final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
|
||||||
protected final Provider<String> passwordGenerator;
|
protected final Provider<String> passwordGenerator;
|
||||||
protected final Map<String, Credentials> credentialStore;
|
protected final Map<String, Credentials> credentialStore;
|
||||||
|
protected final InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
|
protected TerremarkVCloudComputeClient(TerremarkVCloudClient client,
|
||||||
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
|
||||||
@Named("PASSWORD") Provider<String> passwordGenerator, Predicate<URI> successTester,
|
@Named("PASSWORD") Provider<String> passwordGenerator, Predicate<URI> successTester,
|
||||||
Map<Status, NodeState> vAppStatusToNodeState, Map<String, Credentials> credentialStore) {
|
Map<Status, NodeState> vAppStatusToNodeState, Map<String, Credentials> credentialStore,
|
||||||
|
InternetServiceAndPublicIpAddressSupplier internetServiceAndPublicIpAddressSupplier) {
|
||||||
super(client, successTester, vAppStatusToNodeState);
|
super(client, successTester, vAppStatusToNodeState);
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.credentialsProvider = credentialsProvider;
|
this.credentialsProvider = credentialsProvider;
|
||||||
this.passwordGenerator = passwordGenerator;
|
this.passwordGenerator = passwordGenerator;
|
||||||
this.credentialStore = credentialStore;
|
this.credentialStore = credentialStore;
|
||||||
|
this.internetServiceAndPublicIpAddressSupplier = internetServiceAndPublicIpAddressSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,42 +135,12 @@ public class TerremarkVCloudComputeClient extends VCloudExpressComputeClientImpl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
if (client instanceof TerremarkVCloudExpressClient) {
|
|
||||||
is = TerremarkVCloudExpressClient.class.cast(client).addInternetServiceToVDC(
|
Entry<InternetService, PublicIpAddress> entry = internetServiceAndPublicIpAddressSupplier
|
||||||
vApp.getVDC().getHref(),
|
.getNewInternetServiceAndIp(vApp, port, protocol);
|
||||||
vApp.getName() + "-" + port,
|
is = entry.getKey();
|
||||||
protocol,
|
ip = entry.getValue();
|
||||||
port,
|
|
||||||
withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
|
|
||||||
vApp.getName())));
|
|
||||||
ip = is.getPublicIpAddress();
|
|
||||||
} else {
|
|
||||||
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
|
|
||||||
try {
|
|
||||||
ip = TerremarkECloudClient.class.cast(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ip == null)
|
|
||||||
throw e;
|
|
||||||
} else {
|
|
||||||
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.getName())));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress(), protocol, port);
|
logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress(), protocol, port);
|
||||||
is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
|
is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
|
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.terremark.suppliers;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public interface InternetServiceAndPublicIpAddressSupplier {
|
||||||
|
Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VCloudExpressVApp vApp, int port,
|
||||||
|
Protocol protocol);
|
||||||
|
}
|
|
@ -27,8 +27,6 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.vcloud.domain.ReferenceType;
|
import org.jclouds.vcloud.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkECloudMediaType;
|
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressMediaType;
|
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkOrg;
|
import org.jclouds.vcloud.terremark.domain.TerremarkOrg;
|
||||||
import org.jclouds.vcloud.terremark.domain.internal.TerremarkOrgImpl;
|
import org.jclouds.vcloud.terremark.domain.internal.TerremarkOrgImpl;
|
||||||
import org.jclouds.vcloud.xml.OrgHandler;
|
import org.jclouds.vcloud.xml.OrgHandler;
|
||||||
|
@ -59,12 +57,10 @@ public class TerremarkOrgHandler extends OrgHandler {
|
||||||
if (qName.equals("Link")) {
|
if (qName.equals("Link")) {
|
||||||
if (attributes.containsKey("type")) {
|
if (attributes.containsKey("type")) {
|
||||||
String type = attributes.get("type");
|
String type = attributes.get("type");
|
||||||
if (type.equals(TerremarkVCloudExpressMediaType.KEYSLIST_XML)
|
if (type != null && type.endsWith("keysList+xml")) {
|
||||||
|| type.equals(TerremarkECloudMediaType.KEYSLIST_XML)) {
|
|
||||||
keysList = newReferenceType(attributes);
|
keysList = newReferenceType(attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,7 @@ import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
@ -66,7 +67,6 @@ import org.jclouds.vcloud.predicates.TaskSuccess;
|
||||||
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
|
import org.jclouds.vcloud.terremark.domain.CustomizationParameters;
|
||||||
import org.jclouds.vcloud.terremark.domain.InternetService;
|
import org.jclouds.vcloud.terremark.domain.InternetService;
|
||||||
import org.jclouds.vcloud.terremark.domain.Node;
|
import org.jclouds.vcloud.terremark.domain.Node;
|
||||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
|
||||||
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
import org.jclouds.vcloud.terremark.domain.PublicIpAddress;
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem;
|
import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem;
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||||
|
@ -115,7 +115,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPublicIpsAssociatedWithVDC() throws Exception {
|
public void testGetPublicIpsAssociatedWithVDC() throws Exception {
|
||||||
for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) {
|
for (PublicIpAddress ip : tmClient
|
||||||
|
.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) {
|
||||||
assertNotNull(tmClient.getInternetServicesOnPublicIp(ip.getId()));
|
assertNotNull(tmClient.getInternetServicesOnPublicIp(ip.getId()));
|
||||||
assertNotNull(tmClient.getPublicIp(ip.getId()));
|
assertNotNull(tmClient.getPublicIp(ip.getId()));
|
||||||
}
|
}
|
||||||
|
@ -175,7 +176,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
||||||
VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getHref());
|
VCloudExpressVAppTemplate vAppTemplate = tmClient.getVAppTemplate(item.getEntity().getHref());
|
||||||
|
|
||||||
// instantiate, noting vApp returned has minimal details
|
// instantiate, noting vApp returned has minimal details
|
||||||
vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName, instantiateOptions);
|
vApp = tmClient.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName,
|
||||||
|
instantiateOptions);
|
||||||
|
|
||||||
assertEquals(vApp.getStatus(), Status.RESOLVED);
|
assertEquals(vApp.getStatus(), Status.RESOLVED);
|
||||||
|
|
||||||
|
@ -224,19 +226,16 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
||||||
|
|
||||||
abstract TerremarkInstantiateVAppTemplateOptions createInstantiateOptions();
|
abstract TerremarkInstantiateVAppTemplateOptions createInstantiateOptions();
|
||||||
|
|
||||||
|
protected abstract Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIpForSSH(URI vdc);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddInternetService() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
public void testAddInternetService() throws InterruptedException, ExecutionException, TimeoutException, IOException {
|
||||||
PublicIpAddress ip;
|
|
||||||
if (tmClient instanceof TerremarkVCloudExpressClient) {
|
Entry<InternetService, PublicIpAddress> entry = getNewInternetServiceAndIpForSSH(tmClient.findVDCInOrgNamed(null,
|
||||||
is = TerremarkVCloudExpressClient.class.cast(tmClient).addInternetServiceToVDC(
|
null).getHref());
|
||||||
tmClient.findVDCInOrgNamed(null, null).getHref(), "SSH", Protocol.TCP, 22);
|
is = entry.getKey();
|
||||||
ip = is.getPublicIpAddress();
|
publicIp = entry.getValue().getAddress();
|
||||||
} else {
|
|
||||||
ip = TerremarkECloudClient.class.cast(tmClient).activatePublicIpInVDC(
|
|
||||||
tmClient.findVDCInOrgNamed(null, null).getHref());
|
|
||||||
is = tmClient.addInternetServiceToExistingIp(ip.getId(), "SSH", Protocol.TCP, 22);
|
|
||||||
}
|
|
||||||
publicIp = ip.getAddress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testInstantiateAndPowerOn")
|
@Test(enabled = true, dependsOnMethods = "testInstantiateAndPowerOn")
|
||||||
|
@ -461,7 +460,8 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
|
||||||
Properties overrides = setupProperties();
|
Properties overrides = setupProperties();
|
||||||
|
|
||||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
|
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
|
||||||
|
.buildInjector();
|
||||||
|
|
||||||
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||||
|
|
|
@ -24,6 +24,10 @@ import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.classextension.EasyMock.createMock;
|
import static org.easymock.classextension.EasyMock.createMock;
|
||||||
import static org.easymock.classextension.EasyMock.replay;
|
import static org.easymock.classextension.EasyMock.replay;
|
||||||
import static org.easymock.classextension.EasyMock.verify;
|
import static org.easymock.classextension.EasyMock.verify;
|
||||||
|
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||||
|
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||||
|
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_NAME;
|
||||||
|
import static org.jclouds.vcloud.terremark.reference.TerremarkConstants.PROPERTY_TERREMARK_EXTENSION_VERSION;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -31,7 +35,7 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
@ -51,8 +55,12 @@ public class BindNodeConfigurationToXmlPayloadTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
Properties props = new Properties();
|
Properties properties = new Properties();
|
||||||
Names.bindProperties(binder(), checkNotNull(new TerremarkVCloudExpressPropertiesBuilder(props).build(),
|
properties.setProperty(PROPERTY_API_VERSION, "0.8a-ext1.6");
|
||||||
|
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_NAME, "vCloudExpressExtensions");
|
||||||
|
properties.setProperty(PROPERTY_TERREMARK_EXTENSION_VERSION, "1.6");
|
||||||
|
properties.setProperty(PROPERTY_ENDPOINT, "https://services.vcloudexpress.terremark.com/api");
|
||||||
|
Names.bindProperties(binder(), checkNotNull(new TerremarkVCloudPropertiesBuilder(properties).build(),
|
||||||
"properties"));
|
"properties"));
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -36,7 +36,7 @@ import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
|
import org.jclouds.vcloud.domain.internal.VCloudExpressVAppImpl;
|
||||||
import org.jclouds.vcloud.domain.ovf.ResourceAllocation;
|
import org.jclouds.vcloud.domain.ovf.ResourceAllocation;
|
||||||
import org.jclouds.vcloud.domain.ovf.ResourceType;
|
import org.jclouds.vcloud.domain.ovf.ResourceType;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressPropertiesBuilder;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudPropertiesBuilder;
|
||||||
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
|
import org.jclouds.vcloud.terremark.domain.VAppConfiguration;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class BindVAppConfigurationToXmlPayloadTest {
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
Names.bindProperties(binder(),
|
Names.bindProperties(binder(),
|
||||||
checkNotNull(new TerremarkVCloudExpressPropertiesBuilder(props).build(), "properties"));
|
checkNotNull(new TerremarkVCloudPropertiesBuilder(props).build(), "properties"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,10 +38,11 @@ import org.jclouds.vcloud.domain.Status;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
import org.jclouds.vcloud.domain.VCloudExpressVApp;
|
||||||
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptionToGetDefaultLoginCredentials;
|
||||||
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
|
||||||
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions;
|
||||||
|
import org.jclouds.vcloud.terremark.suppliers.InternetServiceAndPublicIpAddressSupplier;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -65,14 +66,14 @@ public class TerremarkVCloudComputeClientTest {
|
||||||
URI vdcURI = URI.create("vdc");
|
URI vdcURI = URI.create("vdc");
|
||||||
|
|
||||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||||
TerremarkVCloudExpressClient client = createMock(TerremarkVCloudExpressClient.class);
|
TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
|
||||||
VCloudExpressVApp vApp = createMock(VCloudExpressVApp.class);
|
VCloudExpressVApp vApp = createMock(VCloudExpressVApp.class);
|
||||||
|
InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
|
||||||
expect(client.getVAppTemplate(templateURI)).andReturn(template);
|
expect(client.getVAppTemplate(templateURI)).andReturn(template);
|
||||||
expect(
|
expect(
|
||||||
client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name",
|
client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name",
|
||||||
new TerremarkInstantiateVAppTemplateOptions().productProperty("password", "password"))).andReturn(
|
new TerremarkInstantiateVAppTemplateOptions().productProperty("password", "password")))
|
||||||
vApp);
|
.andReturn(vApp);
|
||||||
Task task = createMock(Task.class);
|
Task task = createMock(Task.class);
|
||||||
URI vappLocation = URI.create("vapp");
|
URI vappLocation = URI.create("vapp");
|
||||||
URI taskLocation = URI.create("task");
|
URI taskLocation = URI.create("task");
|
||||||
|
@ -96,7 +97,7 @@ public class TerremarkVCloudComputeClientTest {
|
||||||
return "password";
|
return "password";
|
||||||
}
|
}
|
||||||
|
|
||||||
}, successTester, vAppStatusToNodeState, credentialStore);
|
}, successTester, vAppStatusToNodeState, credentialStore, supplier);
|
||||||
|
|
||||||
replay(vdc);
|
replay(vdc);
|
||||||
replay(template);
|
replay(template);
|
|
@ -27,7 +27,7 @@ import static org.easymock.classextension.EasyMock.verify;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
import org.jclouds.vcloud.terremark.compute.domain.KeyPairCredentials;
|
import org.jclouds.vcloud.terremark.compute.domain.KeyPairCredentials;
|
||||||
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
|
import org.jclouds.vcloud.terremark.compute.domain.OrgAndName;
|
||||||
import org.jclouds.vcloud.terremark.domain.KeyPair;
|
import org.jclouds.vcloud.terremark.domain.KeyPair;
|
||||||
|
@ -126,7 +126,7 @@ public class DeleteKeyPairTest {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private DeleteKeyPair setupStrategy() {
|
private DeleteKeyPair setupStrategy() {
|
||||||
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap = createMock(ConcurrentMap.class);
|
ConcurrentMap<OrgAndName, KeyPairCredentials> credentialsMap = createMock(ConcurrentMap.class);
|
||||||
TerremarkVCloudExpressClient terremarkClient = createMock(TerremarkVCloudExpressClient.class);
|
TerremarkVCloudClient terremarkClient = createMock(TerremarkVCloudClient.class);
|
||||||
|
|
||||||
return new DeleteKeyPair(terremarkClient, credentialsMap);
|
return new DeleteKeyPair(terremarkClient, credentialsMap);
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue