mirror of https://github.com/apache/jclouds.git
commit
109db817ed
|
@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
|
import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
|
||||||
import org.jclouds.atmos.config.AtmosRestClientModule;
|
import org.jclouds.atmos.config.AtmosRestClientModule;
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -42,7 +41,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class AtmosApiMetadata extends BaseRestApiMetadata {
|
public class AtmosApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<AtmosClient, AtmosAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<AtmosClient, AtmosAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as
|
||||||
|
* {@link AtmosAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<AtmosClient, AtmosAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<AtmosClient, AtmosAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +75,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(AtmosClient.class, AtmosAsyncClient.class);
|
super(AtmosClient.class, AtmosAsyncClient.class);
|
||||||
id("atmos")
|
id("atmos")
|
||||||
|
|
|
@ -75,7 +75,11 @@ import com.google.inject.Provides;
|
||||||
* @see AtmosClient
|
* @see AtmosClient
|
||||||
* @see <a href="https://community.emc.com/community/labs/atmos_online" />
|
* @see <a href="https://community.emc.com/community/labs/atmos_online" />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(AtmosClient.class)} as
|
||||||
|
* {@link AtmosAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(SignRequest.class)
|
@RequestFilters(SignRequest.class)
|
||||||
@Path("/rest/namespace")
|
@Path("/rest/namespace")
|
||||||
public interface AtmosAsyncClient extends Closeable {
|
public interface AtmosAsyncClient extends Closeable {
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.jclouds.cloudfiles.config.CloudFilesRestClientModule.StorageAndCDNMan
|
||||||
import org.jclouds.openstack.swift.SwiftApiMetadata;
|
import org.jclouds.openstack.swift.SwiftApiMetadata;
|
||||||
import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
|
import org.jclouds.openstack.swift.blobstore.SwiftBlobSigner;
|
||||||
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
|
import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
@ -43,7 +42,12 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
public class CloudFilesApiMetadata extends SwiftApiMetadata {
|
public class CloudFilesApiMetadata extends SwiftApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudFilesClient, CloudFilesAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudFilesClient, CloudFilesAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as
|
||||||
|
* {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudFilesClient, CloudFilesAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudFilesClient, CloudFilesAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,6 +70,7 @@ public class CloudFilesApiMetadata extends SwiftApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends SwiftApiMetadata.Builder<Builder> {
|
public static class Builder extends SwiftApiMetadata.Builder<Builder> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder(){
|
protected Builder(){
|
||||||
super(CloudFilesClient.class, CloudFilesAsyncClient.class);
|
super(CloudFilesClient.class, CloudFilesAsyncClient.class);
|
||||||
id("cloudfiles")
|
id("cloudfiles")
|
||||||
|
|
|
@ -64,7 +64,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @see CloudFilesClient
|
* @see CloudFilesClient
|
||||||
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
|
* @see <a href="http://www.rackspacecloud.com/cf-devguide-20090812.pdf" />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudFilesClient.class)} as
|
||||||
|
* {@link CloudFilesAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
@Endpoint(Storage.class)
|
@Endpoint(Storage.class)
|
||||||
public interface CloudFilesAsyncClient extends SwiftAsyncClient {
|
public interface CloudFilesAsyncClient extends SwiftAsyncClient {
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
|
import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
|
||||||
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
|
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -41,7 +40,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CloudServersApiMetadata extends BaseRestApiMetadata {
|
public class CloudServersApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudServersClient, CloudServersAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudServersClient, CloudServersAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as
|
||||||
|
* {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +69,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(CloudServersClient.class, CloudServersAsyncClient.class);
|
super(CloudServersClient.class, CloudServersAsyncClient.class);
|
||||||
id("cloudservers")
|
id("cloudservers")
|
||||||
|
|
|
@ -74,7 +74,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @see CloudServersClient
|
* @see CloudServersClient
|
||||||
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
|
* @see <a href="http://docs.rackspacecloud.com/servers/api/cs-devguide-latest.pdf" />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as
|
||||||
|
* {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
|
@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
|
||||||
@Endpoint(Compute.class)
|
@Endpoint(Compute.class)
|
||||||
public interface CloudServersAsyncClient extends Closeable {
|
public interface CloudServersAsyncClient extends Closeable {
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule;
|
import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule;
|
||||||
import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule;
|
import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -42,7 +41,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudSigmaClient, CloudSigmaAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudSigmaClient, CloudSigmaAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as
|
||||||
|
* {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudSigmaClient, CloudSigmaAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudSigmaClient, CloudSigmaAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,6 +76,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(CloudSigmaClient.class, CloudSigmaAsyncClient.class);
|
super(CloudSigmaClient.class, CloudSigmaAsyncClient.class);
|
||||||
id("cloudsigma")
|
id("cloudsigma")
|
||||||
|
|
|
@ -73,7 +73,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @see CloudSigmaClient
|
* @see CloudSigmaClient
|
||||||
* @see <a href="http://cloudsigma.com/en/platform-details/the-api" />
|
* @see <a href="http://cloudsigma.com/en/platform-details/the-api" />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudSigmaClient.class)} as
|
||||||
|
* {@link CloudSigmaAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(BasicAuthentication.class)
|
@RequestFilters(BasicAuthentication.class)
|
||||||
@Consumes(MediaType.TEXT_PLAIN)
|
@Consumes(MediaType.TEXT_PLAIN)
|
||||||
public interface CloudSigmaAsyncClient extends Closeable {
|
public interface CloudSigmaAsyncClient extends Closeable {
|
||||||
|
|
|
@ -47,7 +47,6 @@ import org.jclouds.compute.domain.ExecResponse;
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||||
import org.jclouds.domain.LoginCredentials;
|
import org.jclouds.domain.LoginCredentials;
|
||||||
import org.jclouds.predicates.SocketOpen;
|
import org.jclouds.predicates.SocketOpen;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.testng.annotations.AfterGroups;
|
import org.testng.annotations.AfterGroups;
|
||||||
|
@ -78,7 +77,6 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
protected int maxDriveImageTime = 300;
|
protected int maxDriveImageTime = 300;
|
||||||
protected String vncPassword = "Il0veVNC";
|
protected String vncPassword = "Il0veVNC";
|
||||||
protected CloudSigmaClient client;
|
protected CloudSigmaClient client;
|
||||||
protected RestContext<CloudSigmaClient, CloudSigmaAsyncClient> cloudSigmaContext;
|
|
||||||
protected Predicate<HostAndPort> socketTester;
|
protected Predicate<HostAndPort> socketTester;
|
||||||
|
|
||||||
protected Predicate<DriveInfo> driveNotClaimed;
|
protected Predicate<DriveInfo> driveNotClaimed;
|
||||||
|
@ -88,9 +86,8 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
cloudSigmaContext = view.unwrap();
|
|
||||||
|
|
||||||
client = cloudSigmaContext.getApi();
|
client = view.utils().injector().getInstance(CloudSigmaClient.class);
|
||||||
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
|
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
|
||||||
SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class);
|
SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class);
|
||||||
socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS);
|
socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS);
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.cloudstack.compute.config.CloudStackComputeServiceContextModule;
|
import org.jclouds.cloudstack.compute.config.CloudStackComputeServiceContextModule;
|
||||||
import org.jclouds.cloudstack.config.CloudStackParserModule;
|
import org.jclouds.cloudstack.config.CloudStackParserModule;
|
||||||
import org.jclouds.cloudstack.config.CloudStackRestClientModule;
|
import org.jclouds.cloudstack.config.CloudStackRestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -39,7 +38,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CloudStackApiMetadata extends BaseRestApiMetadata {
|
public class CloudStackApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudStackClient, CloudStackAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudStackClient, CloudStackAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackClient.class)} as
|
||||||
|
* {@link CloudStackAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudStackClient, CloudStackAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudStackClient, CloudStackAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +69,7 @@ public class CloudStackApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(CloudStackClient.class, CloudStackAsyncClient.class);
|
super(CloudStackClient.class, CloudStackAsyncClient.class);
|
||||||
id("cloudstack")
|
id("cloudstack")
|
||||||
|
|
|
@ -50,7 +50,10 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see CloudStackClient
|
* @see CloudStackClient
|
||||||
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
|
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackClient.class)} as
|
||||||
|
* {@link CloudStackAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CloudStackAsyncClient {
|
public interface CloudStackAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.cloudstack;
|
||||||
|
|
||||||
import org.jclouds.cloudstack.internal.CloudStackContextImpl;
|
import org.jclouds.cloudstack.internal.CloudStackContextImpl;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
@ -33,8 +32,24 @@ import com.google.inject.ImplementedBy;
|
||||||
@ImplementedBy(CloudStackContextImpl.class)
|
@ImplementedBy(CloudStackContextImpl.class)
|
||||||
public interface CloudStackContext extends ComputeServiceContext {
|
public interface CloudStackContext extends ComputeServiceContext {
|
||||||
|
|
||||||
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext();
|
CloudStackClient getApi();
|
||||||
|
|
||||||
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext();
|
/**
|
||||||
|
* @deprecated please use {@link #getDomainApi()} as
|
||||||
|
* async interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext();
|
||||||
|
|
||||||
|
CloudStackDomainClient getDomainApi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated please use {@link #getGlobalApi()} as
|
||||||
|
* async interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext();
|
||||||
|
|
||||||
|
CloudStackGlobalClient getGlobalApi();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,10 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html"
|
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html"
|
||||||
* />
|
* />
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackDomainClient.class)} as
|
||||||
|
* {@link CloudStackDomainAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CloudStackDomainAsyncClient extends CloudStackAsyncClient {
|
public interface CloudStackDomainAsyncClient extends CloudStackAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -38,11 +38,14 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see CloudStackDomainClient
|
* @see CloudStackGlobalClient
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html"
|
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html"
|
||||||
* />
|
* />
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudStackGlobalClient.class)} as
|
||||||
|
* {@link CloudStackGlobalAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CloudStackGlobalAsyncClient extends CloudStackDomainAsyncClient {
|
public interface CloudStackGlobalAsyncClient extends CloudStackDomainAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.Context;
|
import org.jclouds.Context;
|
||||||
|
import org.jclouds.cloudstack.CloudStackClient;
|
||||||
import org.jclouds.cloudstack.CloudStackContext;
|
import org.jclouds.cloudstack.CloudStackContext;
|
||||||
import org.jclouds.cloudstack.CloudStackDomainAsyncClient;
|
import org.jclouds.cloudstack.CloudStackDomainAsyncClient;
|
||||||
import org.jclouds.cloudstack.CloudStackDomainClient;
|
import org.jclouds.cloudstack.CloudStackDomainClient;
|
||||||
|
@ -31,7 +32,6 @@ import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.Utils;
|
import org.jclouds.compute.Utils;
|
||||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.location.Provider;
|
import org.jclouds.location.Provider;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
|
||||||
|
@ -40,26 +40,43 @@ import com.google.common.reflect.TypeToken;
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class CloudStackContextImpl extends ComputeServiceContextImpl implements CloudStackContext {
|
public class CloudStackContextImpl extends ComputeServiceContextImpl implements CloudStackContext {
|
||||||
private final RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext;
|
private final CloudStackClient client;
|
||||||
private final RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
|
private final org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext;
|
||||||
|
private final org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CloudStackContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
|
CloudStackContextImpl(@Provider Context backend, @Provider TypeToken<? extends Context> backendType,
|
||||||
ComputeService computeService, Utils utils,
|
ComputeService computeService, Utils utils, CloudStackClient client,
|
||||||
RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
|
org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainContext,
|
||||||
RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
|
org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalContext) {
|
||||||
super(backend, backendType, computeService, utils);
|
super(backend, backendType, computeService, utils);
|
||||||
|
this.client = client;
|
||||||
this.domainContext = domainContext;
|
this.domainContext = domainContext;
|
||||||
this.globalContext = globalContext;
|
this.globalContext = globalContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext() {
|
public CloudStackClient getApi() {
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudStackDomainClient getDomainApi() {
|
||||||
|
return domainContext.getApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudStackGlobalClient getGlobalApi() {
|
||||||
|
return globalContext.getApi();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.jclouds.rest.RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> getDomainContext() {
|
||||||
return domainContext;
|
return domainContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext() {
|
public org.jclouds.rest.RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> getGlobalContext() {
|
||||||
return globalContext;
|
return globalContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien
|
||||||
}).annotatedWith(Memoized.class).to(NetworksForCurrentUser.class).in(Scopes.SINGLETON);
|
}).annotatedWith(Memoized.class).to(NetworksForCurrentUser.class).in(Scopes.SINGLETON);
|
||||||
bind(new TypeLiteral<Map<String, Credentials>>() {
|
bind(new TypeLiteral<Map<String, Credentials>>() {
|
||||||
}).toInstance(credentialStore);
|
}).toInstance(credentialStore);
|
||||||
bind(CloudStackClient.class).toInstance(cloudStackContext.getApi());
|
bind(CloudStackClient.class).toInstance(client);
|
||||||
bind(new TypeLiteral<Map<NetworkType, ? extends OptionsConverter>>() {}).
|
bind(new TypeLiteral<Map<NetworkType, ? extends OptionsConverter>>() {}).
|
||||||
toInstance(new CloudStackComputeServiceContextModule().optionsConverters());
|
toInstance(new CloudStackComputeServiceContextModule().optionsConverters());
|
||||||
bind(String.class).annotatedWith(Names.named(PROPERTY_SESSION_INTERVAL)).toInstance("60");
|
bind(String.class).annotatedWith(Names.named(PROPERTY_SESSION_INTERVAL)).toInstance("60");
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void deleteNetworksInZoneWithVlanId(String zoneId, String vlanId) {
|
protected void deleteNetworksInZoneWithVlanId(String zoneId, String vlanId) {
|
||||||
Set<Network> networks = domainAdminContext.getApi().getNetworkClient().listNetworks(
|
Set<Network> networks = domainAdminClient.getNetworkClient().listNetworks(
|
||||||
ListNetworksOptions.Builder
|
ListNetworksOptions.Builder
|
||||||
.isDefault(false)
|
.isDefault(false)
|
||||||
.isSystem(false)
|
.isSystem(false)
|
||||||
|
@ -63,7 +63,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
URI broadcastUri = URI.create("vlan://" + vlanId);
|
URI broadcastUri = URI.create("vlan://" + vlanId);
|
||||||
for (Network net : networks) {
|
for (Network net : networks) {
|
||||||
if (broadcastUri.equals(net.getBroadcastURI())) {
|
if (broadcastUri.equals(net.getBroadcastURI())) {
|
||||||
String jobId = domainAdminContext.getApi().getNetworkClient().deleteNetwork(net.getId());
|
String jobId = domainAdminClient.getNetworkClient().deleteNetwork(net.getId());
|
||||||
adminJobComplete.apply(jobId);
|
adminJobComplete.apply(jobId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
cloudStackContext.getApi().getOfferingClient().listNetworkOfferings(specifyVLAN(true).zoneId(zoneId)), 0).getId();
|
cloudStackContext.getApi().getOfferingClient().listNetworkOfferings(specifyVLAN(true).zoneId(zoneId)), 0).getId();
|
||||||
|
|
||||||
// create an arbitrary network
|
// create an arbitrary network
|
||||||
network = domainAdminContext.getApi()
|
network = domainAdminClient
|
||||||
.getNetworkClient()
|
.getNetworkClient()
|
||||||
// startIP/endIP/netmask/gateway must be specified together
|
// startIP/endIP/netmask/gateway must be specified together
|
||||||
.createNetworkInZone(zoneId, offeringId, group, group,
|
.createNetworkInZone(zoneId, offeringId, group, group,
|
||||||
|
@ -117,7 +117,7 @@ public class CloudStackExperimentLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
if (nodes != null)
|
if (nodes != null)
|
||||||
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
|
||||||
if (network != null)
|
if (network != null)
|
||||||
domainAdminContext.getApi().getNetworkClient().deleteNetwork(network.getId());
|
domainAdminClient.getNetworkClient().deleteNetwork(network.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,6 @@ public class DomainDomainClientExpectTest extends BaseCloudStackExpectTest<Domai
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DomainDomainClient clientFrom(CloudStackContext context) {
|
protected DomainDomainClient clientFrom(CloudStackContext context) {
|
||||||
return context.getDomainContext().getApi().getDomainClient();
|
return context.getDomainApi().getDomainClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class NetworkClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
|
|
||||||
Network network = null;
|
Network network = null;
|
||||||
try {
|
try {
|
||||||
network = domainAdminContext.getApi()
|
network = domainAdminClient
|
||||||
.getNetworkClient()
|
.getNetworkClient()
|
||||||
// startIP/endIP/netmask/gateway must be specified together
|
// startIP/endIP/netmask/gateway must be specified together
|
||||||
.createNetworkInZone(zone.getId(), offering.getId(), name, name,
|
.createNetworkInZone(zone.getId(), offering.getId(), name, name,
|
||||||
|
|
|
@ -67,8 +67,7 @@ public class OfferingClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
|
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
// This bug is present both in 2.2.8 and 2.2.12
|
// This bug is present both in 2.2.8 and 2.2.12
|
||||||
assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(
|
assertTrue(Predicates.in(ImmutableSet.of("2.2.8", "2.2.12")).apply(apiVersion));
|
||||||
cloudStackContext.getProviderMetadata().getApiMetadata().getVersion()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ public class SessionClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
public void testCreateContextUsingUserAndPasswordAuthentication() {
|
public void testCreateContextUsingUserAndPasswordAuthentication() {
|
||||||
skipIfNotGlobalAdmin();
|
skipIfNotGlobalAdmin();
|
||||||
|
|
||||||
String endpoint = cloudStackContext.getProviderMetadata().getEndpoint();
|
|
||||||
Account testAccount = null;
|
Account testAccount = null;
|
||||||
User testUser = null;
|
User testUser = null;
|
||||||
|
|
||||||
|
@ -79,7 +78,6 @@ public class SessionClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||||
|
|
||||||
@Test(expectedExceptions = AuthorizationException.class)
|
@Test(expectedExceptions = AuthorizationException.class)
|
||||||
public void testTryToGetApiKeypairWithWrongCredentials() {
|
public void testTryToGetApiKeypairWithWrongCredentials() {
|
||||||
String endpoint = cloudStackContext.getProviderMetadata().getEndpoint();
|
|
||||||
ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair(
|
ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair(
|
||||||
URI.create(endpoint), "dummy-missing-user", "with-a-wrong-password", "");
|
URI.create(endpoint), "dummy-missing-user", "with-a-wrong-password", "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ package org.jclouds.cloudstack.internal;
|
||||||
import static com.google.common.collect.Iterables.filter;
|
import static com.google.common.collect.Iterables.filter;
|
||||||
import static com.google.common.collect.Iterables.get;
|
import static com.google.common.collect.Iterables.get;
|
||||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
|
import static org.jclouds.cloudstack.domain.Account.Type.ADMIN;
|
||||||
|
import static org.jclouds.cloudstack.domain.Account.Type.DOMAIN_ADMIN;
|
||||||
|
import static org.jclouds.cloudstack.domain.Account.Type.USER;
|
||||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||||
import static org.jclouds.util.Predicates2.retry;
|
import static org.jclouds.util.Predicates2.retry;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
@ -30,17 +33,15 @@ import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jclouds.cloudstack.CloudStackAsyncClient;
|
|
||||||
import org.jclouds.cloudstack.CloudStackClient;
|
import org.jclouds.cloudstack.CloudStackClient;
|
||||||
import org.jclouds.cloudstack.CloudStackContext;
|
import org.jclouds.cloudstack.CloudStackContext;
|
||||||
import org.jclouds.cloudstack.CloudStackDomainAsyncClient;
|
|
||||||
import org.jclouds.cloudstack.CloudStackDomainClient;
|
import org.jclouds.cloudstack.CloudStackDomainClient;
|
||||||
import org.jclouds.cloudstack.CloudStackGlobalAsyncClient;
|
|
||||||
import org.jclouds.cloudstack.CloudStackGlobalClient;
|
import org.jclouds.cloudstack.CloudStackGlobalClient;
|
||||||
import org.jclouds.cloudstack.domain.Account;
|
import org.jclouds.cloudstack.domain.Account;
|
||||||
import org.jclouds.cloudstack.domain.Template;
|
import org.jclouds.cloudstack.domain.Template;
|
||||||
import org.jclouds.cloudstack.domain.User;
|
import org.jclouds.cloudstack.domain.User;
|
||||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||||
|
import org.jclouds.cloudstack.features.AccountClient;
|
||||||
import org.jclouds.cloudstack.functions.ReuseOrAssociateNewPublicIPAddress;
|
import org.jclouds.cloudstack.functions.ReuseOrAssociateNewPublicIPAddress;
|
||||||
import org.jclouds.cloudstack.options.ListTemplatesOptions;
|
import org.jclouds.cloudstack.options.ListTemplatesOptions;
|
||||||
import org.jclouds.cloudstack.predicates.CorrectHypervisorForZone;
|
import org.jclouds.cloudstack.predicates.CorrectHypervisorForZone;
|
||||||
|
@ -55,7 +56,6 @@ import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.domain.ExecResponse;
|
import org.jclouds.compute.domain.ExecResponse;
|
||||||
import org.jclouds.compute.internal.BaseGenericComputeServiceContextLiveTest;
|
import org.jclouds.compute.internal.BaseGenericComputeServiceContextLiveTest;
|
||||||
import org.jclouds.predicates.SocketOpen;
|
import org.jclouds.predicates.SocketOpen;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.testng.SkipException;
|
import org.testng.SkipException;
|
||||||
|
@ -151,7 +151,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
||||||
protected String prefix = System.getProperty("user.name");
|
protected String prefix = System.getProperty("user.name");
|
||||||
|
|
||||||
protected ComputeService computeClient;
|
protected ComputeService computeClient;
|
||||||
protected RestContext<CloudStackClient, CloudStackAsyncClient> cloudStackContext;
|
protected CloudStackContext cloudStackContext;
|
||||||
protected CloudStackClient client;
|
protected CloudStackClient client;
|
||||||
protected CloudStackClient adminClient;
|
protected CloudStackClient adminClient;
|
||||||
protected User user;
|
protected User user;
|
||||||
|
@ -171,13 +171,11 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
||||||
|
|
||||||
protected boolean domainAdminEnabled;
|
protected boolean domainAdminEnabled;
|
||||||
protected CloudStackContext domainAdminComputeContext;
|
protected CloudStackContext domainAdminComputeContext;
|
||||||
protected RestContext<CloudStackDomainClient, CloudStackDomainAsyncClient> domainAdminContext;
|
|
||||||
protected CloudStackDomainClient domainAdminClient;
|
protected CloudStackDomainClient domainAdminClient;
|
||||||
protected User domainAdminUser;
|
protected User domainAdminUser;
|
||||||
|
|
||||||
protected boolean globalAdminEnabled;
|
protected boolean globalAdminEnabled;
|
||||||
protected CloudStackContext globalAdminComputeContext;
|
protected CloudStackContext globalAdminComputeContext;
|
||||||
protected RestContext<CloudStackGlobalClient, CloudStackGlobalAsyncClient> globalAdminContext;
|
|
||||||
protected CloudStackGlobalClient globalAdminClient;
|
protected CloudStackGlobalClient globalAdminClient;
|
||||||
protected User globalAdminUser;
|
protected User globalAdminUser;
|
||||||
|
|
||||||
|
@ -200,26 +198,25 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
||||||
public void setupContext() {
|
public void setupContext() {
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
computeClient = view.getComputeService();
|
computeClient = view.getComputeService();
|
||||||
cloudStackContext = view.unwrap();
|
cloudStackContext = CloudStackContext.class.cast(view);
|
||||||
client = cloudStackContext.getApi();
|
client = cloudStackContext.getApi();
|
||||||
user = verifyCurrentUserIsOfType(cloudStackContext, Account.Type.USER);
|
user = verifyCurrentUserIsOfType(identity, client.getAccountClient(), USER);
|
||||||
|
|
||||||
domainAdminEnabled = setupDomainAdminProperties() != null;
|
domainAdminEnabled = setupDomainAdminProperties() != null;
|
||||||
if (domainAdminEnabled) {
|
if (domainAdminEnabled) {
|
||||||
domainAdminComputeContext = createView(setupDomainAdminProperties(), setupModules());
|
domainAdminComputeContext = createView(setupDomainAdminProperties(), setupModules());
|
||||||
domainAdminContext = domainAdminComputeContext.getDomainContext();
|
domainAdminClient = domainAdminComputeContext.getDomainApi();
|
||||||
domainAdminClient = domainAdminContext.getApi();
|
domainAdminUser = verifyCurrentUserIsOfType(domainAdminIdentity, domainAdminClient.getAccountClient(),
|
||||||
domainAdminUser = verifyCurrentUserIsOfType(domainAdminContext, Account.Type.DOMAIN_ADMIN);
|
DOMAIN_ADMIN);
|
||||||
adminClient = domainAdminContext.getApi();
|
adminClient = domainAdminClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
globalAdminEnabled = setupGlobalAdminProperties() != null;
|
globalAdminEnabled = setupGlobalAdminProperties() != null;
|
||||||
if (globalAdminEnabled) {
|
if (globalAdminEnabled) {
|
||||||
globalAdminComputeContext = createView(setupGlobalAdminProperties(), setupModules());
|
globalAdminComputeContext = createView(setupGlobalAdminProperties(), setupModules());
|
||||||
globalAdminContext = globalAdminComputeContext.getGlobalContext();
|
globalAdminClient = globalAdminComputeContext.getGlobalApi();
|
||||||
globalAdminClient = globalAdminContext.getApi();
|
globalAdminUser = verifyCurrentUserIsOfType(globalAdminIdentity, globalAdminClient.getAccountClient(), ADMIN);
|
||||||
globalAdminUser = verifyCurrentUserIsOfType(globalAdminContext, Account.Type.ADMIN);
|
adminClient = globalAdminClient;
|
||||||
adminClient = globalAdminContext.getApi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
injector = cloudStackContext.utils().injector();
|
injector = cloudStackContext.utils().injector();
|
||||||
|
@ -250,10 +247,9 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
||||||
return new SshjSshClientModule();
|
return new SshjSshClientModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static User verifyCurrentUserIsOfType(
|
private static User verifyCurrentUserIsOfType(String identity, AccountClient accountClient, Account.Type type) {
|
||||||
RestContext<? extends CloudStackClient, ? extends CloudStackAsyncClient> context, Account.Type type) {
|
Iterable<User> users = Iterables.concat(accountClient.listAccounts());
|
||||||
Iterable<User> users = Iterables.concat(context.getApi().getAccountClient().listAccounts());
|
Predicate<User> apiKeyMatches = UserPredicates.apiKeyEquals(identity);
|
||||||
Predicate<User> apiKeyMatches = UserPredicates.apiKeyEquals(context.getIdentity());
|
|
||||||
User currentUser;
|
User currentUser;
|
||||||
try {
|
try {
|
||||||
currentUser = Iterables.find(users, apiKeyMatches);
|
currentUser = Iterables.find(users, apiKeyMatches);
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.cloudwatch.config.CloudWatchRestClientModule;
|
import org.jclouds.cloudwatch.config.CloudWatchRestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
@ -38,7 +37,12 @@ import com.google.common.reflect.TypeToken;
|
||||||
*/
|
*/
|
||||||
public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudWatchApi.class)} as
|
||||||
|
* {@link CloudWatchAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudWatchApi, CloudWatchAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudWatchApi, CloudWatchAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +51,7 @@ public class CloudWatchApiMetadata extends BaseRestApiMetadata {
|
||||||
return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
|
return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public CloudWatchApiMetadata() {
|
public CloudWatchApiMetadata() {
|
||||||
this(new Builder(CloudWatchApi.class, CloudWatchAsyncApi.class));
|
this(new Builder(CloudWatchApi.class, CloudWatchAsyncApi.class));
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,10 @@ import com.google.inject.Provides;
|
||||||
* href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference"
|
* href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudWatchApi.class)} as
|
||||||
|
* {@link CloudWatchAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CloudWatchAsyncApi extends Closeable {
|
public interface CloudWatchAsyncApi extends Closeable {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,46 +25,29 @@ import static org.jclouds.util.Predicates2.retry;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.cloudwatch.domain.Dimension;
|
import org.jclouds.cloudwatch.domain.Dimension;
|
||||||
import org.jclouds.cloudwatch.domain.MetricDatum;
|
import org.jclouds.cloudwatch.domain.MetricDatum;
|
||||||
import org.jclouds.cloudwatch.domain.Unit;
|
import org.jclouds.cloudwatch.domain.Unit;
|
||||||
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
import org.jclouds.cloudwatch.options.ListMetricsOptions;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code CloudWatch}.
|
* Tests behavior of {@code CloudWatch}.
|
||||||
*
|
*
|
||||||
* @author Jeremy Whitlock
|
* @author Jeremy Whitlock
|
||||||
*/
|
*/
|
||||||
public class CloudWatchLiveTest extends BaseContextLiveTest<RestContext<CloudWatchApi, CloudWatchAsyncApi>> {
|
public class CloudWatchLiveTest extends BaseApiLiveTest<CloudWatchApi> {
|
||||||
|
|
||||||
public CloudWatchLiveTest() {
|
public CloudWatchLiveTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
private CloudWatchApi api;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
|
||||||
public void setupContext() {
|
|
||||||
super.setupContext();
|
|
||||||
api = context.getApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> contextType() {
|
|
||||||
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void testCloudWatchListMetrics() {
|
protected void testCloudWatchListMetrics() {
|
||||||
// Just make sure there is at least one metric returned (Much better if the account you use has more than 500)
|
// Just make sure there is at least one metric returned (Much better if the account you use has more than 500)
|
||||||
|
|
|
@ -303,6 +303,6 @@ public class MetricApiLiveTest extends BaseCloudWatchApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MetricApi api() {
|
protected MetricApi api() {
|
||||||
return context.getApi().getMetricApiForRegion(null);
|
return api.getMetricApiForRegion(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,29 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.cloudwatch.internal;
|
package org.jclouds.cloudwatch.internal;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.cloudwatch.CloudWatchApiMetadata;
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchAsyncApi;
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchApi;
|
import org.jclouds.cloudwatch.CloudWatchApi;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseCloudWatchApiLiveTest extends BaseContextLiveTest<RestContext<CloudWatchApi, CloudWatchAsyncApi>> {
|
public class BaseCloudWatchApiLiveTest extends BaseApiLiveTest<CloudWatchApi> {
|
||||||
|
|
||||||
public BaseCloudWatchApiLiveTest() {
|
public BaseCloudWatchApiLiveTest() {
|
||||||
provider = "cloudwatch";
|
provider = "cloudwatch";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<CloudWatchApi, CloudWatchAsyncApi>> contextType() {
|
|
||||||
return CloudWatchApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds 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
|
|
||||||
*
|
|
||||||
* 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.cloudwatch.internal;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.cloudwatch.CloudWatchAsyncApi;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class BaseCloudWatchAsyncApiExpectTest extends BaseCloudWatchExpectTest<CloudWatchAsyncApi> {
|
|
||||||
public CloudWatchAsyncApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
|
||||||
return createInjector(fn, module, props).getInstance(CloudWatchAsyncApi.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -34,7 +34,6 @@ import org.jclouds.ec2.compute.EC2ComputeServiceContext;
|
||||||
import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
|
import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
|
||||||
import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
|
import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
|
||||||
import org.jclouds.ec2.config.EC2RestClientModule;
|
import org.jclouds.ec2.config.EC2RestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -59,8 +58,13 @@ import com.google.inject.Module;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class EC2ApiMetadata extends BaseRestApiMetadata {
|
public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<? extends EC2Client, ? extends EC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends EC2Client, ? extends EC2AsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as
|
||||||
|
* {@link EC2AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<? extends EC2Client, ? extends EC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends EC2Client, ? extends EC2AsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,6 +94,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
this(EC2Client.class, EC2AsyncClient.class);
|
this(EC2Client.class, EC2AsyncClient.class);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +107,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
|
||||||
.credentialName("Secret Access Key")
|
.credentialName("Secret Access Key")
|
||||||
.defaultEndpoint("https://ec2.us-east-1.amazonaws.com")
|
.defaultEndpoint("https://ec2.us-east-1.amazonaws.com")
|
||||||
.documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
|
.documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
|
||||||
.version(EC2AsyncClient.VERSION)
|
.version("2010-06-15")
|
||||||
.defaultProperties(EC2ApiMetadata.defaultProperties())
|
.defaultProperties(EC2ApiMetadata.defaultProperties())
|
||||||
.context(CONTEXT_TOKEN)
|
.context(CONTEXT_TOKEN)
|
||||||
.view(EC2ComputeServiceContext.class)
|
.view(EC2ComputeServiceContext.class)
|
||||||
|
|
|
@ -32,9 +32,11 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* Provides asynchronous access to EC2 services.
|
* Provides asynchronous access to EC2 services.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(EC2Client.class)} as
|
||||||
|
* {@link EC2AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface EC2AsyncClient extends EC2AsyncApi {
|
public interface EC2AsyncClient extends EC2AsyncApi {
|
||||||
public static final String VERSION = "2010-06-15";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to AMI services.
|
* Provides asynchronous access to AMI services.
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class SubnetApiLiveTest extends BaseEC2ApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SubnetApi api() {
|
private SubnetApi api() {
|
||||||
Optional<? extends SubnetApi> subnetOption = context.getApi().getSubnetApi();
|
Optional<? extends SubnetApi> subnetOption = api.getSubnetApi();
|
||||||
if (!subnetOption.isPresent())
|
if (!subnetOption.isPresent())
|
||||||
throw new SkipException("subnet api not present");
|
throw new SkipException("subnet api not present");
|
||||||
return subnetOption.get();
|
return subnetOption.get();
|
||||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.base.Optional;
|
||||||
public class WindowsApiLiveTest extends BaseEC2ApiLiveTest {
|
public class WindowsApiLiveTest extends BaseEC2ApiLiveTest {
|
||||||
|
|
||||||
protected WindowsApi api() {
|
protected WindowsApi api() {
|
||||||
Optional<? extends WindowsApi> windowsOption = context.getApi().getWindowsApi();
|
Optional<? extends WindowsApi> windowsOption = api.getWindowsApi();
|
||||||
if (!windowsOption.isPresent())
|
if (!windowsOption.isPresent())
|
||||||
throw new SkipException("windows api not present");
|
throw new SkipException("windows api not present");
|
||||||
return windowsOption.get();
|
return windowsOption.get();
|
||||||
|
|
|
@ -119,8 +119,8 @@ public abstract class BaseTagApiLiveTest extends BaseEC2ApiLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeClass(groups = "live")
|
@BeforeClass(groups = "live")
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
resource = checkNotNull(createResourceForTagging(System.getProperty("user.name") + "-tag"), "resource");
|
resource = checkNotNull(createResourceForTagging(System.getProperty("user.name") + "-tag"), "resource");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,16 +146,16 @@ public abstract class BaseTagApiLiveTest extends BaseEC2ApiLiveTest {
|
||||||
protected abstract void cleanupResource(Resource resource);
|
protected abstract void cleanupResource(Resource resource);
|
||||||
|
|
||||||
protected TagApi api() {
|
protected TagApi api() {
|
||||||
Optional<? extends TagApi> tagOption = context.getApi().getTagApi();
|
Optional<? extends TagApi> tagOption = api.getTagApi();
|
||||||
if (!tagOption.isPresent())
|
if (!tagOption.isPresent())
|
||||||
throw new SkipException("tag api not present");
|
throw new SkipException("tag api not present");
|
||||||
return tagOption.get();
|
return tagOption.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = "live")
|
@AfterClass(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (resource != null)
|
if (resource != null)
|
||||||
cleanupResource(resource);
|
cleanupResource(resource);
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,14 @@
|
||||||
package org.jclouds.ec2.internal;
|
package org.jclouds.ec2.internal;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.ec2.EC2Api;
|
import org.jclouds.ec2.EC2Api;
|
||||||
import org.jclouds.ec2.EC2AsyncApi;
|
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseEC2ApiLiveTest extends BaseContextLiveTest<RestContext<? extends EC2Api, ? extends EC2AsyncApi>> {
|
public class BaseEC2ApiLiveTest extends BaseApiLiveTest<EC2Api> {
|
||||||
|
|
||||||
public BaseEC2ApiLiveTest() {
|
public BaseEC2ApiLiveTest() {
|
||||||
provider = "ec2";
|
provider = "ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<? extends EC2Api, ? extends EC2AsyncApi>> contextType() {
|
|
||||||
return new TypeToken<RestContext<? extends EC2Api, ? extends EC2AsyncApi>>() {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package org.jclouds.ec2.internal;
|
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
|
||||||
import org.jclouds.ec2.EC2ApiMetadata;
|
|
||||||
import org.jclouds.ec2.EC2AsyncClient;
|
|
||||||
import org.jclouds.ec2.EC2Client;
|
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class BaseEC2ClientLiveTest extends BaseContextLiveTest<RestContext<? extends EC2Client, ? extends EC2AsyncClient>> {
|
|
||||||
|
|
||||||
public BaseEC2ClientLiveTest() {
|
|
||||||
provider = "ec2";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<? extends EC2Client, ? extends EC2AsyncClient>> contextType() {
|
|
||||||
return EC2ApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
|
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
|
||||||
import org.jclouds.elasticstack.config.ElasticStackRestClientModule;
|
import org.jclouds.elasticstack.config.ElasticStackRestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -42,7 +41,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<ElasticStackClient, ElasticStackAsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<ElasticStackClient, ElasticStackAsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(ElasticStackClient.class)} as
|
||||||
|
* {@link ElasticStackAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<ElasticStackClient, ElasticStackAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<ElasticStackClient, ElasticStackAsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +75,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(ElasticStackClient.class, ElasticStackAsyncClient.class);
|
super(ElasticStackClient.class, ElasticStackAsyncClient.class);
|
||||||
id("elasticstack")
|
id("elasticstack")
|
||||||
|
|
|
@ -62,7 +62,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @see ElasticStackClient
|
* @see ElasticStackClient
|
||||||
* @see <a href="TODO: insert URL of provider documentation" />
|
* @see <a href="TODO: insert URL of provider documentation" />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(ElasticStackClient.class)} as
|
||||||
|
* {@link ElasticStackAsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(BasicAuthentication.class)
|
@RequestFilters(BasicAuthentication.class)
|
||||||
@Consumes(MediaType.TEXT_PLAIN)
|
@Consumes(MediaType.TEXT_PLAIN)
|
||||||
public interface ElasticStackAsyncClient extends Closeable {
|
public interface ElasticStackAsyncClient extends Closeable {
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.jclouds.elasticstack.predicates.DriveClaimed;
|
||||||
import org.jclouds.elasticstack.util.Servers;
|
import org.jclouds.elasticstack.util.Servers;
|
||||||
import org.jclouds.io.Payloads;
|
import org.jclouds.io.Payloads;
|
||||||
import org.jclouds.predicates.SocketOpen;
|
import org.jclouds.predicates.SocketOpen;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.jclouds.util.Strings2;
|
import org.jclouds.util.Strings2;
|
||||||
|
@ -76,7 +75,6 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes
|
||||||
protected int maxDriveImageTime = 360;
|
protected int maxDriveImageTime = 360;
|
||||||
protected String vncPassword = "Il0veVNC";
|
protected String vncPassword = "Il0veVNC";
|
||||||
protected ElasticStackClient client;
|
protected ElasticStackClient client;
|
||||||
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> cloudStackContext;
|
|
||||||
protected Predicate<HostAndPort> socketTester;
|
protected Predicate<HostAndPort> socketTester;
|
||||||
protected Predicate<DriveInfo> driveNotClaimed;
|
protected Predicate<DriveInfo> driveNotClaimed;
|
||||||
protected String imageId;
|
protected String imageId;
|
||||||
|
@ -87,7 +85,7 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes
|
||||||
super.setupContext();
|
super.setupContext();
|
||||||
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
|
imageId = view.getComputeService().templateBuilder().build().getImage().getId();
|
||||||
|
|
||||||
client = view.unwrap(ElasticStackApiMetadata.CONTEXT_TOKEN).getApi();
|
client = view.utils().injector().getInstance(ElasticStackClient.class);
|
||||||
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
|
driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS);
|
||||||
SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
|
SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class);
|
||||||
socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
|
socketTester = retry(socketOpen, maxDriveImageTime, 1, SECONDS);
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -45,7 +44,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CinderApiMetadata extends BaseRestApiMetadata {
|
public class CinderApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CinderApi, CinderAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<CinderApi, CinderAsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CinderApi.class)} as
|
||||||
|
* {@link CinderAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CinderApi, CinderAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CinderApi, CinderAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +75,7 @@ public class CinderApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(CinderApi.class, CinderAsyncApi.class);
|
super(CinderApi.class, CinderAsyncApi.class);
|
||||||
id("openstack-cinder")
|
id("openstack-cinder")
|
||||||
|
|
|
@ -39,7 +39,10 @@ import com.google.inject.Provides;
|
||||||
* @see CinderApi
|
* @see CinderApi
|
||||||
* @see <a href="http://api.openstack.org/">API Doc</a>
|
* @see <a href="http://api.openstack.org/">API Doc</a>
|
||||||
* @author Everett Toews
|
* @author Everett Toews
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CinderApi.class)} as
|
||||||
|
* {@link CinderAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CinderAsyncApi extends Closeable {
|
public interface CinderAsyncApi extends Closeable {
|
||||||
/**
|
/**
|
||||||
* @return the Zone codes configured
|
* @return the Zone codes configured
|
||||||
|
|
|
@ -57,16 +57,16 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(cinder.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
volumeApi = cinder.getApi().getVolumeApiForZone(zone);
|
volumeApi = api.getVolumeApiForZone(zone);
|
||||||
snapshotApi = cinder.getApi().getSnapshotApiForZone(zone);
|
snapshotApi = api.getSnapshotApiForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (testSnapshot != null) {
|
if (testSnapshot != null) {
|
||||||
assertTrue(snapshotApi.delete(testSnapshot.getId()));
|
assertTrue(snapshotApi.delete(testSnapshot.getId()));
|
||||||
assertTrue(SnapshotPredicates.awaitDeleted(snapshotApi).apply(testSnapshot));
|
assertTrue(SnapshotPredicates.awaitDeleted(snapshotApi).apply(testSnapshot));
|
||||||
|
@ -77,7 +77,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest {
|
||||||
assertTrue(VolumePredicates.awaitDeleted(volumeApi).apply(testVolume));
|
assertTrue(VolumePredicates.awaitDeleted(volumeApi).apply(testVolume));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateVolume() {
|
public void testCreateVolume() {
|
||||||
|
|
|
@ -42,16 +42,16 @@ public class VolumeTypeApiLiveTest extends BaseCinderApiLiveTest {
|
||||||
|
|
||||||
@BeforeGroups(groups = {"integration", "live"})
|
@BeforeGroups(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(cinder.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
volumeTypeApi = cinder.getApi().getVolumeTypeApiForZone(zone);
|
volumeTypeApi = api.getVolumeTypeApiForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListAndGetVolumeTypes() {
|
public void testListAndGetVolumeTypes() {
|
||||||
|
|
|
@ -20,46 +20,25 @@ package org.jclouds.openstack.cinder.v1.internal;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.openstack.cinder.v1.CinderApi;
|
import org.jclouds.openstack.cinder.v1.CinderApi;
|
||||||
import org.jclouds.openstack.cinder.v1.CinderApiMetadata;
|
|
||||||
import org.jclouds.openstack.cinder.v1.CinderAsyncApi;
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of CinderApi
|
* Tests behavior of CinderApi
|
||||||
*
|
*
|
||||||
* @author Everett Toews
|
* @author Everett Toews
|
||||||
*/
|
*/
|
||||||
public class BaseCinderApiLiveTest extends BaseContextLiveTest<RestContext<CinderApi, CinderAsyncApi>> {
|
public class BaseCinderApiLiveTest extends BaseApiLiveTest<CinderApi> {
|
||||||
|
|
||||||
public BaseCinderApiLiveTest() {
|
public BaseCinderApiLiveTest() {
|
||||||
provider = "openstack-cinder";
|
provider = "openstack-cinder";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestContext<CinderApi, CinderAsyncApi> cinder;
|
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
|
||||||
@Override
|
|
||||||
public void setupContext() {
|
|
||||||
super.setupContext();
|
|
||||||
cinder = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Properties setupProperties() {
|
protected Properties setupProperties() {
|
||||||
Properties props = super.setupProperties();
|
Properties props = super.setupProperties();
|
||||||
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<CinderApi, CinderAsyncApi>> contextType() {
|
|
||||||
return CinderApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.jclouds.openstack.keystone.v2_0.config.KeystoneParserModule;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -44,7 +43,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as
|
||||||
|
* {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,6 +73,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
this(KeystoneApi.class, KeystoneAsyncApi.class);
|
this(KeystoneApi.class, KeystoneAsyncApi.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
* @see <a href="http://keystone.openstack.org/" />
|
* @see <a href="http://keystone.openstack.org/" />
|
||||||
* @see KeystoneApi
|
* @see KeystoneApi
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as
|
||||||
|
* {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface KeystoneAsyncApi extends Closeable {
|
public interface KeystoneAsyncApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.testng.annotations.Test;
|
||||||
public class KeystoneApiLiveTest extends BaseKeystoneApiLiveTest {
|
public class KeystoneApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testGetApiMetaData() {
|
public void testGetApiMetaData() {
|
||||||
ApiMetadata result = keystoneContext.getApi().getApiMetadata();
|
ApiMetadata result = api.getApiMetadata();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertNotNull(result.getId());
|
assertNotNull(result.getId());
|
||||||
assertNotNull(result.getStatus());
|
assertNotNull(result.getStatus());
|
||||||
|
|
|
@ -36,8 +36,7 @@ import org.testng.annotations.Test;
|
||||||
public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest {
|
public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testTenants() {
|
public void testTenants() {
|
||||||
ServiceApi api = keystoneContext.getApi().getServiceApi();
|
Set<? extends Tenant> result = api.getServiceApi().listTenants();
|
||||||
Set<? extends Tenant> result = api.listTenants();
|
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertFalse(result.isEmpty());
|
assertFalse(result.isEmpty());
|
||||||
|
|
||||||
|
|
|
@ -37,15 +37,15 @@ import org.testng.annotations.Test;
|
||||||
public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {
|
public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testTenants() {
|
public void testTenants() {
|
||||||
TenantApi api = keystoneContext.getApi().getTenantApi().get();
|
TenantApi tenantApi = api.getTenantApi().get();
|
||||||
Set<? extends Tenant> result = api.list().concat().toSet();
|
Set<? extends Tenant> result = tenantApi.list().concat().toSet();
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertFalse(result.isEmpty());
|
assertFalse(result.isEmpty());
|
||||||
|
|
||||||
for (Tenant tenant : result) {
|
for (Tenant tenant : result) {
|
||||||
assertNotNull(tenant.getId());
|
assertNotNull(tenant.getId());
|
||||||
|
|
||||||
Tenant aTenant = api.get(tenant.getId());
|
Tenant aTenant = tenantApi.get(tenant.getId());
|
||||||
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
||||||
|
|
||||||
assertEquals(aTenant, tenant);
|
assertEquals(aTenant, tenant);
|
||||||
|
@ -54,10 +54,10 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testTenantsByName() {
|
public void testTenantsByName() {
|
||||||
|
|
||||||
TenantApi api = keystoneContext.getApi().getTenantApi().get();
|
TenantApi tenantApi = api.getTenantApi().get();
|
||||||
|
|
||||||
for (Tenant tenant : api.list().concat()) {
|
for (Tenant tenant : tenantApi.list().concat()) {
|
||||||
Tenant aTenant = api.getByName(tenant.getName());
|
Tenant aTenant = tenantApi.getByName(tenant.getName());
|
||||||
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
assertNotNull(aTenant, "get returned null for tenant: " + tenant);
|
||||||
|
|
||||||
assertEquals(aTenant, tenant);
|
assertEquals(aTenant, tenant);
|
||||||
|
|
|
@ -24,18 +24,21 @@ import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.testng.AssertJUnit.assertTrue;
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
import org.jclouds.openstack.keystone.v2_0.domain.Token;
|
||||||
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
import org.jclouds.openstack.keystone.v2_0.domain.User;
|
||||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
import org.jclouds.openstack.keystone.v2_0.internal.BaseKeystoneApiLiveTest;
|
||||||
import org.testng.annotations.BeforeMethod;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests TokenApi
|
* Tests TokenApi
|
||||||
|
@ -46,25 +49,30 @@ import com.google.common.collect.Iterables;
|
||||||
public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
|
public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
protected String token;
|
protected String token;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected KeystoneApi create(Properties props, Iterable<Module> modules) {
|
||||||
|
Injector injector = newBuilder().modules(modules).overrides(props).buildInjector();
|
||||||
|
grabToken(injector.getInstance(AuthenticateRequest.class));
|
||||||
|
return injector.getInstance(KeystoneApi.class);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the token currently in use (there's currently no listTokens())
|
// Get the token currently in use (there's currently no listTokens())
|
||||||
@BeforeMethod
|
private void grabToken(AuthenticateRequest ar) {
|
||||||
public void grabToken() {
|
HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(endpoint).build());
|
||||||
AuthenticateRequest ar = keystoneContext.getUtils().getInjector().getInstance(AuthenticateRequest.class);
|
|
||||||
HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(context.getProviderMetadata().getEndpoint()).build());
|
|
||||||
token = Iterables.getOnlyElement(test.getHeaders().get("X-Auth-Token"));
|
token = Iterables.getOnlyElement(test.getHeaders().get("X-Auth-Token"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToken() {
|
public void testToken() {
|
||||||
|
|
||||||
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
TokenApi tokenApi = api.getTokenApi().get();
|
||||||
assertTrue(api.isValid(token));
|
assertTrue(tokenApi.isValid(token));
|
||||||
Token result = api.get(token);
|
Token result = tokenApi.get(token);
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
assertEquals(result.getId(), token);
|
assertEquals(result.getId(), token);
|
||||||
assertNotNull(result.getTenant());
|
assertNotNull(result.getTenant());
|
||||||
|
|
||||||
User user = api.getUserOfToken(token);
|
User user = tokenApi.getUserOfToken(token);
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertNotNull(user.getId());
|
assertNotNull(user.getId());
|
||||||
assertNotNull(user.getName());
|
assertNotNull(user.getName());
|
||||||
|
@ -73,16 +81,16 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testInvalidToken() {
|
public void testInvalidToken() {
|
||||||
|
|
||||||
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
TokenApi tokenApi = api.getTokenApi().get();
|
||||||
assertFalse(api.isValid("thisisnotarealtoken!"));
|
assertFalse(tokenApi.isValid("thisisnotarealtoken!"));
|
||||||
assertNull(api.get("thisisnotarealtoken!"));
|
assertNull(tokenApi.get("thisisnotarealtoken!"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTokenEndpoints() {
|
public void testTokenEndpoints() {
|
||||||
|
|
||||||
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
TokenApi tokenApi = api.getTokenApi().get();
|
||||||
Set<? extends Endpoint> endpoints = api.listEndpointsForToken(token);
|
Set<? extends Endpoint> endpoints = tokenApi.listEndpointsForToken(token);
|
||||||
assertNotNull(endpoints);
|
assertNotNull(endpoints);
|
||||||
assertFalse(endpoints.isEmpty());
|
assertFalse(endpoints.isEmpty());
|
||||||
|
|
||||||
|
@ -90,8 +98,8 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testInvalidTokenEndpoints() {
|
public void testInvalidTokenEndpoints() {
|
||||||
|
|
||||||
TokenApi api = keystoneContext.getApi().getTokenApi().get();
|
TokenApi tokenApi = api.getTokenApi().get();
|
||||||
assertTrue(api.listEndpointsForToken("thisisnotarealtoken!").isEmpty());
|
assertTrue(tokenApi.listEndpointsForToken("thisisnotarealtoken!").isEmpty());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testUsers() {
|
public void testUsers() {
|
||||||
|
|
||||||
UserApi api = keystoneContext.getApi().getUserApi().get();
|
UserApi userApi = api.getUserApi().get();
|
||||||
Set<? extends User> users = api.list().concat().toSet();
|
Set<? extends User> users = userApi.list().concat().toSet();
|
||||||
assertNotNull(users);
|
assertNotNull(users);
|
||||||
assertFalse(users.isEmpty());
|
assertFalse(users.isEmpty());
|
||||||
for (User user : users) {
|
for (User user : users) {
|
||||||
User aUser = api.get(user.getId());
|
User aUser = userApi.get(user.getId());
|
||||||
assertEquals(aUser, user);
|
assertEquals(aUser, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testUserRolesOnTenant() {
|
public void testUserRolesOnTenant() {
|
||||||
|
|
||||||
UserApi api = keystoneContext.getApi().getUserApi().get();
|
UserApi userApi = api.getUserApi().get();
|
||||||
Set<? extends Tenant> tenants = keystoneContext.getApi().getTenantApi().get().list().concat().toSet();
|
Set<? extends Tenant> tenants = api.getTenantApi().get().list().concat().toSet();
|
||||||
|
|
||||||
for (User user : api.list().concat()) {
|
for (User user : userApi.list().concat()) {
|
||||||
for (Tenant tenant : tenants) {
|
for (Tenant tenant : tenants) {
|
||||||
Set<? extends Role> roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId());
|
Set<? extends Role> roles = userApi.listRolesOfUserOnTenant(user.getId(), tenant.getId());
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
assertNotNull(role.getId());
|
assertNotNull(role.getId());
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,9 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testListRolesOfUser() {
|
public void testListRolesOfUser() {
|
||||||
|
|
||||||
UserApi api = keystoneContext.getApi().getUserApi().get();
|
UserApi userApi = api.getUserApi().get();
|
||||||
for (User user : api.list().concat()) {
|
for (User user : userApi.list().concat()) {
|
||||||
Set<? extends Role> roles = api.listRolesOfUser(user.getId());
|
Set<? extends Role> roles = userApi.listRolesOfUser(user.getId());
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
assertNotNull(role.getId());
|
assertNotNull(role.getId());
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,9 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest {
|
||||||
|
|
||||||
public void testUsersByName() {
|
public void testUsersByName() {
|
||||||
|
|
||||||
UserApi api = keystoneContext.getApi().getUserApi().get();
|
UserApi userApi = api.getUserApi().get();
|
||||||
for (User user : api.list().concat()) {
|
for (User user : userApi.list().concat()) {
|
||||||
User aUser = api.getByName(user.getName());
|
User aUser = userApi.getByName(user.getName());
|
||||||
assertEquals(aUser, user);
|
assertEquals(aUser, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,48 +20,27 @@ package org.jclouds.openstack.keystone.v2_0.internal;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata;
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi;
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code KeystoneApi}
|
* Tests behavior of {@code KeystoneApi}
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseKeystoneApiLiveTest extends BaseContextLiveTest<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> {
|
public class BaseKeystoneApiLiveTest extends BaseApiLiveTest<KeystoneApi> {
|
||||||
|
|
||||||
public BaseKeystoneApiLiveTest() {
|
public BaseKeystoneApiLiveTest() {
|
||||||
provider = "openstack-keystone";
|
provider = "openstack-keystone";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi> keystoneContext;
|
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
|
||||||
@Override
|
|
||||||
public void setupContext() {
|
|
||||||
super.setupContext();
|
|
||||||
keystoneContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Properties setupProperties() {
|
protected Properties setupProperties() {
|
||||||
Properties props = super.setupProperties();
|
Properties props = super.setupProperties();
|
||||||
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<? extends KeystoneApi,? extends KeystoneAsyncApi>> contextType() {
|
|
||||||
return KeystoneApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
|
||||||
import org.jclouds.openstack.nova.ec2.config.HyphenToNullIso8601Module;
|
import org.jclouds.openstack.nova.ec2.config.HyphenToNullIso8601Module;
|
||||||
import org.jclouds.openstack.nova.ec2.config.NovaEC2ComputeServiceContextModule;
|
import org.jclouds.openstack.nova.ec2.config.NovaEC2ComputeServiceContextModule;
|
||||||
import org.jclouds.openstack.nova.ec2.config.NovaEC2RestClientModule;
|
import org.jclouds.openstack.nova.ec2.config.NovaEC2RestClientModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
@ -46,7 +45,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class NovaEC2ApiMetadata extends EC2ApiMetadata {
|
public class NovaEC2ApiMetadata extends EC2ApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<NovaEC2Client, NovaEC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<NovaEC2Client, NovaEC2AsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as
|
||||||
|
* {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<NovaEC2Client, NovaEC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<NovaEC2Client, NovaEC2AsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,6 +85,7 @@ public class NovaEC2ApiMetadata extends EC2ApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends EC2ApiMetadata.Builder<Builder> {
|
public static class Builder extends EC2ApiMetadata.Builder<Builder> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder(){
|
protected Builder(){
|
||||||
super(NovaEC2Client.class, NovaEC2AsyncClient.class);
|
super(NovaEC2Client.class, NovaEC2AsyncClient.class);
|
||||||
id("openstack-nova-ec2")
|
id("openstack-nova-ec2")
|
||||||
|
|
|
@ -26,7 +26,10 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* Provides asynchronous access to EC2 services.
|
* Provides asynchronous access to EC2 services.
|
||||||
*
|
*
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as
|
||||||
|
* {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface NovaEC2AsyncClient extends EC2AsyncClient {
|
public interface NovaEC2AsyncClient extends EC2AsyncClient {
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.jclouds.openstack.nova.v2_0.compute.config.NovaComputeServiceContextM
|
||||||
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
|
import org.jclouds.openstack.nova.v2_0.config.NovaParserModule;
|
||||||
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
|
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
|
||||||
import org.jclouds.openstack.v2_0.ServiceType;
|
import org.jclouds.openstack.v2_0.ServiceType;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -52,7 +51,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class NovaApiMetadata extends BaseRestApiMetadata {
|
public class NovaApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<NovaApi, NovaAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<NovaApi, NovaAsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
|
||||||
|
* {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<NovaApi, NovaAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(NovaApi.class, NovaAsyncApi.class);
|
super(NovaApi.class, NovaAsyncApi.class);
|
||||||
id("openstack-nova")
|
id("openstack-nova")
|
||||||
|
|
|
@ -57,7 +57,10 @@ import com.google.inject.Provides;
|
||||||
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
* @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaApi.class)} as
|
||||||
|
* {@link NovaAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface NovaAsyncApi extends Closeable {
|
public interface NovaAsyncApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,13 +62,13 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
serverApi = novaContext.getApi().getServerApiForZone(zone);
|
serverApi = api.getServerApiForZone(zone);
|
||||||
extensionApi = novaContext.getApi().getExtensionApiForZone(zone);
|
extensionApi = api.getExtensionApiForZone(zone);
|
||||||
imageApi = novaContext.getApi().getImageApiForZone(zone);
|
imageApi = api.getImageApiForZone(zone);
|
||||||
apiOption = novaContext.getApi().getServerAdminExtensionForZone(zone);
|
apiOption = api.getServerAdminExtensionForZone(zone);
|
||||||
if (apiOption.isPresent()) {
|
if (apiOption.isPresent()) {
|
||||||
testServerId = createServerInZone(zone).getId();
|
testServerId = createServerInZone(zone).getId();
|
||||||
}
|
}
|
||||||
|
@ -76,16 +76,16 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (apiOption.isPresent()) {
|
if (apiOption.isPresent()) {
|
||||||
if (testServerId != null) {
|
if (testServerId != null) {
|
||||||
assertTrue(novaContext.getApi().getServerApiForZone(zone).delete(testServerId));
|
assertTrue(api.getServerApiForZone(zone).delete(testServerId));
|
||||||
}
|
}
|
||||||
if (backupImageId != null) {
|
if (backupImageId != null) {
|
||||||
imageApi.delete(backupImageId);
|
imageApi.delete(backupImageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void skipOnAdminExtensionAbsent() {
|
protected void skipOnAdminExtensionAbsent() {
|
||||||
|
|
|
@ -52,22 +52,22 @@ public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
flavorApi = novaContext.getApi().getFlavorApiForZone(zone);
|
flavorApi = api.getFlavorApiForZone(zone);
|
||||||
apiOption = novaContext.getApi().getFlavorExtraSpecsExtensionForZone(zone);
|
apiOption = api.getFlavorExtraSpecsExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (apiOption.isPresent() && testFlavor != null) {
|
if (apiOption.isPresent() && testFlavor != null) {
|
||||||
for(String key : testSpecs.keySet()) {
|
for(String key : testSpecs.keySet()) {
|
||||||
assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key));
|
assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateExtraSpecs() {
|
public void testCreateExtraSpecs() {
|
||||||
|
|
|
@ -47,8 +47,8 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListFloatingIPs() throws Exception {
|
public void testListFloatingIPs() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
|
Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
|
||||||
if (!apiOption.isPresent())
|
if (!apiOption.isPresent())
|
||||||
continue;
|
continue;
|
||||||
FloatingIPApi api = apiOption.get();
|
FloatingIPApi api = apiOption.get();
|
||||||
|
@ -69,8 +69,8 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllocateAndDecreateFloatingIPs() throws Exception {
|
public void testAllocateAndDecreateFloatingIPs() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
|
Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
|
||||||
if (!apiOption.isPresent())
|
if (!apiOption.isPresent())
|
||||||
continue;
|
continue;
|
||||||
FloatingIPApi api = apiOption.get();
|
FloatingIPApi api = apiOption.get();
|
||||||
|
@ -100,12 +100,12 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddAndRemoveFloatingIp() throws Exception {
|
public void testAddAndRemoveFloatingIp() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
Optional<? extends FloatingIPApi> apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId);
|
Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
|
||||||
if (!apiOption.isPresent())
|
if (!apiOption.isPresent())
|
||||||
continue;
|
continue;
|
||||||
FloatingIPApi api = apiOption.get();
|
FloatingIPApi api = apiOption.get();
|
||||||
ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId);
|
ServerApi serverApi = this.api.getServerApiForZone(zoneId);
|
||||||
Server server = createServerInZone(zoneId);
|
Server server = createServerInZone(zoneId);
|
||||||
FloatingIP floatingIP = api.create();
|
FloatingIP floatingIP = api.create();
|
||||||
assertNotNull(floatingIP);
|
assertNotNull(floatingIP);
|
||||||
|
|
|
@ -1,197 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds 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
|
|
||||||
*
|
|
||||||
* 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.openstack.nova.v2_0.extensions;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertFalse;
|
|
||||||
import static org.testng.Assert.assertNull;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.internal.BaseNovaAsyncApiExpectTest;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPListTest;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.parse.ParseFloatingIPTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests annotation parsing of {@code FloatingIPAsyncApi}
|
|
||||||
*
|
|
||||||
* @author Michael Arnold
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit", testName = "FloatingIPAsyncApiExpectTest")
|
|
||||||
public class FloatingIPAsyncApiExpectTest extends BaseNovaAsyncApiExpectTest {
|
|
||||||
|
|
||||||
public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception {
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
|
||||||
|
|
||||||
assertTrue(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception {
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
|
||||||
|
|
||||||
assertFalse(apiWhenExtensionNotInList.getFloatingIPExtensionForZone("az-1.region-a.geo-1").isPresent());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testListFloatingIPsWhenResponseIs2xx() throws Exception {
|
|
||||||
HttpRequest list = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken).build();
|
|
||||||
|
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
|
||||||
.payload(payloadFromResource("/floatingip_list.json")).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", "az-3.region-a.geo-1"));
|
|
||||||
|
|
||||||
assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().get()
|
|
||||||
.toString(), new ParseFloatingIPListTest().expected().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testListFloatingIPsWhenResponseIs404() throws Exception {
|
|
||||||
HttpRequest list = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken).build();
|
|
||||||
|
|
||||||
HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, list, listResponse);
|
|
||||||
|
|
||||||
assertTrue(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().list().get()
|
|
||||||
.isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetFloatingIPWhenResponseIs2xx() throws Exception {
|
|
||||||
HttpRequest get = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken).build();
|
|
||||||
|
|
||||||
HttpResponse getResponse = HttpResponse.builder().statusCode(200)
|
|
||||||
.payload(payloadFromResource("/floatingip_details.json")).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1").get()
|
|
||||||
.toString(), new ParseFloatingIPTest().expected().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetFloatingIPWhenResponseIs404() throws Exception {
|
|
||||||
HttpRequest get = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips/1")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken).build();
|
|
||||||
|
|
||||||
HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, get, getResponse);
|
|
||||||
|
|
||||||
assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().get("1").get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllocateWhenResponseIs2xx() throws Exception {
|
|
||||||
HttpRequest createFloatingIP = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("POST")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken)
|
|
||||||
.payload(payloadFromStringWithContentType("{}", "application/json")).build();
|
|
||||||
|
|
||||||
HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
|
|
||||||
.payload(payloadFromResource("/floatingip_details.json")).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
|
|
||||||
createFloatingIPResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get()
|
|
||||||
.toString(), new ParseFloatingIPTest().expected().toString());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllocateWhenResponseIs404() throws Exception {
|
|
||||||
HttpRequest createFloatingIP = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("POST")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken)
|
|
||||||
.payload(payloadFromStringWithContentType("{}", "application/json")).build();
|
|
||||||
|
|
||||||
HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
|
|
||||||
createFloatingIPResponse);
|
|
||||||
|
|
||||||
assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAllocateWithPoolNameWhenResponseIs2xx() throws Exception {
|
|
||||||
HttpRequest createFloatingIP = HttpRequest
|
|
||||||
.builder()
|
|
||||||
.method("POST")
|
|
||||||
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.addHeader("X-Auth-Token", authToken)
|
|
||||||
.payload(payloadFromStringWithContentType("{\"pool\":\"myPool\"}", "application/json")).build();
|
|
||||||
|
|
||||||
HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200)
|
|
||||||
.payload(payloadFromResource("/floatingip_details.json")).build();
|
|
||||||
|
|
||||||
NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
|
|
||||||
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP,
|
|
||||||
createFloatingIPResponse);
|
|
||||||
|
|
||||||
assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocateFromPool("myPool")
|
|
||||||
.get()
|
|
||||||
.toString(), new ParseFloatingIPTest().expected().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -53,12 +53,12 @@ public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeGroups(groups = {"integration", "live"})
|
@BeforeGroups(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
|
|
||||||
if (identity.endsWith(":admin")) {
|
if (identity.endsWith(":admin")) {
|
||||||
String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
optApi = novaContext.getApi().getHostAdministrationExtensionForZone(zone);
|
optApi = api.getHostAdministrationExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,20 +51,20 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
apiOption = novaContext.getApi().getHostAggregateExtensionForZone(zone);
|
apiOption = api.getHostAggregateExtensionForZone(zone);
|
||||||
hostAdminOption = novaContext.getApi().getHostAdministrationExtensionForZone(zone);
|
hostAdminOption = api.getHostAdministrationExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (testAggregate != null) {
|
if (testAggregate != null) {
|
||||||
assertTrue(apiOption.get().delete(testAggregate.getId()));
|
assertTrue(apiOption.get().delete(testAggregate.getId()));
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateAggregate() {
|
public void testCreateAggregate() {
|
||||||
|
|
|
@ -35,24 +35,24 @@ import com.google.common.collect.FluentIterable;
|
||||||
public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
|
public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
public void testListKeyPairs() throws Exception {
|
public void testListKeyPairs() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get();
|
KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
|
||||||
FluentIterable<? extends KeyPair> keyPairsList = api.list();
|
FluentIterable<? extends KeyPair> keyPairsList = keyPairApi.list();
|
||||||
assertNotNull(keyPairsList);
|
assertNotNull(keyPairsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateAndDeleteKeyPair() throws Exception {
|
public void testCreateAndDeleteKeyPair() throws Exception {
|
||||||
final String KEYPAIR_NAME = "testkp";
|
final String KEYPAIR_NAME = "testkp";
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get();
|
KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
|
||||||
KeyPair keyPair = null;
|
KeyPair keyPair = null;
|
||||||
try {
|
try {
|
||||||
keyPair = api.create(KEYPAIR_NAME);
|
keyPair = keyPairApi.create(KEYPAIR_NAME);
|
||||||
assertNotNull(keyPair);
|
assertNotNull(keyPair);
|
||||||
} finally {
|
} finally {
|
||||||
if (keyPair != null) {
|
if (keyPair != null) {
|
||||||
api.delete(KEYPAIR_NAME);
|
keyPairApi.delete(KEYPAIR_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,15 +62,15 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
final String KEYPAIR_NAME = "testkp";
|
final String KEYPAIR_NAME = "testkp";
|
||||||
final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
|
final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
|
||||||
|
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get();
|
KeyPairApi keyPairApi = api.getKeyPairExtensionForZone(zoneId).get();
|
||||||
KeyPair keyPair = null;
|
KeyPair keyPair = null;
|
||||||
try {
|
try {
|
||||||
keyPair = api.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY);
|
keyPair = keyPairApi.createWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY);
|
||||||
assertNotNull(keyPair);
|
assertNotNull(keyPair);
|
||||||
} finally {
|
} finally {
|
||||||
if (keyPair != null) {
|
if (keyPair != null) {
|
||||||
api.delete(KEYPAIR_NAME);
|
keyPairApi.delete(KEYPAIR_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,11 @@ public class QuotaApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
tenant = identity.split(":")[0];
|
tenant = identity.split(":")[0];
|
||||||
String zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
String zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
apiOption = novaContext.getApi().getQuotaExtensionForZone(zone);
|
apiOption = api.getQuotaExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetQuotasForCurrentTenant() {
|
public void testGetQuotasForCurrentTenant() {
|
||||||
|
|
|
@ -41,10 +41,10 @@ public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
apiOption = novaContext.getApi().getQuotaClassExtensionForZone(zone);
|
apiOption = api.getQuotaClassExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateAndGetQuotaClass() {
|
public void testUpdateAndGetQuotaClass() {
|
||||||
|
|
|
@ -42,58 +42,58 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
public static final String SECURITY_GROUP_NAME = "testsg";
|
public static final String SECURITY_GROUP_NAME = "testsg";
|
||||||
|
|
||||||
public void list() throws Exception {
|
public void list() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get();
|
SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
|
||||||
Set<? extends SecurityGroup> securityGroupsList = api.list().toSet();
|
Set<? extends SecurityGroup> securityGroupsList = securityGroupApi.list().toSet();
|
||||||
assertNotNull(securityGroupsList);
|
assertNotNull(securityGroupsList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createGetAndDeleteSecurityGroup() throws Exception {
|
public void createGetAndDeleteSecurityGroup() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get();
|
SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
|
||||||
SecurityGroup securityGroup = null;
|
SecurityGroup securityGroup = null;
|
||||||
String id;
|
String id;
|
||||||
try {
|
try {
|
||||||
securityGroup = api
|
securityGroup = securityGroupApi
|
||||||
.createWithDescription(SECURITY_GROUP_NAME, "test security group");
|
.createWithDescription(SECURITY_GROUP_NAME, "test security group");
|
||||||
assertNotNull(securityGroup);
|
assertNotNull(securityGroup);
|
||||||
id = securityGroup.getId();
|
id = securityGroup.getId();
|
||||||
SecurityGroup theGroup = api.get(id);
|
SecurityGroup theGroup = securityGroupApi.get(id);
|
||||||
assertNotNull(theGroup);
|
assertNotNull(theGroup);
|
||||||
} finally {
|
} finally {
|
||||||
if (securityGroup != null) {
|
if (securityGroup != null) {
|
||||||
api.delete(securityGroup.getId());
|
securityGroupApi.delete(securityGroup.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAndDeleteSecurityGroupRule() throws Exception {
|
public void createAndDeleteSecurityGroupRule() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get();
|
SecurityGroupApi securityGroupApi = api.getSecurityGroupExtensionForZone(zoneId).get();
|
||||||
SecurityGroup securityGroup = null;
|
SecurityGroup securityGroup = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
securityGroup = api.createWithDescription(SECURITY_GROUP_NAME, "test security group");
|
securityGroup = securityGroupApi.createWithDescription(SECURITY_GROUP_NAME, "test security group");
|
||||||
assertNotNull(securityGroup);
|
assertNotNull(securityGroup);
|
||||||
|
|
||||||
for (int port : ImmutableSet.of(22, 8080)) {
|
for (int port : ImmutableSet.of(22, 8080)) {
|
||||||
SecurityGroupRule rule = api.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress
|
SecurityGroupRule rule = securityGroupApi.createRuleAllowingCidrBlock(securityGroup.getId(), Ingress
|
||||||
.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
|
.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), "0.0.0.0/0");
|
||||||
assertNotNull(rule);
|
assertNotNull(rule);
|
||||||
|
|
||||||
SecurityGroupRule rule2 = api.createRuleAllowingSecurityGroupId(securityGroup.getId(),
|
SecurityGroupRule rule2 = securityGroupApi.createRuleAllowingSecurityGroupId(securityGroup.getId(),
|
||||||
Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), securityGroup
|
Ingress.builder().ipProtocol(IpProtocol.TCP).fromPort(port).toPort(port).build(), securityGroup
|
||||||
.getId());
|
.getId());
|
||||||
|
|
||||||
assertNotNull(rule2);
|
assertNotNull(rule2);
|
||||||
}
|
}
|
||||||
securityGroup = api.get(securityGroup.getId());
|
securityGroup = securityGroupApi.get(securityGroup.getId());
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (securityGroup != null) {
|
if (securityGroup != null) {
|
||||||
api.delete(securityGroup.getId());
|
securityGroupApi.delete(securityGroup.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,11 @@ public class ServerWithSecurityGroupsApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeGroups(groups = {"integration", "live"})
|
@BeforeGroups(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
serverApi = novaContext.getApi().getServerApiForZone(zone);
|
serverApi = api.getServerApiForZone(zone);
|
||||||
apiOption = novaContext.getApi().getServerWithSecurityGroupsExtensionForZone(zone);
|
apiOption = api.getServerWithSecurityGroupsExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetServer() {
|
public void testGetServer() {
|
||||||
|
|
|
@ -37,8 +37,8 @@ import com.google.common.base.Optional;
|
||||||
public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
|
public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
public void testList() throws Exception {
|
public void testList() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
|
Optional<? extends SimpleTenantUsageApi> optApi = api.getSimpleTenantUsageExtensionForZone(zoneId);
|
||||||
if (optApi.isPresent() && identity.endsWith(":admin")) {
|
if (optApi.isPresent() && identity.endsWith(":admin")) {
|
||||||
SimpleTenantUsageApi api = optApi.get();
|
SimpleTenantUsageApi api = optApi.get();
|
||||||
Set<? extends SimpleTenantUsage> usages = api.list().toSet();
|
Set<? extends SimpleTenantUsage> usages = api.list().toSet();
|
||||||
|
|
|
@ -44,10 +44,10 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
apiOption = novaContext.getApi().getVirtualInterfaceExtensionForZone(zone);
|
apiOption = api.getVirtualInterfaceExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListVirtualInterfaces() {
|
public void testListVirtualInterfaces() {
|
||||||
|
@ -62,7 +62,7 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (testServer != null) {
|
if (testServer != null) {
|
||||||
novaContext.getApi().getServerApiForZone(zone).delete(testServer.getId());
|
api.getServerApiForZone(zone).delete(testServer.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,15 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
volumeOption = novaContext.getApi().getVolumeExtensionForZone(zone);
|
volumeOption = api.getVolumeExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (volumeOption.isPresent()) {
|
if (volumeOption.isPresent()) {
|
||||||
if (testSnapshot != null) {
|
if (testSnapshot != null) {
|
||||||
final String snapshotId = testSnapshot.getId();
|
final String snapshotId = testSnapshot.getId();
|
||||||
|
@ -85,7 +85,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
}, 180 * 1000L).apply(volumeOption.get()));
|
}, 180 * 1000L).apply(volumeOption.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateVolume() {
|
public void testCreateVolume() {
|
||||||
|
@ -268,7 +268,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (server_id != null)
|
if (server_id != null)
|
||||||
novaContext.getApi().getServerApiForZone(zone).delete(server_id);
|
api.getServerApiForZone(zone).delete(server_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,16 +54,16 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeClass(groups = {"integration", "live"})
|
@BeforeClass(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
volumeApi = novaContext.getApi().getVolumeExtensionForZone(zone);
|
volumeApi = api.getVolumeExtensionForZone(zone);
|
||||||
volumeAttachmentApi = novaContext.getApi().getVolumeAttachmentExtensionForZone(zone);
|
volumeAttachmentApi = api.getVolumeAttachmentExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (volumeApi.isPresent()) {
|
if (volumeApi.isPresent()) {
|
||||||
if (testVolume != null) {
|
if (testVolume != null) {
|
||||||
final String volumeId = testVolume.getId();
|
final String volumeId = testVolume.getId();
|
||||||
|
@ -76,7 +76,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateVolume() {
|
public void testCreateVolume() {
|
||||||
|
@ -150,7 +150,7 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (server_id != null)
|
if (server_id != null)
|
||||||
novaContext.getApi().getServerApiForZone(zone).delete(server_id);
|
api.getServerApiForZone(zone).delete(server_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,16 +53,16 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@BeforeGroups(groups = {"integration", "live"})
|
@BeforeGroups(groups = {"integration", "live"})
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
zone = Iterables.getLast(novaContext.getApi().getConfiguredZones(), "nova");
|
zone = Iterables.getLast(api.getConfiguredZones(), "nova");
|
||||||
volumeTypeOption = novaContext.getApi().getVolumeTypeExtensionForZone(zone);
|
volumeTypeOption = api.getVolumeTypeExtensionForZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@AfterClass(groups = { "integration", "live" })
|
@AfterClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
if (volumeTypeOption.isPresent()) {
|
if (volumeTypeOption.isPresent()) {
|
||||||
if (testVolumeType != null) {
|
if (testVolumeType != null) {
|
||||||
final String id = testVolumeType.getId();
|
final String id = testVolumeType.getId();
|
||||||
|
@ -74,7 +74,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
}, 5 * 1000L).apply(volumeTypeOption.get()));
|
}, 5 * 1000L).apply(volumeTypeOption.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateVolumeType() {
|
public void testCreateVolumeType() {
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/extensions")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/extensions")
|
||||||
public void testListExtensions() throws Exception {
|
public void testListExtensions() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId);
|
ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId);
|
||||||
Set<? extends Extension> response = api.list();
|
Set<? extends Extension> response = extensionApi.list();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertFalse(response.isEmpty());
|
assertFalse(response.isEmpty());
|
||||||
for (Extension extension : response) {
|
for (Extension extension : response) {
|
||||||
|
@ -68,10 +68,10 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/extensions/{alias}", dependsOnMethods = { "testListExtensions" })
|
@Test(description = "GET /v${apiVersion}/{tenantId}/extensions/{alias}", dependsOnMethods = { "testListExtensions" })
|
||||||
public void testGetExtensionByAlias() throws Exception {
|
public void testGetExtensionByAlias() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId);
|
ExtensionApi extensionApi = api.getExtensionApiForZone(zoneId);
|
||||||
Set<? extends Extension> response = api.list();
|
Set<? extends Extension> response = extensionApi.list();
|
||||||
for (Extension extension : response) {
|
for (Extension extension : response) {
|
||||||
Extension details = api.get(extension.getId());
|
Extension details = extensionApi.get(extension.getId());
|
||||||
assertNotNull(details);
|
assertNotNull(details);
|
||||||
assertEquals(details.getId(), extension.getId());
|
assertEquals(details.getId(), extension.getId());
|
||||||
assertEquals(details.getName(), extension.getName());
|
assertEquals(details.getName(), extension.getName());
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors")
|
||||||
public void testListFlavors() throws Exception {
|
public void testListFlavors() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
|
FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
|
||||||
Set<? extends Resource> response = api.list().concat().toSet();
|
Set<? extends Resource> response = flavorApi.list().concat().toSet();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertFalse(response.isEmpty());
|
assertFalse(response.isEmpty());
|
||||||
for (Resource flavor : response) {
|
for (Resource flavor : response) {
|
||||||
|
@ -66,8 +66,8 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors/detail")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors/detail")
|
||||||
public void testListFlavorsInDetail() throws Exception {
|
public void testListFlavorsInDetail() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
|
FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
|
||||||
Set<? extends Flavor> response = api.listInDetail().concat().toSet();
|
Set<? extends Flavor> response = flavorApi.listInDetail().concat().toSet();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertFalse(response.isEmpty());
|
assertFalse(response.isEmpty());
|
||||||
for (Flavor flavor : response) {
|
for (Flavor flavor : response) {
|
||||||
|
@ -89,10 +89,10 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors/{id}", dependsOnMethods = { "testListFlavorsInDetail" })
|
@Test(description = "GET /v${apiVersion}/{tenantId}/flavors/{id}", dependsOnMethods = { "testListFlavorsInDetail" })
|
||||||
public void testGetFlavorById() throws Exception {
|
public void testGetFlavorById() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId);
|
FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
|
||||||
Set<? extends Flavor> response = api.listInDetail().concat().toSet();
|
Set<? extends Flavor> response = flavorApi.listInDetail().concat().toSet();
|
||||||
for (Flavor flavor : response) {
|
for (Flavor flavor : response) {
|
||||||
Flavor details = api.get(flavor.getId());
|
Flavor details = flavorApi.get(flavor.getId());
|
||||||
assertNotNull(details);
|
assertNotNull(details);
|
||||||
assertEquals(details.getId(), flavor.getId());
|
assertEquals(details.getId(), flavor.getId());
|
||||||
assertEquals(details.getName(), flavor.getName());
|
assertEquals(details.getName(), flavor.getName());
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/images")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/images")
|
||||||
public void testListImages() throws Exception {
|
public void testListImages() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
|
ImageApi imageApi = api.getImageApiForZone(zoneId);
|
||||||
Set<? extends Resource> response = api.list().concat().toSet();
|
Set<? extends Resource> response = imageApi.list().concat().toSet();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertFalse(response.isEmpty());
|
assertFalse(response.isEmpty());
|
||||||
for (Resource image : response) {
|
for (Resource image : response) {
|
||||||
|
@ -55,9 +55,9 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/images/detail")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/images/detail")
|
||||||
public void testListImagesInDetail() throws Exception {
|
public void testListImagesInDetail() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
|
ImageApi imageApi = api.getImageApiForZone(zoneId);
|
||||||
Set<? extends Image> response = api.listInDetail().concat().toSet();
|
Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertFalse(response.isEmpty());
|
assertFalse(response.isEmpty());
|
||||||
for (Image image : response) {
|
for (Image image : response) {
|
||||||
|
@ -79,11 +79,11 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
|
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/images/{id}", dependsOnMethods = { "testListImagesInDetail" })
|
@Test(description = "GET /v${apiVersion}/{tenantId}/images/{id}", dependsOnMethods = { "testListImagesInDetail" })
|
||||||
public void testGetImageById() throws Exception {
|
public void testGetImageById() throws Exception {
|
||||||
for (String zoneId : novaContext.getApi().getConfiguredZones()) {
|
for (String zoneId : api.getConfiguredZones()) {
|
||||||
ImageApi api = novaContext.getApi().getImageApiForZone(zoneId);
|
ImageApi imageApi = api.getImageApiForZone(zoneId);
|
||||||
Set<? extends Image> response = api.listInDetail().concat().toSet();
|
Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
|
||||||
for (Image image : response) {
|
for (Image image : response) {
|
||||||
Image details = api.get(image.getId());
|
Image details = imageApi.get(image.getId());
|
||||||
assertNotNull(details);
|
assertNotNull(details);
|
||||||
assertEquals(details.getId(), image.getId());
|
assertEquals(details.getId(), image.getId());
|
||||||
assertEquals(details.getName(), image.getName());
|
assertEquals(details.getName(), image.getName());
|
||||||
|
|
|
@ -43,8 +43,8 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/servers")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/servers")
|
||||||
public void testListServers() throws Exception {
|
public void testListServers() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ServerApi api = novaContext.getApi().getServerApiForZone(zoneId);
|
ServerApi serverApi = api.getServerApiForZone(zoneId);
|
||||||
for (Resource server : api.list().concat()) {
|
for (Resource server : serverApi.list().concat()) {
|
||||||
checkResource(server);
|
checkResource(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/detail")
|
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/detail")
|
||||||
public void testListServersInDetail() throws Exception {
|
public void testListServersInDetail() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ServerApi api = novaContext.getApi().getServerApiForZone(zoneId);
|
ServerApi serverApi = api.getServerApiForZone(zoneId);
|
||||||
for (Server server : api.listInDetail().concat()) {
|
for (Server server : serverApi.listInDetail().concat()) {
|
||||||
checkServer(server);
|
checkServer(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,9 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest {
|
||||||
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" })
|
@Test(description = "GET /v${apiVersion}/{tenantId}/servers/{id}", dependsOnMethods = { "testListServersInDetail" })
|
||||||
public void testGetServerById() throws Exception {
|
public void testGetServerById() throws Exception {
|
||||||
for (String zoneId : zones) {
|
for (String zoneId : zones) {
|
||||||
ServerApi api = novaContext.getApi().getServerApiForZone(zoneId);
|
ServerApi serverApi = api.getServerApiForZone(zoneId);
|
||||||
for (Resource server : api.list().concat()) {
|
for (Resource server : serverApi.list().concat()) {
|
||||||
Server details = api.get(server.getId());
|
Server details = serverApi.get(server.getId());
|
||||||
assertEquals(details.getId(), server.getId());
|
assertEquals(details.getId(), server.getId());
|
||||||
assertEquals(details.getName(), server.getName());
|
assertEquals(details.getName(), server.getName());
|
||||||
assertEquals(details.getLinks(), server.getLinks());
|
assertEquals(details.getLinks(), server.getLinks());
|
||||||
|
|
|
@ -21,10 +21,9 @@ package org.jclouds.openstack.nova.v2_0.internal;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
import org.jclouds.openstack.nova.v2_0.NovaApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.config.NovaProperties;
|
import org.jclouds.openstack.nova.v2_0.config.NovaProperties;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.Flavor;
|
import org.jclouds.openstack.nova.v2_0.domain.Flavor;
|
||||||
import org.jclouds.openstack.nova.v2_0.domain.Server;
|
import org.jclouds.openstack.nova.v2_0.domain.Server;
|
||||||
|
@ -34,7 +33,6 @@ import org.jclouds.openstack.nova.v2_0.features.FlavorApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ImageApi;
|
import org.jclouds.openstack.nova.v2_0.features.ImageApi;
|
||||||
import org.jclouds.openstack.nova.v2_0.features.ServerApi;
|
import org.jclouds.openstack.nova.v2_0.features.ServerApi;
|
||||||
import org.jclouds.openstack.v2_0.domain.Resource;
|
import org.jclouds.openstack.v2_0.domain.Resource;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -49,7 +47,7 @@ import com.google.common.collect.Ordering;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest {
|
public class BaseNovaApiLiveTest extends BaseApiLiveTest<NovaApi> {
|
||||||
protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase();
|
protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase();
|
||||||
|
|
||||||
public BaseNovaApiLiveTest() {
|
public BaseNovaApiLiveTest() {
|
||||||
|
@ -57,19 +55,17 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<String> zones;
|
protected Set<String> zones;
|
||||||
protected RestContext<NovaApi, NovaAsyncApi> novaContext;
|
|
||||||
|
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
@BeforeClass(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
novaContext = view.unwrap();
|
zones = api.getConfiguredZones();
|
||||||
zones = novaContext.getApi().getConfiguredZones();
|
|
||||||
for (String zone : zones){
|
for (String zone : zones){
|
||||||
ServerApi api = novaContext.getApi().getServerApiForZone(zone);
|
ServerApi serverApi = api.getServerApiForZone(zone);
|
||||||
for (Resource server : api.list().concat()){
|
for (Resource server : serverApi.list().concat()){
|
||||||
if (server.getName().equals(hostName))
|
if (server.getName().equals(hostName))
|
||||||
api.delete(server.getId());
|
serverApi.delete(server.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +79,7 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Server createServerInZone(String zoneId) {
|
protected Server createServerInZone(String zoneId) {
|
||||||
ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId);
|
ServerApi serverApi = api.getServerApiForZone(zoneId);
|
||||||
ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId));
|
ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId));
|
||||||
blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE);
|
blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE);
|
||||||
return serverApi.get(server.getId());
|
return serverApi.get(server.getId());
|
||||||
|
@ -108,12 +104,12 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String imageIdForZone(String zoneId) {
|
protected String imageIdForZone(String zoneId) {
|
||||||
ImageApi imageApi = novaContext.getApi().getImageApiForZone(zoneId);
|
ImageApi imageApi = api.getImageApiForZone(zoneId);
|
||||||
return Iterables.getLast(imageApi.list().concat()).getId();
|
return Iterables.getLast(imageApi.list().concat()).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String flavorRefForZone(String zoneId) {
|
protected String flavorRefForZone(String zoneId) {
|
||||||
FlavorApi flavorApi = novaContext.getApi().getFlavorApiForZone(zoneId);
|
FlavorApi flavorApi = api.getFlavorApiForZone(zoneId);
|
||||||
return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId();
|
return DEFAULT_FLAVOR_ORDERING.min(flavorApi.listInDetail().concat()).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/**
|
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. jclouds 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
|
|
||||||
*
|
|
||||||
* 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.openstack.nova.v2_0.internal;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for writing KeyStone Rest Api Expect tests
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
public class BaseNovaAsyncApiExpectTest extends BaseNovaExpectTest<NovaAsyncApi> {
|
|
||||||
public NovaAsyncApi createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
|
|
||||||
return createInjector(fn, module, props).getInstance(NovaAsyncApi.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -33,7 +33,6 @@ import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule;
|
||||||
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
|
||||||
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
@ -46,7 +45,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CloudIdentityApiMetadata extends KeystoneApiMetadata {
|
public class CloudIdentityApiMetadata extends KeystoneApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<KeystoneApi, KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<KeystoneApi, KeystoneAsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as
|
||||||
|
* {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<KeystoneApi, KeystoneAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,6 +74,7 @@ public class CloudIdentityApiMetadata extends KeystoneApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder extends KeystoneApiMetadata.Builder<Builder> {
|
public static class Builder extends KeystoneApiMetadata.Builder<Builder> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder(){
|
protected Builder(){
|
||||||
super(KeystoneApi.class, KeystoneAsyncApi.class);
|
super(KeystoneApi.class, KeystoneAsyncApi.class);
|
||||||
id("rackspace-cloudidentity")
|
id("rackspace-cloudidentity")
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticati
|
||||||
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
|
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
|
||||||
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule;
|
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule;
|
||||||
import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
|
import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -45,8 +44,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
|
public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>> CONTEXT_TOKEN =
|
/**
|
||||||
new TypeToken<RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>>() {
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as
|
||||||
|
* {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,6 +75,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
super(CloudLoadBalancersApi.class, CloudLoadBalancersAsyncApi.class);
|
super(CloudLoadBalancersApi.class, CloudLoadBalancersAsyncApi.class);
|
||||||
id("rackspace-cloudloadbalancers")
|
id("rackspace-cloudloadbalancers")
|
||||||
|
|
|
@ -49,7 +49,10 @@ import com.google.inject.Provides;
|
||||||
*
|
*
|
||||||
* @see CloudLoadBalancersApi
|
* @see CloudLoadBalancersApi
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as
|
||||||
|
* {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CloudLoadBalancersAsyncApi extends Closeable {
|
public interface CloudLoadBalancersAsyncApi extends Closeable {
|
||||||
/**
|
/**
|
||||||
* @return the Zone codes configured
|
* @return the Zone codes configured
|
||||||
|
|
|
@ -56,8 +56,8 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeGroups(groups = { "live" })
|
@BeforeGroups(groups = { "live" })
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
|
|
||||||
accessRule1 = AccessRule.deny("206.160.163.21");
|
accessRule1 = AccessRule.deny("206.160.163.21");
|
||||||
accessRule2 = AccessRule.deny("206.160.165.11");
|
accessRule2 = AccessRule.deny("206.160.165.11");
|
||||||
|
@ -76,57 +76,57 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = "ORD";//Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = "ORD";//Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAccessList() throws Exception {
|
public void testCreateAccessList() throws Exception {
|
||||||
clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).create(accessRules.values());
|
api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).create(accessRules.values());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
assertExpectedAccessRules(accessRules);
|
assertExpectedAccessRules(accessRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAccessList")
|
@Test(dependsOnMethods = "testCreateAccessList")
|
||||||
public void testRemoveSingleAccessRule() throws Exception {
|
public void testRemoveSingleAccessRule() throws Exception {
|
||||||
Iterable<AccessRuleWithId> actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<AccessRuleWithId> actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
AccessRuleWithId removedAccessRule = Iterables.getFirst(actualAccessList, null);
|
AccessRuleWithId removedAccessRule = Iterables.getFirst(actualAccessList, null);
|
||||||
accessRules.remove(removedAccessRule.getAddress());
|
accessRules.remove(removedAccessRule.getAddress());
|
||||||
|
|
||||||
assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRule.getId()));
|
assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRule.getId()));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
assertExpectedAccessRules(accessRules);
|
assertExpectedAccessRules(accessRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testRemoveSingleAccessRule")
|
@Test(dependsOnMethods = "testRemoveSingleAccessRule")
|
||||||
public void testRemoveManyAccessRules() throws Exception {
|
public void testRemoveManyAccessRules() throws Exception {
|
||||||
Iterable<AccessRuleWithId> actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<AccessRuleWithId> actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
AccessRuleWithId removedAccessRule1 = Iterables.getFirst(actualAccessList, null);
|
AccessRuleWithId removedAccessRule1 = Iterables.getFirst(actualAccessList, null);
|
||||||
AccessRuleWithId removedAccessRule2 = Iterables.getLast(actualAccessList);
|
AccessRuleWithId removedAccessRule2 = Iterables.getLast(actualAccessList);
|
||||||
List<Integer> removedAccessRuleIds = ImmutableList.<Integer> of(removedAccessRule1.getId(), removedAccessRule2.getId());
|
List<Integer> removedAccessRuleIds = ImmutableList.<Integer> of(removedAccessRule1.getId(), removedAccessRule2.getId());
|
||||||
accessRules.remove(removedAccessRule1.getAddress());
|
accessRules.remove(removedAccessRule1.getAddress());
|
||||||
accessRules.remove(removedAccessRule2.getAddress());
|
accessRules.remove(removedAccessRule2.getAddress());
|
||||||
|
|
||||||
assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRuleIds));
|
assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedAccessRuleIds));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
assertExpectedAccessRules(accessRules);
|
assertExpectedAccessRules(accessRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testRemoveManyAccessRules")
|
@Test(dependsOnMethods = "testRemoveManyAccessRules")
|
||||||
public void testRemoveAllAccessRules() throws Exception {
|
public void testRemoveAllAccessRules() throws Exception {
|
||||||
assertTrue(clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll());
|
assertTrue(api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).deleteAll());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
assertExpectedAccessRules(new HashMap<String, AccessRule>());
|
assertExpectedAccessRules(new HashMap<String, AccessRule>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertExpectedAccessRules(Map<String, AccessRule> expectedAccessList) {
|
private void assertExpectedAccessRules(Map<String, AccessRule> expectedAccessList) {
|
||||||
Iterable<AccessRuleWithId> actualAccessList = clbApi.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<AccessRuleWithId> actualAccessList = api.getAccessRuleApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
|
|
||||||
for (AccessRule actualAccessRule: actualAccessList) {
|
for (AccessRule actualAccessRule: actualAccessList) {
|
||||||
assertEquals(expectedAccessList.containsKey(actualAccessRule.getAddress()), true,
|
assertEquals(expectedAccessList.containsKey(actualAccessRule.getAddress()), true,
|
||||||
|
@ -136,10 +136,10 @@ public class AccessRuleApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,63 +49,63 @@ public class ConnectionApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAndGetConnectionThrottling() throws Exception {
|
public void testCreateAndGetConnectionThrottling() throws Exception {
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdateConnectionThrottle(
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdateConnectionThrottle(
|
||||||
ConnectionApiExpectTest.getConnectionThrottle());
|
ConnectionApiExpectTest.getConnectionThrottle());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
ConnectionThrottle connectionThrottle =
|
ConnectionThrottle connectionThrottle =
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle();
|
||||||
|
|
||||||
assertEquals(connectionThrottle, ConnectionApiExpectTest.getConnectionThrottle());
|
assertEquals(connectionThrottle, ConnectionApiExpectTest.getConnectionThrottle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndGetConnectionThrottling")
|
@Test(dependsOnMethods = "testCreateAndGetConnectionThrottling")
|
||||||
public void testRemoveAndGetConnectionThrottle() throws Exception {
|
public void testRemoveAndGetConnectionThrottle() throws Exception {
|
||||||
assertTrue(clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).deleteConnectionThrottle());
|
assertTrue(api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).deleteConnectionThrottle());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
ConnectionThrottle connectionThrottle =
|
ConnectionThrottle connectionThrottle =
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).getConnectionThrottle();
|
||||||
|
|
||||||
assertNull(connectionThrottle);
|
assertNull(connectionThrottle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testRemoveAndGetConnectionThrottle")
|
@Test(dependsOnMethods = "testRemoveAndGetConnectionThrottle")
|
||||||
public void testEnableAndIsConnectionLogging() throws Exception {
|
public void testEnableAndIsConnectionLogging() throws Exception {
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).enableConnectionLogging();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).enableConnectionLogging();
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
boolean isConnectionLogging =
|
boolean isConnectionLogging =
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging();
|
||||||
|
|
||||||
assertTrue(isConnectionLogging);
|
assertTrue(isConnectionLogging);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testEnableAndIsConnectionLogging")
|
@Test(dependsOnMethods = "testEnableAndIsConnectionLogging")
|
||||||
public void testDisableAndIsConnectionLogging() throws Exception {
|
public void testDisableAndIsConnectionLogging() throws Exception {
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).disableConnectionLogging();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).disableConnectionLogging();
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
boolean isConnectionLogging =
|
boolean isConnectionLogging =
|
||||||
clbApi.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging();
|
api.getConnectionApiForZoneAndLoadBalancer(zone, lb.getId()).isConnectionLogging();
|
||||||
|
|
||||||
assertFalse(isConnectionLogging);
|
assertFalse(isConnectionLogging);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,40 +46,40 @@ public class ContentCachingApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testEnableAndIsContentCaching() throws Exception {
|
public void testEnableAndIsContentCaching() throws Exception {
|
||||||
clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).enable();
|
api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).enable();
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
boolean isContentCaching =
|
boolean isContentCaching =
|
||||||
clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching();
|
api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching();
|
||||||
|
|
||||||
assertTrue(isContentCaching);
|
assertTrue(isContentCaching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testEnableAndIsContentCaching")
|
@Test(dependsOnMethods = "testEnableAndIsContentCaching")
|
||||||
public void testDisableAndIsContentCaching() throws Exception {
|
public void testDisableAndIsContentCaching() throws Exception {
|
||||||
clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).disable();
|
api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).disable();
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
boolean isContentCaching =
|
boolean isContentCaching =
|
||||||
clbApi.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching();
|
api.getContentCachingApiForZoneAndLoadBalancer(zone, lb.getId()).isContentCaching();
|
||||||
|
|
||||||
assertFalse(isContentCaching);
|
assertFalse(isContentCaching);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeGroups(groups = { "live" })
|
@BeforeGroups(groups = { "live" })
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
|
|
||||||
contentExpected = ErrorPageApiExpectTest.getContentExpected();
|
contentExpected = ErrorPageApiExpectTest.getContentExpected();
|
||||||
contentEscaped = ErrorPageApiExpectTest.getContentEscaped();
|
contentEscaped = ErrorPageApiExpectTest.getContentEscaped();
|
||||||
|
@ -58,38 +58,38 @@ public class ErrorPageApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAndGetErrorPage() throws Exception {
|
public void testCreateAndGetErrorPage() throws Exception {
|
||||||
clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).create(contentEscaped);
|
api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).create(contentEscaped);
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
String content = clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
String content = api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertEquals(content, contentExpected);
|
assertEquals(content, contentExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndGetErrorPage")
|
@Test(dependsOnMethods = "testCreateAndGetErrorPage")
|
||||||
public void testRemoveAndGetErrorPage() throws Exception {
|
public void testRemoveAndGetErrorPage() throws Exception {
|
||||||
assertTrue(clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
assertTrue(api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
String content = clbApi.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
String content = api.getErrorPageApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertTrue(content.contains("Service Unavailable"));
|
assertTrue(content.contains("Service Unavailable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,41 +48,41 @@ public class HealthMonitorApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAndGetHealthMonitor() throws Exception {
|
public void testCreateAndGetHealthMonitor() throws Exception {
|
||||||
clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate(
|
api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate(
|
||||||
HealthMonitorApiExpectTest.getConnectHealthMonitor());
|
HealthMonitorApiExpectTest.getConnectHealthMonitor());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
HealthMonitor healthMonitor =
|
HealthMonitor healthMonitor =
|
||||||
clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertEquals(healthMonitor, HealthMonitorApiExpectTest.getConnectHealthMonitor());
|
assertEquals(healthMonitor, HealthMonitorApiExpectTest.getConnectHealthMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndGetHealthMonitor")
|
@Test(dependsOnMethods = "testCreateAndGetHealthMonitor")
|
||||||
public void testRemoveAndGetHealthMonitor() throws Exception {
|
public void testRemoveAndGetHealthMonitor() throws Exception {
|
||||||
assertTrue(clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
assertTrue(api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
HealthMonitor healthMonitor =
|
HealthMonitor healthMonitor =
|
||||||
clbApi.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getHealthMonitorApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertNull(healthMonitor);
|
assertNull(healthMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,20 +53,20 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
for (LoadBalancer lb: lbs) {
|
for (LoadBalancer lb: lbs) {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(lb.getRegion()).delete(lb.getId());
|
api.getLoadBalancerApiForZone(lb.getRegion()).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateLoadBalancer() throws Exception {
|
public void testCreateLoadBalancer() throws Exception {
|
||||||
for (String zone: clbApi.getConfiguredZones()) {
|
for (String zone: api.getConfiguredZones()) {
|
||||||
Logger.getAnonymousLogger().info("starting lb in region " + zone);
|
Logger.getAnonymousLogger().info("starting lb in region " + zone);
|
||||||
|
|
||||||
LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create(
|
LoadBalancer lb = api.getLoadBalancerApiForZone(zone).create(
|
||||||
CreateLoadBalancer.builder()
|
CreateLoadBalancer.builder()
|
||||||
.name(prefix + "-" + zone)
|
.name(prefix + "-" + zone)
|
||||||
.protocol("HTTP")
|
.protocol("HTTP")
|
||||||
|
@ -83,9 +83,9 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
lbs.add(lb);
|
lbs.add(lb);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
|
|
||||||
LoadBalancer newLb = clbApi.getLoadBalancerApiForZone(zone).get(lb.getId());
|
LoadBalancer newLb = api.getLoadBalancerApiForZone(zone).get(lb.getId());
|
||||||
checkLBInRegion(zone, newLb, prefix + "-" + zone);
|
checkLBInRegion(zone, newLb, prefix + "-" + zone);
|
||||||
|
|
||||||
assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE);
|
assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE);
|
||||||
|
@ -95,12 +95,12 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testUpdateLoadBalancer() throws Exception {
|
public void testUpdateLoadBalancer() throws Exception {
|
||||||
for (LoadBalancer lb: lbs) {
|
for (LoadBalancer lb: lbs) {
|
||||||
clbApi.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(),
|
api.getLoadBalancerApiForZone(lb.getRegion()).update(lb.getId(),
|
||||||
UpdateLoadBalancer.builder().name("foo" + "-" + lb.getRegion()).build());
|
UpdateLoadBalancer.builder().name("foo" + "-" + lb.getRegion()).build());
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
|
|
||||||
LoadBalancer newLb = clbApi.getLoadBalancerApiForZone(lb.getRegion()).get(lb.getId());
|
LoadBalancer newLb = api.getLoadBalancerApiForZone(lb.getRegion()).get(lb.getId());
|
||||||
checkLBInRegion(newLb.getRegion(), newLb, "foo" + "-" + lb.getRegion());
|
checkLBInRegion(newLb.getRegion(), newLb, "foo" + "-" + lb.getRegion());
|
||||||
|
|
||||||
assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE);
|
assertEquals(newLb.getStatus(), LoadBalancer.Status.ACTIVE);
|
||||||
|
@ -109,9 +109,9 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testUpdateLoadBalancer")
|
@Test(dependsOnMethods = "testUpdateLoadBalancer")
|
||||||
public void testListLoadBalancers() throws Exception {
|
public void testListLoadBalancers() throws Exception {
|
||||||
for (String zone: clbApi.getConfiguredZones()) {
|
for (String zone: api.getConfiguredZones()) {
|
||||||
|
|
||||||
Set<LoadBalancer> response = clbApi.getLoadBalancerApiForZone(zone).list().concat().toSet();
|
Set<LoadBalancer> response = api.getLoadBalancerApiForZone(zone).list().concat().toSet();
|
||||||
|
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() >= 0);
|
||||||
|
@ -131,7 +131,7 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
// node info not available during list;
|
// node info not available during list;
|
||||||
assert lb.getNodes().size() == 0 : lb;
|
assert lb.getNodes().size() == 0 : lb;
|
||||||
|
|
||||||
LoadBalancer getDetails = clbApi.getLoadBalancerApiForZone(zone).get(lb.getId());
|
LoadBalancer getDetails = api.getLoadBalancerApiForZone(zone).get(lb.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
assertEquals(getDetails.getRegion(), lb.getRegion());
|
assertEquals(getDetails.getRegion(), lb.getRegion());
|
||||||
|
@ -160,27 +160,27 @@ public class LoadBalancerApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
"key2", "value2",
|
"key2", "value2",
|
||||||
"key3", "value3");
|
"key3", "value3");
|
||||||
|
|
||||||
Metadata metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).createMetadata(lb.getId(), metadataMap);
|
Metadata metadata = api.getLoadBalancerApiForZone(lb.getRegion()).createMetadata(lb.getId(), metadataMap);
|
||||||
assertEquals(metadata, getExpectedMetadata());
|
assertEquals(metadata, getExpectedMetadata());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
|
|
||||||
metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
||||||
assertEquals(metadata, getExpectedMetadata());
|
assertEquals(metadata, getExpectedMetadata());
|
||||||
|
|
||||||
assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).updateMetadatum(lb.getId(), metadata.getId("key1"), "key1-updated"));
|
assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).updateMetadatum(lb.getId(), metadata.getId("key1"), "key1-updated"));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
||||||
assertEquals(metadata.get("key1"), "key1-updated");
|
assertEquals(metadata.get("key1"), "key1-updated");
|
||||||
|
|
||||||
assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadatum(lb.getId(), metadata.getId("key1")));
|
assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadatum(lb.getId(), metadata.getId("key1")));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
||||||
assertNull(metadata.get("key1"));
|
assertNull(metadata.get("key1"));
|
||||||
|
|
||||||
assertTrue(clbApi.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadata(lb.getId(),
|
assertTrue(api.getLoadBalancerApiForZone(lb.getRegion()).deleteMetadata(lb.getId(),
|
||||||
ImmutableList.<Integer> of(metadata.getId("key2"), metadata.getId("key3"))));
|
ImmutableList.<Integer> of(metadata.getId("key2"), metadata.getId("key3"))));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
metadata = api.getLoadBalancerApiForZone(lb.getRegion()).getMetadata(lb.getId());
|
||||||
assertEquals(metadata.size(), 0);
|
assertEquals(metadata.size(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,16 +57,16 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
private Map<LoadBalancer, Set<Node>> nodes = Maps.newHashMap();
|
private Map<LoadBalancer, Set<Node>> nodes = Maps.newHashMap();
|
||||||
|
|
||||||
public void testCreateLoadBalancers() {
|
public void testCreateLoadBalancers() {
|
||||||
assertTrue(clbApi.getConfiguredZones().size() > 0, "Need to have some zones!");
|
assertTrue(api.getConfiguredZones().size() > 0, "Need to have some zones!");
|
||||||
Logger.getAnonymousLogger().info("running against zones " + clbApi.getConfiguredZones());
|
Logger.getAnonymousLogger().info("running against zones " + api.getConfiguredZones());
|
||||||
for (String zone : clbApi.getConfiguredZones()) {
|
for (String zone : api.getConfiguredZones()) {
|
||||||
Logger.getAnonymousLogger().info("starting lb in zone " + zone);
|
Logger.getAnonymousLogger().info("starting lb in zone " + zone);
|
||||||
LoadBalancer lb = clbApi.getLoadBalancerApiForZone(zone).create(
|
LoadBalancer lb = api.getLoadBalancerApiForZone(zone).create(
|
||||||
CreateLoadBalancer.builder().name(prefix + "-" + zone).protocol("HTTP").port(80).virtualIPType(
|
CreateLoadBalancer.builder().name(prefix + "-" + zone).protocol("HTTP").port(80).virtualIPType(
|
||||||
Type.PUBLIC).node(AddNode.builder().address("192.168.1.1").port(8080).build()).build());
|
Type.PUBLIC).node(AddNode.builder().address("192.168.1.1").port(8080).build()).build());
|
||||||
nodes.put(lb, new HashSet<Node>());
|
nodes.put(lb, new HashSet<Node>());
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,17 +77,17 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
Set<Node> nodeSet = entry.getValue();
|
Set<Node> nodeSet = entry.getValue();
|
||||||
String region = lb.getRegion();
|
String region = lb.getRegion();
|
||||||
Logger.getAnonymousLogger().info("starting node on loadbalancer " + lb.getId() + " in region " + region);
|
Logger.getAnonymousLogger().info("starting node on loadbalancer " + lb.getId() + " in region " + region);
|
||||||
Set<Node> newNodes = clbApi.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).add(
|
Set<Node> newNodes = api.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).add(
|
||||||
ImmutableSet.<AddNode> of(AddNode.builder().address("192.168.1.2").port(8080).build()));
|
ImmutableSet.<AddNode> of(AddNode.builder().address("192.168.1.2").port(8080).build()));
|
||||||
|
|
||||||
for (Node n : newNodes) {
|
for (Node n : newNodes) {
|
||||||
assertEquals(n.getStatus(), Node.Status.ONLINE);
|
assertEquals(n.getStatus(), Node.Status.ONLINE);
|
||||||
nodeSet.add(n);
|
nodeSet.add(n);
|
||||||
assertEquals(clbApi.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).get(n.getId()).getStatus(),
|
assertEquals(api.getNodeApiForZoneAndLoadBalancer(region, lb.getId()).get(n.getId()).getStatus(),
|
||||||
Node.Status.ONLINE);
|
Node.Status.ONLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
||||||
for (Node n : entry.getValue()) {
|
for (Node n : entry.getValue()) {
|
||||||
String region = entry.getKey().getRegion();
|
String region = entry.getKey().getRegion();
|
||||||
clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).update(n.getId(),
|
api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).update(n.getId(),
|
||||||
UpdateNode.builder().weight(23).build());
|
UpdateNode.builder().weight(23).build());
|
||||||
assertEquals(clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId())
|
assertEquals(api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId())
|
||||||
.getStatus(), Node.Status.ONLINE);
|
.getStatus(), Node.Status.ONLINE);
|
||||||
|
|
||||||
Node newNode = clbApi.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId());
|
Node newNode = api.getNodeApiForZoneAndLoadBalancer(region, entry.getKey().getId()).get(n.getId());
|
||||||
assertEquals(newNode.getStatus(), Node.Status.ONLINE);
|
assertEquals(newNode.getStatus(), Node.Status.ONLINE);
|
||||||
assertEquals(newNode.getWeight(), (Integer) 23);
|
assertEquals(newNode.getWeight(), (Integer) 23);
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
@Test(dependsOnMethods = "testModifyNode")
|
@Test(dependsOnMethods = "testModifyNode")
|
||||||
public void testListNodes() throws Exception {
|
public void testListNodes() throws Exception {
|
||||||
for (LoadBalancer lb : nodes.keySet()) {
|
for (LoadBalancer lb : nodes.keySet()) {
|
||||||
Set<Node> response = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toSet();
|
Set<Node> response = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).list().concat().toSet();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() >= 0);
|
||||||
for (Node n : response) {
|
for (Node n : response) {
|
||||||
|
@ -123,7 +123,7 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
assert !Arrays.asList(LoadBalancer.WEIGHTED_ALGORITHMS).contains(lb.getAlgorithm())
|
assert !Arrays.asList(LoadBalancer.WEIGHTED_ALGORITHMS).contains(lb.getAlgorithm())
|
||||||
|| n.getWeight() != null : n;
|
|| n.getWeight() != null : n;
|
||||||
|
|
||||||
Node getDetails = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).get(n.getId());
|
Node getDetails = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).get(n.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
assertEquals(getDetails.getId(), n.getId());
|
assertEquals(getDetails.getId(), n.getId());
|
||||||
|
@ -151,45 +151,45 @@ public class NodeApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
"key2", "value2",
|
"key2", "value2",
|
||||||
"key3", "value3");
|
"key3", "value3");
|
||||||
|
|
||||||
Metadata metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).createMetadata(node.getId(), metadataMap);
|
Metadata metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).createMetadata(node.getId(), metadataMap);
|
||||||
assertEquals(metadata, getExpectedMetadata());
|
assertEquals(metadata, getExpectedMetadata());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
|
|
||||||
metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
||||||
assertEquals(metadata, getExpectedMetadata());
|
assertEquals(metadata, getExpectedMetadata());
|
||||||
|
|
||||||
assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).updateMetadatum(node.getId(), metadata.getId("key1"), "key1-updated"));
|
assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).updateMetadatum(node.getId(), metadata.getId("key1"), "key1-updated"));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
||||||
assertEquals(metadata.get("key1"), "key1-updated");
|
assertEquals(metadata.get("key1"), "key1-updated");
|
||||||
|
|
||||||
assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadatum(node.getId(), metadata.getId("key1")));
|
assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadatum(node.getId(), metadata.getId("key1")));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
||||||
assertNull(metadata.get("key1"));
|
assertNull(metadata.get("key1"));
|
||||||
|
|
||||||
assertTrue(clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadata(node.getId(),
|
assertTrue(api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).deleteMetadata(node.getId(),
|
||||||
ImmutableList.<Integer> of(metadata.getId("key2"), metadata.getId("key3"))));
|
ImmutableList.<Integer> of(metadata.getId("key2"), metadata.getId("key3"))));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
metadata = clbApi.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
metadata = api.getNodeApiForZoneAndLoadBalancer(lb.getRegion(), lb.getId()).getMetadata(node.getId());
|
||||||
assertEquals(metadata.size(), 0);
|
assertEquals(metadata.size(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
||||||
LoadBalancer lb = entry.getKey();
|
LoadBalancer lb = entry.getKey();
|
||||||
LoadBalancerApi lbClient = clbApi.getLoadBalancerApiForZone(lb.getRegion());
|
LoadBalancerApi lbClient = api.getLoadBalancerApiForZone(lb.getRegion());
|
||||||
|
|
||||||
if (lbClient.get(lb.getId()).getStatus() != Status.DELETED) {
|
if (lbClient.get(lb.getId()).getStatus() != Status.DELETED) {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
lbClient.delete(lb.getId());
|
lbClient.delete(lb.getId());
|
||||||
}
|
}
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(lb.getRegion())).apply(lb));
|
||||||
}
|
}
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Metadata getExpectedMetadata() {
|
private Metadata getExpectedMetadata() {
|
||||||
|
|
|
@ -56,10 +56,10 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
|
@ -69,20 +69,20 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
Date yesterday = calendar.getTime();
|
Date yesterday = calendar.getTime();
|
||||||
Date today = new Date();
|
Date today = new Date();
|
||||||
|
|
||||||
FluentIterable<LoadBalancer> loadBalancers = clbApi.getReportApiForZone(zone).listBillableLoadBalancers(yesterday, today).concat();
|
FluentIterable<LoadBalancer> loadBalancers = api.getReportApiForZone(zone).listBillableLoadBalancers(yesterday, today).concat();
|
||||||
assertNotNull(loadBalancers);
|
assertNotNull(loadBalancers);
|
||||||
|
|
||||||
HistoricalUsage historicalUsage = clbApi.getReportApiForZone(zone).getHistoricalUsage(yesterday, today);
|
HistoricalUsage historicalUsage = api.getReportApiForZone(zone).getHistoricalUsage(yesterday, today);
|
||||||
assertNotEquals(historicalUsage.getAccountId(), 0);
|
assertNotEquals(historicalUsage.getAccountId(), 0);
|
||||||
|
|
||||||
FluentIterable<LoadBalancerUsage> loadBalancerUsages = clbApi.getReportApiForZone(zone).listLoadBalancerUsage(lb.getId(), yesterday, today).concat();
|
FluentIterable<LoadBalancerUsage> loadBalancerUsages = api.getReportApiForZone(zone).listLoadBalancerUsage(lb.getId(), yesterday, today).concat();
|
||||||
assertNotNull(loadBalancerUsages);
|
assertNotNull(loadBalancerUsages);
|
||||||
|
|
||||||
loadBalancerUsages = clbApi.getReportApiForZone(zone).listCurrentLoadBalancerUsage(lb.getId()).concat();
|
loadBalancerUsages = api.getReportApiForZone(zone).listCurrentLoadBalancerUsage(lb.getId()).concat();
|
||||||
assertNotNull(loadBalancerUsages);
|
assertNotNull(loadBalancerUsages);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LoadBalancerStats loadBalancerStats = clbApi.getReportApiForZone(zone).getLoadBalancerStats(lb.getId());
|
LoadBalancerStats loadBalancerStats = api.getReportApiForZone(zone).getLoadBalancerStats(lb.getId());
|
||||||
assertNotNull(loadBalancerStats);
|
assertNotNull(loadBalancerStats);
|
||||||
}
|
}
|
||||||
catch (HttpResponseException e) {
|
catch (HttpResponseException e) {
|
||||||
|
@ -92,19 +92,19 @@ public class ReportApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterable<Protocol> protocols = clbApi.getReportApiForZone(zone).listProtocols();
|
Iterable<Protocol> protocols = api.getReportApiForZone(zone).listProtocols();
|
||||||
assertTrue(!Iterables.isEmpty(protocols));
|
assertTrue(!Iterables.isEmpty(protocols));
|
||||||
|
|
||||||
Iterable<String> algorithms = clbApi.getReportApiForZone(zone).listAlgorithms();
|
Iterable<String> algorithms = api.getReportApiForZone(zone).listAlgorithms();
|
||||||
assertTrue(!Iterables.isEmpty(algorithms));
|
assertTrue(!Iterables.isEmpty(algorithms));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,41 +48,41 @@ public class SSLTerminationApiLiveTest extends BaseCloudLoadBalancersApiLiveTest
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAndGetSSLTermination() throws Exception {
|
public void testCreateAndGetSSLTermination() throws Exception {
|
||||||
clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate(
|
api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).createOrUpdate(
|
||||||
SSLTerminationApiExpectTest.getSSLTermination());
|
SSLTerminationApiExpectTest.getSSLTermination());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
SSLTermination sslTermination =
|
SSLTermination sslTermination =
|
||||||
clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertEquals(sslTermination, SSLTerminationApiExpectTest.getSSLTermination());
|
assertEquals(sslTermination, SSLTerminationApiExpectTest.getSSLTermination());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndGetSSLTermination")
|
@Test(dependsOnMethods = "testCreateAndGetSSLTermination")
|
||||||
public void testRemoveAndGetSSLTermination() throws Exception {
|
public void testRemoveAndGetSSLTermination() throws Exception {
|
||||||
assertTrue(clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
assertTrue(api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).delete());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
SSLTermination sslTermination =
|
SSLTermination sslTermination =
|
||||||
clbApi.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getSSLTerminationApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertNull(sslTermination);
|
assertNull(sslTermination);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,40 +48,40 @@ public class SessionPersistenceApiLiveTest extends BaseCloudLoadBalancersApiLive
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateAndGetSessionPersistence() throws Exception {
|
public void testCreateAndGetSessionPersistence() throws Exception {
|
||||||
clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).create(SessionPersistence.HTTP_COOKIE);
|
api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).create(SessionPersistence.HTTP_COOKIE);
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
SessionPersistence sessionPersistence =
|
SessionPersistence sessionPersistence =
|
||||||
clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertEquals(sessionPersistence, SessionPersistence.HTTP_COOKIE);
|
assertEquals(sessionPersistence, SessionPersistence.HTTP_COOKIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateAndGetSessionPersistence")
|
@Test(dependsOnMethods = "testCreateAndGetSessionPersistence")
|
||||||
public void testRemoveAndGetSessionPersistence() throws Exception {
|
public void testRemoveAndGetSessionPersistence() throws Exception {
|
||||||
clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).delete();
|
api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).delete();
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
SessionPersistence sessionPersistence =
|
SessionPersistence sessionPersistence =
|
||||||
clbApi.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
api.getSessionPersistenceApiForZoneAndLoadBalancer(zone, lb.getId()).get();
|
||||||
|
|
||||||
assertNull(sessionPersistence);
|
assertNull(sessionPersistence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,60 +52,60 @@ public class VirtualIPApiLiveTest extends BaseCloudLoadBalancersApiLiveTest {
|
||||||
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
CreateLoadBalancer createLB = CreateLoadBalancer.builder()
|
||||||
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
.name(prefix+"-jclouds").protocol("HTTP").port(80).virtualIPType(Type.PUBLIC).node(addNode).build();
|
||||||
|
|
||||||
zone = Iterables.getFirst(clbApi.getConfiguredZones(), null);
|
zone = Iterables.getFirst(api.getConfiguredZones(), null);
|
||||||
lb = clbApi.getLoadBalancerApiForZone(zone).create(createLB);
|
lb = api.getLoadBalancerApiForZone(zone).create(createLB);
|
||||||
|
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
@Test(dependsOnMethods = "testCreateLoadBalancer")
|
||||||
public void testCreateVirtualIPs() throws Exception {
|
public void testCreateVirtualIPs() throws Exception {
|
||||||
clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).create(VirtualIP.publicIPv6());
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
Iterable<VirtualIPWithId> actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<VirtualIPWithId> actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
|
|
||||||
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 5);
|
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateVirtualIPs")
|
@Test(dependsOnMethods = "testCreateVirtualIPs")
|
||||||
public void testRemoveSingleVirtualIP() throws Exception {
|
public void testRemoveSingleVirtualIP() throws Exception {
|
||||||
Iterable<VirtualIPWithId> actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<VirtualIPWithId> actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
VirtualIPWithId removedVirtualIP = Iterables.getFirst(actualVirtualIPs, null);
|
VirtualIPWithId removedVirtualIP = Iterables.getFirst(actualVirtualIPs, null);
|
||||||
|
|
||||||
assertTrue(clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIP.getId()));
|
assertTrue(api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIP.getId()));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
|
|
||||||
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 4);
|
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testRemoveSingleVirtualIP")
|
@Test(dependsOnMethods = "testRemoveSingleVirtualIP")
|
||||||
public void testRemoveManyVirtualIPs() throws Exception {
|
public void testRemoveManyVirtualIPs() throws Exception {
|
||||||
Iterable<VirtualIPWithId> actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
Iterable<VirtualIPWithId> actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
VirtualIPWithId removedVirtualIP1 = Iterables.getFirst(actualVirtualIPs, null);
|
VirtualIPWithId removedVirtualIP1 = Iterables.getFirst(actualVirtualIPs, null);
|
||||||
VirtualIPWithId removedVirtualIP2 = Iterables.getLast(actualVirtualIPs);
|
VirtualIPWithId removedVirtualIP2 = Iterables.getLast(actualVirtualIPs);
|
||||||
List<Integer> removedVirtualIPIds = ImmutableList.<Integer> of(removedVirtualIP1.getId(), removedVirtualIP2.getId());
|
List<Integer> removedVirtualIPIds = ImmutableList.<Integer> of(removedVirtualIP1.getId(), removedVirtualIP2.getId());
|
||||||
|
|
||||||
assertTrue(clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIPIds));
|
assertTrue(api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).delete(removedVirtualIPIds));
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
|
|
||||||
actualVirtualIPs = clbApi.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
actualVirtualIPs = api.getVirtualIPApiForZoneAndLoadBalancer(zone, lb.getId()).list();
|
||||||
|
|
||||||
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 2);
|
assertEquals(Iterators.size(actualVirtualIPs.iterator()), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterGroups(groups = "live")
|
@AfterGroups(groups = "live")
|
||||||
protected void tearDownContext() {
|
protected void tearDown() {
|
||||||
assertTrue(awaitAvailable(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitAvailable(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
clbApi.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
api.getLoadBalancerApiForZone(zone).delete(lb.getId());
|
||||||
assertTrue(awaitDeleted(clbApi.getLoadBalancerApiForZone(zone)).apply(lb));
|
assertTrue(awaitDeleted(api.getLoadBalancerApiForZone(zone)).apply(lb));
|
||||||
super.tearDownContext();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,16 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.internal;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
||||||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
|
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
|
||||||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApiMetadata;
|
|
||||||
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersAsyncApi;
|
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.BeforeGroups;
|
import org.testng.annotations.BeforeGroups;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class BaseCloudLoadBalancersApiLiveTest extends BaseContextLiveTest<RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>> {
|
public class BaseCloudLoadBalancersApiLiveTest extends BaseApiLiveTest<CloudLoadBalancersApi> {
|
||||||
protected CloudLoadBalancersApi clbApi;
|
|
||||||
|
|
||||||
public BaseCloudLoadBalancersApiLiveTest() {
|
public BaseCloudLoadBalancersApiLiveTest() {
|
||||||
provider = "rackspace-cloudloadbalancers";
|
provider = "rackspace-cloudloadbalancers";
|
||||||
|
@ -44,12 +38,9 @@ public class BaseCloudLoadBalancersApiLiveTest extends BaseContextLiveTest<RestC
|
||||||
|
|
||||||
@BeforeGroups(groups = { "integration", "live" })
|
@BeforeGroups(groups = { "integration", "live" })
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
|
Logger.getAnonymousLogger().info("running against zones " + api.getConfiguredZones());
|
||||||
clbApi = context.getApi();
|
|
||||||
|
|
||||||
Logger.getAnonymousLogger().info("running against zones " + clbApi.getConfiguredZones());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,9 +49,4 @@ public class BaseCloudLoadBalancersApiLiveTest extends BaseContextLiveTest<RestC
|
||||||
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE);
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>> contextType() {
|
|
||||||
return CloudLoadBalancersApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
import org.jclouds.route53.config.Route53RestClientModule;
|
import org.jclouds.route53.config.Route53RestClientModule;
|
||||||
|
|
||||||
|
@ -38,7 +37,12 @@ import com.google.common.reflect.TypeToken;
|
||||||
*/
|
*/
|
||||||
public class Route53ApiMetadata extends BaseRestApiMetadata {
|
public class Route53ApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<? extends Route53Api, ? extends Route53AsyncApi>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends Route53Api, ? extends Route53AsyncApi>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(Route53Api.class)} as
|
||||||
|
* {@link Route53AsyncApi} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<? extends Route53Api, ? extends Route53AsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends Route53Api, ? extends Route53AsyncApi>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +51,7 @@ public class Route53ApiMetadata extends BaseRestApiMetadata {
|
||||||
return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
|
return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public Route53ApiMetadata() {
|
public Route53ApiMetadata() {
|
||||||
this(new Builder(Route53Api.class, Route53AsyncApi.class));
|
this(new Builder(Route53Api.class, Route53AsyncApi.class));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,10 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
* @see <a href="http://docs.amazonwebservices.com/Route53/latest/APIReference"
|
* @see <a href="http://docs.amazonwebservices.com/Route53/latest/APIReference"
|
||||||
* />
|
* />
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(Route53Api.class)} as
|
||||||
|
* {@link Route53AsyncApi} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(RestAuthentication.class)
|
@RequestFilters(RestAuthentication.class)
|
||||||
@VirtualHost
|
@VirtualHost
|
||||||
@Path("/{jclouds.api-version}")
|
@Path("/{jclouds.api-version}")
|
||||||
|
|
|
@ -31,10 +31,6 @@ public class Route53ApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
protected void testGetChangeReturnsNullOnNotFound() {
|
protected void testGetChangeReturnsNullOnNotFound() {
|
||||||
assertNull(api().getChange("FOOOBAR"));
|
assertNull(api.getChange("FOOOBAR"));
|
||||||
}
|
|
||||||
|
|
||||||
protected Route53Api api() {
|
|
||||||
return context.getApi();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,6 @@ public class HostedZoneApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HostedZoneApi api() {
|
protected HostedZoneApi api() {
|
||||||
return context.getApi().getHostedZoneApi();
|
return api.getHostedZoneApi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAllRRs(String zoneId) {
|
private void checkAllRRs(String zoneId) {
|
||||||
HostedZone zone = context.getApi().getHostedZoneApi().get(zoneId).getZone();
|
HostedZone zone = api.getHostedZoneApi().get(zoneId).getZone();
|
||||||
List<ResourceRecordSet> records = api(zone.getId()).list().concat().toList();
|
List<ResourceRecordSet> records = api(zone.getId()).list().concat().toList();
|
||||||
assertEquals(zone.getResourceRecordSetCount(), records.size());
|
assertEquals(zone.getResourceRecordSetCount(), records.size());
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
clearAndDeleteHostedZonesNamed(name);
|
clearAndDeleteHostedZonesNamed(name);
|
||||||
String nonce = name + " @ " + new Date();
|
String nonce = name + " @ " + new Date();
|
||||||
String comment = name + " for " + JcloudsVersion.get();
|
String comment = name + " for " + JcloudsVersion.get();
|
||||||
NewHostedZone newHostedZone = context.getApi().getHostedZoneApi()
|
NewHostedZone newHostedZone = api.getHostedZoneApi()
|
||||||
.createWithReferenceAndComment(name, nonce, comment);
|
.createWithReferenceAndComment(name, nonce, comment);
|
||||||
getAnonymousLogger().info("created zone: " + newHostedZone);
|
getAnonymousLogger().info("created zone: " + newHostedZone);
|
||||||
assertTrue(inSync.apply(newHostedZone.getChange()), "zone didn't sync " + newHostedZone);
|
assertTrue(inSync.apply(newHostedZone.getChange()), "zone didn't sync " + newHostedZone);
|
||||||
|
@ -191,12 +191,12 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearAndDeleteHostedZonesNamed(String name) {
|
private void clearAndDeleteHostedZonesNamed(String name) {
|
||||||
for (HostedZone zone : context.getApi().getHostedZoneApi().list().concat().filter(nameEquals(name))) {
|
for (HostedZone zone : api.getHostedZoneApi().list().concat().filter(nameEquals(name))) {
|
||||||
getAnonymousLogger().info("clearing and deleting zone: " + zone);
|
getAnonymousLogger().info("clearing and deleting zone: " + zone);
|
||||||
Set<ResourceRecordSet> remaining = refresh(zone.getId()).concat().filter(not(requiredRRTypes)).toSet();
|
Set<ResourceRecordSet> remaining = refresh(zone.getId()).concat().filter(not(requiredRRTypes)).toSet();
|
||||||
if (!remaining.isEmpty())
|
if (!remaining.isEmpty())
|
||||||
sync(api(zone.getId()).apply(deleteAll(remaining)));
|
sync(api(zone.getId()).apply(deleteAll(remaining)));
|
||||||
sync(context.getApi().getHostedZoneApi().delete(zone.getId()));
|
sync(api.getHostedZoneApi().delete(zone.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,13 +209,13 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PagedIterable<HostedZone> zones() {
|
private PagedIterable<HostedZone> zones() {
|
||||||
PagedIterable<HostedZone> zones = context.getApi().getHostedZoneApi().list();
|
PagedIterable<HostedZone> zones = api.getHostedZoneApi().list();
|
||||||
if (zones.get(0).isEmpty())
|
if (zones.get(0).isEmpty())
|
||||||
throw new SkipException("no zones in context: " + context);
|
throw new SkipException("no zones in context: " + identity);
|
||||||
return zones;
|
return zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceRecordSetApi api(String zoneId) {
|
private ResourceRecordSetApi api(String zoneId) {
|
||||||
return context.getApi().getResourceRecordSetApiForHostedZone(zoneId);
|
return api.getResourceRecordSetApiForHostedZone(zoneId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,25 +22,20 @@ import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
import static org.jclouds.route53.domain.Change.Status.INSYNC;
|
import static org.jclouds.route53.domain.Change.Status.INSYNC;
|
||||||
import static org.jclouds.util.Predicates2.retry;
|
import static org.jclouds.util.Predicates2.retry;
|
||||||
|
|
||||||
import org.jclouds.apis.BaseContextLiveTest;
|
import org.jclouds.apis.BaseApiLiveTest;
|
||||||
import org.jclouds.route53.Route53ApiMetadata;
|
|
||||||
import org.jclouds.route53.Route53AsyncApi;
|
|
||||||
import org.jclouds.route53.Route53Api;
|
import org.jclouds.route53.Route53Api;
|
||||||
import org.jclouds.route53.domain.Change;
|
import org.jclouds.route53.domain.Change;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.reflect.TypeToken;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
public class BaseRoute53ApiLiveTest extends
|
public class BaseRoute53ApiLiveTest extends BaseApiLiveTest<Route53Api> {
|
||||||
BaseContextLiveTest<RestContext<? extends Route53Api, ? extends Route53AsyncApi>> {
|
|
||||||
|
|
||||||
public BaseRoute53ApiLiveTest() {
|
public BaseRoute53ApiLiveTest() {
|
||||||
provider = "route53";
|
provider = "route53";
|
||||||
|
@ -50,17 +45,12 @@ public class BaseRoute53ApiLiveTest extends
|
||||||
|
|
||||||
@BeforeClass(groups = "live")
|
@BeforeClass(groups = "live")
|
||||||
@Override
|
@Override
|
||||||
public void setupContext() {
|
public void setup() {
|
||||||
super.setupContext();
|
super.setup();
|
||||||
inSync = retry(new Predicate<Change>() {
|
inSync = retry(new Predicate<Change>() {
|
||||||
public boolean apply(Change input) {
|
public boolean apply(Change input) {
|
||||||
return context.getApi().getChange(input.getId()).getStatus() == INSYNC;
|
return api.getChange(input.getId()).getStatus() == INSYNC;
|
||||||
}
|
}
|
||||||
}, 600, 1, 5, SECONDS);
|
}, 600, 1, 5, SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TypeToken<RestContext<? extends Route53Api, ? extends Route53AsyncApi>> contextType() {
|
|
||||||
return Route53ApiMetadata.CONTEXT_TOKEN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.s3;
|
package org.jclouds.s3;
|
||||||
|
|
||||||
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
|
||||||
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
|
import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
||||||
|
@ -32,7 +31,6 @@ import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.apis.ApiMetadata;
|
import org.jclouds.apis.ApiMetadata;
|
||||||
import org.jclouds.rest.RestContext;
|
|
||||||
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
import org.jclouds.rest.internal.BaseRestApiMetadata;
|
||||||
import org.jclouds.s3.blobstore.S3BlobStoreContext;
|
import org.jclouds.s3.blobstore.S3BlobStoreContext;
|
||||||
import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule;
|
import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule;
|
||||||
|
@ -62,7 +60,12 @@ import com.google.inject.Module;
|
||||||
*/
|
*/
|
||||||
public class S3ApiMetadata extends BaseRestApiMetadata {
|
public class S3ApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static final TypeToken<RestContext<? extends S3Client,? extends S3AsyncClient>> CONTEXT_TOKEN = new TypeToken<RestContext<? extends S3Client,? extends S3AsyncClient>>() {
|
/**
|
||||||
|
* @deprecated please use {@code org.jclouds.ContextBuilder#buildClient(S3Client.class)} as
|
||||||
|
* {@link S3AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static final TypeToken<org.jclouds.rest.RestContext<? extends S3Client, ? extends S3AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<? extends S3Client, ? extends S3AsyncClient>>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +84,6 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
||||||
|
|
||||||
public static Properties defaultProperties() {
|
public static Properties defaultProperties() {
|
||||||
Properties properties = BaseRestApiMetadata.defaultProperties();
|
Properties properties = BaseRestApiMetadata.defaultProperties();
|
||||||
properties.setProperty(PROPERTY_API_VERSION, S3AsyncClient.VERSION);
|
|
||||||
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
|
||||||
properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG);
|
properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG);
|
||||||
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
|
properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
|
||||||
|
@ -93,6 +95,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
this(S3Client.class, S3AsyncClient.class);
|
this(S3Client.class, S3AsyncClient.class);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +108,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
||||||
.credentialName("Secret Access Key")
|
.credentialName("Secret Access Key")
|
||||||
.defaultEndpoint("https://s3.amazonaws.com")
|
.defaultEndpoint("https://s3.amazonaws.com")
|
||||||
.documentation(URI.create("http://docs.amazonwebservices.com/AmazonS3/latest/API"))
|
.documentation(URI.create("http://docs.amazonwebservices.com/AmazonS3/latest/API"))
|
||||||
.version(S3AsyncClient.VERSION)
|
.version("2006-03-01")
|
||||||
.defaultProperties(S3ApiMetadata.defaultProperties())
|
.defaultProperties(S3ApiMetadata.defaultProperties())
|
||||||
.context(CONTEXT_TOKEN)
|
.context(CONTEXT_TOKEN)
|
||||||
.view(typeToken(S3BlobStoreContext.class))
|
.view(typeToken(S3BlobStoreContext.class))
|
||||||
|
|
|
@ -104,9 +104,13 @@ import com.google.inject.Provides;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @author James Murty
|
* @author James Murty
|
||||||
* @see S3Client
|
* @see AWSS3Client
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" />
|
* @see <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAPI.html" />
|
||||||
|
* @deprecated please use
|
||||||
|
* {@code org.jclouds.ContextBuilder#buildApi(S3Client.class)}
|
||||||
|
* as {@link S3AsyncClient} interface will be removed in jclouds 1.7.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@RequestFilters(RequestAuthorizeSignature.class)
|
@RequestFilters(RequestAuthorizeSignature.class)
|
||||||
@BlobScope(CONTAINER)
|
@BlobScope(CONTAINER)
|
||||||
public interface S3AsyncClient extends Closeable {
|
public interface S3AsyncClient extends Closeable {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue