public ClientInfoResponse exec() { initClientRequest(); return _exec(); }
/** * Executes the call to the REST Service and processes the response. * * @param accessToken The access token obtained from the oxAuth authorization request. * @return The service response. */ public ClientInfoResponse execClientInfo(String accessToken) { setRequest(new ClientInfoRequest(accessToken)); return exec(); }
@Override public String getHttpMethod() { if (getRequest().getAuthorizationMethod() == null || getRequest().getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD || getRequest().getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { return HttpMethod.POST; } else { // AuthorizationMethod.URL_QUERY_PARAMETER return HttpMethod.GET; } }
@Test public void requestClientInfoInvalidToken() throws Exception { showTitle("requestClientInfoInvalidToken"); ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse response = clientInfoClient.execClientInfo("INVALID-TOKEN"); showClient(clientInfoClient); assertEquals(response.getStatus(), 400, "Unexpected response code: " + response.getStatus()); assertNotNull(response.getErrorType(), "Unexpected result: errorType not found"); assertNotNull(response.getErrorDescription(), "Unexpected result: errorDescription not found"); } }
clientRequest.setHttpMethod(getHttpMethod()); if (getRequest().getAuthorizationMethod() == null || getRequest().getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD) { if (StringUtils.isNotBlank(getRequest().getAccessToken())) { clientRequest.header("Authorization", "Bearer " + getRequest().getAccessToken()); } else if (getRequest().getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { if (StringUtils.isNotBlank(getRequest().getAccessToken())) { clientRequest.formParameter("access_token", getRequest().getAccessToken()); } else if (getRequest().getAuthorizationMethod() == AuthorizationMethod.URL_QUERY_PARAMETER) { if (StringUtils.isNotBlank(getRequest().getAccessToken())) { clientRequest.queryParameter("access_token", getRequest().getAccessToken()); if (getRequest().getAuthorizationMethod() == null || getRequest().getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD || getRequest().getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { clientResponse = clientRequest.post(String.class); } else { //AuthorizationMethod.URL_QUERY_PARAMETER setResponse(new ClientInfoResponse(status)); getResponse().setEntity(entity); getResponse().setHeaders(clientResponse.getMetadata()); if (StringUtils.isNotBlank(entity)) { try { getResponse().setErrorType(UserInfoErrorResponseType.fromString(jsonObj.getString("error")));
@Test public void requestClientInfoInvalidRequest() throws Exception { showTitle("requestClientInfoInvalidRequest"); ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse response = clientInfoClient.execClientInfo(null); showClient(clientInfoClient); assertEquals(response.getStatus(), 400, "Unexpected response code: " + response.getStatus()); assertNotNull(response.getErrorType(), "Unexpected result: errorType not found"); assertNotNull(response.getErrorDescription(), "Unexpected result: errorDescription not found"); }
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse response2 = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);
ClientInfoClient clientInfoClient = new ClientInfoClient(clientInfoEndpoint); ClientInfoResponse clientInfoResponse = clientInfoClient.execClientInfo(accessToken);