@Test public void testGet() throws Exception { StoragePath storagePath = new StoragePath(ORG_ID, MP_ID, VERSION_2, MP_ELEM_ID); Opt<InputStream> option = repo.get(storagePath); assertTrue(option.isSome()); InputStream original = null; InputStream repo = option.get(); try { original = getClass().getClassLoader().getResourceAsStream(FILE_NAME); byte[] bytesFromRepo = IOUtils.toByteArray(repo); byte[] bytesFromClasspath = IOUtils.toByteArray(original); assertEquals(bytesFromClasspath.length, bytesFromRepo.length); } finally { IOUtils.closeQuietly(original); IOUtils.closeQuietly(repo); } }
@Override public Opt<InputStream> get(final StoragePath path) throws AssetStoreException { return findStoragePathFile(path).map(new Fn<File, InputStream>() { @Override public InputStream apply(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { logger.error("Error getting archive file {}", file); throw new AssetStoreException(e); } } }); }
AbstractFileSystemAssetStore implements AssetStore { @Override public Opt<InputStream> get(final StoragePath path) throws AssetStoreException { return findStoragePathFile(path).map(new Fn<File, InputStream>() { @Override public InputStream apply(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { logger.error("Error getting archive file {}", file); throw new AssetStoreException(e); } } }); } }
AbstractFileSystemAssetStore implements AssetStore { @Override public Opt<InputStream> get(final StoragePath path) throws AssetStoreException { return findStoragePathFile(path).map(new Fn<File, InputStream>() { @Override public InputStream apply(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { logger.error("Error getting archive file {}", file); throw new AssetStoreException(e); } } }); }  }
AbstractFileSystemAssetStore implements AssetStore { @Override public Opt<InputStream> get(final StoragePath path) throws AssetStoreException { return findStoragePathFile(path).map(new Fn<File, InputStream>() { @Override public InputStream apply(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { logger.error("Error getting archive file {}", file); throw new AssetStoreException(e); } } }); }  @Override void put(StoragePath storagePath, Source source); @Override boolean copy(final StoragePath from, final StoragePath to); @Override Opt<InputStream> get(final StoragePath path); @Override boolean contains(StoragePath path); @Override boolean delete(DeletionSelector sel); @Override Option<Long> getUsedSpace(); @Override Option<Long> getUsableSpace(); @Override Option<Long> getTotalSpace(); @Override String getStoreType(); }
AbstractFileSystemAssetStore implements AssetStore { @Override public Opt<InputStream> get(final StoragePath path) throws AssetStoreException { return findStoragePathFile(path).map(new Fn<File, InputStream>() { @Override public InputStream apply(File file) { try { return new FileInputStream(file); } catch (FileNotFoundException e) { logger.error("Error getting archive file {}", file); throw new AssetStoreException(e); } } }); }  @Override void put(StoragePath storagePath, Source source); @Override boolean copy(final StoragePath from, final StoragePath to); @Override Opt<InputStream> get(final StoragePath path); @Override boolean contains(StoragePath path); @Override boolean delete(DeletionSelector sel); @Override Option<Long> getUsedSpace(); @Override Option<Long> getUsableSpace(); @Override Option<Long> getTotalSpace(); @Override String getStoreType();  }