Example usage for org.apache.commons.vfs2 Capability APPEND_CONTENT

List of usage examples for org.apache.commons.vfs2 Capability APPEND_CONTENT

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 Capability APPEND_CONTENT.

Prototype

Capability APPEND_CONTENT

To view the source code for org.apache.commons.vfs2 Capability APPEND_CONTENT.

Click Source Link

Document

File content can be appended.

Usage

From source file:org.pentaho.big.data.impl.vfs.hdfs.HDFSFileSystem.java

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void addCapabilities(Collection caps) {
    caps.addAll(HDFSFileProvider.capabilities);
    // Adding capabilities depending on configuration settings
    try {/* www  .j  av a  2  s . c  o  m*/
        if (Boolean.parseBoolean(getHDFSFileSystem().getProperty("dfs.support.append", "true"))) {
            caps.add(Capability.APPEND_CONTENT);
        }
    } catch (FileSystemException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.pentaho.big.data.impl.vfs.hdfs.HDFSFileSystemTest.java

@Test
public void testAddAppendCapabilities() {
    Collection caps = new ArrayList();
    when(hadoopFileSystem.getProperty(eq("dfs.support.append"), anyString())).thenReturn("false");
    hdfsFileSystem.addCapabilities(caps);
    Collection res = new ArrayList(HDFSFileProvider.capabilities);
    assertArrayEquals(caps.toArray(), Collections.unmodifiableCollection(res).toArray());
    caps = new ArrayList();
    when(hadoopFileSystem.getProperty(eq("dfs.support.append"), anyString())).thenReturn("true");
    hdfsFileSystem.addCapabilities(caps);
    res.add(Capability.APPEND_CONTENT);
    assertArrayEquals(caps.toArray(), Collections.unmodifiableCollection(res).toArray());
}