@Test @RunWithCustomExecutor public void should_extract_correctly_timestamp_token() throws Exception { LogbookOperations logbookOperations = mock(LogbookOperations.class); GUID guid = GUIDFactory.newOperationLogbookGUID(0); LogbookOperationTraceabilityHelper helper = new LogbookOperationTraceabilityHelper(logbookOperations, guid, OPERATION_TRACEABILITY_TEMPORIZATION_DELAY); InputStream stream = getClass().getResourceAsStream(LOGBOOK_OPERATION_WITH_TOKEN); JsonNode jsonNode = JsonHandler.getFromInputStream(stream); LogbookOperation logbookOperation = new LogbookOperation(jsonNode); byte[] token = helper.extractTimestampToken(logbookOperation); assertThat(Base64.encodeBase64String(token)).isEqualTo(LAST_OPERATION_HASH); }
byte[] extractTimestampToken(LogbookOperation logbookOperation) throws InvalidParseOperationException { TraceabilityEvent traceabilityEvent = extractEventDetData(logbookOperation); if (traceabilityEvent == null) { return null; } return traceabilityEvent.getTimeStampToken(); }
LogbookOperationTraceabilityHelper implements LogbookTraceabilityHelper { byte[] extractTimestampToken(LogbookOperation logbookOperation) throws InvalidParseOperationException { TraceabilityEvent traceabilityEvent = extractEventDetData(logbookOperation); if (traceabilityEvent == null) { return null; } return traceabilityEvent.getTimeStampToken(); } }
LogbookOperationTraceabilityHelper implements LogbookTraceabilityHelper { byte[] extractTimestampToken(LogbookOperation logbookOperation) throws InvalidParseOperationException { TraceabilityEvent traceabilityEvent = extractEventDetData(logbookOperation); if (traceabilityEvent == null) { return null; } return traceabilityEvent.getTimeStampToken(); } LogbookOperationTraceabilityHelper(LogbookOperations logbookOperations,
        GUID operationID, int temporizationDelayInSeconds); }
LogbookOperationTraceabilityHelper implements LogbookTraceabilityHelper { byte[] extractTimestampToken(LogbookOperation logbookOperation) throws InvalidParseOperationException { TraceabilityEvent traceabilityEvent = extractEventDetData(logbookOperation); if (traceabilityEvent == null) { return null; } return traceabilityEvent.getTimeStampToken(); } LogbookOperationTraceabilityHelper(LogbookOperations logbookOperations,
        GUID operationID, int temporizationDelayInSeconds); @Override void initialize(); @Override void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file); @Override String getPreviousStartDate(); @Override byte[] getPreviousTimestampToken(); @Override String getPreviousMonthStartDate(); @Override byte[] getPreviousMonthTimestampToken(); @Override String getPreviousYearStartDate(); @Override byte[] getPreviousYearTimestampToken(); @Override void createLogbookOperationStructure(); @Override void createLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status,
        TraceabilityEvent event); @Override void saveEmpty(Integer tenantId); @Override void storeAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName,
        TraceabilityEvent event); @Override String getStepName(); @Override String getTimestampStepName(); @Override String getZipName(); @Override TraceabilityType getTraceabilityType(); @Override boolean getMaxEntriesReached(); @Override TraceabilityStatistics getTraceabilityStatistics(); @Override long getDataSize(); @Override String getTraceabilityStartDate(); @Override String getTraceabilityEndDate(); }
LogbookOperationTraceabilityHelper implements LogbookTraceabilityHelper { byte[] extractTimestampToken(LogbookOperation logbookOperation) throws InvalidParseOperationException { TraceabilityEvent traceabilityEvent = extractEventDetData(logbookOperation); if (traceabilityEvent == null) { return null; } return traceabilityEvent.getTimeStampToken(); } LogbookOperationTraceabilityHelper(LogbookOperations logbookOperations,
        GUID operationID, int temporizationDelayInSeconds); @Override void initialize(); @Override void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file); @Override String getPreviousStartDate(); @Override byte[] getPreviousTimestampToken(); @Override String getPreviousMonthStartDate(); @Override byte[] getPreviousMonthTimestampToken(); @Override String getPreviousYearStartDate(); @Override byte[] getPreviousYearTimestampToken(); @Override void createLogbookOperationStructure(); @Override void createLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status,
        TraceabilityEvent event); @Override void saveEmpty(Integer tenantId); @Override void storeAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName,
        TraceabilityEvent event); @Override String getStepName(); @Override String getTimestampStepName(); @Override String getZipName(); @Override TraceabilityType getTraceabilityType(); @Override boolean getMaxEntriesReached(); @Override TraceabilityStatistics getTraceabilityStatistics(); @Override long getDataSize(); @Override String getTraceabilityStartDate(); @Override String getTraceabilityEndDate();  }