@Test public void checkExportExecutionStatusShouldThrowRestErrorOn500() throws Exception { mExpectedException.expect(HttpException.class); mWebMockRule.enqueue(MockResponseFactory.create500()); restApiUnderTest.checkExportExecutionStatus("any_id", "any_id"); }
@NotNull public ExecutionStatus checkExportExecutionStatus(@NotNull String executionId, @NotNull String exportId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(exportId, "Export id should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reportExecutions") .addPath(executionId) .addPath("exports") .addPath(exportId) .addPath("status") .build() .resolve(mNetworkClient.getBaseUrl()); 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); }
ReportExportRestApi { @NotNull public ExecutionStatus checkExportExecutionStatus(@NotNull String executionId, @NotNull String exportId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(exportId, "Export id should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reportExecutions") .addPath(executionId) .addPath("exports") .addPath(exportId) .addPath("status") .build() .resolve(mNetworkClient.getBaseUrl()); 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); } }
ReportExportRestApi { @NotNull public ExecutionStatus checkExportExecutionStatus(@NotNull String executionId, @NotNull String exportId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(exportId, "Export id should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reportExecutions") .addPath(executionId) .addPath("exports") .addPath(exportId) .addPath("status") .build() .resolve(mNetworkClient.getBaseUrl()); 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); } ReportExportRestApi(NetworkClient networkClient); }
ReportExportRestApi { @NotNull public ExecutionStatus checkExportExecutionStatus(@NotNull String executionId, @NotNull String exportId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(exportId, "Export id should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reportExecutions") .addPath(executionId) .addPath("exports") .addPath(exportId) .addPath("status") .build() .resolve(mNetworkClient.getBaseUrl()); 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); } ReportExportRestApi(NetworkClient networkClient); @NotNull ExportExecutionDescriptor runExportExecution(@NotNull String executionId,
                                                        @NotNull ExecutionRequestOptions executionOptions); @NotNull ExecutionStatus checkExportExecutionStatus(@NotNull String executionId,
                                                      @NotNull String exportId); @NotNull ExportOutputResource requestExportOutput(@NotNull String executionId,
                                                    @NotNull String exportId); @NotNull OutputResource requestExportAttachment(@NotNull String executionId,
                                                  @NotNull String exportId,
                                                  @NotNull String attachmentId); }
ReportExportRestApi { @NotNull public ExecutionStatus checkExportExecutionStatus(@NotNull String executionId, @NotNull String exportId) throws IOException, HttpException { Utils.checkNotNull(executionId, "Execution id should not be null"); Utils.checkNotNull(exportId, "Export id should not be null"); HttpUrl url = new PathResolver.Builder() .addPath("rest_v2") .addPath("reportExecutions") .addPath(executionId) .addPath("exports") .addPath(exportId) .addPath("status") .build() .resolve(mNetworkClient.getBaseUrl()); 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); } ReportExportRestApi(NetworkClient networkClient); @NotNull ExportExecutionDescriptor runExportExecution(@NotNull String executionId,
                                                        @NotNull ExecutionRequestOptions executionOptions); @NotNull ExecutionStatus checkExportExecutionStatus(@NotNull String executionId,
                                                      @NotNull String exportId); @NotNull ExportOutputResource requestExportOutput(@NotNull String executionId,
                                                    @NotNull String exportId); @NotNull OutputResource requestExportAttachment(@NotNull String executionId,
                                                  @NotNull String exportId,
                                                  @NotNull String attachmentId);  }