@Test public void testGetStorageStrategy() throws Exception { final FileStorageProvider fsProvider = new FileStorageProvider(); final StorageStrategy strategy = fsProvider.getStorageStrategy(VitamConfiguration.getDefaultStrategy()); assertEquals(VitamConfiguration.getDefaultStrategy(), strategy.getId()); final List<OfferReference> offerReferences = strategy.getOffers(); assertNotNull(offerReferences); assertEquals(2, offerReferences.size()); final OfferReference offerReference = offerReferences.get(0); assertEquals("default", offerReference.getId()); }
@Override public StorageStrategy getStorageStrategy(String idStrategy) throws StorageTechnicalException { if (storageStrategies == null) { try { loadReferential(ReferentialType.STRATEGY); } catch (IOException | InvalidParseOperationException exc) { throw new StorageTechnicalException(exc); } } if (storageStrategies.containsKey(idStrategy)) { return storageStrategies.get(idStrategy); } else { throw new StorageTechnicalException("Storage strategy '" + idStrategy + "' invalid"); } }
FileStorageProvider implements StorageStrategyProvider, StorageOfferProvider { @Override public StorageStrategy getStorageStrategy(String idStrategy) throws StorageTechnicalException { if (storageStrategies == null) { try { loadReferential(ReferentialType.STRATEGY); } catch (IOException | InvalidParseOperationException exc) { throw new StorageTechnicalException(exc); } } if (storageStrategies.containsKey(idStrategy)) { return storageStrategies.get(idStrategy); } else { throw new StorageTechnicalException("Storage strategy '" + idStrategy + "' invalid"); } } }
FileStorageProvider implements StorageStrategyProvider, StorageOfferProvider { @Override public StorageStrategy getStorageStrategy(String idStrategy) throws StorageTechnicalException { if (storageStrategies == null) { try { loadReferential(ReferentialType.STRATEGY); } catch (IOException | InvalidParseOperationException exc) { throw new StorageTechnicalException(exc); } } if (storageStrategies.containsKey(idStrategy)) { return storageStrategies.get(idStrategy); } else { throw new StorageTechnicalException("Storage strategy '" + idStrategy + "' invalid"); } } FileStorageProvider(); }
FileStorageProvider implements StorageStrategyProvider, StorageOfferProvider { @Override public StorageStrategy getStorageStrategy(String idStrategy) throws StorageTechnicalException { if (storageStrategies == null) { try { loadReferential(ReferentialType.STRATEGY); } catch (IOException | InvalidParseOperationException exc) { throw new StorageTechnicalException(exc); } } if (storageStrategies.containsKey(idStrategy)) { return storageStrategies.get(idStrategy); } else { throw new StorageTechnicalException("Storage strategy '" + idStrategy + "' invalid"); } } FileStorageProvider(); @Override StorageStrategy getStorageStrategy(String idStrategy); @Override StorageOffer getStorageOffer(String idOffer); @Override StorageOffer getStorageOffer(String idOffer, boolean includeDisabled); @Override Map<String, StorageStrategy> getStorageStrategies(); }
FileStorageProvider implements StorageStrategyProvider, StorageOfferProvider { @Override public StorageStrategy getStorageStrategy(String idStrategy) throws StorageTechnicalException { if (storageStrategies == null) { try { loadReferential(ReferentialType.STRATEGY); } catch (IOException | InvalidParseOperationException exc) { throw new StorageTechnicalException(exc); } } if (storageStrategies.containsKey(idStrategy)) { return storageStrategies.get(idStrategy); } else { throw new StorageTechnicalException("Storage strategy '" + idStrategy + "' invalid"); } } FileStorageProvider(); @Override StorageStrategy getStorageStrategy(String idStrategy); @Override StorageOffer getStorageOffer(String idOffer); @Override StorageOffer getStorageOffer(String idOffer, boolean includeDisabled); @Override Map<String, StorageStrategy> getStorageStrategies();  }