updated to latest parsing format

This commit is contained in:
Adrian Cole 2011-11-29 14:44:01 -05:00
parent b909137c4a
commit 95708f36ea
4 changed files with 5 additions and 9 deletions

View File

@ -28,11 +28,9 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.glesys.domain.Server; import org.jclouds.glesys.domain.Server;
import org.jclouds.glesys.domain.ServerDetails; import org.jclouds.glesys.domain.ServerDetails;
import org.jclouds.glesys.functions.MergeArgumentsAndReturnServerDetails;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson; import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
@ -65,7 +63,7 @@ public interface ServerAsyncClient {
*/ */
@GET @GET
@Path("/server/details/serverid/{id}/format/json") @Path("/server/details/serverid/{id}/format/json")
@ResponseParser(MergeArgumentsAndReturnServerDetails.class) @SelectJson("server")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ServerDetails> getServerDetails(@PathParam("id") String id); ListenableFuture<ServerDetails> getServerDetails(@PathParam("id") String id);

View File

@ -21,7 +21,6 @@ package org.jclouds.glesys.features;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.jclouds.glesys.functions.MergeArgumentsAndReturnServerDetails;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed; import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
@ -64,7 +63,7 @@ public class ServerAsyncClientTest extends BaseGleSYSAsyncClientTest<ServerAsync
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, MergeArgumentsAndReturnServerDetails.class); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);

View File

@ -25,10 +25,9 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.glesys.config.GleSYSParserModule; import org.jclouds.glesys.config.GleSYSParserModule;
import org.jclouds.glesys.domain.ServerDetails; import org.jclouds.glesys.domain.ServerDetails;
import org.jclouds.glesys.functions.MergeArgumentsAndReturnServerDetails;
import org.jclouds.json.BaseItemParserTest; import org.jclouds.json.BaseItemParserTest;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.Guice; import com.google.inject.Guice;
@ -47,7 +46,7 @@ public class ParseServerDetailsWithoutIPsTest extends BaseItemParserTest<ServerD
} }
@Override @Override
@ResponseParser(MergeArgumentsAndReturnServerDetails.class) @SelectJson("server")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public ServerDetails expected() { public ServerDetails expected() {
return ServerDetails.builder().id("vz1541880").hostname("mammamia").datacenter("Falkenberg").platform("OpenVZ") return ServerDetails.builder().id("vz1541880").hostname("mammamia").datacenter("Falkenberg").platform("OpenVZ")

View File

@ -1 +1 @@
{"response":{"status":{"code":"200","text":"OK"},"server":{"hostname":"mammamia","description":"description","cpucores":"1","memory":"128","disk":"5","transfer":"50","template":"Ubuntu 11.04 64-bit","datacenter":"Falkenberg","managedhosting":"no","platform":"OpenVZ","cost":{"amount":6.38,"currency":"EUR","timeperiod":"month"},"iplist":[]},"arguments":{"serverid":"vz1541880"}}} {"response":{"status":{"code":"200","text":"OK"},"server":{"serverid":"vz1541880","hostname":"mammamia","description":"description","cpucores":"1","memory":"128","disk":"5","transfer":"50","template":"Ubuntu 11.04 64-bit","datacenter":"Falkenberg","managedhosting":"no","platform":"OpenVZ","cost":{"amount":6.38,"currency":"EUR","timeperiod":"month"},"iplist":[]},"debug":{"serverid":"vz1541880"}}}