@Test @RunWithCustomExecutor public void test_when_update_already_exists_accession_register_then_OK() throws Exception { VitamError ve = new VitamError(Response.Status.CONFLICT.name()).setHttpCode(Response.Status.CONFLICT.getStatusCode()) .setContext(ServiceName.EXTERNAL_ACCESS.getName()) .setState("code_vitam") .setMessage(Response.Status.CONFLICT.getReasonPhrase()) .setDescription("Document already exists in database"); RequestResponse response = new RequestResponseOK<>().setHttpCode(Response.Status.OK.getStatusCode()); when(adminManagementClient.getAccessionRegister(any())).thenReturn(response); when(adminManagementClient.createOrUpdateAccessionRegister(any())) .thenReturn(ve); File file = PropertiesUtils.getResourceFile(ACCESSION_REGISTER_DETAIL); RequestResponseOK<AccessionRegisterDetailModel> accessionRegisterDetailExisting = JsonHandler.getFromFileAsTypeReference(file, new TypeReference<RequestResponseOK<AccessionRegisterDetailModel>>() { }); when(adminManagementClient.getAccessionRegisterDetail(any(), any())).thenReturn(accessionRegisterDetailExisting); ItemStatus itemStatus = instance.execute(params, handler); Assertions.assertThat(itemStatus).isNotNull(); Assertions.assertThat(itemStatus.getGlobalStatus()).isEqualTo(StatusCode.OK); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { updateAccessionRegister(param); LOGGER.info("Purge accession register update succeeded"); return buildItemStatus(actionId, StatusCode.OK, null); } catch (ProcessingStatusException e) { LOGGER.error(String.format( "Purge accession register update failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(actionId, e.getStatusCode(), e.getEventDetails()); } }
PurgeAccessionRegisterUpdatePlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { updateAccessionRegister(param); LOGGER.info("Purge accession register update succeeded"); return buildItemStatus(actionId, StatusCode.OK, null); } catch (ProcessingStatusException e) { LOGGER.error(String.format( "Purge accession register update failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(actionId, e.getStatusCode(), e.getEventDetails()); } } }
PurgeAccessionRegisterUpdatePlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { updateAccessionRegister(param); LOGGER.info("Purge accession register update succeeded"); return buildItemStatus(actionId, StatusCode.OK, null); } catch (ProcessingStatusException e) { LOGGER.error(String.format( "Purge accession register update failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(actionId, e.getStatusCode(), e.getEventDetails()); } } PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess); @VisibleForTesting protected  PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess,
        AdminManagementClientFactory adminManagementClientFactory); }
PurgeAccessionRegisterUpdatePlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { updateAccessionRegister(param); LOGGER.info("Purge accession register update succeeded"); return buildItemStatus(actionId, StatusCode.OK, null); } catch (ProcessingStatusException e) { LOGGER.error(String.format( "Purge accession register update failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(actionId, e.getStatusCode(), e.getEventDetails()); } } PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess); @VisibleForTesting protected  PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess,
        AdminManagementClientFactory adminManagementClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler); }
PurgeAccessionRegisterUpdatePlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handler) throws ProcessingException { try { updateAccessionRegister(param); LOGGER.info("Purge accession register update succeeded"); return buildItemStatus(actionId, StatusCode.OK, null); } catch (ProcessingStatusException e) { LOGGER.error(String.format( "Purge accession register update failed with status [%s]", e.getStatusCode()), e); return buildItemStatus(actionId, e.getStatusCode(), e.getEventDetails()); } } PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess); @VisibleForTesting protected  PurgeAccessionRegisterUpdatePlugin(String actionId, LogbookTypeProcess logbookTypeProcess,
        AdminManagementClientFactory adminManagementClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handler); @Override void checkMandatoryIOParameter(HandlerIO handler);  }