@Test @Category(UnitTest.class) public void testGet() throws Exception { String text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut ullamcorper est. Phasellus sed nisl arcu. Nullam non sem quam. Pellentesque vel neque quis erat ultricies dapibus a ac mauris. Morbi sodales vitae nisl ullamcorper facilisis. Quisque pellentesque est in fermentum luctus. Etiam sed nibh id dui faucibus luctus vel sit amet odio. Fusce non sollicitudin ligula, ac fermentum leo. Nulla facilisi."; OutputStream outputStream = provider.add(); PrintStream out = new PrintStream(outputStream); out.print(text); outputStream.close(); Assert.assertEquals("Adhoc size should be 1!", 1, provider.size()); InputStream instream = provider.get(0); String intext = IOUtils.toString(instream); instream.close(); Assert.assertEquals("Input string is not equal to output string", text, intext); }
@Override public InputStream get(int index) throws IOException { initializeFiles(getConfiguration()); if (index >= 0 && index < files.size()) { return HadoopFileUtils.open(getConfiguration(), files.get(index)); } throw new IOException("Index out of range (" + index + ") "); }
HdfsAdHocDataProvider extends AdHocDataProvider { @Override public InputStream get(int index) throws IOException { initializeFiles(getConfiguration()); if (index >= 0 && index < files.size()) { return HadoopFileUtils.open(getConfiguration(), files.get(index)); } throw new IOException("Index out of range (" + index + ") "); } }
HdfsAdHocDataProvider extends AdHocDataProvider { @Override public InputStream get(int index) throws IOException { initializeFiles(getConfiguration()); if (index >= 0 && index < files.size()) { return HadoopFileUtils.open(getConfiguration(), files.get(index)); } throw new IOException("Index out of range (" + index + ") "); } HdfsAdHocDataProvider(Configuration conf,
    ProviderProperties providerProperties);  HdfsAdHocDataProvider(Configuration conf, String resourceName,
    ProviderProperties providerProperties); }
HdfsAdHocDataProvider extends AdHocDataProvider { @Override public InputStream get(int index) throws IOException { initializeFiles(getConfiguration()); if (index >= 0 && index < files.size()) { return HadoopFileUtils.open(getConfiguration(), files.get(index)); } throw new IOException("Index out of range (" + index + ") "); } HdfsAdHocDataProvider(Configuration conf,
    ProviderProperties providerProperties);  HdfsAdHocDataProvider(Configuration conf, String resourceName,
    ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean canOpen(Configuration conf,
    String name, ProviderProperties providerProperties); static boolean canWrite(String name, Configuration conf,
    ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean exists(Configuration conf, String name,
    ProviderProperties providerProperties); static void delete(Configuration conf, String name,
    ProviderProperties providerProperties); @Override void setupJob(Job job); @Override OutputStream add(); @Override @SuppressWarnings("squid:S1166") // Exception caught and handled OutputStream add(String name); @Override void delete(); @Override void move(String toResource); @Override InputStream get(int index); @Override @SuppressFBWarnings(value = "WEAK_FILENAMEUTILS", justification = "adhoc provider, our class, we control the filenames") InputStream get(String name); @Override String getName(int index); Path getResourcePath(); @Override int size(); }
HdfsAdHocDataProvider extends AdHocDataProvider { @Override public InputStream get(int index) throws IOException { initializeFiles(getConfiguration()); if (index >= 0 && index < files.size()) { return HadoopFileUtils.open(getConfiguration(), files.get(index)); } throw new IOException("Index out of range (" + index + ") "); } HdfsAdHocDataProvider(Configuration conf,
    ProviderProperties providerProperties);  HdfsAdHocDataProvider(Configuration conf, String resourceName,
    ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean canOpen(Configuration conf,
    String name, ProviderProperties providerProperties); static boolean canWrite(String name, Configuration conf,
    ProviderProperties providerProperties); @SuppressWarnings("squid:S1166") // Exception caught and handled static boolean exists(Configuration conf, String name,
    ProviderProperties providerProperties); static void delete(Configuration conf, String name,
    ProviderProperties providerProperties); @Override void setupJob(Job job); @Override OutputStream add(); @Override @SuppressWarnings("squid:S1166") // Exception caught and handled OutputStream add(String name); @Override void delete(); @Override void move(String toResource); @Override InputStream get(int index); @Override @SuppressFBWarnings(value = "WEAK_FILENAMEUTILS", justification = "adhoc provider, our class, we control the filenames") InputStream get(String name); @Override String getName(int index); Path getResourcePath(); @Override int size();  }