mirror of https://github.com/apache/jclouds.git
Issue 280: more changes related to vcloud 1.0 orgs
This commit is contained in:
parent
df50812b53
commit
2db03edb18
|
@ -23,8 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.VCloudClientLiveTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -47,8 +47,8 @@ public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest {
|
|||
"bluelock-vclouddirector.identity");
|
||||
String credential = checkNotNull(System.getProperty("bluelock-vclouddirector.credential"),
|
||||
"bluelock-vclouddirector.credential");
|
||||
context = new RestContextFactory().createContext("bluelock-vclouddirector", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), new Properties());
|
||||
context = new ComputeServiceContextFactory().createContext("bluelock-vclouddirector", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext();
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.VCloudExpressClientLiveTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -46,8 +46,8 @@ public class BlueLockVCloudExpressClientLiveTest extends VCloudExpressClientLive
|
|||
identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity");
|
||||
String credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"),
|
||||
"bluelock-vcloudexpress.credential");
|
||||
context = new RestContextFactory().createContext("bluelock-vcloudexpress", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), new Properties());
|
||||
context = new ComputeServiceContextFactory().createContext("bluelock-vcloudexpress", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext();
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,20 +38,21 @@ import com.google.common.base.Supplier;
|
|||
*/
|
||||
@Singleton
|
||||
public class OrgNameToEndpoint implements Function<Object, URI> {
|
||||
private final Supplier<Map<String, NamedResource>> orgNameToEndpoint;
|
||||
private final Supplier<Map<String, NamedResource>> orgNameToEndpointSupplier;
|
||||
private final URI defaultUri;
|
||||
|
||||
@Inject
|
||||
public OrgNameToEndpoint(@Org Supplier<Map<String, NamedResource>> orgNameToEndpoint, @Org URI defaultUri) {
|
||||
this.orgNameToEndpoint = orgNameToEndpoint;
|
||||
public OrgNameToEndpoint(@Org Supplier<Map<String, NamedResource>> orgNameToEndpointSupplier, @Org URI defaultUri) {
|
||||
this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
|
||||
this.defaultUri = defaultUri;
|
||||
}
|
||||
|
||||
public URI apply(Object from) {
|
||||
try {
|
||||
return from == null ? defaultUri : orgNameToEndpoint.get().get(from).getId();
|
||||
Map<String, NamedResource> orgNameToEndpoint = orgNameToEndpointSupplier.get();
|
||||
return from == null ? defaultUri : orgNameToEndpoint.get(from).getId();
|
||||
} catch (NullPointerException e) {
|
||||
throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpoint.get().keySet());
|
||||
throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,9 @@ public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
|
|||
}
|
||||
|
||||
public URI apply(Object from) {
|
||||
Object org = checkNotNull(from, "args");
|
||||
Object org = from;
|
||||
if (org == null)
|
||||
return defaultUri;
|
||||
|
||||
try {
|
||||
return checkNotNull(orgMap.get().get(org)).getTasksList().getId();
|
||||
} catch (NullPointerException e) {
|
||||
|
|
|
@ -25,9 +25,9 @@ import static org.testng.Assert.assertNotNull;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.NamedResource;
|
||||
|
@ -166,10 +166,9 @@ public class VCloudClientLiveTest {
|
|||
public void setupClient() {
|
||||
setupCredentials();
|
||||
Properties props = new Properties();
|
||||
context = new RestContextFactory().createContext("vcloud", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), props);
|
||||
context = new ComputeServiceContextFactory().createContext("vcloud", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
|
||||
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ import static org.testng.Assert.assertNotNull;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.domain.Catalog;
|
||||
import org.jclouds.vcloud.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.domain.NamedResource;
|
||||
|
@ -166,8 +166,8 @@ public class VCloudExpressClientLiveTest {
|
|||
public void setupClient() {
|
||||
setupCredentials();
|
||||
Properties props = new Properties();
|
||||
context = new RestContextFactory().createContext("vcloudexpress", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), props);
|
||||
context = new ComputeServiceContextFactory().createContext("vcloudexpress", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
|
||||
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.vcloud.compute;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static org.jclouds.Constants.PROPERTY_TRUST_ALL_CERTS;
|
||||
import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.processorCount;
|
||||
import static org.jclouds.vcloud.predicates.VCloudPredicates.resourceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
@ -28,11 +29,13 @@ import static org.testng.Assert.assertEquals;
|
|||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.domain.ResourceType;
|
||||
|
@ -81,7 +84,7 @@ public class VCloudComputeClientLiveTest {
|
|||
|
||||
protected Map<OsFamily, Expectation> expectationMap;
|
||||
|
||||
protected Predicate<String> addressTester;
|
||||
protected Predicate<IPSocket> addressTester;
|
||||
private String identity;
|
||||
private String credential;
|
||||
|
||||
|
@ -114,7 +117,7 @@ public class VCloudComputeClientLiveTest {
|
|||
@Test(dependsOnMethods = "testPowerOn", enabled = true)
|
||||
public void testGetPublicAddresses() {
|
||||
publicAddress = Iterables.getLast(computeClient.getPublicAddresses(id));
|
||||
assert !addressTester.apply(publicAddress);
|
||||
assert !addressTester.apply(new IPSocket(publicAddress, 22));
|
||||
}
|
||||
|
||||
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs, int processorCount,
|
||||
|
@ -148,12 +151,14 @@ public class VCloudComputeClientLiveTest {
|
|||
@BeforeGroups(groups = { "live" })
|
||||
public void setupClient() {
|
||||
setupCredentials();
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true");
|
||||
Injector injector = new RestContextFactory().createContextBuilder("vcloud", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), properties).buildInjector();
|
||||
|
||||
computeClient = injector.getInstance(VCloudComputeClient.class);
|
||||
client = injector.getInstance(VCloudClient.class);
|
||||
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
|
||||
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<IPSocket>>() {
|
||||
}));
|
||||
expectationMap = ImmutableMap.<OsFamily, Expectation> builder().put(OsFamily.CENTOS,
|
||||
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
|
||||
|
|
|
@ -23,8 +23,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.vcloud.VCloudExpressClientLiveTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -46,8 +46,8 @@ public class HostingDotComVCloudClientLiveTest extends VCloudExpressClientLiveTe
|
|||
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
|
||||
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
|
||||
|
||||
context = new RestContextFactory().createContext("hostingdotcom", identity, credential, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), new Properties());
|
||||
context = new ComputeServiceContextFactory().createContext("hostingdotcom", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext();
|
||||
connection = context.getApi();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends VCloudExpressC
|
|||
@Override
|
||||
public void setServiceDefaults() {
|
||||
provider = "trmk-vcloudexpress";
|
||||
tag = "trmkvcx";
|
||||
tag = "vcx";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue