@Test @RunWithCustomExecutor public void whenNoGraphInOfferThenGetListingReturnInitialDate() throws StoreGraphException { when( restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), DataCategory.UNIT_GRAPH, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE)) .thenReturn(IteratorUtils.emptyIterator()); LocalDateTime date = storeGraphService.getLastGraphStoreDate(MetadataCollections.UNIT); assertThat(date).isEqualTo(StoreGraphService.INITIAL_START_DATE); }
public LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException { try { DataCategory dataCategory = getDataCategory(metadataCollections); Iterator<OfferLog> offerLogIterator = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), dataCategory, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE); if (!offerLogIterator.hasNext()) { return INITIAL_START_DATE; } return LocalDateTime.from(formatter.parse(offerLogIterator.next().getFileName().split(UNDERSCORE, 2)[1])); } catch (Exception e) { throw new StoreGraphException(e); } }
StoreGraphService { public LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException { try { DataCategory dataCategory = getDataCategory(metadataCollections); Iterator<OfferLog> offerLogIterator = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), dataCategory, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE); if (!offerLogIterator.hasNext()) { return INITIAL_START_DATE; } return LocalDateTime.from(formatter.parse(offerLogIterator.next().getFileName().split(UNDERSCORE, 2)[1])); } catch (Exception e) { throw new StoreGraphException(e); } } }
StoreGraphService { public LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException { try { DataCategory dataCategory = getDataCategory(metadataCollections); Iterator<OfferLog> offerLogIterator = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), dataCategory, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE); if (!offerLogIterator.hasNext()) { return INITIAL_START_DATE; } return LocalDateTime.from(formatter.parse(offerLogIterator.next().getFileName().split(UNDERSCORE, 2)[1])); } catch (Exception e) { throw new StoreGraphException(e); } } @VisibleForTesting  StoreGraphService(
        VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService restoreBackupService,
        WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory);  StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider); }
StoreGraphService { public LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException { try { DataCategory dataCategory = getDataCategory(metadataCollections); Iterator<OfferLog> offerLogIterator = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), dataCategory, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE); if (!offerLogIterator.hasNext()) { return INITIAL_START_DATE; } return LocalDateTime.from(formatter.parse(offerLogIterator.next().getFileName().split(UNDERSCORE, 2)[1])); } catch (Exception e) { throw new StoreGraphException(e); } } @VisibleForTesting  StoreGraphService(
        VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService restoreBackupService,
        WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory);  StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider); LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections); boolean isInProgress(); Map<MetadataCollections, Integer> tryStoreGraph(); void zipAndSaveInOffer(DataCategory dataCategory, String containerName, String graphFolder,
        String graphZipName, String graph_store_name); void storeInWorkspace(String containerName, String graphFolder,
        List<Document> documents); }
StoreGraphService { public LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException { try { DataCategory dataCategory = getDataCategory(metadataCollections); Iterator<OfferLog> offerLogIterator = restoreBackupService.getListing(VitamConfiguration.getDefaultStrategy(), dataCategory, null, null, Order.DESC, LAST_GRAPHSTORE_OFFERLOG_BATCH_SIZE); if (!offerLogIterator.hasNext()) { return INITIAL_START_DATE; } return LocalDateTime.from(formatter.parse(offerLogIterator.next().getFileName().split(UNDERSCORE, 2)[1])); } catch (Exception e) { throw new StoreGraphException(e); } } @VisibleForTesting  StoreGraphService(
        VitamRepositoryProvider vitamRepositoryProvider,
        RestoreBackupService restoreBackupService,
        WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory);  StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider); LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections); boolean isInProgress(); Map<MetadataCollections, Integer> tryStoreGraph(); void zipAndSaveInOffer(DataCategory dataCategory, String containerName, String graphFolder,
        String graphZipName, String graph_store_name); void storeInWorkspace(String containerName, String graphFolder,
        List<Document> documents); static final LocalDateTime INITIAL_START_DATE; static final DateTimeFormatter formatter; static final String GRAPH; static final String UNDERSCORE; static final String ZIP_EXTENTION; static final String ZIP_PREFIX_NAME; static final String _GTE; static final String _LT; }