@Test(expected = StorageException.class) public void testGetStorageStrategy_ForceIoException() throws Exception { final File strategy = PropertiesUtils.findFile("static-strategy.json"); assertNotNull(strategy); strategy.setReadable(false); final FileStorageProvider fsProvider = new FileStorageProvider(); try { fsProvider.getStorageStrategy(null); fail("Expecting storage exception"); } finally { strategy.setReadable(true); } }
@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();  }