@Test public void givenErrorWhenUploadThenReturnBadRequestErrorWithBody() throws Exception { final MultivaluedHashMap<String, Object> headers = new MultivaluedHashMap<>(); headers.add(GlobalDataRest.X_REQUEST_ID, FAKE_X_REQUEST_ID); ObjectNode objectNode = JsonHandler.createObjectNode(); objectNode.put(GlobalDataRest.X_REQUEST_ID, FAKE_X_REQUEST_ID); when(mock.post()) .thenReturn(Response.accepted().header(GlobalDataRest.X_REQUEST_ID, FAKE_X_REQUEST_ID).build()); try (final InputStream streamToUpload = IOUtils.toInputStream(MOCK_INPUTSTREAM_CONTENT, CharsetUtils.UTF_8)) { RequestResponse<Void> resp = client.ingest(new VitamContext(TENANT_ID), streamToUpload, CONTEXT_ID, EXECUTION_MODE); assertEquals(resp.getHttpCode(), Status.ACCEPTED.getStatusCode()); } }
@Override public RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream, String contextId, String action) throws IngestExternalException { return ingest(vitamContext, stream, new IngestRequestParameters(contextId, action)); }
IngestExternalClientRest extends DefaultClient implements IngestExternalClient { @Override public RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream, String contextId, String action) throws IngestExternalException { return ingest(vitamContext, stream, new IngestRequestParameters(contextId, action)); } }
IngestExternalClientRest extends DefaultClient implements IngestExternalClient { @Override public RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream, String contextId, String action) throws IngestExternalException { return ingest(vitamContext, stream, new IngestRequestParameters(contextId, action)); } IngestExternalClientRest(IngestExternalClientFactory factory); }
IngestExternalClientRest extends DefaultClient implements IngestExternalClient { @Override public RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream, String contextId, String action) throws IngestExternalException { return ingest(vitamContext, stream, new IngestRequestParameters(contextId, action)); } IngestExternalClientRest(IngestExternalClientFactory factory); @Override RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream,
        String contextId,
        String action); @Override RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream,
        IngestRequestParameters ingestRequestParameters); Response downloadObjectAsync(VitamContext vitamContext, String objectId,
        IngestCollection type); @Override RequestResponse<Void> ingestLocal(VitamContext vitamContext, LocalFile localFile, String contextId,
        String action); @Override RequestResponse<Void> ingestLocal(VitamContext vitamContext, LocalFile localFile,
        IngestRequestParameters ingestRequestParameters); }
IngestExternalClientRest extends DefaultClient implements IngestExternalClient { @Override public RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream, String contextId, String action) throws IngestExternalException { return ingest(vitamContext, stream, new IngestRequestParameters(contextId, action)); } IngestExternalClientRest(IngestExternalClientFactory factory); @Override RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream,
        String contextId,
        String action); @Override RequestResponse<Void> ingest(VitamContext vitamContext, InputStream stream,
        IngestRequestParameters ingestRequestParameters); Response downloadObjectAsync(VitamContext vitamContext, String objectId,
        IngestCollection type); @Override RequestResponse<Void> ingestLocal(VitamContext vitamContext, LocalFile localFile, String contextId,
        String action); @Override RequestResponse<Void> ingestLocal(VitamContext vitamContext, LocalFile localFile,
        IngestRequestParameters ingestRequestParameters);  }