Search in sources :

Example 71 with InstancedConfiguration

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

the class ShowCommandIntegrationTest method setPathConfigurations.

/**
 * Sets path level configurations through meta master client, and update client configurations
 * from meta master afterwards.
 *
 * @return the configuration after updating from meta master
 */
private InstancedConfiguration setPathConfigurations() throws Exception {
    FileSystemContext metaCtx = FileSystemContext.create(ServerConfiguration.global());
    MetaMasterConfigClient client = new RetryHandlingMetaMasterConfigClient(MasterClientContext.newBuilder(metaCtx.getClientContext()).build());
    client.setPathConfiguration(new AlluxioURI(DIR1), PROPERTY_KEY11, PROPERTY_VALUE11);
    client.setPathConfiguration(new AlluxioURI(DIR1), PROPERTY_KEY12, PROPERTY_VALUE12);
    client.setPathConfiguration(new AlluxioURI(DIR2), PROPERTY_KEY2, PROPERTY_VALUE2);
    InetSocketAddress address = sLocalAlluxioClusterResource.get().getLocalAlluxioMaster().getAddress();
    FileSystemContext fsCtx = FileSystemContext.create(ServerConfiguration.global());
    fsCtx.getClientContext().loadConf(address, true, true);
    return (InstancedConfiguration) fsCtx.getClusterConf();
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) RetryHandlingMetaMasterConfigClient(alluxio.client.meta.RetryHandlingMetaMasterConfigClient) MetaMasterConfigClient(alluxio.client.meta.MetaMasterConfigClient) InetSocketAddress(java.net.InetSocketAddress) FileSystemContext(alluxio.client.file.FileSystemContext) RetryHandlingMetaMasterConfigClient(alluxio.client.meta.RetryHandlingMetaMasterConfigClient) AlluxioURI(alluxio.AlluxioURI)

Example 72 with InstancedConfiguration

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

the class PersistCommandTest method persistOnRenameDirectoryBlacklist.

@Test
public void persistOnRenameDirectoryBlacklist() 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";
        // create the file that is blacklisted, under the directory
        FileSystemTestUtils.createByteFile(sFileSystem, toPersist + "/foobar_blacklist", WritePType.MUST_CACHE, 10);
        assertFalse(sFileSystem.getStatus(new AlluxioURI(testDir)).isPersisted());
        assertFalse(sFileSystem.getStatus(new AlluxioURI(toPersist)).isPersisted());
        assertFalse(sFileSystem.getStatus(new AlluxioURI(toPersist + "/foobar_blacklist")).isPersisted());
        int ret = fsShell.run("mv", toPersist, persisted);
        Assert.assertEquals(0, ret);
        CommonUtils.waitFor("Directory to be persisted", () -> {
            try {
                return sFileSystem.getStatus(new AlluxioURI(persisted)).isPersisted() && sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar1")).isPersisted();
            } catch (Exception e) {
                return false;
            }
        }, WaitForOptions.defaults().setTimeoutMs(10000));
        assertFalse(sFileSystem.getStatus(new AlluxioURI(persisted + "/foobar_blacklist")).isPersisted());
        checkFilePersisted(new AlluxioURI(persisted + "/foobar1"), 10);
    }
}
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 73 with InstancedConfiguration

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

the class ConfigurationRuleTest method changeConfiguration.

@Test
public void changeConfiguration() throws Throwable {
    InstancedConfiguration conf = ConfigurationTestUtils.defaults();
    Statement statement = new Statement() {

        @Override
        public void evaluate() throws Throwable {
            assertEquals("testValue", conf.get(PropertyKey.MASTER_HOSTNAME));
        }
    };
    new ConfigurationRule(ImmutableMap.of(PropertyKey.MASTER_HOSTNAME, "testValue"), conf).apply(statement, null).evaluate();
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) Statement(org.junit.runners.model.Statement) Test(org.junit.Test)

Example 74 with InstancedConfiguration

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

the class ConfigurationRuleTest method changeConfigurationForDefaultNullValue.

@Test
public void changeConfigurationForDefaultNullValue() throws Throwable {
    InstancedConfiguration conf = ConfigurationTestUtils.defaults();
    Statement statement = new Statement() {

        @Override
        public void evaluate() throws Throwable {
            assertEquals("testValue", conf.get(PropertyKey.SECURITY_LOGIN_USERNAME));
        }
    };
    assertFalse(conf.isSet(PropertyKey.SECURITY_LOGIN_USERNAME));
    new ConfigurationRule(ImmutableMap.of(PropertyKey.SECURITY_LOGIN_USERNAME, "testValue"), conf).apply(statement, null).evaluate();
    assertFalse(conf.isSet(PropertyKey.SECURITY_LOGIN_USERNAME));
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) Statement(org.junit.runners.model.Statement) Test(org.junit.Test)

Example 75 with InstancedConfiguration

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

the class ManagerProcessContext method getUpdatedProps.

/**
 * Get updated cluster configuration from the configuration set.
 *
 * @param configSet cluster config set
 * @return Alluxio configuration
 */
public AlluxioConfiguration getUpdatedProps(AlluxioConfigurationSet configSet) {
    if (!configSet.hasSiteProperties()) {
        return ServerConfiguration.global();
    }
    Properties props = ConfigurationUtils.loadProperties(new ByteArrayInputStream(configSet.getSiteProperties().getBytes()));
    AlluxioProperties alluxioProperties = ConfigurationUtils.defaults().copy();
    alluxioProperties.merge(props, CLUSTER_DEFAULT);
    return new InstancedConfiguration(alluxioProperties);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) ByteArrayInputStream(java.io.ByteArrayInputStream) AlluxioProperties(alluxio.conf.AlluxioProperties) Properties(java.util.Properties)

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