@Test @RunWithCustomExecutor public void should_correctly_save_data_and_compute_start_date_for_first_traceability() throws Exception { GUID guid = GUIDFactory.newOperationLogbookGUID(0); handlerIO.addOutIOParameters(in); handlerIO.addOutputResult(0, PropertiesUtils.getResourceFile(LAST_OPERATION), false); handlerIO.addOutputResult(1, PropertiesUtils.getResourceFile(TRACEABILITY_INFO), false); handlerIO.addOutputResult(3, PropertiesUtils.getResourceFile(TRACEABILITY_STATISTICS), false); handlerIO.addInIOParameters(in); when(logbookOperationsClient.selectOperation(any())) .thenThrow(new LogbookClientException("LogbookClientException")); JsonLineIterator entriesIterator = new JsonLineIterator(PropertiesUtils.getResourceAsStream(TRACEABILITY_DATA)); LogbookObjectGroupLifeCycleTraceabilityHelper helper = new LogbookObjectGroupLifeCycleTraceabilityHelper(handlerIO, logbookOperationsClient, itemStatus, guid.getId(), workspaceClientFactory, entriesIterator, "eventFileName", "zipFileName"); final MerkleTreeAlgo algo = new MerkleTreeAlgo(VitamConfiguration.getDefaultDigestType()); File zipFile = new File(folder.newFolder(), String.format(FILE_NAME)); TraceabilityFile file = new TraceabilityFile(zipFile); helper.saveDataInZip(algo, file); file.close(); assertThat(Files.size(Paths.get(zipFile.getPath()))).isEqualTo(150L); }
@Override public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException { file.initStoreLog(); try { extractAppendToFinalFile(traceabilityDataIterator, file, algo); } finally { file.closeStoreLog(); } }
LogbookObjectGroupLifeCycleTraceabilityHelper extends LogbookLifeCycleTraceabilityHelper { @Override public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException { file.initStoreLog(); try { extractAppendToFinalFile(traceabilityDataIterator, file, algo); } finally { file.closeStoreLog(); } } }
LogbookObjectGroupLifeCycleTraceabilityHelper extends LogbookLifeCycleTraceabilityHelper { @Override public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException { file.initStoreLog(); try { extractAppendToFinalFile(traceabilityDataIterator, file, algo); } finally { file.closeStoreLog(); } } LogbookObjectGroupLifeCycleTraceabilityHelper(HandlerIO handlerIO,
        LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID,
        WorkspaceClientFactory workspaceClientFactory,
        CloseableIterator<JsonLineModel> traceabilityDataIterator, String traceabilityEventFileName,
        String traceabilityZipFileName); }
LogbookObjectGroupLifeCycleTraceabilityHelper extends LogbookLifeCycleTraceabilityHelper { @Override public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException { file.initStoreLog(); try { extractAppendToFinalFile(traceabilityDataIterator, file, algo); } finally { file.closeStoreLog(); } } LogbookObjectGroupLifeCycleTraceabilityHelper(HandlerIO handlerIO,
        LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID,
        WorkspaceClientFactory workspaceClientFactory,
        CloseableIterator<JsonLineModel> traceabilityDataIterator, String traceabilityEventFileName,
        String traceabilityZipFileName); @Override void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file); @Override String getZipName(); @Override TraceabilityType getTraceabilityType(); }
LogbookObjectGroupLifeCycleTraceabilityHelper extends LogbookLifeCycleTraceabilityHelper { @Override public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException { file.initStoreLog(); try { extractAppendToFinalFile(traceabilityDataIterator, file, algo); } finally { file.closeStoreLog(); } } LogbookObjectGroupLifeCycleTraceabilityHelper(HandlerIO handlerIO,
        LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID,
        WorkspaceClientFactory workspaceClientFactory,
        CloseableIterator<JsonLineModel> traceabilityDataIterator, String traceabilityEventFileName,
        String traceabilityZipFileName); @Override void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file); @Override String getZipName(); @Override TraceabilityType getTraceabilityType();  }