Example usage for org.apache.commons.vfs2.provider URLFileName URLFileName

List of usage examples for org.apache.commons.vfs2.provider URLFileName URLFileName

Introduction

In this page you can find the example usage for org.apache.commons.vfs2.provider URLFileName URLFileName.

Prototype

public URLFileName(final String scheme, final String hostName, final int port, final int defaultPort,
            final String userName, final String password, final String path, final FileType type,
            final String queryString) 

Source Link

Usage

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

@Override
public FileName parseUri(VfsComponentContext context, FileName base, String filename)
        throws FileSystemException {
    URLFileName fileNameURLFileName = (URLFileName) super.parseUri(context, base, filename);

    return new URLFileName(fileNameURLFileName.getScheme(), getHostNameCaseSensitive(filename),
            fileNameURLFileName.getPort(), fileNameURLFileName.getDefaultPort(),
            fileNameURLFileName.getUserName(), fileNameURLFileName.getPassword(), fileNameURLFileName.getPath(),
            fileNameURLFileName.getType(), fileNameURLFileName.getQueryString());
}

From source file:org.pentaho.googlecloudstorage.vfs.GoogleCloudStorageFileObjectVFS.java

@Before
public void setup() {
    AbstractFileName rootFileName = new URLFileName("gs", "mock-bucket", -1, -1, "", "", "/", FileType.FILE,
            "");/*from   w w w . j ava2s  .  c o  m*/

    fileSystem = new GoogleCloudStorageFileSystem(rootFileName, null);
    URLFileName testFileName = new URLFileName("gs", "mock-bucket", -1, -1, "", "", "/file/path/file.csv",
            FileType.FILE, "");
    fileObject = new GoogleCloudStorageFileObject(testFileName, fileSystem, storage);

    doReturn(bucket).when(storage).get(testFileName.getHostName());
    doReturn(true).when(bucket).exists();
    doReturn(blob).when(bucket).get(anyString());
    doReturn("/file/path/file.csv").when(blob).getName();

    Blob blob1 = mock(Blob.class);
    doReturn("/file/").when(blob1).getName();
    Blob blob2 = mock(Blob.class);
    doReturn("/file/path/").when(blob2).getName();
    Blob blob3 = mock(Blob.class);
    doReturn("/file/path/file2.csv").when(blob3).getName();

    URLFileName testFolderName = new URLFileName("gs", "mock-bucket", -1, -1, "", "", "/file/path/",
            FileType.FILE, "");
    folderObject = new GoogleCloudStorageFileObject(testFolderName, fileSystem, storage);
    doReturn(ImmutableList.of(blob1, blob2, blob, blob3)).when(page).iterateAll();
    doReturn(page).when(bucket).list();
}