From 1a6071ab9294a1bf06eb62d7320470e4575fc74e Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Fri, 2 Aug 2013 07:56:31 -0700 Subject: [PATCH] Removed async from cloudsigma --- ...gmaAsyncClient.java => CloudSigmaApi.java} | 248 +++++++++----- .../cloudsigma/CloudSigmaApiMetadata.java | 21 +- .../jclouds/cloudsigma/CloudSigmaClient.java | 304 ------------------ .../CloudSigmaComputeServiceAdapter.java | 9 +- ...CloudSigmaComputeServiceContextModule.java | 6 +- .../config/CloudSigmaRestClientModule.java | 7 +- .../cloudsigma/predicates/DriveClaimed.java | 6 +- .../org/jclouds/cloudsigma/util/Servers.java | 3 +- ...ClientTest.java => CloudSigmaApiTest.java} | 72 ++--- .../cloudsigma/CloudSigmaClientLiveTest.java | 6 +- ...loudSigmaZurichComputeServiceLiveTest.java | 6 +- 11 files changed, 232 insertions(+), 456 deletions(-) rename apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/{CloudSigmaAsyncClient.java => CloudSigmaApi.java} (56%) delete mode 100644 apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java rename apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/{CloudSigmaAsyncClientTest.java => CloudSigmaApiTest.java} (90%) diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApi.java similarity index 56% rename from apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java rename to apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApi.java index ca5ddb8f9f..42ffd5ea57 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaAsyncClient.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApi.java @@ -62,199 +62,269 @@ import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.ResponseParser; -import com.google.common.util.concurrent.ListenableFuture; - /** - * Provides asynchronous access to CloudSigma via their REST API. + * Provides synchronous access to CloudSigma via their REST API. *

- * - * @see CloudSigmaClient + * * @see * @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) @Consumes(MediaType.TEXT_PLAIN) -public interface CloudSigmaAsyncClient extends Closeable { +public interface CloudSigmaApi extends Closeable { /** - * @see CloudSigmaClient#listStandardDrives + * list of drive uuids that are in the library + * + * @return or empty set if no drives are found */ @GET @Path("/drives/standard/list") @ResponseParser(SplitNewlines.class) - ListenableFuture> listStandardDrives(); + Set listStandardDrives(); /** - * @see CloudSigmaClient#listStandardCds + * list of cd uuids that are in the library + * + * @return or empty set if no cds are found */ @GET @Path("/drives/standard/cd/list") @ResponseParser(SplitNewlines.class) - ListenableFuture> listStandardCds(); + Set listStandardCds(); /** - * @see CloudSigmaClient#listStandardImages + * list of image uuids that are in the library + * + * @return or empty set if no images are found */ @GET @Path("/drives/standard/img/list") @ResponseParser(SplitNewlines.class) - ListenableFuture> listStandardImages(); + Set listStandardImages(); /** - * @see CloudSigmaClient#cloneDrive + * Clone an existing drive. By default, the size is the same as the source + * + * @param sourceUuid + * source to clone + * @param newName + * name of the resulting drive + * @param options + * options to control size + * @return new drive */ @POST @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @Path("/drives/{uuid}/clone") @MapBinder(BindCloneDriveOptionsToPlainTextString.class) - ListenableFuture cloneDrive(@PathParam("uuid") String sourceUuid, @PayloadParam("name") String newName, - CloneDriveOptions... options); + DriveInfo cloneDrive(@PathParam("uuid") String sourceUuid, @PayloadParam("name") String newName, + CloneDriveOptions... options); /** - * @see CloudSigmaClient#getProfileInfo + * Get profile info + * + * @return info or null, if not found */ @GET @Path("/profile/info") @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToProfileInfo.class) - ListenableFuture getProfileInfo(); + ProfileInfo getProfileInfo(); /** - * @see CloudSigmaClient#listDriveInfo + * Get all drives info + * + * @return or empty set if no drives are found */ @GET @Path("/drives/info") @ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class) - ListenableFuture> listDriveInfo(); + Set listDriveInfo(); /** - * @see CloudSigmaClient#getDriveInfo + * @param uuid + * what to get + * @return null, if not found */ @GET @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @Path("/drives/{uuid}/info") - ListenableFuture getDriveInfo(@PathParam("uuid") String uuid); + DriveInfo getDriveInfo(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#createDrive + * create a new drive + * + * @param createDrive + * required parameters: name, size + * @return newly created drive */ @POST @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @Path("/drives/create") - ListenableFuture createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive); + DriveInfo createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive); /** - * @see CloudSigmaClient#setDriveData + * set extra drive data + * + * @param uuid + * what drive to change + * @param createDrive + * what values to change + * @return new data */ @POST @ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class) @Path("/drives/{uuid}/set") - ListenableFuture setDriveData(@PathParam("uuid") String uuid, - @BinderParam(BindDriveDataToPlainTextString.class) DriveData createDrive); + DriveInfo setDriveData(@PathParam("uuid") String uuid, + @BinderParam(BindDriveDataToPlainTextString.class) DriveData createDrive); /** - * @see CloudSigmaClient#createServer + * create a new server + * + * @param createServer + * @return newly created server */ @POST @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @Path("/servers/create") - ListenableFuture createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer); + ServerInfo createServer(@BinderParam(BindServerToPlainTextString.class) Server createServer); /** - * @see CloudSigmaClient#listServerInfo + * Get all servers info + * + * @return or empty set if no servers are found */ @GET @Path("/servers/info") @ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class) - ListenableFuture> listServerInfo(); + Set listServerInfo(); /** - * @see CloudSigmaClient#getServerInfo + * @param uuid + * what to get + * @return null, if not found */ @GET @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @Path("/servers/{uuid}/info") - ListenableFuture getServerInfo(@PathParam("uuid") String uuid); + ServerInfo getServerInfo(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#setServerConfiguration + * set server configuration + * + * @param uuid + * what server to change + * @param setServer + * what values to change + * @return new data */ @POST @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class) @Path("/servers/{uuid}/set") - ListenableFuture setServerConfiguration(@PathParam("uuid") String uuid, - @BinderParam(BindServerToPlainTextString.class) Server setServer); + ServerInfo setServerConfiguration(@PathParam("uuid") String uuid, + @BinderParam(BindServerToPlainTextString.class) Server setServer); /** - * @see CloudSigmaClient#listServers + * list of server uuids in your account + * + * @return or empty set if no servers are found */ @GET @Path("/servers/list") @ResponseParser(SplitNewlines.class) - ListenableFuture> listServers(); + Set listServers(); /** - * @see CloudSigmaClient#destroyServer + * Destroy a server + * + * @param uuid + * what to destroy */ @GET @Path("/servers/{uuid}/destroy") @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture destroyServer(@PathParam("uuid") String uuid); + void destroyServer(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#startServer + * Start a server + * + * @param uuid + * what to start */ @POST @Path("/servers/{uuid}/start") - ListenableFuture startServer(@PathParam("uuid") String uuid); + void startServer(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#stopServer + * Stop a server + *

+ * Kills the server immediately, equivalent to a power failure. Server reverts to a stopped + * status if it is persistent and is automatically destroyed otherwise. + * + * @param uuid + * what to stop */ @POST @Path("/servers/{uuid}/stop") - ListenableFuture stopServer(@PathParam("uuid") String uuid); + void stopServer(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#shutdownServer + * Shutdown a server + *

+ * Sends the server an ACPI power-down event. Server reverts to a stopped status if it is + * persistent and is automatically destroyed otherwise. + *

note

behaviour on shutdown depends on how your server OS is set up to respond to an + * ACPI power button signal. + * + * @param uuid + * what to shutdown */ @POST @Path("/servers/{uuid}/shutdown") - ListenableFuture shutdownServer(@PathParam("uuid") String uuid); + void shutdownServer(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#resetServer + * Reset a server + * + * @param uuid + * what to reset */ @POST @Path("/servers/{uuid}/reset") - ListenableFuture resetServer(@PathParam("uuid") String uuid); + void resetServer(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#listDrives + * list of drive uuids in your account + * + * @return or empty set if no drives are found */ @GET @Path("/drives/list") @ResponseParser(SplitNewlines.class) - ListenableFuture> listDrives(); + Set listDrives(); /** - * @see CloudSigmaClient#destroyDrive + * Destroy a drive + * + * @param uuid + * what to delete */ @GET @Path("/drives/{uuid}/destroy") @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture destroyDrive(@PathParam("uuid") String uuid); + void destroyDrive(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#createVLAN + * create a new vlan + * + * @param name + * @return newly created vlan */ @POST @Fallback(NullOnNotFoundOr404.class) @@ -262,91 +332,117 @@ public interface CloudSigmaAsyncClient extends Closeable { @Path("/resources/vlan/create") @Payload("name {name}\n") @Produces(MediaType.TEXT_PLAIN) - ListenableFuture createVLAN(@PayloadParam("name") String name); + VLANInfo createVLAN(@PayloadParam("name") String name); /** - * @see CloudSigmaClient#listVLANInfo + * Get all vlans info + * + * @return or empty set if no vlans are found */ @GET @Path("/resources/vlan/info") @ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToVLANInfoSet.class) - ListenableFuture> listVLANInfo(); + Set listVLANInfo(); /** - * @see CloudSigmaClient#getVLANInfo + * @param uuid + * what to get + * @return null, if not found */ @GET @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class) @Path("/resources/vlan/{uuid}/info") - ListenableFuture getVLANInfo(@PathParam("uuid") String uuid); + VLANInfo getVLANInfo(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#setVLANConfiguration + * set vlan configuration + * + * @param uuid + * what vlan to change + * @param name + * what the new name is + * @return new data */ @POST @ResponseParser(KeyValuesDelimitedByBlankLinesToVLANInfo.class) @Path("/resources/vlan/{uuid}/set") @Payload("name {name}\n") @Produces(MediaType.TEXT_PLAIN) - ListenableFuture renameVLAN(@PathParam("uuid") String uuid, @PayloadParam("name") String name); + VLANInfo renameVLAN(@PathParam("uuid") String uuid, @PayloadParam("name") String name); /** - * @see CloudSigmaClient#listVLANs + * list of vlan uuids in your account + * + * @return or empty set if no vlans are found */ @GET @Path("/resources/vlan/list") @ResponseParser(SplitNewlinesAndReturnSecondField.class) - ListenableFuture> listVLANs(); + Set listVLANs(); /** - * @see CloudSigmaClient#destroyVLAN + * Destroy a vlan + * + * @param uuid + * what to destroy */ @GET @Path("/resources/vlan/{uuid}/destroy") @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture destroyVLAN(@PathParam("uuid") String uuid); + void destroyVLAN(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#createStaticIP + * create a new ip + * + * @return newly created ip */ @POST @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class) @Path("/resources/ip/create") - ListenableFuture createStaticIP(); + StaticIPInfo createStaticIP(); /** - * @see CloudSigmaClient#listStaticIPInfo + * Get all ips info + * + * @return or empty set if no ips are found */ @GET @Path("/resources/ip/info") @ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToStaticIPInfoSet.class) - ListenableFuture> listStaticIPInfo(); + Set listStaticIPInfo(); /** - * @see CloudSigmaClient#getStaticIPInfo + * @param uuid + * what to get + * @return null, if not found */ @GET @Fallback(NullOnNotFoundOr404.class) @ResponseParser(KeyValuesDelimitedByBlankLinesToStaticIPInfo.class) @Path("/resources/ip/{uuid}/info") - ListenableFuture getStaticIPInfo(@PathParam("uuid") String uuid); + StaticIPInfo getStaticIPInfo(@PathParam("uuid") String uuid); /** - * @see CloudSigmaClient#listStaticIPs + * list of ip uuids in your account + * + * @return or empty set if no ips are found */ @GET @Path("/resources/ip/list") @ResponseParser(SplitNewlinesAndReturnSecondField.class) - ListenableFuture> listStaticIPs(); + Set listStaticIPs(); /** - * @see CloudSigmaClient#destroyStaticIP + * Destroy a ip + * + * @param uuid + * what to destroy */ @GET @Path("/resources/ip/{uuid}/destroy") @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture destroyStaticIP(@PathParam("uuid") String uuid); + void destroyStaticIP(@PathParam("uuid") String uuid); } diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java index eea93cbae5..22fb6cf990 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java @@ -26,10 +26,9 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule; import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule; import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.rest.internal.BaseRestApiMetadata; +import org.jclouds.rest.internal.BaseHttpApiMetadata; import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; import com.google.inject.Module; /** @@ -37,17 +36,9 @@ import com.google.inject.Module; * * @author Adrian Cole */ -public class CloudSigmaApiMetadata extends BaseRestApiMetadata { +public class CloudSigmaApiMetadata extends BaseHttpApiMetadata { + - /** - * @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> CONTEXT_TOKEN = new TypeToken>() { - private static final long serialVersionUID = 1L; - }; - @Override public Builder toBuilder() { return new Builder().fromApiMetadata(this); @@ -62,7 +53,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata { } public static Properties defaultProperties() { - Properties properties = BaseRestApiMetadata.defaultProperties(); + Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d"); // passwords are set post-boot, so auth failures are possible // from a race condition applying the password set script @@ -72,11 +63,9 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata { return properties; } - public static class Builder extends BaseRestApiMetadata.Builder { + public static class Builder extends BaseHttpApiMetadata.Builder { - @SuppressWarnings("deprecation") protected Builder() { - super(CloudSigmaClient.class, CloudSigmaAsyncClient.class); id("cloudsigma") .name("CloudSigma API") .identityName("Email") diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java deleted file mode 100644 index b57095f30c..0000000000 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaClient.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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.cloudsigma; - -import java.io.Closeable; -import java.util.Set; - -import org.jclouds.cloudsigma.domain.Drive; -import org.jclouds.cloudsigma.domain.DriveData; -import org.jclouds.cloudsigma.domain.DriveInfo; -import org.jclouds.cloudsigma.domain.ProfileInfo; -import org.jclouds.cloudsigma.domain.Server; -import org.jclouds.cloudsigma.domain.ServerInfo; -import org.jclouds.cloudsigma.domain.StaticIPInfo; -import org.jclouds.cloudsigma.domain.VLANInfo; -import org.jclouds.cloudsigma.options.CloneDriveOptions; - -/** - * Provides synchronous access to CloudSigma. - *

- * - * @see CloudSigmaAsyncClient - * @see - * @author Adrian Cole - */ -public interface CloudSigmaClient extends Closeable { - - /** - * Get profile info - * - * @return info or null, if not found - */ - ProfileInfo getProfileInfo(); - - /** - * list of server uuids in your account - * - * @return or empty set if no servers are found - */ - Set listServers(); - - /** - * Get all servers info - * - * @return or empty set if no servers are found - */ - Set listServerInfo(); - - /** - * @param uuid - * what to get - * @return null, if not found - */ - ServerInfo getServerInfo(String uuid); - - /** - * create a new server - * - * @param server - * @return newly created server - */ - ServerInfo createServer(Server server); - - /** - * set server configuration - * - * @param uuid - * what server to change - * @param serverData - * what values to change - * @return new data - */ - ServerInfo setServerConfiguration(String uuid, Server server); - - /** - * Destroy a server - * - * @param uuid - * what to destroy - */ - void destroyServer(String uuid); - - /** - * Start a server - * - * @param uuid - * what to start - */ - void startServer(String uuid); - - /** - * Stop a server - *

- * Kills the server immediately, equivalent to a power failure. Server reverts to a stopped - * status if it is persistent and is automatically destroyed otherwise. - * - * @param uuid - * what to stop - */ - void stopServer(String uuid); - - /** - * Shutdown a server - *

- * Sends the server an ACPI power-down event. Server reverts to a stopped status if it is - * persistent and is automatically destroyed otherwise. - *

note

behaviour on shutdown depends on how your server OS is set up to respond to an - * ACPI power button signal. - * - * @param uuid - * what to shutdown - */ - void shutdownServer(String uuid); - - /** - * Reset a server - * - * @param uuid - * what to reset - */ - void resetServer(String uuid); - - /** - * list of drive uuids in your account - * - * @return or empty set if no drives are found - */ - Set listDrives(); - - /** - * Get all drives info - * - * @return or empty set if no drives are found - */ - Set listDriveInfo(); - - /** - * @param uuid - * what to get - * @return null, if not found - */ - DriveInfo getDriveInfo(String uuid); - - /** - * create a new drive - * - * @param createDrive - * required parameters: name, size - * @return newly created drive - */ - DriveInfo createDrive(Drive createDrive); - - /** - * set extra drive data - * - * @param uuid - * what drive to change - * @param driveData - * what values to change - * @return new data - */ - DriveInfo setDriveData(String uuid, DriveData driveData); - - /** - * Destroy a drive - * - * @param uuid - * what to delete - */ - void destroyDrive(String uuid); - - /** - * list of drive uuids that are in the library - * - * @return or empty set if no drives are found - */ - Set listStandardDrives(); - - /** - * list of cd uuids that are in the library - * - * @return or empty set if no cds are found - */ - Set listStandardCds(); - - /** - * list of image uuids that are in the library - * - * @return or empty set if no images are found - */ - Set listStandardImages(); - - /** - * Clone an existing drive. By default, the size is the same as the source - * - * @param sourceUuid - * source to clone - * @param newName - * name of the resulting drive - * @param options - * options to control size - * @return new drive - */ - DriveInfo cloneDrive(String sourceUuid, String newName, CloneDriveOptions... options); - - /** - * list of vlan uuids in your account - * - * @return or empty set if no vlans are found - */ - Set listVLANs(); - - /** - * Get all vlans info - * - * @return or empty set if no vlans are found - */ - Set listVLANInfo(); - - /** - * @param uuid - * what to get - * @return null, if not found - */ - VLANInfo getVLANInfo(String uuid); - - /** - * create a new vlan - * - * @param vlan - * @return newly created vlan - */ - VLANInfo createVLAN(String name); - - /** - * set vlan configuration - * - * @param uuid - * what vlan to change - * @param newName - * what the new name is - * @return new data - */ - VLANInfo renameVLAN(String uuid, String newName); - - /** - * Destroy a vlan - * - * @param uuid - * what to destroy - */ - void destroyVLAN(String uuid); - - /** - * list of ip uuids in your account - * - * @return or empty set if no ips are found - */ - Set listStaticIPs(); - - /** - * Get all ips info - * - * @return or empty set if no ips are found - */ - Set listStaticIPInfo(); - - /** - * @param uuid - * what to get - * @return null, if not found - */ - StaticIPInfo getStaticIPInfo(String uuid); - - /** - * create a new ip - * - * @return newly created ip - */ - StaticIPInfo createStaticIP(); - - /** - * Destroy a ip - * - * @param uuid - * what to destroy - */ - void destroyStaticIP(String uuid); - -} diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java index 10c8e26642..51240ff3d7 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java @@ -28,7 +28,7 @@ import javax.inject.Named; import javax.inject.Singleton; import org.jclouds.Constants; -import org.jclouds.cloudsigma.CloudSigmaClient; +import org.jclouds.cloudsigma.CloudSigmaApi; import org.jclouds.cloudsigma.compute.options.CloudSigmaTemplateOptions; import org.jclouds.cloudsigma.domain.AffinityType; import org.jclouds.cloudsigma.domain.Device; @@ -62,14 +62,13 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; -import com.google.common.collect.Iterables; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.UncheckedExecutionException; /** - * defines the connection between the {@link CloudSigmaClient} implementation + * defines the connection between the {@link org.jclouds.cloudsigma.CloudSigmaApi} implementation * and the jclouds {@link ComputeService} * */ @@ -85,7 +84,7 @@ public class CloudSigmaComputeServiceAdapter implements } }); - private final CloudSigmaClient client; + private final CloudSigmaApi client; private final Predicate driveNotClaimed; private final String defaultVncPassword; private final LoadingCache cache; @@ -96,7 +95,7 @@ public class CloudSigmaComputeServiceAdapter implements protected Logger logger = Logger.NULL; @Inject - public CloudSigmaComputeServiceAdapter(CloudSigmaClient client, Predicate driveNotClaimed, + public CloudSigmaComputeServiceAdapter(CloudSigmaApi client, Predicate driveNotClaimed, @Named(CloudSigmaConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword, LoadingCache cache, @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { this.client = checkNotNull(client, "client"); diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java index f16a15e01e..d9ddeacd09 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java @@ -22,7 +22,7 @@ import static org.jclouds.util.Predicates2.retry; import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.cloudsigma.CloudSigmaClient; +import org.jclouds.cloudsigma.CloudSigmaApi; import org.jclouds.cloudsigma.compute.CloudSigmaComputeServiceAdapter; import org.jclouds.cloudsigma.compute.CloudSigmaTemplateBuilderImpl; import org.jclouds.cloudsigma.compute.functions.ParseOsFamilyVersion64BitFromImageName; @@ -97,10 +97,10 @@ public class CloudSigmaComputeServiceContextModule extends @Singleton public static class GetDrive extends CacheLoader { - private final CloudSigmaClient client; + private final CloudSigmaApi client; @Inject - public GetDrive(CloudSigmaClient client) { + public GetDrive(CloudSigmaApi client) { this.client = client; } diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java index fd62d8a934..3773fa3e76 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java @@ -19,8 +19,7 @@ package org.jclouds.cloudsigma.config; import java.util.List; import java.util.Map; -import org.jclouds.cloudsigma.CloudSigmaAsyncClient; -import org.jclouds.cloudsigma.CloudSigmaClient; +import org.jclouds.cloudsigma.CloudSigmaApi; import org.jclouds.cloudsigma.domain.Device; import org.jclouds.cloudsigma.domain.Drive; import org.jclouds.cloudsigma.domain.DriveData; @@ -42,7 +41,7 @@ import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.ServerError; import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; +import org.jclouds.rest.config.HttpApiModule; import com.google.common.base.Function; import com.google.inject.TypeLiteral; @@ -53,7 +52,7 @@ import com.google.inject.TypeLiteral; * @author Adrian Cole */ @ConfiguresRestClient -public class CloudSigmaRestClientModule extends RestClientModule { +public class CloudSigmaRestClientModule extends HttpApiModule { @Override protected void bindErrorHandlers() { diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/predicates/DriveClaimed.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/predicates/DriveClaimed.java index 3f7aa03bd6..210c2efdef 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/predicates/DriveClaimed.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/predicates/DriveClaimed.java @@ -22,7 +22,7 @@ import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Singleton; -import org.jclouds.cloudsigma.CloudSigmaClient; +import org.jclouds.cloudsigma.CloudSigmaApi; import org.jclouds.cloudsigma.domain.DriveInfo; import org.jclouds.logging.Logger; @@ -35,13 +35,13 @@ import com.google.common.base.Predicate; @Singleton public class DriveClaimed implements Predicate { - private final CloudSigmaClient client; + private final CloudSigmaApi client; @Resource protected Logger logger = Logger.NULL; @Inject - public DriveClaimed(CloudSigmaClient client) { + public DriveClaimed(CloudSigmaApi client) { this.client = client; } diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/util/Servers.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/util/Servers.java index 62a59a3fb2..768f515e46 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/util/Servers.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/util/Servers.java @@ -16,7 +16,6 @@ */ package org.jclouds.cloudsigma.util; -import org.jclouds.cloudsigma.CloudSigmaClient; import org.jclouds.cloudsigma.domain.IDEDevice; import org.jclouds.cloudsigma.domain.Model; import org.jclouds.cloudsigma.domain.NIC; @@ -69,7 +68,7 @@ public class Servers { /** * Takes the input server and changes its primary ip to a new address. To make this happen, - * you'll need to invoke {@link CloudSigmaClient#setServerConfiguration} + * you'll need to invoke {@link org.jclouds.cloudsigma.CloudSigmaApi#setServerConfiguration} * * @param in * server to change diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaApiTest.java similarity index 90% rename from apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java rename to apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaApiTest.java index e1e5867417..24c0c4dae0 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaAsyncClientTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaApiTest.java @@ -53,16 +53,16 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.reflect.Invokable; /** - * Tests behavior of {@code CloudSigmaAsyncClient} + * Tests behavior of {@code CloudSigmaApi} * * @author Adrian Cole */ // NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "CloudSigmaAsyncClientTest") -public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest { +@Test(groups = "unit", testName = "CloudSigmaApiTest") +public class CloudSigmaApiTest extends BaseAsyncClientTest { public void testGetProfileInfo() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudSigmaAsyncClient.class, "getProfileInfo"); + Invokable method = method(CloudSigmaApi.class, "getProfileInfo"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/profile/info HTTP/1.1"); @@ -78,7 +78,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listStandardDrives"); + Invokable method = method(CloudSigmaApi.class, "listStandardDrives"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/list HTTP/1.1"); @@ -93,7 +93,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listStandardCds"); + Invokable method = method(CloudSigmaApi.class, "listStandardCds"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/cd/list HTTP/1.1"); @@ -108,7 +108,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listStandardImages"); + Invokable method = method(CloudSigmaApi.class, "listStandardImages"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/img/list HTTP/1.1"); @@ -123,7 +123,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listDriveInfo"); + Invokable method = method(CloudSigmaApi.class, "listDriveInfo"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/info HTTP/1.1"); @@ -138,7 +138,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "getDriveInfo", String.class); + Invokable method = method(CloudSigmaApi.class, "getDriveInfo", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/info HTTP/1.1"); @@ -154,7 +154,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "createDrive", Drive.class); + Invokable method = method(CloudSigmaApi.class, "createDrive", Drive.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of( new CreateDriveRequest.Builder().name("foo").use(ImmutableList.of("production", "candy")).size(10000l) .build())); @@ -172,7 +172,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class, + Invokable method = method(CloudSigmaApi.class, "cloneDrive", String.class, String.class, CloneDriveOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("sourceid", "newname")); @@ -189,7 +189,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class, + Invokable method = method(CloudSigmaApi.class, "cloneDrive", String.class, String.class, CloneDriveOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("sourceid", "newname", new CloneDriveOptions().size(1024l))); @@ -207,7 +207,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "setDriveData", String.class, DriveData.class); + Invokable method = method(CloudSigmaApi.class, "setDriveData", String.class, DriveData.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("100", new DriveData.Builder().name("foo").size(10000l) .use(ImmutableList.of("production", "candy")).build())); @@ -224,7 +224,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listServers"); + Invokable method = method(CloudSigmaApi.class, "listServers"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/list HTTP/1.1"); @@ -251,7 +251,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listServerInfo"); + Invokable method = method(CloudSigmaApi.class, "listServerInfo"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/info HTTP/1.1"); @@ -266,7 +266,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "getServerInfo", String.class); + Invokable method = method(CloudSigmaApi.class, "getServerInfo", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/info HTTP/1.1"); @@ -282,7 +282,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "createServer", Server.class); + Invokable method = method(CloudSigmaApi.class, "createServer", Server.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of(BindServerToPlainTextStringTest.SERVER)); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/create HTTP/1.1"); @@ -298,7 +298,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "setServerConfiguration", String.class, Server.class); + Invokable method = method(CloudSigmaApi.class, "setServerConfiguration", String.class, Server.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("100", BindServerToPlainTextStringTest.SERVER)); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/100/set HTTP/1.1"); @@ -314,7 +314,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "destroyServer", String.class); + Invokable method = method(CloudSigmaApi.class, "destroyServer", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1"); @@ -330,7 +330,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "startServer", String.class); + Invokable method = method(CloudSigmaApi.class, "startServer", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/start HTTP/1.1"); @@ -346,7 +346,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "stopServer", String.class); + Invokable method = method(CloudSigmaApi.class, "stopServer", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/stop HTTP/1.1"); @@ -362,7 +362,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "shutdownServer", String.class); + Invokable method = method(CloudSigmaApi.class, "shutdownServer", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/shutdown HTTP/1.1"); @@ -378,7 +378,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "resetServer", String.class); + Invokable method = method(CloudSigmaApi.class, "resetServer", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/reset HTTP/1.1"); @@ -394,7 +394,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listDrives"); + Invokable method = method(CloudSigmaApi.class, "listDrives"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/list HTTP/1.1"); @@ -421,7 +421,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "destroyDrive", String.class); + Invokable method = method(CloudSigmaApi.class, "destroyDrive", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1"); @@ -437,7 +437,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listVLANs"); + Invokable method = method(CloudSigmaApi.class, "listVLANs"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/list HTTP/1.1"); @@ -464,7 +464,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listVLANInfo"); + Invokable method = method(CloudSigmaApi.class, "listVLANInfo"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/info HTTP/1.1"); @@ -479,7 +479,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "getVLANInfo", String.class); + Invokable method = method(CloudSigmaApi.class, "getVLANInfo", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/info HTTP/1.1"); @@ -495,7 +495,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "createVLAN", String.class); + Invokable method = method(CloudSigmaApi.class, "createVLAN", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("poohbear")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/create HTTP/1.1"); @@ -511,7 +511,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "renameVLAN", String.class, String.class); + Invokable method = method(CloudSigmaApi.class, "renameVLAN", String.class, String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("100", "poohbear")); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/100/set HTTP/1.1"); @@ -527,7 +527,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "destroyVLAN", String.class); + Invokable method = method(CloudSigmaApi.class, "destroyVLAN", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1"); @@ -543,7 +543,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listStaticIPs"); + Invokable method = method(CloudSigmaApi.class, "listStaticIPs"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/list HTTP/1.1"); @@ -570,7 +570,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "listStaticIPInfo"); + Invokable method = method(CloudSigmaApi.class, "listStaticIPInfo"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/info HTTP/1.1"); @@ -585,7 +585,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "getStaticIPInfo", String.class); + Invokable method = method(CloudSigmaApi.class, "getStaticIPInfo", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/info HTTP/1.1"); @@ -601,7 +601,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "createStaticIP"); + Invokable method = method(CloudSigmaApi.class, "createStaticIP"); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/ip/create HTTP/1.1"); @@ -617,7 +617,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest method = method(CloudSigmaAsyncClient.class, "destroyStaticIP", String.class); + Invokable method = method(CloudSigmaApi.class, "destroyStaticIP", String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("uuid")); assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1"); diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java index 210683e80c..2c4e206479 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java @@ -60,7 +60,7 @@ import com.google.gson.Gson; import com.google.inject.Guice; /** - * Tests behavior of {@code CloudSigmaClient} + * Tests behavior of {@code CloudSigmaApi} * * @author Adrian Cole */ @@ -74,7 +74,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest protected long driveSize = 8 * 1024 * 1024 * 1024l; protected int maxDriveImageTime = 300; protected String vncPassword = "Il0veVNC"; - protected CloudSigmaClient client; + protected CloudSigmaApi client; protected Predicate socketTester; protected Predicate driveNotClaimed; @@ -85,7 +85,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest public void setupContext() { super.setupContext(); - client = view.utils().injector().getInstance(CloudSigmaClient.class); + client = view.utils().injector().getInstance(CloudSigmaApi.class); driveNotClaimed = retry(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, 1, SECONDS); SocketOpen socketOpten = context.utils().injector().getInstance(SocketOpen.class); socketTester = retry(socketOpten, maxDriveImageTime, 1, SECONDS); diff --git a/providers/cloudsigma-zrh/src/test/java/org/jclouds/cloudsigma/compute/CloudSigmaZurichComputeServiceLiveTest.java b/providers/cloudsigma-zrh/src/test/java/org/jclouds/cloudsigma/compute/CloudSigmaZurichComputeServiceLiveTest.java index 42b57331c7..38e49762c4 100644 --- a/providers/cloudsigma-zrh/src/test/java/org/jclouds/cloudsigma/compute/CloudSigmaZurichComputeServiceLiveTest.java +++ b/providers/cloudsigma-zrh/src/test/java/org/jclouds/cloudsigma/compute/CloudSigmaZurichComputeServiceLiveTest.java @@ -24,8 +24,7 @@ import static org.testng.Assert.assertTrue; import java.util.Set; -import org.jclouds.cloudsigma.CloudSigmaApiMetadata; -import org.jclouds.cloudsigma.CloudSigmaClient; +import org.jclouds.cloudsigma.CloudSigmaApi; import org.jclouds.cloudsigma.compute.options.CloudSigmaTemplateOptions; import org.jclouds.cloudsigma.domain.AffinityType; import org.jclouds.cloudsigma.domain.Device; @@ -62,8 +61,7 @@ public class CloudSigmaZurichComputeServiceLiveTest extends CloudSigmaComputeSer Set nodes = client.createNodesInGroup(group, 1, template); NodeMetadata node = get(nodes, 0); - CloudSigmaClient api = CloudSigmaClient.class.cast(client.getContext().unwrap( - CloudSigmaApiMetadata.CONTEXT_TOKEN).getApi()); + CloudSigmaApi api = CloudSigmaApi.class.cast(client.getContext()); // Note: I wanted to use node.getHardware().getVolumes() but there is no // way to go from a Volume to a DriveInfo