Search in sources :

Example 6 with ConfExpectingUnderFileSystemFactory

use of alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory in project alluxio by Alluxio.

the class MountCommandTest method mountWithMultipleOptions.

@Test
public void mountWithMultipleOptions() throws Exception {
    ConfExpectingUnderFileSystemFactory factory = new ConfExpectingUnderFileSystemFactory("ufs", ImmutableMap.of("k1", "v1", "k2", "v2"));
    try (Closeable closeable = new UnderFileSystemFactoryRegistryRule(factory).toResource()) {
        AlluxioURI mountPoint = new AlluxioURI("/mnt");
        String ufsPath = "ufs://" + mFolder.getRoot().getAbsolutePath();
        Assert.assertEquals(0, sFsShell.run("mount", "--option", "k1=v1", "--option", "k2=v2", mountPoint.toString(), ufsPath));
        FileSystemTestUtils.createByteFile(sFileSystem, "/mnt/testFile1", WritePType.CACHE_THROUGH, 20);
        Assert.assertTrue(sFileSystem.exists(new AlluxioURI("/mnt/testFile1")));
        URIStatus status = sFileSystem.getStatus(new AlluxioURI("/mnt/testFile1"));
        Assert.assertTrue(status.isPersisted());
    }
}
Also used : Closeable(java.io.Closeable) URIStatus(alluxio.client.file.URIStatus) UnderFileSystemFactoryRegistryRule(alluxio.UnderFileSystemFactoryRegistryRule) ConfExpectingUnderFileSystemFactory(alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory) AlluxioURI(alluxio.AlluxioURI) AbstractFileSystemShellTest(alluxio.client.cli.fs.AbstractFileSystemShellTest) Test(org.junit.Test)

Example 7 with ConfExpectingUnderFileSystemFactory

use of alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory in project alluxio by Alluxio.

the class UpdateMountCommandTest method updateMountWithMultipleOptions.

@Test
public void updateMountWithMultipleOptions() throws Exception {
    ConfExpectingUnderFileSystemFactory factory = new ConfExpectingUnderFileSystemFactory("ufs", ImmutableMap.of("k1", "v1", "k2", "v2"));
    AlluxioURI mountPoint = new AlluxioURI("/mnt");
    String ufsPath = "ufs://" + mFolder.getRoot().getAbsolutePath();
    try (Closeable closeable = new UnderFileSystemFactoryRegistryRule(factory).toResource()) {
        Assert.assertEquals(0, sFsShell.run("mount", "--option", "k1=v1", "--option", "k2=v2", mountPoint.toString(), ufsPath));
        FileSystemTestUtils.createByteFile(sFileSystem, "/mnt/testFile1", WritePType.CACHE_THROUGH, 20);
        Assert.assertTrue(sFileSystem.exists(new AlluxioURI("/mnt/testFile1")));
        URIStatus status = sFileSystem.getStatus(new AlluxioURI("/mnt/testFile1"));
        Assert.assertTrue(status.isPersisted());
    }
    ConfExpectingUnderFileSystemFactory newFactory = new ConfExpectingUnderFileSystemFactory("ufs", ImmutableMap.of("k1", "v3", "k2", "v4"));
    try (Closeable closeable = new UnderFileSystemFactoryRegistryRule(newFactory).toResource()) {
        Assert.assertEquals(0, sFsShell.run("updateMount", "--option", "k1=v3", "--option", "k2=v4", mountPoint.toString()));
        FileSystemTestUtils.createByteFile(sFileSystem, "/mnt/testFile2", WritePType.CACHE_THROUGH, 20);
        Assert.assertTrue(sFileSystem.exists(new AlluxioURI("/mnt/testFile2")));
        URIStatus status = sFileSystem.getStatus(new AlluxioURI("/mnt/testFile2"));
        Assert.assertTrue(status.isPersisted());
    }
}
Also used : Closeable(java.io.Closeable) URIStatus(alluxio.client.file.URIStatus) UnderFileSystemFactoryRegistryRule(alluxio.UnderFileSystemFactoryRegistryRule) ConfExpectingUnderFileSystemFactory(alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory) AlluxioURI(alluxio.AlluxioURI) AbstractFileSystemShellTest(alluxio.client.cli.fs.AbstractFileSystemShellTest) Test(org.junit.Test)

Aggregations

AlluxioURI (alluxio.AlluxioURI)7 ConfExpectingUnderFileSystemFactory (alluxio.testutils.underfs.ConfExpectingUnderFileSystemFactory)7 Test (org.junit.Test)6 UnderFileSystemFactoryRegistryRule (alluxio.UnderFileSystemFactoryRegistryRule)4 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)4 Closeable (java.io.Closeable)4 URIStatus (alluxio.client.file.URIStatus)3 MountPOptions (alluxio.grpc.MountPOptions)3 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 MountPointInfo (alluxio.wire.MountPointInfo)2 LocalUnderFileSystemFactory (alluxio.underfs.local.LocalUnderFileSystemFactory)1 Before (org.junit.Before)1