@RunWithCustomExecutor @Test public void submitOK() throws Exception { VitamThreadUtils.getVitamSession().setRequestId(DUMMY_REQUEST_ID); final ItemStatus result = new ItemStatus("StepId"); final ItemStatus itemStatus1 = new ItemStatus("checkSeda"); itemStatus1.setMessage("CHECK_MANIFEST_OK"); final StatusCode status = StatusCode.OK; itemStatus1.increment(status); result.setItemsStatus("checkSeda", itemStatus1); final ItemStatus itemStatus2 = new ItemStatus("CheckVersion"); itemStatus2.setMessage("CHECK_VERSION_OK"); itemStatus2.increment(status); result.setItemsStatus("CheckVersion", itemStatus2); when(mock.post()).thenReturn(Response.status(Response.Status.OK).entity(result).build()); final ItemStatus responses = client.submitStep(new DescriptionStep(new Step(), WorkerParametersFactory.newWorkerParameters())); assertNotNull(responses); assertEquals(StatusCode.OK, responses.getItemsStatus().get("checkSeda").getGlobalStatus()); assertEquals(StatusCode.OK, responses.getItemsStatus().get("CheckVersion").getGlobalStatus()); assertEquals(StatusCode.OK, responses.getGlobalStatus()); }
@Override public ItemStatus submitStep(DescriptionStep step) throws WorkerNotFoundClientException, WorkerServerClientException { VitamThreadUtils.getVitamSession().checkValidRequestId(); VitamRequestBuilder request = post() .withPath("/tasks") .withBody(step, DATA_MUST_HAVE_A_VALID_VALUE) .withJson(); try (Response response = make(request)) { return handleCommonResponseStatus(step, response); } catch (VitamClientInternalException e) { throw new WorkerServerClientException(e); } }
WorkerClientRest extends DefaultClient implements WorkerClient { @Override public ItemStatus submitStep(DescriptionStep step) throws WorkerNotFoundClientException, WorkerServerClientException { VitamThreadUtils.getVitamSession().checkValidRequestId(); VitamRequestBuilder request = post() .withPath("/tasks") .withBody(step, DATA_MUST_HAVE_A_VALID_VALUE) .withJson(); try (Response response = make(request)) { return handleCommonResponseStatus(step, response); } catch (VitamClientInternalException e) { throw new WorkerServerClientException(e); } } }
WorkerClientRest extends DefaultClient implements WorkerClient { @Override public ItemStatus submitStep(DescriptionStep step) throws WorkerNotFoundClientException, WorkerServerClientException { VitamThreadUtils.getVitamSession().checkValidRequestId(); VitamRequestBuilder request = post() .withPath("/tasks") .withBody(step, DATA_MUST_HAVE_A_VALID_VALUE) .withJson(); try (Response response = make(request)) { return handleCommonResponseStatus(step, response); } catch (VitamClientInternalException e) { throw new WorkerServerClientException(e); } } WorkerClientRest(WorkerClientFactory factory); }
WorkerClientRest extends DefaultClient implements WorkerClient { @Override public ItemStatus submitStep(DescriptionStep step) throws WorkerNotFoundClientException, WorkerServerClientException { VitamThreadUtils.getVitamSession().checkValidRequestId(); VitamRequestBuilder request = post() .withPath("/tasks") .withBody(step, DATA_MUST_HAVE_A_VALID_VALUE) .withJson(); try (Response response = make(request)) { return handleCommonResponseStatus(step, response); } catch (VitamClientInternalException e) { throw new WorkerServerClientException(e); } } WorkerClientRest(WorkerClientFactory factory); @Override ItemStatus submitStep(DescriptionStep step); }
WorkerClientRest extends DefaultClient implements WorkerClient { @Override public ItemStatus submitStep(DescriptionStep step) throws WorkerNotFoundClientException, WorkerServerClientException { VitamThreadUtils.getVitamSession().checkValidRequestId(); VitamRequestBuilder request = post() .withPath("/tasks") .withBody(step, DATA_MUST_HAVE_A_VALID_VALUE) .withJson(); try (Response response = make(request)) { return handleCommonResponseStatus(step, response); } catch (VitamClientInternalException e) { throw new WorkerServerClientException(e); } } WorkerClientRest(WorkerClientFactory factory); @Override ItemStatus submitStep(DescriptionStep step);  }