Search in sources :

Example 1 with UnderFileSystemFactory

use of alluxio.underfs.UnderFileSystemFactory in project alluxio by Alluxio.

the class AlluxioMasterRestServiceHandlerTest method registerFileSystemMock.

private void registerFileSystemMock() throws IOException {
    Configuration.set(PropertyKey.UNDERFS_ADDRESS, TEST_PATH);
    UnderFileSystemFactory underFileSystemFactoryMock = mock(UnderFileSystemFactory.class);
    when(underFileSystemFactoryMock.supportsPath(anyString())).thenReturn(Boolean.FALSE);
    when(underFileSystemFactoryMock.supportsPath(TEST_PATH)).thenReturn(Boolean.TRUE);
    UnderFileSystem underFileSystemMock = mock(UnderFileSystem.class);
    when(underFileSystemMock.getSpace(TEST_PATH, UnderFileSystem.SpaceType.SPACE_FREE)).thenReturn(UFS_SPACE_FREE);
    when(underFileSystemMock.getSpace(TEST_PATH, UnderFileSystem.SpaceType.SPACE_TOTAL)).thenReturn(UFS_SPACE_TOTAL);
    when(underFileSystemMock.getSpace(TEST_PATH, UnderFileSystem.SpaceType.SPACE_USED)).thenReturn(UFS_SPACE_USED);
    when(underFileSystemFactoryMock.create(eq(TEST_PATH), anyObject())).thenReturn(underFileSystemMock);
    UnderFileSystemRegistry.register(underFileSystemFactoryMock);
}
Also used : UnderFileSystem(alluxio.underfs.UnderFileSystem) UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory)

Example 2 with UnderFileSystemFactory

use of alluxio.underfs.UnderFileSystemFactory in project alluxio by Alluxio.

the class GlusterFSUnderFileSystemFactoryTest method factory.

/**
   * Tests the {@link UnderFileSystemRegistry#find(String)} method.
   */
@Test
public void factory() {
    UnderFileSystemFactory factory = UnderFileSystemRegistry.find("glusterfs://localhost/test/path");
    Assert.assertNotNull("A UnderFileSystemFactory should exist for Gluster FS paths when using this module", factory);
    factory = UnderFileSystemRegistry.find("alluxio://localhost/test/path");
    Assert.assertNull("A UnderFileSystemFactory should not exist for unsupported paths when using" + " this module.", factory);
}
Also used : UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) Test(org.junit.Test)

Example 3 with UnderFileSystemFactory

use of alluxio.underfs.UnderFileSystemFactory in project alluxio by Alluxio.

the class OSSUnderFileSystemFactoryTest method factory.

/**
   * Tests that the OSS UFS module correctly accepts paths that begin with oss://.
   */
@Test
public void factory() {
    UnderFileSystemFactory factory = UnderFileSystemRegistry.find("oss://test-bucket/path");
    Assert.assertNotNull("A UnderFileSystemFactory should exist for oss paths when using this module", factory);
}
Also used : UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) Test(org.junit.Test)

Example 4 with UnderFileSystemFactory

use of alluxio.underfs.UnderFileSystemFactory in project alluxio by Alluxio.

the class LocalUnderFileSystemFactoryTest method factory.

/**
   * This test ensures the local UFS module correctly accepts paths that begin with / or file://.
   */
@Test
public void factory() {
    UnderFileSystemFactory factory = UnderFileSystemRegistry.find("/local/test/path");
    UnderFileSystemFactory factory2 = UnderFileSystemRegistry.find("file://local/test/path");
    UnderFileSystemFactory factory3 = UnderFileSystemRegistry.find("hdfs://test-bucket/path");
    UnderFileSystemFactory factory4 = UnderFileSystemRegistry.find("R:\\ramfs\\");
    UnderFileSystemFactory factory5 = UnderFileSystemRegistry.find("file://R:/famfs");
    UnderFileSystemFactory factory6 = UnderFileSystemRegistry.find("R:/ramfs/");
    Assert.assertNotNull("A UnderFileSystemFactory should exist for local paths when using this module", factory);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for local paths when using this module", factory2);
    Assert.assertNull("A UnderFileSystemFactory should not exist for non local paths when using this module", factory3);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for local paths when using this module", factory4);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for local paths when using this module", factory5);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for local paths when using this module", factory6);
}
Also used : UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) Test(org.junit.Test)

Example 5 with UnderFileSystemFactory

use of alluxio.underfs.UnderFileSystemFactory in project alluxio by Alluxio.

the class SwiftUnderFileSystemFactoryTest method factory.

/**
   * This test ensures the Swift UFS module correctly accepts paths that begin with swift://.
   */
@Test
public void factory() {
    UnderFileSystemFactory factory = UnderFileSystemRegistry.find("swift://localhost/test/path");
    UnderFileSystemFactory factory2 = UnderFileSystemRegistry.find("file://localhost/test/path");
    Assert.assertNotNull("A UnderFileSystemFactory should exist for swift paths when using this " + "module", factory);
    Assert.assertNull("A UnderFileSystemFactory should not exist for non supported paths when " + "using this module", factory2);
}
Also used : UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) Test(org.junit.Test)

Aggregations

UnderFileSystemFactory (alluxio.underfs.UnderFileSystemFactory)9 Test (org.junit.Test)8 UnderFileSystem (alluxio.underfs.UnderFileSystem)1