@Test public void appendExistingNotSupported() throws Exception { Path path = new Path("/file"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.exists(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(true); try (FileSystem alluxioHadoopFs = new FileSystem(alluxioFs)) { alluxioHadoopFs.append(path, 100); fail("append() of existing file is expected to fail"); } catch (IOException e) { assertEquals("append() to existing Alluxio path is currently not supported: " + path, e.getMessage()); } }
@Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { LOG.debug("append({}, {}, {})", path, bufferSize, progress); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = getAlluxioPath(path); try { if (mFileSystem.exists(uri)) { throw new IOException( "append() to existing Alluxio path is currently not supported: " + uri); } return new FSDataOutputStream( mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setRecursive(true).build()), mStatistics); } catch (AlluxioException e) { throw new IOException(e); } }
AbstractFileSystem extends org.apache.hadoop.fs.FileSystem { @Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { LOG.debug("append({}, {}, {})", path, bufferSize, progress); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = getAlluxioPath(path); try { if (mFileSystem.exists(uri)) { throw new IOException( "append() to existing Alluxio path is currently not supported: " + uri); } return new FSDataOutputStream( mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setRecursive(true).build()), mStatistics); } catch (AlluxioException e) { throw new IOException(e); } } }
AbstractFileSystem extends org.apache.hadoop.fs.FileSystem { @Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { LOG.debug("append({}, {}, {})", path, bufferSize, progress); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = getAlluxioPath(path); try { if (mFileSystem.exists(uri)) { throw new IOException( "append() to existing Alluxio path is currently not supported: " + uri); } return new FSDataOutputStream( mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setRecursive(true).build()), mStatistics); } catch (AlluxioException e) { throw new IOException(e); } } protected  AbstractFileSystem(FileSystem fileSystem); protected  AbstractFileSystem(); }
AbstractFileSystem extends org.apache.hadoop.fs.FileSystem { @Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { LOG.debug("append({}, {}, {})", path, bufferSize, progress); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = getAlluxioPath(path); try { if (mFileSystem.exists(uri)) { throw new IOException( "append() to existing Alluxio path is currently not supported: " + uri); } return new FSDataOutputStream( mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setRecursive(true).build()), mStatistics); } catch (AlluxioException e) { throw new IOException(e); } } protected  AbstractFileSystem(FileSystem fileSystem); protected  AbstractFileSystem(); @Override FSDataOutputStream append(Path path, int bufferSize, Progressable progress); @Override void close(); @Override FSDataOutputStream create(Path path, FsPermission permission, boolean overwrite,
      int bufferSize, short replication, long blockSize, Progressable progress); @Override @Deprecated FSDataOutputStream createNonRecursive(Path path, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress); @Override @Deprecated boolean delete(Path path); @Override boolean delete(Path path, boolean recursive); @Override long getDefaultBlockSize(); @Nullable @Override BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len); @Override short getDefaultReplication(); @Override boolean setReplication(Path path, short replication); @Override FileStatus getFileStatus(Path path); @Override void setOwner(Path path, final String username, final String groupname); @Override void setPermission(Path path, FsPermission permission); abstract String getScheme(); @Override URI getUri(); @Override Path getWorkingDirectory(); @Override synchronized void initialize(URI uri, org.apache.hadoop.conf.Configuration conf); @VisibleForTesting synchronized void initialize(URI uri, org.apache.hadoop.conf.Configuration conf,
      @Nullable AlluxioConfiguration alluxioConfiguration); @Override FileStatus[] listStatus(Path path); @Override boolean mkdirs(Path path, FsPermission permission); @Override FSDataInputStream open(Path path, int bufferSize); @Override boolean rename(Path src, Path dst); @Override void setWorkingDirectory(Path path); }
AbstractFileSystem extends org.apache.hadoop.fs.FileSystem { @Override public FSDataOutputStream append(Path path, int bufferSize, Progressable progress) throws IOException { LOG.debug("append({}, {}, {})", path, bufferSize, progress); if (mStatistics != null) { mStatistics.incrementWriteOps(1); } AlluxioURI uri = getAlluxioPath(path); try { if (mFileSystem.exists(uri)) { throw new IOException( "append() to existing Alluxio path is currently not supported: " + uri); } return new FSDataOutputStream( mFileSystem.createFile(uri, CreateFilePOptions.newBuilder().setRecursive(true).build()), mStatistics); } catch (AlluxioException e) { throw new IOException(e); } } protected  AbstractFileSystem(FileSystem fileSystem); protected  AbstractFileSystem(); @Override FSDataOutputStream append(Path path, int bufferSize, Progressable progress); @Override void close(); @Override FSDataOutputStream create(Path path, FsPermission permission, boolean overwrite,
      int bufferSize, short replication, long blockSize, Progressable progress); @Override @Deprecated FSDataOutputStream createNonRecursive(Path path, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress); @Override @Deprecated boolean delete(Path path); @Override boolean delete(Path path, boolean recursive); @Override long getDefaultBlockSize(); @Nullable @Override BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len); @Override short getDefaultReplication(); @Override boolean setReplication(Path path, short replication); @Override FileStatus getFileStatus(Path path); @Override void setOwner(Path path, final String username, final String groupname); @Override void setPermission(Path path, FsPermission permission); abstract String getScheme(); @Override URI getUri(); @Override Path getWorkingDirectory(); @Override synchronized void initialize(URI uri, org.apache.hadoop.conf.Configuration conf); @VisibleForTesting synchronized void initialize(URI uri, org.apache.hadoop.conf.Configuration conf,
      @Nullable AlluxioConfiguration alluxioConfiguration); @Override FileStatus[] listStatus(Path path); @Override boolean mkdirs(Path path, FsPermission permission); @Override FSDataInputStream open(Path path, int bufferSize); @Override boolean rename(Path src, Path dst); @Override void setWorkingDirectory(Path path); static final String FIRST_COM_PATH; }