use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class FileSystemFactoryTest method multiMasterFileSystemCacheTest.
@Test
public void multiMasterFileSystemCacheTest() {
try (Closeable p = new SystemPropertyRule(PropertyKey.MASTER_RPC_ADDRESSES.getName(), "192.168.0.1:1234,192.168.0.2:1445,192.168.0.3:9943").toResource()) {
ConfigurationUtils.reloadProperties();
InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
MasterInquireClient.ConnectDetails connectDetails = MasterInquireClient.Factory.getConnectDetails(conf);
// Make sure we have a MultiMaster authority
assertTrue(connectDetails.toAuthority() instanceof MultiMasterAuthority);
fileSystemCacheTest();
} catch (IOException e) {
fail("Unable to set system properties");
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class CopyToLocalCommandIntegrationTest method copyToLocalRelativePathDir.
@Test
public void copyToLocalRelativePathDir() throws Exception {
String version = System.getProperty("java.version");
if (version.startsWith("11")) {
// Breaks on Java 11+ because of https://bugs.openjdk.java.net/browse/JDK-8202127
return;
}
FileSystemTestUtils.createByteFile(sFileSystem, "/testFile", WritePType.MUST_CACHE, 10);
HashMap<String, String> sysProps = new HashMap<>();
sysProps.put("user.dir", mTestFolder.getRoot().getAbsolutePath());
try (Closeable p = new SystemPropertyRule(sysProps).toResource()) {
File localDir = mTestFolder.newFolder("localDir");
localDir.mkdir();
sFsShell.run("copyToLocal", "/testFile", "localDir");
Assert.assertEquals("Copied /testFile to file://" + mTestFolder.getRoot().getAbsolutePath() + "/localDir/testFile" + "\n", mOutput.toString());
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class GetConfTest method getConfWithInvalidConf.
@Test
public void getConfWithInvalidConf() throws Exception {
try (Closeable p = new SystemPropertyRule(ImmutableMap.of(PropertyKey.CONF_VALIDATION_ENABLED.toString(), "false", PropertyKey.ZOOKEEPER_ENABLED.toString(), "true")).toResource()) {
ServerConfiguration.reset();
ClientContext ctx = ClientContext.create(ServerConfiguration.global());
assertEquals(0, GetConf.getConf(ctx, PropertyKey.ZOOKEEPER_ENABLED.toString()));
assertEquals("true\n", mOutputStream.toString());
} finally {
ServerConfiguration.reset();
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class CopyFromLocalCommandIntegrationTest method copyFromLocalRelativePath.
@Test
public void copyFromLocalRelativePath() throws Exception {
String version = System.getProperty("java.version");
if (version.startsWith("11")) {
// Breaks on Java 11+ because of https://bugs.openjdk.java.net/browse/JDK-8202127
return;
}
HashMap<String, String> sysProps = new HashMap<>();
sysProps.put("user.dir", mTestFolder.getRoot().getAbsolutePath());
try (Closeable p = new SystemPropertyRule(sysProps).toResource()) {
File localDir = mTestFolder.newFolder("testDir");
generateRelativeFileContent(localDir.getPath() + "/testFile", BufferUtils.getIncreasingByteArray(10));
int ret = sFsShell.run("copyFromLocal", "testDir/testFile", "/testFile");
Assert.assertEquals(0, ret);
Assert.assertTrue(fileExists(new AlluxioURI(("/testFile"))));
}
}
use of alluxio.SystemPropertyRule in project alluxio by Alluxio.
the class AbstractFileSystemTest method initializeWithZookeeperSystemProperties.
@Test
public void initializeWithZookeeperSystemProperties() throws Exception {
HashMap<String, String> sysProps = new HashMap<>();
sysProps.put(PropertyKey.ZOOKEEPER_ENABLED.getName(), "true");
sysProps.put(PropertyKey.ZOOKEEPER_ADDRESS.getName(), "zkHost:2181");
try (Closeable p = new SystemPropertyRule(sysProps).toResource()) {
ConfigurationUtils.reloadProperties();
URI uri = URI.create("alluxio:///");
FileSystem fs = getHadoopFilesystem(org.apache.hadoop.fs.FileSystem.get(uri, getConf()));
assertTrue(fs.mFileSystem.getConf().getBoolean(PropertyKey.ZOOKEEPER_ENABLED));
assertEquals("zkHost:2181", fs.mFileSystem.getConf().get(PropertyKey.ZOOKEEPER_ADDRESS));
}
}
Aggregations