@Test @RunWithCustomExecutor public void givenExportDIPNoQueryThen415() { when(mock.post()).thenReturn(Response.status(Status.UNSUPPORTED_MEDIA_TYPE).build()); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> client.exportDIP(new VitamContext(TENANT_ID).setAccessContract(CONTRACT), (DipRequest) null)) .withMessage("DipRequest cannot be null."); }
@Override public RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest) throws VitamClientException { VitamRequestBuilder request = post() .withPath(AccessExtAPI.DIP_API) .withHeaders(vitamContext.getHeaders()) .withBody(dipRequest, "DipRequest cannot be null.") .withJson(); try (Response response = make(request)) { return RequestResponse.parseFromResponse(check(response), JsonNode.class); } catch (IllegalStateException e) { throw new VitamClientException(e); } }
AccessExternalClientV2Rest extends DefaultClient implements AccessExternalClientV2 { @Override public RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest) throws VitamClientException { VitamRequestBuilder request = post() .withPath(AccessExtAPI.DIP_API) .withHeaders(vitamContext.getHeaders()) .withBody(dipRequest, "DipRequest cannot be null.") .withJson(); try (Response response = make(request)) { return RequestResponse.parseFromResponse(check(response), JsonNode.class); } catch (IllegalStateException e) { throw new VitamClientException(e); } } }
AccessExternalClientV2Rest extends DefaultClient implements AccessExternalClientV2 { @Override public RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest) throws VitamClientException { VitamRequestBuilder request = post() .withPath(AccessExtAPI.DIP_API) .withHeaders(vitamContext.getHeaders()) .withBody(dipRequest, "DipRequest cannot be null.") .withJson(); try (Response response = make(request)) { return RequestResponse.parseFromResponse(check(response), JsonNode.class); } catch (IllegalStateException e) { throw new VitamClientException(e); } } AccessExternalClientV2Rest(AccessExternalClientV2Factory factory); }
AccessExternalClientV2Rest extends DefaultClient implements AccessExternalClientV2 { @Override public RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest) throws VitamClientException { VitamRequestBuilder request = post() .withPath(AccessExtAPI.DIP_API) .withHeaders(vitamContext.getHeaders()) .withBody(dipRequest, "DipRequest cannot be null.") .withJson(); try (Response response = make(request)) { return RequestResponse.parseFromResponse(check(response), JsonNode.class); } catch (IllegalStateException e) { throw new VitamClientException(e); } } AccessExternalClientV2Rest(AccessExternalClientV2Factory factory); @Override RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest); @Override RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipExportRequest dipExportRequest); }
AccessExternalClientV2Rest extends DefaultClient implements AccessExternalClientV2 { @Override public RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest) throws VitamClientException { VitamRequestBuilder request = post() .withPath(AccessExtAPI.DIP_API) .withHeaders(vitamContext.getHeaders()) .withBody(dipRequest, "DipRequest cannot be null.") .withJson(); try (Response response = make(request)) { return RequestResponse.parseFromResponse(check(response), JsonNode.class); } catch (IllegalStateException e) { throw new VitamClientException(e); } } AccessExternalClientV2Rest(AccessExternalClientV2Factory factory); @Override RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipRequest dipRequest); @Override RequestResponse<JsonNode> exportDIP(VitamContext vitamContext, DipExportRequest dipExportRequest);  }