@Test(expectedExceptions = IllegalArgumentException.class) public void testConnectFailsWithS3URLWithoutAWSCredentials() throws FileBasedHelperException { Configuration conf = new Configuration(); SourceState sourceState = new SourceState(); sourceState.setProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI, "s3: HadoopFsHelper fsHelper = new HadoopFsHelper(sourceState, conf); fsHelper.connect(); }
@Override public void connect() throws FileBasedHelperException { String uri = this.state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI); try { if (Strings.isNullOrEmpty(uri)) { throw new FileBasedHelperException(ConfigurationKeys.SOURCE_FILEBASED_FS_URI + " has not been configured"); } this.createFileSystem(uri); } catch (IOException e) { throw new FileBasedHelperException("Cannot connect to given URI " + uri + " due to " + e.getMessage(), e); } catch (URISyntaxException e) { throw new FileBasedHelperException("Malformed uri " + uri + " due to " + e.getMessage(), e); } catch (InterruptedException e) { throw new FileBasedHelperException("Interrupted exception is caught when getting the proxy file system", e); } }
HadoopFsHelper implements TimestampAwareFileBasedHelper { @Override public void connect() throws FileBasedHelperException { String uri = this.state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI); try { if (Strings.isNullOrEmpty(uri)) { throw new FileBasedHelperException(ConfigurationKeys.SOURCE_FILEBASED_FS_URI + " has not been configured"); } this.createFileSystem(uri); } catch (IOException e) { throw new FileBasedHelperException("Cannot connect to given URI " + uri + " due to " + e.getMessage(), e); } catch (URISyntaxException e) { throw new FileBasedHelperException("Malformed uri " + uri + " due to " + e.getMessage(), e); } catch (InterruptedException e) { throw new FileBasedHelperException("Interrupted exception is caught when getting the proxy file system", e); } } }
HadoopFsHelper implements TimestampAwareFileBasedHelper { @Override public void connect() throws FileBasedHelperException { String uri = this.state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI); try { if (Strings.isNullOrEmpty(uri)) { throw new FileBasedHelperException(ConfigurationKeys.SOURCE_FILEBASED_FS_URI + " has not been configured"); } this.createFileSystem(uri); } catch (IOException e) { throw new FileBasedHelperException("Cannot connect to given URI " + uri + " due to " + e.getMessage(), e); } catch (URISyntaxException e) { throw new FileBasedHelperException("Malformed uri " + uri + " due to " + e.getMessage(), e); } catch (InterruptedException e) { throw new FileBasedHelperException("Interrupted exception is caught when getting the proxy file system", e); } } HadoopFsHelper(State state);  HadoopFsHelper(State state, Configuration configuration); }
HadoopFsHelper implements TimestampAwareFileBasedHelper { @Override public void connect() throws FileBasedHelperException { String uri = this.state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI); try { if (Strings.isNullOrEmpty(uri)) { throw new FileBasedHelperException(ConfigurationKeys.SOURCE_FILEBASED_FS_URI + " has not been configured"); } this.createFileSystem(uri); } catch (IOException e) { throw new FileBasedHelperException("Cannot connect to given URI " + uri + " due to " + e.getMessage(), e); } catch (URISyntaxException e) { throw new FileBasedHelperException("Malformed uri " + uri + " due to " + e.getMessage(), e); } catch (InterruptedException e) { throw new FileBasedHelperException("Interrupted exception is caught when getting the proxy file system", e); } } HadoopFsHelper(State state);  HadoopFsHelper(State state, Configuration configuration); FileSystem getFileSystem(); @Override void connect(); @Override List<String> ls(String path); void lsr(Path p, List<String> results); @Override long getFileMTime(String filePath); @Override long getFileSize(String filePath); @Override InputStream getFileStream(String path); @Override void close(); }
HadoopFsHelper implements TimestampAwareFileBasedHelper { @Override public void connect() throws FileBasedHelperException { String uri = this.state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI); try { if (Strings.isNullOrEmpty(uri)) { throw new FileBasedHelperException(ConfigurationKeys.SOURCE_FILEBASED_FS_URI + " has not been configured"); } this.createFileSystem(uri); } catch (IOException e) { throw new FileBasedHelperException("Cannot connect to given URI " + uri + " due to " + e.getMessage(), e); } catch (URISyntaxException e) { throw new FileBasedHelperException("Malformed uri " + uri + " due to " + e.getMessage(), e); } catch (InterruptedException e) { throw new FileBasedHelperException("Interrupted exception is caught when getting the proxy file system", e); } } HadoopFsHelper(State state);  HadoopFsHelper(State state, Configuration configuration); FileSystem getFileSystem(); @Override void connect(); @Override List<String> ls(String path); void lsr(Path p, List<String> results); @Override long getFileMTime(String filePath); @Override long getFileSize(String filePath); @Override InputStream getFileStream(String path); @Override void close();  }