Removed async from elasticstack

This commit is contained in:
Andrew Bayer 2013-08-02 07:56:48 -07:00
parent 1a6071ab92
commit a2af31c419
19 changed files with 430 additions and 596 deletions

View File

@ -0,0 +1,343 @@
/*
* 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.elasticstack;
import java.io.Closeable;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.elasticstack.binders.BindDriveDataToPlainTextString;
import org.jclouds.elasticstack.binders.BindDriveToPlainTextString;
import org.jclouds.elasticstack.binders.BindServerToPlainTextString;
import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveData;
import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToDriveInfo;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToServerInfo;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet;
import org.jclouds.elasticstack.functions.ReturnPayload;
import org.jclouds.elasticstack.functions.SplitNewlines;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.io.Payload;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
/**
* Provides synchronous access to elasticstack via their REST API.
* <p/>
*
* @see <a href="TODO: insert URL of provider documentation" />
* @author Adrian Cole
*/
@RequestFilters(BasicAuthentication.class)
@Consumes(MediaType.TEXT_PLAIN)
public interface ElasticStackApi extends Closeable {
/**
* list of server uuids in your account
*
* @return or empty set if no servers are found
*/
@GET
@Path("/servers/list")
@ResponseParser(SplitNewlines.class)
Set<String> listServers();
/**
* Get all servers info
*
* @return or empty set if no servers are found
*/
@GET
@Path("/servers/info")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class)
Set<ServerInfo> listServerInfo();
/**
* @param uuid
* what to get
* @return null, if not found
*/
@GET
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/info")
ServerInfo getServerInfo(@PathParam("uuid") String uuid);
/**
* create a new server
*
* @param createServer
* @return newly created server
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create/stopped")
ServerInfo createServer(
@BinderParam(BindServerToPlainTextString.class) Server createServer);
/**
* 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")
ServerInfo setServerConfiguration(@PathParam("uuid") String uuid,
@BinderParam(BindServerToPlainTextString.class) Server setServer);
/**
* Destroy a server
*
* @param uuid
* what to destroy
*/
@POST
@Path("/servers/{uuid}/destroy")
@Fallback(VoidOnNotFoundOr404.class)
void destroyServer(@PathParam("uuid") String uuid);
/**
* Start a server
*
* @param uuid
* what to start
*/
@POST
@Path("/servers/{uuid}/start")
void startServer(@PathParam("uuid") String uuid);
/**
* Stop a server
* <p/>
* 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")
void stopServer(@PathParam("uuid") String uuid);
/**
* Shutdown a server
* <p/>
* Sends the server an ACPI power-down event. Server reverts to a stopped status if it is
* persistent and is automatically destroyed otherwise.
* <h4>note</h4> 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")
void shutdownServer(@PathParam("uuid") String uuid);
/**
* Reset a server
*
* @param uuid
* what to reset
*/
@POST
@Path("/servers/{uuid}/reset")
void resetServer(@PathParam("uuid") String uuid);
/**
* list of drive uuids in your account
*
* @return or empty set if no drives are found
*/
@GET
@Path("/drives/list")
@ResponseParser(SplitNewlines.class)
Set<String> listDrives();
/**
* Get all drives info
*
* @return or empty set if no drives are found
*/
@GET
@Path("/drives/info")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class)
Set<DriveInfo> listDriveInfo();
/**
* @param uuid
* what to get
* @return null, if not found
*/
@GET
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/info")
DriveInfo getDriveInfo(@PathParam("uuid") String uuid);
/**
* create a new drive
*
* @param createDrive
* required parameters: name, size
* @return newly created drive
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/create")
DriveInfo createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
/**
* set extra drive data
*
* @param uuid
* what drive to change
* @param setDrive
* what values to change
* @return new data
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/set")
DriveInfo setDriveData(@PathParam("uuid") String uuid,
@BinderParam(BindDriveDataToPlainTextString.class) DriveData setDrive);
/**
* Destroy a drive
*
* @param uuid
* what to delete
*/
@POST
@Path("/drives/{uuid}/destroy")
@Fallback(VoidOnNotFoundOr404.class)
void destroyDrive(@PathParam("uuid") String uuid);
/**
* create and start a new server
*
* @param createServer
* @return newly created server
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create")
ServerInfo createAndStartServer(
@BinderParam(BindServerToPlainTextString.class) Server createServer);
/**
* Image a drive from another drive. The actual imaging process is asynchronous, with progress
* reported via drive info.
*
* @param source
* drive to copy from
* @param destination
* drive to copy to
*/
@POST
@Path("/drives/{destination}/image/{source}")
@Fallback(VoidOnNotFoundOr404.class)
void imageDrive(@PathParam("source") String source, @PathParam("destination") String destination);
/**
* @see #imageDrive(String, String)
* @param conversionType
* Supports 'gzip' or 'gunzip' conversions.
*/
@POST
@Path("/drives/{destination}/image/{source}/{conversion}")
@Fallback(VoidOnNotFoundOr404.class)
void imageDrive(@PathParam("source") String source, @PathParam("destination") String destination,
@PathParam("conversion") ImageConversionType conversionType);
/**
* Read binary data from a drive
*
* @param uuid
* drive to read
* @param offset
* start at the specified offset in bytes
* @param size
* the specified size in bytes; must be <=4096k
* @return binary content of the drive.
*/
@POST
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/read/{offset}/{size}")
@ResponseParser(ReturnPayload.class)
@Fallback(NullOnNotFoundOr404.class)
Payload readDrive(@PathParam("uuid") String uuid, @PathParam("offset") long offset,
@PathParam("size") long size);
/**
* Write binary data to a drive
*
* @param uuid
* drive to write
* @param content
* what to write.
* <ul>
* <li>Binary data (Content-Type: application/octet-stream)</li>
* <li>Supports raw data or Content-Encoding: gzip</li>
* <li>Does not support Transfer-Encoding: chunked</li>
* </ul>
*/
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/write")
@Fallback(VoidOnNotFoundOr404.class)
void writeDrive(@PathParam("uuid") String uuid, Payload content);
/**
* @see ElasticStackApi#writeDrive(String, Payload)
* @param offset
* the byte offset in the target drive at which to start writing, not an offset in the
* input stream.
*/
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/write/{offset}")
@Fallback(VoidOnNotFoundOr404.class)
void writeDrive(@PathParam("uuid") String uuid, Payload content, @PathParam("offset") long offset);
}

View File

@ -25,11 +25,10 @@ import java.util.Properties;
import org.jclouds.apis.ApiMetadata; 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.ElasticStackHttpApiModule;
import org.jclouds.rest.internal.BaseRestApiMetadata; import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken;
import com.google.inject.Module; import com.google.inject.Module;
/** /**
@ -37,16 +36,7 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ElasticStackApiMetadata extends BaseRestApiMetadata { public class ElasticStackApiMetadata extends BaseHttpApiMetadata<ElasticStackApi> {
/**
* @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;
};
@Override @Override
public Builder toBuilder() { public Builder toBuilder() {
@ -62,7 +52,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
} }
public static Properties defaultProperties() { public static Properties defaultProperties() {
Properties properties = BaseRestApiMetadata.defaultProperties(); Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d"); properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
// passwords are set post-boot, so auth failures are possible // passwords are set post-boot, so auth failures are possible
// from a race condition applying the password set script // from a race condition applying the password set script
@ -71,11 +61,10 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
return properties; return properties;
} }
public static class Builder extends BaseRestApiMetadata.Builder<Builder> { public static class Builder extends BaseHttpApiMetadata.Builder<ElasticStackApi, Builder> {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
protected Builder() { protected Builder() {
super(ElasticStackClient.class, ElasticStackAsyncClient.class);
id("elasticstack") id("elasticstack")
.name("ElasticStack API") .name("ElasticStack API")
.identityName("UUID") .identityName("UUID")
@ -85,7 +74,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://api-lon-p.elastichosts.com") .defaultEndpoint("https://api-lon-p.elastichosts.com")
.defaultProperties(ElasticStackApiMetadata.defaultProperties()) .defaultProperties(ElasticStackApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class)) .view(typeToken(ComputeServiceContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackRestClientModule.class, ElasticStackComputeServiceContextModule.class)); .defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackHttpApiModule.class, ElasticStackComputeServiceContextModule.class));
} }
@Override @Override

View File

@ -1,259 +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.elasticstack;
import java.io.Closeable;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.elasticstack.binders.BindDriveDataToPlainTextString;
import org.jclouds.elasticstack.binders.BindDriveToPlainTextString;
import org.jclouds.elasticstack.binders.BindServerToPlainTextString;
import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveData;
import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToDriveInfo;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToServerInfo;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet;
import org.jclouds.elasticstack.functions.ReturnPayload;
import org.jclouds.elasticstack.functions.SplitNewlines;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.io.Payload;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to elasticstack via their REST API.
* <p/>
*
* @see ElasticStackClient
* @see <a href="TODO: insert URL of provider documentation" />
* @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)
@Consumes(MediaType.TEXT_PLAIN)
public interface ElasticStackAsyncClient extends Closeable {
/**
* @see ElasticStackClient#listServers()
*/
@GET
@Path("/servers/list")
@ResponseParser(SplitNewlines.class)
ListenableFuture<Set<String>> listServers();
/**
* @see ElasticStackClient#listServerInfo()
*/
@GET
@Path("/servers/info")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet.class)
ListenableFuture<Set<ServerInfo>> listServerInfo();
/**
* @see ElasticStackClient#getServerInfo
*/
@GET
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/info")
ListenableFuture<ServerInfo> getServerInfo(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#createServer
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create/stopped")
ListenableFuture<ServerInfo> createServer(
@BinderParam(BindServerToPlainTextString.class) Server createServer);
/**
* @see ElasticStackClient#setServerConfiguration
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/{uuid}/set")
ListenableFuture<ServerInfo> setServerConfiguration(@PathParam("uuid") String uuid,
@BinderParam(BindServerToPlainTextString.class) Server setServer);
/**
* @see ElasticStackClient#destroyServer
*/
@POST
@Path("/servers/{uuid}/destroy")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#startServer
*/
@POST
@Path("/servers/{uuid}/start")
ListenableFuture<Void> startServer(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#stopServer
*/
@POST
@Path("/servers/{uuid}/stop")
ListenableFuture<Void> stopServer(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#shutdownServer
*/
@POST
@Path("/servers/{uuid}/shutdown")
ListenableFuture<Void> shutdownServer(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#resetServer
*/
@POST
@Path("/servers/{uuid}/reset")
ListenableFuture<Void> resetServer(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#listDrives()
*/
@GET
@Path("/drives/list")
@ResponseParser(SplitNewlines.class)
ListenableFuture<Set<String>> listDrives();
/**
* @see ElasticStackClient#listDriveInfo()
*/
@GET
@Path("/drives/info")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class)
ListenableFuture<Set<DriveInfo>> listDriveInfo();
/**
* @see ElasticStackClient#getDriveInfo
*/
@GET
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/info")
ListenableFuture<DriveInfo> getDriveInfo(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#createDrive
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/create")
ListenableFuture<DriveInfo> createDrive(@BinderParam(BindDriveToPlainTextString.class) Drive createDrive);
/**
* @see ElasticStackClient#setDriveData
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToDriveInfo.class)
@Path("/drives/{uuid}/set")
ListenableFuture<DriveInfo> setDriveData(@PathParam("uuid") String uuid,
@BinderParam(BindDriveDataToPlainTextString.class) DriveData setDrive);
/**
* @see ElasticStackClient#destroyDrive
*/
@POST
@Path("/drives/{uuid}/destroy")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
/**
* @see ElasticStackClient#createAndStartServer
*/
@POST
@Fallback(NullOnNotFoundOr404.class)
@ResponseParser(KeyValuesDelimitedByBlankLinesToServerInfo.class)
@Path("/servers/create")
ListenableFuture<ServerInfo> createAndStartServer(
@BinderParam(BindServerToPlainTextString.class) Server createServer);
/**
* @see ElasticStackClient#imageDrive(String,String)
*/
@POST
@Path("/drives/{destination}/image/{source}")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> imageDrive(@PathParam("source") String source, @PathParam("destination") String destination);
/**
* @see ElasticStackClient#imageDrive(String,String,ImageConversionType)
*/
@POST
@Path("/drives/{destination}/image/{source}/{conversion}")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> imageDrive(@PathParam("source") String source, @PathParam("destination") String destination,
@PathParam("conversion") ImageConversionType conversionType);
/**
* @see ElasticStackClient#readDrive
*/
@POST
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/read/{offset}/{size}")
@ResponseParser(ReturnPayload.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Payload> readDrive(@PathParam("uuid") String uuid, @PathParam("offset") long offset,
@PathParam("size") long size);
/**
* @see ElasticStackClient#writeDrive(String, Payload)
*/
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/write")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> writeDrive(@PathParam("uuid") String uuid, Payload content);
/**
* @see ElasticStackClient#writeDrive(String, Payload, long)
*/
@POST
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Path("/drives/{uuid}/write/{offset}")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> writeDrive(@PathParam("uuid") String uuid, Payload content, @PathParam("offset") long offset);
}

View File

@ -1,237 +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.elasticstack;
import java.io.Closeable;
import java.util.Set;
import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveData;
import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.io.Payload;
/**
* Provides synchronous access to elasticstack.
* <p/>
*
* @see ElasticStackAsyncClient
* @see <a href="TODO: insert URL of elasticstack documentation" />
* @author Adrian Cole
*/
public interface ElasticStackClient extends Closeable {
/**
* list of server uuids in your account
*
* @return or empty set if no servers are found
*/
Set<String> listServers();
/**
* Get all servers info
*
* @return or empty set if no servers are found
*/
Set<? extends ServerInfo> 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
* <p/>
* 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
* <p/>
* Sends the server an ACPI power-down event. Server reverts to a stopped status if it is
* persistent and is automatically destroyed otherwise.
* <h4>note</h4> 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<String> listDrives();
/**
* Get all drives info
*
* @return or empty set if no drives are found
*/
Set<? extends DriveInfo> 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);
/**
* create and start a new server
*
* @param server
* @return newly created server
*/
ServerInfo createAndStartServer(Server server);
/**
* Image a drive from another drive. The actual imaging process is asynchronous, with progress
* reported via drive info.
*
* @param source
* drive to copy from
* @param destination
* drive to copy to
*/
void imageDrive(String source, String destination);
/**
* @see #imageDrive(String, String)
* @param conversionType
* Supports 'gzip' or 'gunzip' conversions.
*/
void imageDrive(String source, String destination, ImageConversionType conversionType);
/**
* Read binary data from a drive
*
* @param uuid
* drive to read
* @param offset
* start at the specified offset in bytes
* @param size
* the specified size in bytes; must be <=4096k
* @return binary content of the drive.
*/
Payload readDrive(String uuid, long offset, long size);
/**
* Write binary data to a drive
*
* @param uuid
* drive to write
* @param content
* what to write.
* <ul>
* <li>Binary data (Content-Type: application/octet-stream)</li>
* <li>Supports raw data or Content-Encoding: gzip</li>
* <li>Does not support Transfer-Encoding: chunked</li>
* </ul>
*/
void writeDrive(String uuid, Payload content);
/**
* @see ElasticStackClient#writeDrive(String, Payload)
* @param offset
* the byte offset in the target drive at which to start writing, not an offset in the
* input stream.
*/
void writeDrive(String uuid, Payload content, long offset);
}

View File

@ -44,7 +44,7 @@ import org.jclouds.compute.domain.internal.VolumeImpl;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.elasticstack.ElasticStackClient; import org.jclouds.elasticstack.ElasticStackApi;
import org.jclouds.elasticstack.domain.Device; import org.jclouds.elasticstack.domain.Device;
import org.jclouds.elasticstack.domain.Drive; import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveInfo; import org.jclouds.elasticstack.domain.DriveInfo;
@ -64,21 +64,20 @@ import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder; 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.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.UncheckedExecutionException; import com.google.common.util.concurrent.UncheckedExecutionException;
/** /**
* defines the connection between the {@link ElasticStackClient} implementation * defines the connection between the {@link org.jclouds.elasticstack.ElasticStackApi} implementation
* and the jclouds {@link ComputeService} * and the jclouds {@link ComputeService}
* *
*/ */
@Singleton @Singleton
public class ElasticStackComputeServiceAdapter implements public class ElasticStackComputeServiceAdapter implements
ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location> { ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location> {
private final ElasticStackClient client; private final ElasticStackApi client;
private final Predicate<DriveInfo> driveNotClaimed; private final Predicate<DriveInfo> driveNotClaimed;
private final Map<String, WellKnownImage> preinstalledImages; private final Map<String, WellKnownImage> preinstalledImages;
private final LoadingCache<String, DriveInfo> cache; private final LoadingCache<String, DriveInfo> cache;
@ -90,7 +89,7 @@ public class ElasticStackComputeServiceAdapter implements
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@Inject @Inject
public ElasticStackComputeServiceAdapter(ElasticStackClient client, Predicate<DriveInfo> driveNotClaimed, public ElasticStackComputeServiceAdapter(ElasticStackApi client, Predicate<DriveInfo> driveNotClaimed,
Map<String, WellKnownImage> preinstalledImages, LoadingCache<String, DriveInfo> cache, Map<String, WellKnownImage> preinstalledImages, LoadingCache<String, DriveInfo> cache,
@Named(ElasticStackConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword, @Named(ElasticStackConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword,
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) { @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {

View File

@ -34,7 +34,7 @@ import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts; import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.elasticstack.ElasticStackClient; import org.jclouds.elasticstack.ElasticStackApi;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceAdapter; import org.jclouds.elasticstack.compute.ElasticStackComputeServiceAdapter;
import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata; import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata;
import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata.DeviceToVolume; import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata.DeviceToVolume;
@ -98,10 +98,10 @@ public class ElasticStackComputeServiceContextModule extends
@Singleton @Singleton
public static class GetDrive extends CacheLoader<String, DriveInfo> { public static class GetDrive extends CacheLoader<String, DriveInfo> {
private final ElasticStackClient client; private final ElasticStackApi client;
@Inject @Inject
public GetDrive(ElasticStackClient client) { public GetDrive(ElasticStackApi client) {
this.client = client; this.client = client;
} }

View File

@ -19,8 +19,7 @@ package org.jclouds.elasticstack.config;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jclouds.elasticstack.ElasticStackAsyncClient; import org.jclouds.elasticstack.ElasticStackApi;
import org.jclouds.elasticstack.ElasticStackClient;
import org.jclouds.elasticstack.domain.Device; import org.jclouds.elasticstack.domain.Device;
import org.jclouds.elasticstack.domain.Drive; import org.jclouds.elasticstack.domain.Drive;
import org.jclouds.elasticstack.domain.DriveData; import org.jclouds.elasticstack.domain.DriveData;
@ -31,18 +30,18 @@ import org.jclouds.elasticstack.domain.ServerMetrics;
import org.jclouds.elasticstack.functions.CreateDriveRequestToMap; import org.jclouds.elasticstack.functions.CreateDriveRequestToMap;
import org.jclouds.elasticstack.functions.DriveDataToMap; import org.jclouds.elasticstack.functions.DriveDataToMap;
import org.jclouds.elasticstack.functions.MapToDevices; import org.jclouds.elasticstack.functions.MapToDevices;
import org.jclouds.elasticstack.functions.MapToDevices.DeviceToId;
import org.jclouds.elasticstack.functions.MapToDriveMetrics; import org.jclouds.elasticstack.functions.MapToDriveMetrics;
import org.jclouds.elasticstack.functions.MapToNICs; import org.jclouds.elasticstack.functions.MapToNICs;
import org.jclouds.elasticstack.functions.MapToServerMetrics; import org.jclouds.elasticstack.functions.MapToServerMetrics;
import org.jclouds.elasticstack.functions.ServerToMap; import org.jclouds.elasticstack.functions.ServerToMap;
import org.jclouds.elasticstack.functions.MapToDevices.DeviceToId;
import org.jclouds.elasticstack.handlers.ElasticStackErrorHandler; import org.jclouds.elasticstack.handlers.ElasticStackErrorHandler;
import org.jclouds.http.HttpErrorHandler; import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError; import org.jclouds.http.annotation.ServerError;
import org.jclouds.rest.ConfiguresRestClient; 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.common.base.Function;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
@ -53,7 +52,7 @@ import com.google.inject.TypeLiteral;
* @author Adrian Cole * @author Adrian Cole
*/ */
@ConfiguresRestClient @ConfiguresRestClient
public class ElasticStackRestClientModule extends RestClientModule<ElasticStackClient, ElasticStackAsyncClient> { public class ElasticStackHttpApiModule extends HttpApiModule<ElasticStackApi> {
@Override @Override
protected void configure() { protected void configure() {

View File

@ -22,7 +22,7 @@ import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.elasticstack.ElasticStackClient; import org.jclouds.elasticstack.ElasticStackApi;
import org.jclouds.elasticstack.domain.DriveInfo; import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
@ -35,13 +35,13 @@ import com.google.common.base.Predicate;
@Singleton @Singleton
public class DriveClaimed implements Predicate<DriveInfo> { public class DriveClaimed implements Predicate<DriveInfo> {
private final ElasticStackClient client; private final ElasticStackApi client;
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@Inject @Inject
public DriveClaimed(ElasticStackClient client) { public DriveClaimed(ElasticStackApi client) {
this.client = client; this.client = client;
} }

View File

@ -58,21 +58,21 @@ import com.google.gson.Gson;
import com.google.inject.Guice; import com.google.inject.Guice;
/** /**
* Tests behavior of {@code ElasticStackClient} * Tests behavior of {@code ElasticStackApi}
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticStackClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticStackApiLiveTest")
public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTest { public class ElasticStackApiLiveTest extends BaseComputeServiceContextLiveTest {
public ElasticStackClientLiveTest() { public ElasticStackApiLiveTest() {
provider = "elasticstack"; provider = "elasticstack";
} }
protected long driveSize = 1 * 1024 * 1024 * 1024l; protected long driveSize = 1 * 1024 * 1024 * 1024l;
protected int maxDriveImageTime = 360; protected int maxDriveImageTime = 360;
protected String vncPassword = "Il0veVNC"; protected String vncPassword = "Il0veVNC";
protected ElasticStackClient client; protected ElasticStackApi client;
protected Predicate<HostAndPort> socketTester; protected Predicate<HostAndPort> socketTester;
protected Predicate<DriveInfo> driveNotClaimed; protected Predicate<DriveInfo> driveNotClaimed;
protected String imageId; protected String imageId;
@ -83,7 +83,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.utils().injector().getInstance(ElasticStackClient.class); client = view.utils().injector().getInstance(ElasticStackApi.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);

View File

@ -52,15 +52,15 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.reflect.Invokable; import com.google.common.reflect.Invokable;
/** /**
* Tests behavior of {@code ElasticStackAsyncClient} * Tests behavior of {@code ElasticStackApi}
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "ElasticStackAsyncClientTest") @Test(groups = "unit", testName = "ElasticStackApiTest")
public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStackAsyncClient> { public class ElasticStackApiTest extends BaseAsyncClientTest<ElasticStackApi> {
public void testListServers() throws SecurityException, NoSuchMethodException, IOException { public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listServers"); Invokable<?, ?> method = method(ElasticStackApi.class, "listServers");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
@ -87,7 +87,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException { public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listServerInfo"); Invokable<?, ?> method = method(ElasticStackApi.class, "listServerInfo");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/info HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/info HTTP/1.1");
@ -102,7 +102,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException { public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "getServerInfo", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "getServerInfo", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/uuid/info HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/uuid/info HTTP/1.1");
@ -118,7 +118,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testCreateAndStartServer() throws SecurityException, NoSuchMethodException, IOException { public void testCreateAndStartServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createAndStartServer", Server.class); Invokable<?, ?> method = method(ElasticStackApi.class, "createAndStartServer", Server.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of( GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
BindServerToPlainTextStringTest.SERVER)); BindServerToPlainTextStringTest.SERVER));
@ -135,7 +135,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException { public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createServer", Server.class); Invokable<?, ?> method = method(ElasticStackApi.class, "createServer", Server.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of( GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
BindServerToPlainTextStringTest.SERVER)); BindServerToPlainTextStringTest.SERVER));
@ -152,7 +152,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testSetServerConfiguration() throws SecurityException, NoSuchMethodException, IOException { public void testSetServerConfiguration() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "setServerConfiguration", String.class, Server.class); Invokable<?, ?> method = method(ElasticStackApi.class, "setServerConfiguration", String.class, Server.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
BindServerToPlainTextStringTest.SERVER)); BindServerToPlainTextStringTest.SERVER));
@ -169,7 +169,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException { public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "destroyServer", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "destroyServer", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1");
@ -185,7 +185,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException { public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "startServer", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "startServer", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/start HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/start HTTP/1.1");
@ -201,7 +201,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException { public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "stopServer", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "stopServer", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1");
@ -217,7 +217,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException { public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "shutdownServer", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "shutdownServer", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1");
@ -233,7 +233,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException { public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "resetServer", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "resetServer", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1");
@ -249,7 +249,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException { public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listDrives"); Invokable<?, ?> method = method(ElasticStackApi.class, "listDrives");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
@ -276,7 +276,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException { public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listDriveInfo"); Invokable<?, ?> method = method(ElasticStackApi.class, "listDriveInfo");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of()); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/info HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/info HTTP/1.1");
@ -291,7 +291,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException { public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "getDriveInfo", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "getDriveInfo", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/uuid/info HTTP/1.1"); assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/uuid/info HTTP/1.1");
@ -307,7 +307,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException { public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createDrive", Drive.class); Invokable<?, ?> method = method(ElasticStackApi.class, "createDrive", Drive.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of( GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
new CreateDriveRequest.Builder().name("foo").size(10000l).build())); new CreateDriveRequest.Builder().name("foo").size(10000l).build()));
@ -324,7 +324,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testSetDriveData() throws SecurityException, NoSuchMethodException, IOException { public void testSetDriveData() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "setDriveData", String.class, DriveData.class); Invokable<?, ?> method = method(ElasticStackApi.class, "setDriveData", String.class, DriveData.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
new DriveData.Builder().name("foo").size(10000l).tags(ImmutableList.of("production", "candy")).build())); new DriveData.Builder().name("foo").size(10000l).tags(ImmutableList.of("production", "candy")).build()));
@ -341,7 +341,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException { public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "destroyDrive", String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "destroyDrive", String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1");
@ -357,7 +357,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testImageDrive() throws SecurityException, NoSuchMethodException, IOException { public void testImageDrive() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "imageDrive", String.class, String.class); Invokable<?, ?> method = method(ElasticStackApi.class, "imageDrive", String.class, String.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200")); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200"));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100 HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100 HTTP/1.1");
@ -373,7 +373,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testImageDriveWithConversion() throws SecurityException, NoSuchMethodException, IOException { public void testImageDriveWithConversion() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "imageDrive", String.class, String.class, Invokable<?, ?> method = method(ElasticStackApi.class, "imageDrive", String.class, String.class,
ImageConversionType.class); ImageConversionType.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200", GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200",
ImageConversionType.GUNZIP)); ImageConversionType.GUNZIP));
@ -391,7 +391,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testReadDrive() throws SecurityException, NoSuchMethodException, IOException { public void testReadDrive() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "readDrive", String.class, long.class, long.class); Invokable<?, ?> method = method(ElasticStackApi.class, "readDrive", String.class, long.class, long.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", 1024, 2048)); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", 1024, 2048));
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/read/1024/2048 HTTP/1.1"); assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/read/1024/2048 HTTP/1.1");
@ -406,7 +406,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testWriteDrive() throws SecurityException, NoSuchMethodException, IOException { public void testWriteDrive() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "writeDrive", String.class, Payload.class); Invokable<?, ?> method = method(ElasticStackApi.class, "writeDrive", String.class, Payload.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
Payloads.newStringPayload("foo"))); Payloads.newStringPayload("foo")));
@ -422,7 +422,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
} }
public void testWriteDriveOffset() throws SecurityException, NoSuchMethodException, IOException { public void testWriteDriveOffset() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "writeDrive", String.class, Payload.class, long.class); Invokable<?, ?> method = method(ElasticStackApi.class, "writeDrive", String.class, Payload.class, long.class);
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
Payloads.newStringPayload("foo"), 2048)); Payloads.newStringPayload("foo"), 2048));

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.elastichosts; package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LosAngelesClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LosAngelesApiLiveTest")
public class ElasticHostsPeer1LosAngelesClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1LosAngelesApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsPeer1LosAngelesClientLiveTest() { public ElasticHostsPeer1LosAngelesApiLiveTest() {
provider = "elastichosts-lax-p"; provider = "elastichosts-lax-p";
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.elastichosts; package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsBlueSquareLondonClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsBlueSquareLondonApiLiveTest")
public class ElasticHostsBlueSquareLondonClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsBlueSquareLondonApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsBlueSquareLondonClientLiveTest() { public ElasticHostsBlueSquareLondonApiLiveTest() {
provider = "elastichosts-lon-b"; provider = "elastichosts-lon-b";
} }
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.elastichosts; package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LondonClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LondonApiLiveTest")
public class ElasticHostsPeer1LondonClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1LondonApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsPeer1LondonClientLiveTest() { public ElasticHostsPeer1LondonApiLiveTest() {
provider = "elastichosts-lon-p"; provider = "elastichosts-lon-p";
} }
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.elastichosts; package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1SanAntonioClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1SanAntonioApiLiveTest")
public class ElasticHostsPeer1SanAntonioClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1SanAntonioApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsPeer1SanAntonioClientLiveTest() { public ElasticHostsPeer1SanAntonioApiLiveTest() {
provider = "elastichosts-sat-p"; provider = "elastichosts-sat-p";
} }
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.elastichosts; package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1TorontoClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1TorontoApiLiveTest")
public class ElasticHostsPeer1TorontoClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1TorontoApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsPeer1TorontoClientLiveTest() { public ElasticHostsPeer1TorontoApiLiveTest() {
provider = "elastichosts-tor-p"; provider = "elastichosts-tor-p";
} }
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.go2cloud; package org.jclouds.go2cloud;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "Go2CloudJohannesburg1ClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "Go2CloudJohannesburg1ApiLiveTest")
public class Go2CloudJohannesburg1ClientLiveTest extends ElasticStackClientLiveTest { public class Go2CloudJohannesburg1ApiLiveTest extends ElasticStackApiLiveTest {
public Go2CloudJohannesburg1ClientLiveTest() { public Go2CloudJohannesburg1ApiLiveTest() {
provider = "go2cloud-jhb1"; provider = "go2cloud-jhb1";
} }
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.openhosting; package org.jclouds.openhosting;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "OpenHostingEast1ClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "OpenHostingEast1ApiLiveTest")
public class OpenHostingEast1ClientLiveTest extends ElasticStackClientLiveTest { public class OpenHostingEast1ApiLiveTest extends ElasticStackApiLiveTest {
public OpenHostingEast1ClientLiveTest() { public OpenHostingEast1ApiLiveTest() {
provider = "openhosting-east1"; provider = "openhosting-east1";
} }
} }

View File

@ -17,7 +17,7 @@
package org.jclouds.serverlove; package org.jclouds.serverlove;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.jclouds.elasticstack.domain.Server; import org.jclouds.elasticstack.domain.Server;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -25,9 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "ServerloveManchesterClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ServerloveManchesterApiLiveTest")
public class ServerloveManchesterClientLiveTest extends ElasticStackClientLiveTest { public class ServerloveManchesterApiLiveTest extends ElasticStackApiLiveTest {
public ServerloveManchesterClientLiveTest() { public ServerloveManchesterApiLiveTest() {
provider = "serverlove-z1-man"; provider = "serverlove-z1-man";
} }

View File

@ -16,16 +16,16 @@
*/ */
package org.jclouds.skalicloud; package org.jclouds.skalicloud;
import org.jclouds.elasticstack.ElasticStackClientLiveTest; import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "SkaliCloudMalaysiaClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "SkaliCloudMalaysiaApiLiveTest")
public class SkaliCloudMalaysiaClientLiveTest extends ElasticStackClientLiveTest { public class SkaliCloudMalaysiaApiLiveTest extends ElasticStackApiLiveTest {
public SkaliCloudMalaysiaClientLiveTest() { public SkaliCloudMalaysiaApiLiveTest() {
provider = "skalicloud-sdg-my"; provider = "skalicloud-sdg-my";
} }
} }