Updated names for add/remove in GleSYS IP client.

This commit is contained in:
Mattias Holmqvist 2012-01-07 23:37:28 +01:00
parent 948a004b60
commit ad2c2a03e0
3 changed files with 61 additions and 61 deletions

View File

@ -64,8 +64,8 @@ public interface IpAsyncClient {
*/
@POST
@Path("/ip/add/format/json")
ListenableFuture<Void> add(@FormParam("serverid") String serverId,
@FormParam("ipaddress") String ipAddress);
ListenableFuture<Void> addIpToServer(@FormParam("ipaddress") String ipAddress,
@FormParam("serverid") String serverId);
/**
@ -75,7 +75,7 @@ public interface IpAsyncClient {
*/
@POST
@Path("/ip/remove/format/json")
ListenableFuture<Void> remove(@FormParam("ipaddress") String ipAddress,
ListenableFuture<Void> removeIpFromServer(@FormParam("ipaddress") String ipAddress,
@FormParam("serverid") String serverId);

View File

@ -40,7 +40,6 @@ public interface IpClient {
* Once your free IP on this account you can add it to a server with the add() function.
*
* @param ipAddress
* @return
*/
void take(String ipAddress);
@ -58,10 +57,10 @@ public interface IpClient {
* ip to an Xen-server you have to configure the server yourself, unless the ip was added during the c
* server (server/create). You can get detailed information such as gateway and netmask using the ip
*
* @param serverId the server to add the IP address to
* @param ipAddress the IP address to remove
* @param serverId the server to add the IP address to
*/
void add(String serverId, String ipAddress);
void addIpToServer(String ipAddress, String serverId);
/**
* Remove an IP address from a server. This does not release it back to GleSYS pool of free ips. The address will be
@ -71,7 +70,7 @@ public interface IpClient {
* @param ipAddress the IP address to remove
* @param serverId the server to remove the IP address from
*/
void remove(String ipAddress, String serverId);
void removeIpFromServer(String ipAddress, String serverId);
/**
* Get a set of all IP addresses that are available and not used on any account or server.

View File

@ -180,12 +180,12 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
"Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(newUrlEncodedFormPayload(
ImmutableMultimap.<String, String>builder()
.put("serverid", "vz1946889")
.put("ipaddress", "31.192.227.37").build())).build(),
.put("ipaddress", "31.192.227.37")
.put("serverid", "vz1946889").build())).build(),
HttpResponse.builder().statusCode(200).build())
.getIpClient();
client.add("vz1946889", "31.192.227.37");
client.addIpToServer("31.192.227.37", "vz1946889");
}
public void testAddWhenResponseIs4xxThrowsHttpException() {
@ -196,13 +196,14 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
"Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(newUrlEncodedFormPayload(
ImmutableMultimap.<String, String>builder()
.put("ipaddress", "31.192.227.37")
.put("serverid", "vz1946889")
.put("ipaddress", "31.192.227.37").build())).build(),
.build())).build(),
HttpResponse.builder().statusCode(400).build())
.getIpClient();
try {
client.add("vz1946889", "31.192.227.37");
client.addIpToServer("31.192.227.37", "vz1946889");
fail();
} catch (HttpResponseException e) {
// Expected
@ -222,7 +223,7 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
HttpResponse.builder().statusCode(200).build())
.getIpClient();
client.remove("31.192.227.37", "vz1946889");
client.removeIpFromServer("31.192.227.37", "vz1946889");
}
public void testRemoveWhenResponseIs4xxThrowsHttpException() {
@ -239,7 +240,7 @@ public class IpClientExpectTest extends BaseRestClientExpectTest<GleSYSClient> {
.getIpClient();
try {
client.remove("31.192.227.37", "vz1946889");
client.removeIpFromServer("31.192.227.37", "vz1946889");
fail();
} catch (HttpResponseException e) {
// Expected