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();
}
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);
}
}
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();
}
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));
}
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);
}
Aggregations