@Test public void should_extract_from_zip() throws Exception { WorkerParameters defaultWorkerParameters = mock(WorkerParameters.class); when(defaultWorkerParameters.getObjectName()) .thenReturn("evidenceAudit/0_LogbookLifecycles_20180220_111512.zip"); ItemStatus execute = evidenceAuditExtractFromZip.execute(defaultWorkerParameters, handlerIO); assertThat(execute.getGlobalStatus()).isEqualTo(StatusCode.OK); }
@Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE); String secureDataFileName = param.getObjectName(); File file = null; try { file = evidenceService.downloadAndExtractDataFromStorage(secureDataFileName, "data.txt", "zip",true); handlerIO.transferFileToWorkspace("zip" + File.separator + secureDataFileName, file, true, false); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE) .setItemsStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE, itemStatus); } catch (EvidenceAuditException e) { LOGGER.error(e); return itemStatus.increment(StatusCode.FATAL); } }
EvidenceAuditExtractFromZip extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE); String secureDataFileName = param.getObjectName(); File file = null; try { file = evidenceService.downloadAndExtractDataFromStorage(secureDataFileName, "data.txt", "zip",true); handlerIO.transferFileToWorkspace("zip" + File.separator + secureDataFileName, file, true, false); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE) .setItemsStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE, itemStatus); } catch (EvidenceAuditException e) { LOGGER.error(e); return itemStatus.increment(StatusCode.FATAL); } } }
EvidenceAuditExtractFromZip extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE); String secureDataFileName = param.getObjectName(); File file = null; try { file = evidenceService.downloadAndExtractDataFromStorage(secureDataFileName, "data.txt", "zip",true); handlerIO.transferFileToWorkspace("zip" + File.separator + secureDataFileName, file, true, false); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE) .setItemsStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE, itemStatus); } catch (EvidenceAuditException e) { LOGGER.error(e); return itemStatus.increment(StatusCode.FATAL); } } @VisibleForTesting  EvidenceAuditExtractFromZip(EvidenceService evidenceService);  EvidenceAuditExtractFromZip(); }
EvidenceAuditExtractFromZip extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE); String secureDataFileName = param.getObjectName(); File file = null; try { file = evidenceService.downloadAndExtractDataFromStorage(secureDataFileName, "data.txt", "zip",true); handlerIO.transferFileToWorkspace("zip" + File.separator + secureDataFileName, file, true, false); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE) .setItemsStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE, itemStatus); } catch (EvidenceAuditException e) { LOGGER.error(e); return itemStatus.increment(StatusCode.FATAL); } } @VisibleForTesting  EvidenceAuditExtractFromZip(EvidenceService evidenceService);  EvidenceAuditExtractFromZip(); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO); }
EvidenceAuditExtractFromZip extends ActionHandler { @Override public ItemStatus execute(WorkerParameters param, HandlerIO handlerIO) throws ProcessingException { ItemStatus itemStatus = new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE); String secureDataFileName = param.getObjectName(); File file = null; try { file = evidenceService.downloadAndExtractDataFromStorage(secureDataFileName, "data.txt", "zip",true); handlerIO.transferFileToWorkspace("zip" + File.separator + secureDataFileName, file, true, false); itemStatus.increment(StatusCode.OK); return new ItemStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE) .setItemsStatus(EVIDENCE_AUDIT_EXTRACT_ZIP_FILE, itemStatus); } catch (EvidenceAuditException e) { LOGGER.error(e); return itemStatus.increment(StatusCode.FATAL); } } @VisibleForTesting  EvidenceAuditExtractFromZip(EvidenceService evidenceService);  EvidenceAuditExtractFromZip(); @Override ItemStatus execute(WorkerParameters param, HandlerIO handlerIO);  }