Search in sources :

Example 11 with UnsupportedFileSystemException

use of org.apache.hadoop.fs.UnsupportedFileSystemException in project hadoop by apache.

the class TestWasbUriAndConfiguration method testNoAbstractFileSystemImplementationSpecifiedForWasbsScheme.

@Test
public void testNoAbstractFileSystemImplementationSpecifiedForWasbsScheme() throws Exception {
    try {
        testAccount = AzureBlobStorageTestAccount.createMock();
        Configuration conf = testAccount.getFileSystem().getConf();
        String authority = testAccount.getFileSystem().getUri().getAuthority();
        URI defaultUri = new URI("wasbs", authority, null, null, null);
        conf.set(FS_DEFAULT_NAME_KEY, defaultUri.toString());
        FileSystem fs = FileSystem.get(conf);
        assertTrue(fs instanceof NativeAzureFileSystem);
        assertEquals("wasbs", fs.getScheme());
        // should throw if 'fs.AbstractFileSystem.wasbs.impl'' is not specified
        try {
            FileContext.getFileContext(conf).getDefaultFileSystem();
            fail("Should've thrown.");
        } catch (UnsupportedFileSystemException e) {
        }
    } finally {
        testAccount.cleanup();
        FileSystem.closeAll();
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) FileSystem(org.apache.hadoop.fs.FileSystem) AbstractFileSystem(org.apache.hadoop.fs.AbstractFileSystem) UnsupportedFileSystemException(org.apache.hadoop.fs.UnsupportedFileSystemException) URI(java.net.URI) Test(org.junit.Test)

Aggregations

UnsupportedFileSystemException (org.apache.hadoop.fs.UnsupportedFileSystemException)11 IOException (java.io.IOException)6 Configuration (org.apache.hadoop.conf.Configuration)6 Path (org.apache.hadoop.fs.Path)6 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 FileContext (org.apache.hadoop.fs.FileContext)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 FileNotFoundException (java.io.FileNotFoundException)2 Principal (java.security.Principal)2 Subject (javax.security.auth.Subject)2 AbstractFileSystem (org.apache.hadoop.fs.AbstractFileSystem)2 FileStatus (org.apache.hadoop.fs.FileStatus)2 FsPermission (org.apache.hadoop.fs.permission.FsPermission)2 AccessControlException (org.apache.hadoop.security.AccessControlException)2 Test (org.junit.Test)2 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1