/** * @return The currently set API key or {@code null} if no key is set. */ public String getApiKey() { return serverConnector.getApiKey(); }
/** * @return The currently set API key or {@code null} if no key is set. */ public String getApiKey() { return serverConnector.getApiKey(); }
/** * @return The currently set API key or {@code null} if no key is set. */ public String getApiKey() { return serverConnector.getApiKey(); }
@Override public RenderingInfo getRenderInfo() { String apiKey = getApiKey(); WebTarget target = restClient.target(serverUrl).path((RENDER_INFO_PATH)).queryParam("apiKey", apiKey); Invocation.Builder request = target.request(MediaType.APPLICATION_JSON); // Ok, let's create the running session from the response List<Integer> validStatusCodes = new ArrayList<>(); validStatusCodes.add(Response.Status.OK.getStatusCode()); Response response = request.get(); renderingInfo = parseResponseWithJsonData(response, validStatusCodes, RenderingInfo.class); return renderingInfo; }
@Override public String postDomSnapshot(String domJson) { WebTarget target = restClient.target(serverUrl).path(("api/sessions/running/data")).queryParam("apiKey", getApiKey()); byte[] resultStream = GeneralUtils.getGzipByteArrayOutputStream(domJson); Invocation.Builder request = target.request(MediaType.APPLICATION_JSON); Response response = postWithRetry(request, Entity.entity(resultStream, MediaType.APPLICATION_OCTET_STREAM), null); String entity = response.getHeaderString("Location"); return entity; }
public Response call() { String currentTime = GeneralUtils.toRfc1123( Calendar.getInstance(TimeZone.getTimeZone("UTC"))); // Building the request Invocation.Builder invocationBuilder = endPoint.path(sessionId) .queryParam("apiKey", getApiKey()) .queryParam("aborted", String.valueOf(isAborted)) .queryParam("updateBaseline", String.valueOf(save)) .request(MediaType.APPLICATION_JSON) .header("Eyes-Expect", "202-accepted") .header("Eyes-Date", currentTime); // Actually perform the method call and return the result return invocationBuilder.delete(); } };
public Response call() { String currentTime = GeneralUtils.toRfc1123( Calendar.getInstance(TimeZone.getTimeZone("UTC"))); // Building the request Invocation.Builder invocationBuilder = endPoint.path(sessionId) .queryParam("apiKey", getApiKey()) .queryParam("aborted", String.valueOf(isAborted)) .queryParam("updateBaseline", String.valueOf(save)) .request(MediaType.APPLICATION_JSON) .header("Eyes-Expect", "202-accepted") .header("Eyes-Date", currentTime); // Actually perform the method call and return the result return invocationBuilder.delete(); } };
public Response call() { String currentTime = GeneralUtils.toRfc1123( Calendar.getInstance(TimeZone.getTimeZone("UTC"))); // Building the request Invocation.Builder invocationBuilder = endPoint.path(sessionId) .queryParam("apiKey", getApiKey()) .queryParam("aborted", String.valueOf(isAborted)) .queryParam("updateBaseline", String.valueOf(save)) .request(MediaType.APPLICATION_JSON) .header("Eyes-Expect", "202-accepted") .header("Eyes-Date", currentTime); // Actually perform the method call and return the result return invocationBuilder.delete(); } };
@Override public String postDomSnapshot(String domJson) { restClient.register(GZipEncoder.class); WebTarget target = restClient.target(serverUrl).path((RUNNING_DATA_PATH)).queryParam("apiKey", getApiKey()); Invocation.Builder request = target.request(MediaType.APPLICATION_JSON); byte[] resultStream = GeneralUtils.getGzipByteArrayOutputStream(domJson); Response response = sendWithRetry(HttpMethod.POST, request, Entity.entity(resultStream, MediaType.APPLICATION_OCTET_STREAM), null); @SuppressWarnings("UnnecessaryLocalVariable") String entity = response.getHeaderString("Location"); return entity; }
@Override public String postDomSnapshot(String domJson) { restClient.register(GZipEncoder.class); WebTarget target = restClient.target(serverUrl).path(("api/sessions/running/data")).queryParam("apiKey", getApiKey()); Invocation.Builder request = target.request(MediaType.APPLICATION_JSON); byte[] resultStream = GeneralUtils.getGzipByteArrayOutputStream(domJson); Response response = postWithRetry(request, Entity.entity(resultStream, MediaType.APPLICATION_OCTET_STREAM), null ); String entity = response.getHeaderString("Location"); return entity; }
@Override public void deleteSession(TestResults testResults) { ArgumentGuard.notNull(testResults, "testResults"); Invocation.Builder invocationBuilder = restClient.target(serverUrl) .path("/api/sessions/batches/") .path(testResults.getBatchId()) .path("/") .path(testResults.getId()) .queryParam("apiKey", getApiKey()) .queryParam("AccessToken", testResults.getSecretToken()) .request(MediaType.APPLICATION_JSON); Response response = invocationBuilder.delete(); }
@Override public void deleteSession(TestResults testResults) { ArgumentGuard.notNull(testResults, "testResults"); Invocation.Builder invocationBuilder = restClient.target(serverUrl) .path("/api/sessions/batches/") .path(testResults.getBatchId()) .path("/") .path(testResults.getId()) .queryParam("apiKey", getApiKey()) .queryParam("AccessToken", testResults.getSecretToken()) .request(MediaType.APPLICATION_JSON); Response response = invocationBuilder.delete(); }
@Override public void deleteSession(TestResults testResults) { ArgumentGuard.notNull(testResults, "testResults"); Invocation.Builder invocationBuilder = restClient.target(serverUrl) .path("/api/sessions/batches/") .path(testResults.getBatchId()) .path("/") .path(testResults.getId()) .queryParam("apiKey", getApiKey()) .queryParam("AccessToken", testResults.getSecretToken()) .request(MediaType.APPLICATION_JSON); @SuppressWarnings("unused") Response response = invocationBuilder.delete(); }
@Override public String postDomSnapshot (String domJson){ WebResource target = restClient.resource(serverUrl).path(("api/sessions/running/data")).queryParam("apiKey", getApiKey()); byte[] resultStream = GeneralUtils.getGzipByteArrayOutputStream(domJson); WebResource.Builder request = target.accept(MediaType.APPLICATION_JSON).entity(resultStream, MediaType.APPLICATION_OCTET_STREAM_TYPE); ClientResponse response = request.post(ClientResponse.class); MultivaluedMap<String, String> headers = response.getHeaders(); List<String> location = headers.get("Location"); String entity = null; if (!location.isEmpty()) { entity = location.get(0); } return entity; } }
Invocation.Builder request = endPoint.queryParam("apiKey", getApiKey()). request(MediaType.APPLICATION_JSON); response = postWithRetry(request, Entity.json(postData), null);
Invocation.Builder request = endPoint.queryParam("apiKey", getApiKey()). request(MediaType.APPLICATION_JSON); response = postWithRetry(request, Entity.json(postData), null);
Invocation.Builder request = endPoint.queryParam("apiKey", getApiKey()). request(MediaType.APPLICATION_JSON); response = sendWithRetry(HttpMethod.POST, request, Entity.json(postData), null);
public ClientResponse call() { String currentTime = GeneralUtils.toRfc1123( Calendar.getInstance(TimeZone.getTimeZone("UTC"))); // Building the request WebResource.Builder builder = endPoint.path(sessionId) .queryParam("apiKey", getApiKey()) .queryParam("aborted", String.valueOf(isAborted)) .queryParam("updateBaseline", String.valueOf(save)) .accept(MediaType.APPLICATION_JSON) .header("Eyes-Expect", "202-accepted") .header("Eyes-Date", currentTime); // Actually perform the method call and return the result return builder.delete(ClientResponse.class); } };
response = endPoint.queryParam("apiKey", getApiKey()). accept(MediaType.APPLICATION_JSON). entity(postData, MediaType.APPLICATION_JSON_TYPE).
@Override public void deleteSession(TestResults testResults) { ArgumentGuard.notNull(testResults, "testResults"); WebResource sessionsResources = restClient.resource(serverUrl); WebResource.Builder builder = sessionsResources .path("/api/sessions/batches/") .path(testResults.getBatchId()) .path("/") .path(testResults.getId()) .queryParam("apiKey", getApiKey()) .queryParam("AccessToken", testResults.getSecretToken()) .accept(MediaType.APPLICATION_JSON); builder.delete(); }