@Test public void should_prepare_evidence_audit() throws Exception { WorkerParameters defaultWorkerParameters = mock(WorkerParameters.class); when(defaultWorkerParameters.getObjectName()).thenReturn("test"); JsonNode query = JsonHandler.getFromString(EvidenceAuditPrepareTest.query); when(handlerIO.getJsonFromWorkspace(anyString())).thenReturn(query); given(metaDataClient.selectUnits(JsonHandler.getFromString(query2))).willReturn( JsonHandler.getFromInputStream(getClass().getResourceAsStream("/evidenceAudit/selectResult.json"))); given(handlerIO.getNewLocalFile("aeaqaaaaaaebta56aaoc4alcdk4hlcqaaaaq")).willReturn(tempFolder.newFile()); given(handlerIO.getNewLocalFile("aeaqaaaaaaebta56aam5ualcdnzc4wiaaabq")).willReturn(tempFolder.newFile()); given(handlerIO.getJsonFromWorkspace("evidenceOptions")) .willReturn(JsonHandler.createObjectNode().put("correctiveOption", false)); ItemStatus execute = evidenceAuditPrepare.execute(defaultWorkerParameters, handlerIO); Assertions.assertThat(execute.getGlobalStatus()).isEqualTo(StatusCode.OK); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_LIST_OBJECT); JsonNode options = handlerIO.getJsonFromWorkspace("evidenceOptions"); boolean correctiveAudit = options.get("correctiveOption").booleanValue(); if (!correctiveAudit) { return handleEvidenceAudit(handlerIO, itemStatus); } String operationId = options.get(OPERATION).textValue(); return handleRectificationAudit(handlerIO, itemStatus, operationId); }
EvidenceAuditPrepare extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_LIST_OBJECT); JsonNode options = handlerIO.getJsonFromWorkspace("evidenceOptions"); boolean correctiveAudit = options.get("correctiveOption").booleanValue(); if (!correctiveAudit) { return handleEvidenceAudit(handlerIO, itemStatus); } String operationId = options.get(OPERATION).textValue(); return handleRectificationAudit(handlerIO, itemStatus, operationId); } }
EvidenceAuditPrepare extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_LIST_OBJECT); JsonNode options = handlerIO.getJsonFromWorkspace("evidenceOptions"); boolean correctiveAudit = options.get("correctiveOption").booleanValue(); if (!correctiveAudit) { return handleEvidenceAudit(handlerIO, itemStatus); } String operationId = options.get(OPERATION).textValue(); return handleRectificationAudit(handlerIO, itemStatus, operationId); } EvidenceAuditPrepare(); @VisibleForTesting  EvidenceAuditPrepare(MetaDataClientFactory metaDataClientFactory, StorageClientFactory storageClientFactory); }
EvidenceAuditPrepare extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_LIST_OBJECT); JsonNode options = handlerIO.getJsonFromWorkspace("evidenceOptions"); boolean correctiveAudit = options.get("correctiveOption").booleanValue(); if (!correctiveAudit) { return handleEvidenceAudit(handlerIO, itemStatus); } String operationId = options.get(OPERATION).textValue(); return handleRectificationAudit(handlerIO, itemStatus, operationId); } EvidenceAuditPrepare(); @VisibleForTesting  EvidenceAuditPrepare(MetaDataClientFactory metaDataClientFactory, StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO); }
EvidenceAuditPrepare extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_LIST_OBJECT); JsonNode options = handlerIO.getJsonFromWorkspace("evidenceOptions"); boolean correctiveAudit = options.get("correctiveOption").booleanValue(); if (!correctiveAudit) { return handleEvidenceAudit(handlerIO, itemStatus); } String operationId = options.get(OPERATION).textValue(); return handleRectificationAudit(handlerIO, itemStatus, operationId); } EvidenceAuditPrepare(); @VisibleForTesting  EvidenceAuditPrepare(MetaDataClientFactory metaDataClientFactory, StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO);  }