/** * Prerequisite to {@link #configureArgs(JsonRepresentation)} or * {@link #configureArgs(Map)}. */ public ClientRequestConfigurer setHttpMethod(final HttpMethod httpMethod) { clientRequest.setHttpMethod(httpMethod.getJavaxRsMethod()); return this; }
/** * Prerequisite to {@link #configureArgs(JsonRepresentation)} or * {@link #configureArgs(Map)}. */ public ClientRequestConfigurer setHttpMethod(final RestfulHttpMethod httpMethod) { clientRequest.setHttpMethod(httpMethod.getJavaxRsMethod()); return this; }
clientRequest.setHttpMethod(HttpMethod.GET);
clientRequest.setHttpMethod(HttpMethod.GET);
clientRequest.setHttpMethod(HttpMethod.GET);
@Test public void bioViaJson() throws Exception{ String jsonBodyRequest = "{\n" + " \"id\": \"303021\",\n" + " \"names\": [\n" + " {\n" + " \"firstName\": \"You First\",\n" + " \"lastName\": \"Me Last\"\n" + " }\n" + " ]\n" + "}"; givenThat(WireMock.get(urlEqualTo("/identitymanagement-services/identitymanagement-services/person/internalHandle/person_id_009/biographics/default")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", APPLICATION_JSON) .withBody(jsonBodyRequest))); ApacheHttpClientExecutor httpClientExecutor = new ApacheHttpClientExecutor(); ClientRequest clientExecutor = httpClientExecutor.createRequest("http://localhost:9073/identitymanagement-services/identitymanagement-services/person/internalHandle/person_id_009/biographics/default"); clientExecutor.setHttpMethod("GET"); ClientResponse serverResponse = clientExecutor.execute(); final String respBodyAsString = (String)serverResponse.getEntity(String.class); JSONAssert.assertEquals(jsonBodyRequest, respBodyAsString, true); System.out.println("### bio response from mapping: \n" + respBodyAsString); } }
private OpenIdConnectDiscoveryResponse _exec2() { clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(HttpMethod.GET);
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
private RegisterResponse _exec() { try { clientRequest.setHttpMethod(getHttpMethod());
private AuthorizationResponse exec_() throws Exception { clientRequest.setHttpMethod(getHttpMethod());
clientRequest.setHttpMethod(getHttpMethod());
@Ignore("TODO") @Test public void follow_get() throws Exception { final LinkRepresentation link = jsonRepresentation.getLink("aLink"); final String href = link.getHref(); // when context.checking(new Expectations() { { one(mockExecutor).createRequest(with(any(UriBuilderImpl.class))); will(returnValue(mockClientRequest)); one(mockExecutor).execute(mockClientRequest); will(returnValue(mockClientResponse)); one(mockClientRequest).accept(MediaType.APPLICATION_JSON_TYPE); atLeast(1).of(mockClientRequest).setHttpMethod("GET"); allowing(mockClientRequest).getHttpMethod(); will(returnValue("GET")); one(mockClientRequest).execute(); will(returnValue(mockClientResponse)); one(mockClientResponse).setReturnType(String.class); allowing(mockClientResponse); final MultiValueMap result = new MultiValueMap(); result.put("Content-Type", "application/json"); allowing(mockClientResponse).getMetadata(); will(returnValue(result)); } }); final RestfulResponse<JsonRepresentation> response = client.follow(link); // then }