Search in sources :

Example 51 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class PersistCommandTest method persistOnRenameDirectory.

@Test
public void persistOnRenameDirectory() throws Exception {
    InstancedConfiguration conf = new InstancedConfiguration(ServerConfiguration.global());
    conf.set(PropertyKey.USER_FILE_WRITE_TYPE_DEFAULT, "MUST_CACHE");
    conf.set(PropertyKey.USER_FILE_PERSIST_ON_RENAME, true);
    try (FileSystemShell fsShell = new FileSystemShell(conf)) {
        String testDir = FileSystemShellUtilsTest.resetFileHierarchy(sFileSystem);
        String toPersist = testDir + "/foo";
        String persisted = testDir + "/foo_persisted";
        String doNotPersist = testDir + "/bar";
        assertFalse(sFileSystem.getStatus(new AlluxioURI(testDir)).isPersisted());
        assertFalse(sFileSystem.getStatus(new AlluxioURI(toPersist)).isPersisted());
        assertFalse(sFileSystem.getStatus(new AlluxioURI(doNotPersist)).isPersisted());
        int ret = fsShell.run("mv", toPersist, persisted);
        Assert.assertEquals(mOutput.toString(), 0, ret);
        CommonUtils.waitFor("Directory to be persisted", () -> {
            try {
                return sFileSystem.getStatus(new AlluxioURI(persisted)).isPersisted() && sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar1")).isPersisted() && sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar2")).isPersisted();
            } catch (Exception e) {
                return false;
            }
        }, WaitForOptions.defaults().setTimeoutMs(10000));
        assertFalse(sFileSystem.getStatus(new AlluxioURI(testDir + "/bar")).isPersisted());
        checkFilePersisted(new AlluxioURI(persisted + "/foobar1"), 10);
        checkFilePersisted(new AlluxioURI(persisted + "/foobar2"), 20);
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) FileSystemShell(alluxio.cli.fs.FileSystemShell) AlluxioURI(alluxio.AlluxioURI) AbstractFileSystemShellTest(alluxio.client.cli.fs.AbstractFileSystemShellTest) Test(org.junit.Test) FileSystemShellUtilsTest(alluxio.client.cli.fs.FileSystemShellUtilsTest)

Example 52 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class AddCommandIntegrationTest method immediatelyEffectiveForShellCommands.

@Test
public void immediatelyEffectiveForShellCommands() throws Exception {
    // Tests that after adding some path configuration, it's immediately effective for command
    // line calls afterwards.
    InstancedConfiguration conf = ServerConfiguration.global();
    try (FileSystemShell fsShell = new FileSystemShell(conf);
        FileSystemAdminShell fsAdminShell = new FileSystemAdminShell(conf)) {
        Assert.assertEquals(0, fsAdminShell.run("pathConf", "add", "--property", WRITE_TYPE_THROUGH, PATH1));
        Assert.assertEquals(0, fsAdminShell.run("pathConf", "add", "--property", WRITE_TYPE_CACHE_THROUGH, PATH2));
        FileSystem fs = sLocalAlluxioClusterResource.get().getClient();
        String file = "/file";
        FileSystemTestUtils.createByteFile(fs, file, 100, CreateFilePOptions.getDefaultInstance());
        fs.createDirectory(new AlluxioURI(PATH1), CreateDirectoryPOptions.newBuilder().setRecursive(true).build());
        fs.createDirectory(new AlluxioURI(PATH2), CreateDirectoryPOptions.newBuilder().setRecursive(true).build());
        AlluxioURI target = new AlluxioURI(PATH1 + file);
        Assert.assertEquals(0, fsShell.run("cp", file, target.toString()));
        URIStatus status = fs.getStatus(target);
        Assert.assertEquals(0, status.getInMemoryPercentage());
        Assert.assertEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
        target = new AlluxioURI(PATH2 + file);
        Assert.assertEquals(0, fsShell.run("cp", file, target.toString()));
        status = fs.getStatus(target);
        Assert.assertEquals(100, status.getInMemoryPercentage());
        Assert.assertEquals(PersistenceState.PERSISTED.toString(), status.getPersistenceState());
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) FileSystem(alluxio.client.file.FileSystem) FileSystemShell(alluxio.cli.fs.FileSystemShell) FileSystemAdminShell(alluxio.cli.fsadmin.FileSystemAdminShell) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) AbstractShellIntegrationTest(alluxio.client.cli.fs.AbstractShellIntegrationTest)

Example 53 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class LocalCacheManagerIntegrationTest method before.

@Before
public void before() throws Exception {
    mConf = new InstancedConfiguration(new AlluxioProperties());
    mConf.set(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE, PAGE_SIZE_BYTES);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_SIZE, CACHE_SIZE_BYTES);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_ENABLED, true);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_DIR, mTemp.getRoot().getPath());
    mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_WRITE_ENABLED, false);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_ASYNC_RESTORE_ENABLED, false);
    mConf.set(PropertyKey.USER_CLIENT_CACHE_STORE_OVERHEAD, 0);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) Before(org.junit.Before)

Example 54 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class WebUnderFileSystemFactoryTest method factory.

/**
 * This test ensures the web UFS module correctly accepts paths that begin with / or file://.
 */
@Test
public void factory() {
    AlluxioConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    UnderFileSystemFactory factory = UnderFileSystemFactoryRegistry.find("https://downloads.alluxio.io/downloads/files/2.0.0-preview/", conf);
    UnderFileSystemFactory factory2 = UnderFileSystemFactoryRegistry.find("http://downloads.alluxio.org/", conf);
    UnderFileSystemFactory factory3 = UnderFileSystemFactoryRegistry.find("httpx://path", conf);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for http paths when using this module", factory);
    Assert.assertNotNull("A UnderFileSystemFactory should exist for http paths when using this module", factory2);
    Assert.assertNull("A UnderFileSystemFactory should not exist for non http paths when using this module", factory3);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) UnderFileSystemFactory(alluxio.underfs.UnderFileSystemFactory) Test(org.junit.Test)

Example 55 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class TimeBoundPageStoreTest method before.

@Before
public void before() throws Exception {
    InstancedConfiguration conf = ConfigurationTestUtils.defaults();
    conf.set(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE, PAGE_SIZE_BYTES);
    conf.set(PropertyKey.USER_CLIENT_CACHE_SIZE, CACHE_SIZE_BYTES);
    conf.set(PropertyKey.USER_CLIENT_CACHE_DIR, mTemp.getRoot().getAbsolutePath());
    conf.set(PropertyKey.USER_CLIENT_CACHE_TIMEOUT_DURATION, "-1");
    mPageStoreOptions = PageStoreOptions.create(conf);
    mPageStore = new HangingPageStore(mPageStoreOptions);
    conf.set(PropertyKey.USER_CLIENT_CACHE_TIMEOUT_DURATION, "2s");
    mTimeBoundPageStoreOptions = PageStoreOptions.create(conf);
    mTimeBoundPageStore = new TimeBoundPageStore(mPageStore, mTimeBoundPageStoreOptions);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) Before(org.junit.Before)

Aggregations

InstancedConfiguration (alluxio.conf.InstancedConfiguration)94 Test (org.junit.Test)35 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)16 AlluxioURI (alluxio.AlluxioURI)14 AlluxioProperties (alluxio.conf.AlluxioProperties)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 HashMap (java.util.HashMap)9 BaseHubTest (alluxio.hub.test.BaseHubTest)8 InetSocketAddress (java.net.InetSocketAddress)8 FileSystemShell (alluxio.cli.fs.FileSystemShell)6 FileSystemContext (alluxio.client.file.FileSystemContext)6 HealthCheckClient (alluxio.HealthCheckClient)5 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)5 FileSystemShellUtilsTest (alluxio.client.cli.fs.FileSystemShellUtilsTest)5 MasterInquireClient (alluxio.master.MasterInquireClient)5 Properties (java.util.Properties)5 ParseException (org.apache.commons.cli.ParseException)5 ClientContext (alluxio.ClientContext)4 FileSystem (alluxio.client.file.FileSystem)4