@Test public void shouldRequestReportExecutionStatus() throws Exception { MockResponse response = MockResponseFactory.create200().setBody("{\"value\":\"execution\"}"); mWebMockRule.enqueue(response); ExecutionStatus status = restApiUnderTest.requestReportExecutionStatus(EXEC_ID); assertThat(status, is(notNullValue())); RecordedRequest request = mWebMockRule.get().takeRequest(); assertThat(request, containsHeader("Accept", "application/json; charset=UTF-8")); assertThat(request, hasPath("/rest_v2/reportExecutions/f3a9805a-4089-4b53-b9e9-b54752f91586/status")); assertThat(request, wasMethod("GET")); }
@NotNull public ExecutionStatus requestReportExecutionStatus(@NotNull String executionId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("status") .build(); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ExecutionStatus.class); }
ReportExecutionRestApi { @NotNull public ExecutionStatus requestReportExecutionStatus(@NotNull String executionId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("status") .build(); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ExecutionStatus.class); } }
ReportExecutionRestApi { @NotNull public ExecutionStatus requestReportExecutionStatus(@NotNull String executionId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("status") .build(); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ExecutionStatus.class); } ReportExecutionRestApi(NetworkClient networkClient); }
ReportExecutionRestApi { @NotNull public ExecutionStatus requestReportExecutionStatus(@NotNull String executionId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("status") .build(); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ExecutionStatus.class); } ReportExecutionRestApi(NetworkClient networkClient); @NotNull ReportExecutionDescriptor runReportExecution(@NotNull ReportExecutionRequestOptions executionOptions); @NotNull ReportExecutionDescriptor requestReportExecutionDetails(@NotNull String executionId); @NotNull ExecutionStatus requestReportExecutionStatus(@NotNull String executionId); boolean cancelReportExecution(@NotNull String executionId); boolean updateReportExecution(@NotNull String executionId,
                                         @NotNull List<ReportParameter> params); }
ReportExecutionRestApi { @NotNull public ExecutionStatus requestReportExecutionStatus(@NotNull String executionId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); HttpUrl url = mNetworkClient.getBaseUrl() .resolve("rest_v2/reportExecutions") .newBuilder() .addPathSegment(executionId) .addPathSegment("status") .build(); Request request = new Request.Builder() .addHeader("Accept", "application/json; charset=UTF-8") .get() .url(url) .build(); com.squareup.okhttp.Response response = mNetworkClient.makeCall(request); return mNetworkClient.deserializeJson(response, ExecutionStatus.class); } ReportExecutionRestApi(NetworkClient networkClient); @NotNull ReportExecutionDescriptor runReportExecution(@NotNull ReportExecutionRequestOptions executionOptions); @NotNull ReportExecutionDescriptor requestReportExecutionDetails(@NotNull String executionId); @NotNull ExecutionStatus requestReportExecutionStatus(@NotNull String executionId); boolean cancelReportExecution(@NotNull String executionId); boolean updateReportExecution(@NotNull String executionId,
                                         @NotNull List<ReportParameter> params);  }