mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of git@github.com:jclouds/jclouds
* 'master' of git@github.com:jclouds/jclouds: Issue 191: added example to integrate chef with compute fixed parent project refs updated snapshot repository info Issue 280: added orglist command changed default test so that they work with self-signed certs
This commit is contained in:
commit
c1a989c9f6
|
@ -54,7 +54,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
$HeadURL$ $Revision$ $Date$ Copyright (C) 2010 Cloud Conscious, LLC
|
||||||
|
<info@cloudconscious.com>
|
||||||
|
|
||||||
|
====================================================================
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to you 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.html 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.
|
||||||
|
====================================================================
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<artifactId>jclouds-chef-project</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<groupId>org.jclouds</groupId>
|
||||||
|
<artifactId>jclouds-chef-compute</artifactId>
|
||||||
|
<name>jclouds chef compute integration</name>
|
||||||
|
<description>provisions nodes with jclouds and kick's off chef to configure and integrate</description>
|
||||||
|
<properties>
|
||||||
|
<!-- for example: ec2, trmk-ecloud, bluelock-vclouddirector, cloudservers, etc -->
|
||||||
|
<jclouds.compute.provider>YOUR_PREFERRED_PROVIDER</jclouds.compute.provider>
|
||||||
|
<!-- leave blank unless you have a different url to override -->
|
||||||
|
<jclouds.compute.endpoint></jclouds.compute.endpoint>
|
||||||
|
<jclouds.compute.identity>YOUR_ACCOUNT</jclouds.compute.identity>
|
||||||
|
<jclouds.compute.credential>YOUR_CREDENTIAL</jclouds.compute.credential>
|
||||||
|
<jclouds.chef.identity>YOUR_USER</jclouds.chef.identity>
|
||||||
|
<jclouds.chef.identity.pem>${user.home}/.chef/${jclouds.chef.identity}.pem</jclouds.chef.identity.pem>
|
||||||
|
<jclouds.opscodeplatform.org>YOUR_ORG</jclouds.opscodeplatform.org>
|
||||||
|
<jclouds.chef.endpoint>https://api.opscode.com/organizations/${jclouds.opscodeplatform.org}</jclouds.chef.endpoint>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<!-- bootstrapping: need to fetch the project POM -->
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jclouds-googlecode-deploy</id>
|
||||||
|
<url>http://jclouds.googlecode.com/svn/repo</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-chef</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-compute</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-compute</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>jclouds-allcompute</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>live</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>integration</id>
|
||||||
|
<phase>integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>none</exclude>
|
||||||
|
</excludes>
|
||||||
|
<includes>
|
||||||
|
<include>**/*LiveTest.java</include>
|
||||||
|
</includes>
|
||||||
|
<systemProperties>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.compute.provider</name>
|
||||||
|
<value>${jclouds.compute.provider}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.compute.endpoint</name>
|
||||||
|
<value>${jclouds.compute.endpoint}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.compute.identity</name>
|
||||||
|
<value>${jclouds.compute.identity}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.compute.credential</name>
|
||||||
|
<value>${jclouds.compute.credential}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.chef.identity</name>
|
||||||
|
<value>${jclouds.chef.identity}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.chef.identity.pem</name>
|
||||||
|
<value>${jclouds.chef.identity.pem}</value>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>jclouds.chef.endpoint</name>
|
||||||
|
<value>${jclouds.chef.endpoint}</value>
|
||||||
|
</property>
|
||||||
|
</systemProperties>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
</project>
|
|
@ -25,7 +25,7 @@
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-chef-project</artifactId>
|
<artifactId>jclouds-chef-project</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<relativePath>../project/pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-chef</artifactId>
|
<artifactId>jclouds-chef</artifactId>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -34,5 +34,6 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>core</module>
|
<module>core</module>
|
||||||
<module>servlet</module>
|
<module>servlet</module>
|
||||||
|
<module>compute</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-chef-project</artifactId>
|
<artifactId>jclouds-chef-project</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<relativePath>../project/pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.jclouds</groupId>
|
<groupId>org.jclouds</groupId>
|
||||||
<artifactId>jclouds-chef-servlet</artifactId>
|
<artifactId>jclouds-chef-servlet</artifactId>
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -50,6 +51,7 @@ 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;
|
||||||
|
|
||||||
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.domain.ComputeMetadata;
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
import org.jclouds.compute.domain.ComputeType;
|
import org.jclouds.compute.domain.ComputeType;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
|
@ -92,32 +94,32 @@ import com.google.inject.Module;
|
||||||
@Test(groups = { "integration", "live" }, sequential = true, testName = "compute.ComputeServiceLiveTest")
|
@Test(groups = { "integration", "live" }, sequential = true, testName = "compute.ComputeServiceLiveTest")
|
||||||
public abstract class BaseComputeServiceLiveTest {
|
public abstract class BaseComputeServiceLiveTest {
|
||||||
public static final String APT_RUN_SCRIPT = new StringBuilder()//
|
public static final String APT_RUN_SCRIPT = new StringBuilder()//
|
||||||
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
|
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
|
||||||
.append("cp /etc/apt/sources.list /etc/apt/sources.list.old\n")//
|
.append("cp /etc/apt/sources.list /etc/apt/sources.list.old\n")//
|
||||||
.append(
|
.append(
|
||||||
"sed 's~us.archive.ubuntu.com~mirror.anl.gov/pub~g' /etc/apt/sources.list.old >/etc/apt/sources.list\n")//
|
"sed 's~us.archive.ubuntu.com~mirror.anl.gov/pub~g' /etc/apt/sources.list.old >/etc/apt/sources.list\n")//
|
||||||
.append("apt-get update\n")//
|
.append("apt-get update\n")//
|
||||||
.append("apt-get install -f -y --force-yes openjdk-6-jdk\n")//
|
.append("apt-get install -f -y --force-yes openjdk-6-jdk\n")//
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
public static final String YUM_RUN_SCRIPT = new StringBuilder()
|
public static final String YUM_RUN_SCRIPT = new StringBuilder()
|
||||||
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")
|
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")
|
||||||
//
|
//
|
||||||
.append("echo \"[jdkrepo]\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
|
.append("echo \"[jdkrepo]\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
|
||||||
//
|
//
|
||||||
.append("echo \"name=jdkrepository\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
|
.append("echo \"name=jdkrepository\" >> /etc/yum.repos.d/CentOS-Base.repo\n")
|
||||||
//
|
//
|
||||||
.append(
|
.append(
|
||||||
"echo \"baseurl=http://ec2-us-east-mirror.rightscale.com/epel/5/i386/\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
|
"echo \"baseurl=http://ec2-us-east-mirror.rightscale.com/epel/5/i386/\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
|
||||||
.append("echo \"enabled=1\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
|
.append("echo \"enabled=1\" >> /etc/yum.repos.d/CentOS-Base.repo\n")//
|
||||||
.append("yum --nogpgcheck -y install java-1.6.0-openjdk\n")//
|
.append("yum --nogpgcheck -y install java-1.6.0-openjdk\n")//
|
||||||
.append("echo \"export PATH=\\\"/usr/lib/jvm/jre-1.6.0-openjdk/bin/:\\$PATH\\\"\" >> /root/.bashrc\n")//
|
.append("echo \"export PATH=\\\"/usr/lib/jvm/jre-1.6.0-openjdk/bin/:\\$PATH\\\"\" >> /root/.bashrc\n")//
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
public static final String ZYPPER_RUN_SCRIPT = new StringBuilder()//
|
public static final String ZYPPER_RUN_SCRIPT = new StringBuilder()//
|
||||||
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
|
.append("echo nameserver 208.67.222.222 >> /etc/resolv.conf\n")//
|
||||||
.append("sudo zypper install java-1.6.0-openjdk-devl\n")//
|
.append("sudo zypper install java-1.6.0-openjdk-devl\n")//
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
abstract public void setServiceDefaults();
|
abstract public void setServiceDefaults();
|
||||||
|
|
||||||
|
@ -165,7 +167,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
String secret = Files.toString(new File(secretKeyFile), Charsets.UTF_8);
|
String secret = Files.toString(new File(secretKeyFile), Charsets.UTF_8);
|
||||||
assert secret.startsWith("-----BEGIN RSA PRIVATE KEY-----") : "invalid key:\n" + secret;
|
assert secret.startsWith("-----BEGIN RSA PRIVATE KEY-----") : "invalid key:\n" + secret;
|
||||||
return ImmutableMap.<String, String> of("private", secret, "public", Files.toString(new File(secretKeyFile
|
return ImmutableMap.<String, String> of("private", secret, "public", Files.toString(new File(secretKeyFile
|
||||||
+ ".pub"), Charsets.UTF_8));
|
+ ".pub"), Charsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupCredentials() {
|
protected void setupCredentials() {
|
||||||
|
@ -180,8 +182,11 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
private void initializeContextAndClient() throws IOException {
|
private void initializeContextAndClient() throws IOException {
|
||||||
if (context != null)
|
if (context != null)
|
||||||
context.close();
|
context.close();
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
|
||||||
|
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
|
||||||
context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet.of(
|
context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet.of(
|
||||||
new Log4JLoggingModule(), getSshModule()));
|
new Log4JLoggingModule(), getSshModule()), props);
|
||||||
client = context.getComputeService();
|
client = context.getComputeService();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
ComputeServiceContext context = null;
|
ComputeServiceContext context = null;
|
||||||
try {
|
try {
|
||||||
context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet
|
context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet
|
||||||
.<Module> of(new Log4JLoggingModule()));
|
.<Module> of(new Log4JLoggingModule()));
|
||||||
context.getComputeService().listNodes();
|
context.getComputeService().listNodes();
|
||||||
} finally {
|
} finally {
|
||||||
if (context != null)
|
if (context != null)
|
||||||
|
@ -239,7 +244,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
OperatingSystem os = get(nodes, 0).getOperatingSystem();
|
OperatingSystem os = get(nodes, 0).getOperatingSystem();
|
||||||
try {
|
try {
|
||||||
Map<? extends NodeMetadata, ExecResponse> responses = runScriptWithCreds(tag, os, new Credentials(
|
Map<? extends NodeMetadata, ExecResponse> responses = runScriptWithCreds(tag, os, new Credentials(
|
||||||
good.identity, "romeo"));
|
good.identity, "romeo"));
|
||||||
assert false : "shouldn't pass with a bad password\n" + responses;
|
assert false : "shouldn't pass with a bad password\n" + responses;
|
||||||
} catch (RunScriptOnNodesException e) {
|
} catch (RunScriptOnNodesException e) {
|
||||||
assert getRootCause(e).getMessage().contains("Auth fail") : e;
|
assert getRootCause(e).getMessage().contains("Auth fail") : e;
|
||||||
|
@ -294,8 +299,8 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
template = buildTemplate(client.templateBuilder());
|
template = buildTemplate(client.templateBuilder());
|
||||||
|
|
||||||
template.getOptions().installPrivateKey(newStringPayload(keyPair.get("private"))).authorizePublicKey(
|
template.getOptions().installPrivateKey(newStringPayload(keyPair.get("private"))).authorizePublicKey(
|
||||||
newStringPayload(keyPair.get("public"))).runScript(
|
newStringPayload(keyPair.get("public"))).runScript(
|
||||||
newStringPayload(buildScript(template.getImage().getOperatingSystem())));
|
newStringPayload(buildScript(template.getImage().getOperatingSystem())));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkImageIdMatchesTemplate(NodeMetadata node) {
|
protected void checkImageIdMatchesTemplate(NodeMetadata node) {
|
||||||
|
@ -306,8 +311,8 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
protected void checkOsMatchesTemplate(NodeMetadata node) {
|
protected void checkOsMatchesTemplate(NodeMetadata node) {
|
||||||
if (node.getOperatingSystem() != null)
|
if (node.getOperatingSystem() != null)
|
||||||
assert node.getOperatingSystem().getFamily().equals(template.getImage().getOperatingSystem().getFamily()) : String
|
assert node.getOperatingSystem().getFamily().equals(template.getImage().getOperatingSystem().getFamily()) : String
|
||||||
.format("expecting family %s but got %s", template.getImage().getOperatingSystem().getFamily(), node
|
.format("expecting family %s but got %s", template.getImage().getOperatingSystem().getFamily(), node
|
||||||
.getOperatingSystem());
|
.getOperatingSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertLocationSameOrChild(Location test, Location expected) {
|
void assertLocationSameOrChild(Location test, Location expected) {
|
||||||
|
@ -332,10 +337,10 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<? extends NodeMetadata, ExecResponse> runScriptWithCreds(final String tag, OperatingSystem os,
|
protected Map<? extends NodeMetadata, ExecResponse> runScriptWithCreds(final String tag, OperatingSystem os,
|
||||||
Credentials creds) throws RunScriptOnNodesException {
|
Credentials creds) throws RunScriptOnNodesException {
|
||||||
try {
|
try {
|
||||||
return client.runScriptOnNodesMatching(runningWithTag(tag), newStringPayload(buildScript(os)),
|
return client.runScriptOnNodesMatching(runningWithTag(tag), newStringPayload(buildScript(os)),
|
||||||
overrideCredentialsWith(creds));
|
overrideCredentialsWith(creds));
|
||||||
} catch (SshException e) {
|
} catch (SshException e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +398,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
protected void assertNodeZero(Set<? extends NodeMetadata> metadataSet) {
|
protected void assertNodeZero(Set<? extends NodeMetadata> metadataSet) {
|
||||||
assert metadataSet.size() == 0 : String.format("nodes left in set: [%s] which didn't match set: [%s]",
|
assert metadataSet.size() == 0 : String.format("nodes left in set: [%s] which didn't match set: [%s]",
|
||||||
metadataSet, nodes);
|
metadataSet, nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testGet")
|
@Test(enabled = true, dependsOnMethods = "testGet")
|
||||||
|
@ -454,26 +459,26 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
assert location != location.getParent() : location;
|
assert location != location.getParent() : location;
|
||||||
assert location.getScope() != null : location;
|
assert location.getScope() != null : location;
|
||||||
switch (location.getScope()) {
|
switch (location.getScope()) {
|
||||||
case PROVIDER:
|
case PROVIDER:
|
||||||
assertProvider(location);
|
assertProvider(location);
|
||||||
break;
|
break;
|
||||||
case REGION:
|
case REGION:
|
||||||
assertProvider(location.getParent());
|
assertProvider(location.getParent());
|
||||||
break;
|
break;
|
||||||
case ZONE:
|
case ZONE:
|
||||||
Location provider = location.getParent().getParent();
|
Location provider = location.getParent().getParent();
|
||||||
// zone can be a direct descendant of provider
|
// zone can be a direct descendant of provider
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
provider = location.getParent();
|
provider = location.getParent();
|
||||||
assertProvider(provider);
|
assertProvider(provider);
|
||||||
break;
|
break;
|
||||||
case HOST:
|
case HOST:
|
||||||
Location provider2 = location.getParent().getParent().getParent();
|
Location provider2 = location.getParent().getParent().getParent();
|
||||||
// zone can be a direct descendant of provider
|
// zone can be a direct descendant of provider
|
||||||
if (provider2 == null)
|
if (provider2 == null)
|
||||||
provider2 = location.getParent().getParent();
|
provider2 = location.getParent().getParent();
|
||||||
assertProvider(provider2);
|
assertProvider(provider2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
classpathref="maven-ant-tasks.classpath" />
|
classpathref="maven-ant-tasks.classpath" />
|
||||||
|
|
||||||
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
|
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository" />
|
||||||
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots" />
|
<artifact:remoteRepository id="jclouds-snapshot.repository" url="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||||
<artifact:remoteRepository id="shrinkwrap.repository" url="http://repository.jboss.org/maven2" />
|
<artifact:remoteRepository id="shrinkwrap.repository" url="http://repository.jboss.org/maven2" />
|
||||||
|
|
||||||
<!-- Setup maven so that we can get latest version of jclouds, shrinkwrap, and jruby -->
|
<!-- Setup maven so that we can get latest version of jclouds, shrinkwrap, and jruby -->
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-rimu-snapshots-nexus</id>
|
||||||
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
<uniqueVersion>false</uniqueVersion>
|
<uniqueVersion>false</uniqueVersion>
|
||||||
</repository>
|
</repository>
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
<id>jclouds-rimu-snapshots-nexus</id>
|
<id>jclouds-snapshots</id>
|
||||||
<url>http://jclouds.rimuhosting.com/nexus/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository"/>
|
<artifact:localRepository id="local.repository" path="${user.home}/.m2/repository"/>
|
||||||
<artifact:remoteRepository id="jclouds.repository" url="http://jclouds.googlecode.com/svn/repo" />
|
<artifact:remoteRepository id="jclouds.repository" url="http://jclouds.googlecode.com/svn/repo" />
|
||||||
<artifact:remoteRepository id="jclouds-snapshot.repository" url="http://jclouds.rimuhosting.com/maven2/snapshots"/>
|
<artifact:remoteRepository id="jclouds-snapshot.repository" url="https://oss.sonatype.org/content/repositories/snapshots"/>
|
||||||
|
|
||||||
<!-- Setup maven so that we can get latest version of jclouds, jclouds, and jruby -->
|
<!-- Setup maven so that we can get latest version of jclouds, jclouds, and jruby -->
|
||||||
<artifact:dependencies pathId="jclouds.classpath">
|
<artifact:dependencies pathId="jclouds.classpath">
|
||||||
|
|
|
@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
public interface VCloudLoginAsyncClient {
|
public interface VCloudLoginAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This request returns a token to use in subsequent requests. After ten minutes of inactivity,
|
* This request returns a token to use in subsequent requests. After 30 minutes of inactivity,
|
||||||
* the token expires and you have to request a new token with this call.
|
* the token expires and you have to request a new token with this call.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
|
|
|
@ -27,6 +27,7 @@ import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
|
@ -38,6 +39,7 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.predicates.validators.DnsNameValidator;
|
import org.jclouds.predicates.validators.DnsNameValidator;
|
||||||
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.MapBinder;
|
import org.jclouds.rest.annotations.MapBinder;
|
||||||
|
@ -52,16 +54,19 @@ import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
|
||||||
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
|
||||||
|
import org.jclouds.vcloud.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
import org.jclouds.vcloud.domain.Vm;
|
import org.jclouds.vcloud.domain.Vm;
|
||||||
import org.jclouds.vcloud.domain.ovf.OvfEnvelope;
|
import org.jclouds.vcloud.domain.ovf.OvfEnvelope;
|
||||||
|
import org.jclouds.vcloud.endpoints.OrgList;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameCatalogNameVAppTemplateNameToEndpoint;
|
||||||
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
import org.jclouds.vcloud.functions.OrgNameVDCNameResourceEntityNameToEndpoint;
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
|
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppHandler;
|
import org.jclouds.vcloud.xml.VAppHandler;
|
||||||
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
||||||
|
@ -74,11 +79,21 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* Provides access to VCloud resources via their REST API.
|
* Provides access to VCloud resources via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx"
|
||||||
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequestFilters(SetVCloudTokenCookie.class)
|
@RequestFilters(SetVCloudTokenCookie.class)
|
||||||
public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @see VCloudClient#listOrgs
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Endpoint(OrgList.class)
|
||||||
|
@XMLResponseParser(OrgListHandler.class)
|
||||||
|
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||||
|
ListenableFuture<Map<String, ReferenceType>> listOrgs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#getVAppTemplate
|
* @see VCloudClient#getVAppTemplate
|
||||||
|
@ -107,9 +122,9 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(VAppTemplateHandler.class)
|
@XMLResponseParser(VAppTemplateHandler.class)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
|
ListenableFuture<? extends VAppTemplate> findVAppTemplateInOrgCatalogNamed(
|
||||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String orgName,
|
||||||
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
|
@Nullable @EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String catalogName,
|
||||||
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
|
@EndpointParam(parser = OrgNameCatalogNameVAppTemplateNameToEndpoint.class) String itemName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#instantiateVAppTemplateInVDC
|
* @see VCloudClient#instantiateVAppTemplateInVDC
|
||||||
|
@ -121,9 +136,9 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(VAppHandler.class)
|
@XMLResponseParser(VAppHandler.class)
|
||||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
@MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
ListenableFuture<? extends VApp> instantiateVAppTemplateInVDC(@EndpointParam URI vdc,
|
||||||
@MapPayloadParam("template") URI template,
|
@MapPayloadParam("template") URI template,
|
||||||
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
@MapPayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName,
|
||||||
InstantiateVAppTemplateOptions... options);
|
InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#cloneVAppInVDC
|
* @see VCloudClient#cloneVAppInVDC
|
||||||
|
@ -135,8 +150,8 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(TaskHandler.class)
|
@XMLResponseParser(TaskHandler.class)
|
||||||
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
@MapBinder(BindCloneVAppParamsToXmlPayload.class)
|
||||||
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
ListenableFuture<? extends Task> cloneVAppInVDC(@EndpointParam URI vdc, @MapPayloadParam("vApp") URI toClone,
|
||||||
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
@MapPayloadParam("newName") @ParamValidators(DnsNameValidator.class) String newName,
|
||||||
CloneVAppOptions... options);
|
CloneVAppOptions... options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#findVAppInOrgVDCNamed
|
* @see VCloudClient#findVAppInOrgVDCNamed
|
||||||
|
@ -146,9 +161,9 @@ public interface VCloudAsyncClient extends CommonVCloudAsyncClient {
|
||||||
@XMLResponseParser(VAppHandler.class)
|
@XMLResponseParser(VAppHandler.class)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
|
ListenableFuture<? extends VApp> findVAppInOrgVDCNamed(
|
||||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
|
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String orgName,
|
||||||
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
|
@Nullable @EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String catalogName,
|
||||||
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
|
@EndpointParam(parser = OrgNameVDCNameResourceEntityNameToEndpoint.class) String vAppName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VCloudClient#getVApp
|
* @see VCloudClient#getVApp
|
||||||
|
|
|
@ -20,12 +20,14 @@
|
||||||
package org.jclouds.vcloud;
|
package org.jclouds.vcloud;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
import org.jclouds.vcloud.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.domain.Task;
|
import org.jclouds.vcloud.domain.Task;
|
||||||
import org.jclouds.vcloud.domain.VApp;
|
import org.jclouds.vcloud.domain.VApp;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
@ -38,11 +40,20 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
* Provides access to VCloud resources via their REST API.
|
* Provides access to VCloud resources via their REST API.
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
|
* @see <a
|
||||||
|
* href="http://communities.vmware.com/community/developer/forums/vcloudapi"
|
||||||
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 300, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface VCloudClient extends CommonVCloudClient {
|
public interface VCloudClient extends CommonVCloudClient {
|
||||||
|
/**
|
||||||
|
* The response to a login request includes a list of the organizations to
|
||||||
|
* which the authenticated user has access.
|
||||||
|
*
|
||||||
|
* @return organizations indexed by name
|
||||||
|
*/
|
||||||
|
Map<String, ReferenceType> listOrgs();
|
||||||
|
|
||||||
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
VApp instantiateVAppTemplateInVDC(URI vDC, URI template, String appName, InstantiateVAppTemplateOptions... options);
|
||||||
|
|
||||||
|
@ -53,8 +64,9 @@ public interface VCloudClient extends CommonVCloudClient {
|
||||||
OvfEnvelope getOvfEnvelopeForVAppTemplate(URI vAppTemplate);
|
OvfEnvelope getOvfEnvelopeForVAppTemplate(URI vAppTemplate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the vapp template corresponding to a catalog item in the catalog associated with the
|
* returns the vapp template corresponding to a catalog item in the catalog
|
||||||
* specified name. Note that the org and catalog parameters can be null to choose default.
|
* associated with the specified name. Note that the org and catalog
|
||||||
|
* parameters can be null to choose default.
|
||||||
*
|
*
|
||||||
* @param orgName
|
* @param orgName
|
||||||
* organization name, or null for the default
|
* organization name, or null for the default
|
||||||
|
@ -64,10 +76,11 @@ public interface VCloudClient extends CommonVCloudClient {
|
||||||
* item you wish to lookup
|
* item you wish to lookup
|
||||||
*
|
*
|
||||||
* @throws NoSuchElementException
|
* @throws NoSuchElementException
|
||||||
* if you specified an org, catalog, or catalog item name that isn't present
|
* if you specified an org, catalog, or catalog item name that
|
||||||
|
* isn't present
|
||||||
*/
|
*/
|
||||||
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable String orgName, @Nullable String catalogName,
|
||||||
String itemName);
|
String itemName);
|
||||||
|
|
||||||
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
|
VApp findVAppInOrgVDCNamed(@Nullable String orgName, @Nullable String catalogName, String vAppName);
|
||||||
|
|
||||||
|
@ -76,100 +89,112 @@ public interface VCloudClient extends CommonVCloudClient {
|
||||||
Vm getVm(URI vm);
|
Vm getVm(URI vm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
|
* To deploy a vApp, the client makes a request to its action/deploy URL.
|
||||||
* automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
|
* Deploying a vApp automatically deploys all of the virtual machines it
|
||||||
* the client makes a request to its action/deploy URL.
|
* contains. To deploy a virtual machine, the client makes a request to its
|
||||||
|
* action/deploy URL.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
|
* Deploying a Vm implicitly deploys the parent vApp if that vApp is not
|
||||||
|
* already deployed.
|
||||||
*/
|
*/
|
||||||
Task deployVAppOrVm(URI vAppOrVmId);
|
Task deployVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* like {@link #deployVAppOrVm(URI)}, except deploy transistions to power on state
|
* like {@link #deployVAppOrVm(URI)}, except deploy transistions to power on
|
||||||
|
* state
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Task deployAndPowerOnVAppOrVm(URI vAppOrVmId);
|
Task deployAndPowerOnVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
|
* Undeploying a vApp powers off or suspends any running virtual machines it
|
||||||
* the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
|
* contains, then frees the resources reserved for the vApp and sets the
|
||||||
* to indicate that it is not deployed.
|
* vApp’s deploy attribute to a value of false to indicate that it is not
|
||||||
|
* deployed.
|
||||||
* <p/>
|
* <p/>
|
||||||
* Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
|
* Undeploying a virtual machine powers off or suspends the virtual machine,
|
||||||
* resources reserved for it and sets the its deploy attribute to a value of false to indicate
|
* then frees the resources reserved for it and sets the its deploy attribute
|
||||||
* that it is not deployed. This operation has no effect on the containing vApp.
|
* to a value of false to indicate that it is not deployed. This operation
|
||||||
|
* has no effect on the containing vApp.
|
||||||
* <h4>NOTE</h4>
|
* <h4>NOTE</h4>
|
||||||
* Using this method will simply power off the vms. In order to save their state, use
|
* Using this method will simply power off the vms. In order to save their
|
||||||
* {@link #undeployAndSaveStateOfVAppOrVm}
|
* state, use {@link #undeployAndSaveStateOfVAppOrVm}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Task undeployVAppOrVm(URI vAppOrVmId);
|
Task undeployVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* like {@link #undeployVAppOrVm(URI)}, where the undeployed virtual machines are suspended and
|
* like {@link #undeployVAppOrVm(URI)}, where the undeployed virtual machines
|
||||||
* their suspend state saved
|
* are suspended and their suspend state saved
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Task undeployAndSaveStateOfVAppOrVm(URI vAppOrVmId);
|
Task undeployAndSaveStateOfVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
|
* A powerOn request to a vApp URL powers on all of the virtual machines in
|
||||||
* specified in the vApp’s StartupSection field.
|
* the vApp, as specified in the vApp’s StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
|
* A powerOn request to a virtual machine URL powers on the specified virtual
|
||||||
* deployment of the parent vApp.
|
* machine and forces deployment of the parent vApp.
|
||||||
* <p/>
|
* <p/>
|
||||||
* <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
|
* <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is
|
||||||
* deployment.
|
* undeployed forces deployment.
|
||||||
*/
|
*/
|
||||||
Task powerOnVAppOrVm(URI vAppOrVmId);
|
Task powerOnVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
|
* A powerOff request to a vApp URL powers off all of the virtual machines in
|
||||||
* specified in its StartupSection field.
|
* the vApp, as specified in its StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A powerOff request to a virtual machine URL powers off the specified virtual machine.
|
* A powerOff request to a virtual machine URL powers off the specified
|
||||||
|
* virtual machine.
|
||||||
*/
|
*/
|
||||||
Task powerOffVAppOrVm(URI vAppOrVmId);
|
Task powerOffVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
|
* A shutdown request to a vApp URL shuts down all of the virtual machines in
|
||||||
* specified in its StartupSection field.
|
* the vApp, as specified in its StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A shutdown request to a virtual machine URL shuts down the specified virtual machine.
|
* A shutdown request to a virtual machine URL shuts down the specified
|
||||||
|
* virtual machine.
|
||||||
* <p/>
|
* <p/>
|
||||||
* <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
|
* <h4>NOTE</h4Because this request sends a signal to the guest OS, the
|
||||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
* vCloud API cannot track the progress or verify the result of the requested
|
||||||
|
* operation. Hence, void is returned
|
||||||
*/
|
*/
|
||||||
void shutdownVAppOrVm(URI vAppOrVmId);
|
void shutdownVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
|
* A reset request to a vApp URL resets all of the virtual machines in the
|
||||||
* its StartupSection field.
|
* vApp, as specified in its StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A reset request to a virtual machine URL resets the specified virtual machine.
|
* A reset request to a virtual machine URL resets the specified virtual
|
||||||
|
* machine.
|
||||||
*/
|
*/
|
||||||
Task resetVAppOrVm(URI vAppOrVmId);
|
Task resetVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
|
* A reboot request to a vApp URL reboots all of the virtual machines in the
|
||||||
* in its StartupSection field.
|
* vApp, as specified in its StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A reboot request to a virtual machine URL reboots the specified virtual machine.
|
* A reboot request to a virtual machine URL reboots the specified virtual
|
||||||
|
* machine.
|
||||||
* <p/>
|
* <p/>
|
||||||
* <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
|
* <h4>NOTE</h4> Because this request sends a signal to the guest OS, the
|
||||||
* the progress or verify the result of the requested operation. Hence, void is returned
|
* vCloud API cannot track the progress or verify the result of the requested
|
||||||
|
* operation. Hence, void is returned
|
||||||
*/
|
*/
|
||||||
void rebootVAppOrVm(URI vAppOrVmId);
|
void rebootVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
|
* A suspend request to a vApp URL suspends all of the virtual machines in
|
||||||
* in its StartupSection field.
|
* the vApp, as specified in its StartupSection field.
|
||||||
* <p/>
|
* <p/>
|
||||||
* A suspend request to a virtual machine URL suspends the specified virtual machine.
|
* A suspend request to a virtual machine URL suspends the specified virtual
|
||||||
|
* machine.
|
||||||
*/
|
*/
|
||||||
Task suspendVAppOrVm(URI vAppOrVmId);
|
Task suspendVAppOrVm(URI vAppOrVmId);
|
||||||
|
|
||||||
Task deleteVApp(URI vAppId);
|
Task deleteVApp(URI vAppId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ import org.jclouds.vcloud.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.domain.VCloudSession;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.endpoints.Network;
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
|
import org.jclouds.vcloud.endpoints.OrgList;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
import org.jclouds.vcloud.functions.AllCatalogItemsInCatalog;
|
import org.jclouds.vcloud.functions.AllCatalogItemsInCatalog;
|
||||||
import org.jclouds.vcloud.functions.AllCatalogsInOrg;
|
import org.jclouds.vcloud.functions.AllCatalogsInOrg;
|
||||||
|
@ -94,14 +95,15 @@ import com.google.inject.name.Names;
|
||||||
import domain.VCloudVersionsAsyncClient;
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging and http transport.
|
* Configures the VCloud authentication service connection, including logging
|
||||||
|
* and http transport.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> extends
|
public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> extends
|
||||||
RestClientModule<S, A> {
|
RestClientModule<S, A> {
|
||||||
|
|
||||||
public CommonVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
public CommonVCloudRestClientModule(Class<S> syncClientType, Class<A> asyncClientType) {
|
||||||
super(syncClientType, asyncClientType);
|
super(syncClientType, asyncClientType);
|
||||||
|
@ -144,20 +146,20 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Singleton
|
@Singleton
|
||||||
@org.jclouds.vcloud.endpoints.VDC
|
@org.jclouds.vcloud.endpoints.VDC
|
||||||
protected Supplier<Map<String, String>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<Map<String, String>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final Supplier<Map<String, ? extends Org>> orgToVDCSupplier) {
|
final Supplier<Map<String, ? extends Org>> orgToVDCSupplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, String>>(authException, seconds,
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, String>>(authException, seconds,
|
||||||
new Supplier<Map<String, String>>() {
|
new Supplier<Map<String, String>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> get() {
|
public Map<String, String> get() {
|
||||||
Map<String, String> returnVal = newLinkedHashMap();
|
Map<String, String> returnVal = newLinkedHashMap();
|
||||||
for (Entry<String, ? extends Org> orgr : orgToVDCSupplier.get().entrySet()) {
|
for (Entry<String, ? extends Org> orgr : orgToVDCSupplier.get().entrySet()) {
|
||||||
for (String vdc : orgr.getValue().getVDCs().keySet()) {
|
for (String vdc : orgr.getValue().getVDCs().keySet()) {
|
||||||
returnVal.put(vdc, orgr.getKey());
|
returnVal.put(vdc, orgr.getKey());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return returnVal;
|
|
||||||
}
|
}
|
||||||
});
|
return returnVal;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,15 +182,24 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<String, ? extends Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<Map<String, ? extends Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final OrgMapSupplier supplier) {
|
final OrgMapSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ? extends Org>>(authException,
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ? extends Org>>(authException,
|
||||||
seconds, new Supplier<Map<String, ? extends Org>>() {
|
seconds, new Supplier<Map<String, ? extends Org>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Org> get() {
|
public Map<String, ? extends Org> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@OrgList
|
||||||
|
URI provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
|
||||||
|
VCloudSession session = sessionSupplier.get();
|
||||||
|
return URI.create(Iterables.getLast(session.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*",
|
||||||
|
"org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -198,7 +209,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier,
|
protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier,
|
||||||
Function<Iterable<String>, Iterable<? extends Org>> organizationsForNames) {
|
Function<Iterable<String>, Iterable<? extends Org>> organizationsForNames) {
|
||||||
this.sessionSupplier = sessionSupplier;
|
this.sessionSupplier = sessionSupplier;
|
||||||
this.organizationsForNames = organizationsForNames;
|
this.organizationsForNames = organizationsForNames;
|
||||||
}
|
}
|
||||||
|
@ -211,13 +222,13 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public static class OrgCatalogSupplier implements
|
public static class OrgCatalogSupplier implements
|
||||||
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> {
|
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> {
|
||||||
protected final Supplier<Map<String, ? extends Org>> orgSupplier;
|
protected final Supplier<Map<String, ? extends Org>> orgSupplier;
|
||||||
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg;
|
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected OrgCatalogSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
|
protected OrgCatalogSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||||
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg) {
|
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.Catalog>> allCatalogsInOrg) {
|
||||||
this.orgSupplier = orgSupplier;
|
this.orgSupplier = orgSupplier;
|
||||||
this.allCatalogsInOrg = allCatalogsInOrg;
|
this.allCatalogsInOrg = allCatalogsInOrg;
|
||||||
}
|
}
|
||||||
|
@ -225,16 +236,16 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
||||||
return transformValues(
|
return transformValues(
|
||||||
transformValues(orgSupplier.get(), allCatalogsInOrg),
|
transformValues(orgSupplier.get(), allCatalogsInOrg),
|
||||||
new Function<Iterable<? extends org.jclouds.vcloud.domain.Catalog>, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>() {
|
new Function<Iterable<? extends org.jclouds.vcloud.domain.Catalog>, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends org.jclouds.vcloud.domain.Catalog> apply(
|
public Map<String, ? extends org.jclouds.vcloud.domain.Catalog> apply(
|
||||||
Iterable<? extends org.jclouds.vcloud.domain.Catalog> from) {
|
Iterable<? extends org.jclouds.vcloud.domain.Catalog> from) {
|
||||||
return uniqueIndex(from, name);
|
return uniqueIndex(from, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,27 +276,27 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@org.jclouds.vcloud.endpoints.Org
|
@org.jclouds.vcloud.endpoints.Org
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final OrgNameToOrgSupplier supplier) {
|
final OrgNameToOrgSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ReferenceType>>(authException,
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, ReferenceType>>(authException,
|
||||||
seconds, new Supplier<Map<String, ReferenceType>>() {
|
seconds, new Supplier<Map<String, ReferenceType>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ReferenceType> get() {
|
public Map<String, ReferenceType> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>> provideURIToVDC(
|
protected Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>> provideURIToVDC(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final URItoVDC supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final URItoVDC supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>(
|
||||||
authException, seconds, new Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>() {
|
authException, seconds, new Supplier<Map<URI, ? extends org.jclouds.vcloud.domain.VDC>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
|
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -300,24 +311,24 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Override
|
@Override
|
||||||
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
|
public Map<URI, ? extends org.jclouds.vcloud.domain.VDC> get() {
|
||||||
return uniqueIndex(
|
return uniqueIndex(
|
||||||
concat(transform(
|
concat(transform(
|
||||||
orgVDCMap.get().values(),
|
orgVDCMap.get().values(),
|
||||||
new Function<Map<String, ? extends org.jclouds.vcloud.domain.VDC>, Iterable<? extends org.jclouds.vcloud.domain.VDC>>() {
|
new Function<Map<String, ? extends org.jclouds.vcloud.domain.VDC>, Iterable<? extends org.jclouds.vcloud.domain.VDC>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends org.jclouds.vcloud.domain.VDC> apply(
|
public Iterable<? extends org.jclouds.vcloud.domain.VDC> apply(
|
||||||
Map<String, ? extends org.jclouds.vcloud.domain.VDC> from) {
|
Map<String, ? extends org.jclouds.vcloud.domain.VDC> from) {
|
||||||
return from.values();
|
return from.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
})), new Function<org.jclouds.vcloud.domain.VDC, URI>() {
|
})), new Function<org.jclouds.vcloud.domain.VDC, URI>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI apply(org.jclouds.vcloud.domain.VDC from) {
|
public URI apply(org.jclouds.vcloud.domain.VDC from) {
|
||||||
return from.getHref();
|
return from.getHref();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -346,8 +357,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Singleton
|
@Singleton
|
||||||
@org.jclouds.vcloud.endpoints.VCloudLogin
|
@org.jclouds.vcloud.endpoints.VCloudLogin
|
||||||
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
||||||
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException,
|
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
TimeoutException {
|
|
||||||
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
|
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
|
||||||
checkState(versions.size() > 0, "No versions present");
|
checkState(versions.size() > 0, "No versions present");
|
||||||
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
|
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
|
||||||
|
@ -381,7 +391,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@org.jclouds.vcloud.endpoints.Catalog
|
@org.jclouds.vcloud.endpoints.Catalog
|
||||||
@Singleton
|
@Singleton
|
||||||
protected String provideCatalogName(
|
protected String provideCatalogName(
|
||||||
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogs) {
|
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogs) {
|
||||||
return getLast(getLast(catalogs.get().values()).keySet());
|
return getLast(getLast(catalogs.get().values()).keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +399,7 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Network
|
@Network
|
||||||
@Singleton
|
@Singleton
|
||||||
protected URI provideDefaultNetwork(@org.jclouds.vcloud.endpoints.VDC URI defaultVDC, CommonVCloudClient client,
|
protected URI provideDefaultNetwork(@org.jclouds.vcloud.endpoints.VDC URI defaultVDC, CommonVCloudClient client,
|
||||||
Injector injector) {
|
Injector injector) {
|
||||||
if (authException.get() != null)
|
if (authException.get() != null)
|
||||||
throw authException.get();
|
throw authException.get();
|
||||||
try {
|
try {
|
||||||
|
@ -400,13 +410,13 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
return Iterables.getLast(networks.values()).getHref();
|
return Iterables.getLast(networks.values()).getHref();
|
||||||
try {
|
try {
|
||||||
String networkName = injector.getInstance(Key.get(String.class, Names
|
String networkName = injector.getInstance(Key.get(String.class, Names
|
||||||
.named(PROPERTY_VCLOUD_DEFAULT_NETWORK)));
|
.named(PROPERTY_VCLOUD_DEFAULT_NETWORK)));
|
||||||
ReferenceType network = networks.get(networkName);
|
ReferenceType network = networks.get(networkName);
|
||||||
checkState(network != null, String.format("network named %s not in %s", networkName, networks.keySet()));
|
checkState(network != null, String.format("network named %s not in %s", networkName, networks.keySet()));
|
||||||
return network.getHref();
|
return network.getHref();
|
||||||
} catch (ConfigurationException e) {
|
} catch (ConfigurationException e) {
|
||||||
throw new IllegalStateException(String.format("you must specify the property %s as one of %s",
|
throw new IllegalStateException(String.format("you must specify the property %s as one of %s",
|
||||||
PROPERTY_VCLOUD_DEFAULT_NETWORK, networks.keySet()), e);
|
PROPERTY_VCLOUD_DEFAULT_NETWORK, networks.keySet()), e);
|
||||||
}
|
}
|
||||||
} catch (AuthorizationException e) {
|
} catch (AuthorizationException e) {
|
||||||
authException.set(e);
|
authException.set(e);
|
||||||
|
@ -430,49 +440,48 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Predicate<URI> successTester(Injector injector,
|
protected Predicate<URI> successTester(Injector injector,
|
||||||
@Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) {
|
@Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) {
|
||||||
return new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), completed);
|
return new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> provideOrgCatalogItemMapSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> provideOrgCatalogItemMapSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>(
|
||||||
authException, seconds,
|
authException, seconds,
|
||||||
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>() {
|
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
||||||
authException, seconds,
|
authException, seconds, new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
||||||
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
@Override
|
||||||
@Override
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
return supplier.get();
|
||||||
return supplier.get();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public static class OrgVDCSupplier implements
|
public static class OrgVDCSupplier implements
|
||||||
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> {
|
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> {
|
||||||
protected final Supplier<Map<String, ? extends Org>> orgSupplier;
|
protected final Supplier<Map<String, ? extends Org>> orgSupplier;
|
||||||
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg;
|
private final Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected OrgVDCSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
|
protected OrgVDCSupplier(Supplier<Map<String, ? extends Org>> orgSupplier,
|
||||||
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg) {
|
Function<Org, Iterable<? extends org.jclouds.vcloud.domain.VDC>> allVDCsInOrg) {
|
||||||
this.orgSupplier = orgSupplier;
|
this.orgSupplier = orgSupplier;
|
||||||
this.allVDCsInOrg = allVDCsInOrg;
|
this.allVDCsInOrg = allVDCsInOrg;
|
||||||
}
|
}
|
||||||
|
@ -480,29 +489,29 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
||||||
return transformValues(
|
return transformValues(
|
||||||
transformValues(orgSupplier.get(), allVDCsInOrg),
|
transformValues(orgSupplier.get(), allVDCsInOrg),
|
||||||
new Function<Iterable<? extends org.jclouds.vcloud.domain.VDC>, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>() {
|
new Function<Iterable<? extends org.jclouds.vcloud.domain.VDC>, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends org.jclouds.vcloud.domain.VDC> apply(
|
public Map<String, ? extends org.jclouds.vcloud.domain.VDC> apply(
|
||||||
Iterable<? extends org.jclouds.vcloud.domain.VDC> from) {
|
Iterable<? extends org.jclouds.vcloud.domain.VDC> from) {
|
||||||
return uniqueIndex(from, name);
|
return uniqueIndex(from, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public static class OrgCatalogItemSupplier implements
|
public static class OrgCatalogItemSupplier implements
|
||||||
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> {
|
Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> {
|
||||||
protected final Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier;
|
protected final Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier;
|
||||||
private final Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog;
|
private final Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected OrgCatalogItemSupplier(
|
protected OrgCatalogItemSupplier(
|
||||||
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier,
|
Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>>> catalogSupplier,
|
||||||
Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog) {
|
Function<org.jclouds.vcloud.domain.Catalog, Iterable<? extends CatalogItem>> allCatalogItemsInCatalog) {
|
||||||
this.catalogSupplier = catalogSupplier;
|
this.catalogSupplier = catalogSupplier;
|
||||||
this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
|
this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
|
||||||
}
|
}
|
||||||
|
@ -510,40 +519,39 @@ public class CommonVCloudRestClientModule<S extends CommonVCloudClient, A extend
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||||
return transformValues(
|
return transformValues(
|
||||||
catalogSupplier.get(),
|
catalogSupplier.get(),
|
||||||
new Function<Map<String, ? extends org.jclouds.vcloud.domain.Catalog>, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>() {
|
new Function<Map<String, ? extends org.jclouds.vcloud.domain.Catalog>, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends CatalogItem>> apply(
|
public Map<String, Map<String, ? extends CatalogItem>> apply(
|
||||||
Map<String, ? extends org.jclouds.vcloud.domain.Catalog> from) {
|
Map<String, ? extends org.jclouds.vcloud.domain.Catalog> from) {
|
||||||
return transformValues(
|
return transformValues(
|
||||||
from,
|
from,
|
||||||
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends CatalogItem> apply(
|
public Map<String, ? extends CatalogItem> apply(org.jclouds.vcloud.domain.Catalog from) {
|
||||||
org.jclouds.vcloud.domain.Catalog from) {
|
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
||||||
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> provideOrgCatalogItemSupplierCache(
|
protected Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>> provideOrgCatalogItemSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogItemSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgCatalogItemSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>(
|
||||||
authException, seconds,
|
authException, seconds,
|
||||||
new Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>() {
|
new Supplier<Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.domain;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.domain.ovf.ResourceAllocation;
|
||||||
|
import org.jclouds.vcloud.domain.ovf.System;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The InstantiateVAppTemplateParams element forms the body of an instantiateVappTemplate request.
|
||||||
|
*/
|
||||||
|
public class InstantiateVAppTemplateParams {
|
||||||
|
|
||||||
|
protected final String info;
|
||||||
|
protected final System virtualSystem;
|
||||||
|
protected final Set<ResourceAllocation> resourceAllocations = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
public InstantiateVAppTemplateParams(String info, System virtualSystem, Iterable<? extends ResourceAllocation> resourceAllocations) {
|
||||||
|
this.info = info;
|
||||||
|
this.virtualSystem = virtualSystem;
|
||||||
|
Iterables.addAll(this.resourceAllocations, resourceAllocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public System getSystem() {
|
||||||
|
return virtualSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<? extends ResourceAllocation> getResourceAllocations() {
|
||||||
|
return resourceAllocations;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[info=" + getInfo() + ", virtualSystem=" + getSystem() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((info == null) ? 0 : info.hashCode());
|
||||||
|
result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
|
||||||
|
result = prime * result + ((virtualSystem == null) ? 0 : virtualSystem.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
InstantiateVAppTemplateParams other = (InstantiateVAppTemplateParams) obj;
|
||||||
|
if (info == null) {
|
||||||
|
if (other.info != null)
|
||||||
|
return false;
|
||||||
|
} else if (!info.equals(other.info))
|
||||||
|
return false;
|
||||||
|
if (resourceAllocations == null) {
|
||||||
|
if (other.resourceAllocations != null)
|
||||||
|
return false;
|
||||||
|
} else if (!resourceAllocations.equals(other.resourceAllocations))
|
||||||
|
return false;
|
||||||
|
if (virtualSystem == null) {
|
||||||
|
if (other.virtualSystem != null)
|
||||||
|
return false;
|
||||||
|
} else if (!virtualSystem.equals(other.virtualSystem))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 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.endpoints;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Related to a VCloud express Org List.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Qualifier
|
||||||
|
public @interface OrgList {
|
||||||
|
|
||||||
|
}
|
|
@ -45,6 +45,7 @@ import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.RestClientTest;
|
import org.jclouds.rest.RestClientTest;
|
||||||
import org.jclouds.rest.RestContextFactory;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
||||||
|
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
|
||||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
|
@ -67,6 +68,7 @@ import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||||
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
import org.jclouds.vcloud.xml.CatalogItemHandler;
|
||||||
import org.jclouds.vcloud.xml.OrgHandler;
|
import org.jclouds.vcloud.xml.OrgHandler;
|
||||||
|
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||||
|
@ -97,21 +99,21 @@ import domain.VCloudVersionsAsyncClient;
|
||||||
public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
|
public void testInstantiateVAppTemplateInVDCURIOptions() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp",
|
||||||
addNetworkConfig(new NetworkConfig("aloha", URI
|
addNetworkConfig(new NetworkConfig("aloha", URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED)));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream(
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream(
|
||||||
"/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
|
"/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
|
||||||
false);
|
false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
assertSaxResponseParserClassEquals(method, VAppHandler.class);
|
||||||
|
@ -122,28 +124,28 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
|
public void testInstantiateVAppTemplateInOrgOptionsIllegalName() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
processor.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
processor
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "CentOS 01", processorCount(1).memory(512)
|
.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.disk(1024).addNetworkConfig(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "CentOS 01", processorCount(1).memory(
|
||||||
new NetworkConfig(null, URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"),
|
512).disk(1024).addNetworkConfig(
|
||||||
null)));
|
new NetworkConfig(null, URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneVAppInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||||
CloneVAppOptions[].class);
|
CloneVAppOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-vapp");
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-vapp");
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp-default.xml")),
|
||||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -154,17 +156,17 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneVAppInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("cloneVAppInVDC", URI.class, URI.class, String.class,
|
||||||
CloneVAppOptions[].class);
|
CloneVAppOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server", new CloneVAppOptions()
|
||||||
new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp"));
|
.deploy().powerOn().withDescription("The description of the new vApp"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml")),
|
assertPayloadEquals(request, Utils.toStringAndClose(getClass().getResourceAsStream("/cloneVApp.xml")),
|
||||||
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -173,10 +175,25 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = VCloudAsyncClient.class.getMethod("listOrgs");
|
||||||
|
HttpRequest request = processor.createRequest(method);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
|
||||||
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, OrgListHandler.class);
|
||||||
|
assertExceptionParserClassEquals(method, MapHttp4xxCodesToExceptions.class);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getOrg", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getOrg", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
||||||
|
@ -207,7 +224,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getCatalog", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getCatalog", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||||
|
@ -238,7 +255,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getNetwork", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getNetwork", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
||||||
|
@ -254,7 +271,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getCatalogItem", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
||||||
|
@ -269,7 +286,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class, String.class,
|
Method method = VCloudAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
|
HttpRequest request = processor.createRequest(method, "org", "catalog", "item");
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
||||||
|
@ -285,7 +302,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
Method method = VCloudAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
|
HttpRequest request = processor.createRequest(method, "org", "catalog", "template");
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||||
|
@ -302,7 +319,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVAppTemplate", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||||
|
@ -318,7 +335,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getOvfEnvelopeForVAppTemplate", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getOvfEnvelopeForVAppTemplate", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
|
||||||
|
@ -391,7 +408,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVDC", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVDC", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
||||||
|
@ -407,7 +424,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getTasksList", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getTasksList", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
||||||
|
@ -438,12 +455,12 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testDeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("deployVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("deployVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
||||||
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -455,12 +472,12 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testDeployAndPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployAndPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("deployAndPowerOnVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("deployAndPowerOnVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
|
assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
|
||||||
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.deployVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -472,7 +489,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
|
||||||
|
@ -488,7 +505,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
|
||||||
|
@ -504,10 +521,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testRebootVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRebootVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("rebootVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("rebootVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -521,13 +538,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testUndeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUndeployVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("undeployVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("undeployVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
|
||||||
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -537,17 +554,17 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUndeployAndSaveStateOfVAppOrVmSaveState() throws SecurityException, NoSuchMethodException,
|
public void testUndeployAndSaveStateOfVAppOrVmSaveState() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("undeployAndSaveStateOfVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("undeployAndSaveStateOfVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request,
|
||||||
"<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
|
"<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
|
||||||
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
"application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
assertSaxResponseParserClassEquals(method, TaskHandler.class);
|
||||||
|
@ -559,7 +576,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("deleteVApp", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("deleteVApp", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -575,10 +592,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOnVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("powerOnVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("powerOnVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -592,10 +609,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testPowerOffVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOffVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("powerOffVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("powerOffVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -609,10 +626,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testResetVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testResetVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("resetVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("resetVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -626,10 +643,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testSuspendVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSuspendVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("suspendVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("suspendVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -643,10 +660,10 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testShutdownVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
public void testShutdownVAppOrVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("shutdownVAppOrVm", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("shutdownVAppOrVm", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -660,7 +677,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("getTask", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("getTask", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
|
||||||
|
@ -676,7 +693,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("cancelTask", URI.class);
|
Method method = VCloudAsyncClient.class.getMethod("cancelTask", URI.class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1"));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -718,7 +735,7 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public static class VCloudRestClientModuleExtension extends VCloudRestClientModule {
|
public static class VCloudRestClientModuleExtension extends VCloudRestClientModule {
|
||||||
@Override
|
@Override
|
||||||
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
||||||
@Named(PROPERTY_API_VERSION) String version) {
|
@Named(PROPERTY_API_VERSION) String version) {
|
||||||
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/login");
|
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,13 +778,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final VCloudLoginAsyncClient login) {
|
final VCloudLoginAsyncClient login) {
|
||||||
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ReferenceType> getOrgs() {
|
public Map<String, ReferenceType> getOrgs() {
|
||||||
return ImmutableMap.<String, ReferenceType> of("org", new ReferenceTypeImpl("org",
|
return ImmutableMap.<String, ReferenceType> of("org", new ReferenceTypeImpl("org",
|
||||||
VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
VCloudMediaType.ORG_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -788,44 +805,19 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
||||||
|
|
||||||
return Suppliers
|
return Suppliers.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
||||||
.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of("org",
|
||||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of(
|
|
||||||
"org",
|
|
||||||
|
|
||||||
ImmutableMap
|
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of("vdc", new VDCImpl("vdc", null, URI
|
||||||
.<String, org.jclouds.vcloud.domain.VDC> of(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), null, null, "description", null,
|
||||||
"vdc",
|
null, null, null, null, ImmutableMap.<String, ReferenceType> of("vapp", new ReferenceTypeImpl(
|
||||||
new VDCImpl(
|
"vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
|
||||||
"vdc",
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")), "network",
|
||||||
null,
|
new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||||
URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))), null, 0, 0, 0,
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"),
|
false))));
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"description",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
ImmutableMap
|
|
||||||
.<String, ReferenceType> of(
|
|
||||||
"vapp",
|
|
||||||
new ReferenceTypeImpl(
|
|
||||||
"vapp",
|
|
||||||
"application/vnd.vmware.vcloud.vApp+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
|
|
||||||
"network",
|
|
||||||
new ReferenceTypeImpl(
|
|
||||||
"network",
|
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
|
|
||||||
null, 0, 0, 0, false))));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,18 +831,15 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Org> get() {
|
public Map<String, Org> get() {
|
||||||
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
|
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", null, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap
|
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "org", "description", ImmutableMap
|
||||||
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog",
|
.<String, ReferenceType> of("catalog", new ReferenceTypeImpl("catalog", VCloudMediaType.CATALOG_XML,
|
||||||
VCloudMediaType.CATALOG_XML, URI
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML, URI
|
||||||
.<String, ReferenceType> of("vdc", new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML, URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
.<String, ReferenceType> of("network", new ReferenceTypeImpl("network", VCloudMediaType.NETWORK_XML,
|
||||||
.<String, ReferenceType> of("network", new ReferenceTypeImpl("network",
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))), new ReferenceTypeImpl(
|
||||||
VCloudMediaType.NETWORK_XML, URI
|
"tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))),
|
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList.<Task> of()));
|
||||||
new ReferenceTypeImpl("tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")), ImmutableList
|
|
||||||
.<Task> of()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,14 +855,13 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
|
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
|
||||||
|
|
||||||
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
|
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", "type",
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description",
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), null, "description", ImmutableMap
|
||||||
ImmutableMap.<String, ReferenceType> of("item", new ReferenceTypeImpl("item",
|
.<String, ReferenceType> of("item", new ReferenceTypeImpl("item",
|
||||||
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")), "template",
|
||||||
"template", new ReferenceTypeImpl("template",
|
new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
|
ImmutableList.<Task> of(), true)));
|
||||||
ImmutableList.<Task> of(), true)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,26 +873,14 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||||
return ImmutableMap
|
return ImmutableMap.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
||||||
.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
"org", ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
||||||
"org",
|
"catalog", ImmutableMap.<String, org.jclouds.vcloud.domain.CatalogItem> of("template",
|
||||||
ImmutableMap
|
new CatalogItemImpl("template", URI
|
||||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
|
||||||
"catalog",
|
new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||||
ImmutableMap
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
||||||
.<String, org.jclouds.vcloud.domain.CatalogItem> of(
|
ImmutableMap.<String, String> of()))));
|
||||||
"template",
|
|
||||||
new CatalogItemImpl(
|
|
||||||
"template",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"),
|
|
||||||
"description",
|
|
||||||
new ReferenceTypeImpl(
|
|
||||||
"template",
|
|
||||||
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
|
||||||
URI
|
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
|
||||||
ImmutableMap.<String, String> of()))));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,17 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
|
||||||
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
|
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testListOrgs() throws Exception {
|
||||||
|
for (ReferenceType response : connection.listOrgs().values()) {
|
||||||
|
assertNotNull(response);
|
||||||
|
assertNotNull(response.getName());
|
||||||
|
assertNotNull(response.getHref());
|
||||||
|
assertEquals(connection.getOrg(response.getHref()).getName(), response.getName());
|
||||||
|
assertEquals(connection.findOrgNamed(response.getName()).getName(), response.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetVAppTemplate() throws Exception {
|
public void testGetVAppTemplate() throws Exception {
|
||||||
Org org = connection.findOrgNamed(null);
|
Org org = connection.findOrgNamed(null);
|
||||||
|
@ -137,7 +148,7 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
|
||||||
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
|
||||||
try {
|
try {
|
||||||
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
|
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
|
||||||
.getEntity().getName()));
|
.getEntity().getName()));
|
||||||
} catch (AuthorizationException e) {
|
} catch (AuthorizationException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue