public void testGetServerListWithOptionsWhenResponseIs2xx() throws Exception { HttpRequest listGridServers = HttpRequest.builder().method("GET").endpoint( URI.create("https://api.gogrid.com/api/grid/server/list?" + "v=1.6&isSandbox=true&" + "sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity")).build(); HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build(); GoGridClient clientWhenGridServersExist = requestSendsResponse(listGridServers, listGridServersResponse); assertEquals(clientWhenGridServersExist.getServerServices().getServerList( new GetServerListOptions.Builder().onlySandboxServers()).toString(), new ParseServerListTest() .expected().toString()); }
public void testGetServerListWithOptionsWhenResponseIs2xx() throws Exception { HttpRequest listGridServers = HttpRequest.builder().method("GET").endpoint( URI.create("https://api.gogrid.com/api/grid/server/list?" + "v=1.6&isSandbox=true&" + "sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity")).build(); HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build(); GoGridApi clientWhenGridServersExist = requestSendsResponse(listGridServers, listGridServersResponse); assertEquals(clientWhenGridServersExist.getServerServices().getServerList( new GetServerListOptions.Builder().onlySandboxServers()).toString(), new ParseServerListTest() .expected().toString()); }
@Test public void testGetServerListWithOptions() throws NoSuchMethodException, IOException { Invokable<?, ?> method = method(GridServerAsyncClient.class, "getServerList", GetServerListOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of( new GetServerListOptions.Builder().onlySandboxServers())); assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?v=1.6&isSandbox=true HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, ""); assertPayloadEquals(httpRequest, null, null, false); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class); checkFilters(httpRequest); httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?" + "v=1.6&isSandbox=true&sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity " + "HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, ""); assertPayloadEquals(httpRequest, null, null, false); }
@Test public void testGetServerListWithOptions() throws NoSuchMethodException, IOException { Invokable<?, ?> method = method(GridServerApi.class, "getServerList", GetServerListOptions[].class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of( new GetServerListOptions.Builder().onlySandboxServers())); assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?v=1.6&isSandbox=true HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, ""); assertPayloadEquals(httpRequest, null, null, false); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class); checkFilters(httpRequest); httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest); assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/server/list?" + "v=1.6&isSandbox=true&sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity " + "HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, ""); assertPayloadEquals(httpRequest, null, null, false); }