Search in sources :

Example 21 with PropertyKey

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

the class ConfigurationDocGeneratorTest method checkYMLFile.

@Test
public void checkYMLFile() throws Exception {
    if (mFileType != TYPE.YML) {
        return;
    }
    Collection<PropertyKey> defaultKeys = new ArrayList<>();
    PropertyKey pKey = mTestConf.getFirst();
    String description = pKey.getDescription();
    defaultKeys.add(pKey);
    ConfigurationDocGenerator.writeYMLFile(defaultKeys, mLocation);
    String filePath = PathUtils.concatPath(mLocation, mTestConf.getSecond());
    Path p = Paths.get(filePath);
    assertTrue(Files.exists(p));
    // assert file contents
    List<String> keyDescription = Files.readAllLines(p, StandardCharsets.UTF_8);
    String expected = pKey + ":\n  '" + description.replace("'", "''") + "'";
    checkFileContents(expected, keyDescription, mFileType);
}
Also used : Path(java.nio.file.Path) ArrayList(java.util.ArrayList) PropertyKey(alluxio.conf.PropertyKey) Test(org.junit.Test)

Example 22 with PropertyKey

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

the class ConfigurationDocGeneratorTest method checkCSVFile.

@Test
public void checkCSVFile() throws Exception {
    if (mFileType != TYPE.CSV) {
        return;
    }
    Collection<PropertyKey> defaultKeys = new ArrayList<>();
    PropertyKey pKey = mTestConf.getFirst();
    defaultKeys.add(pKey);
    ConfigurationDocGenerator.writeCSVFile(defaultKeys, mLocation);
    String filePath = PathUtils.concatPath(mLocation, mTestConf.getSecond());
    Path p = Paths.get(filePath);
    assertTrue(Files.exists(p));
    // assert file contents
    List<String> userFile = Files.readAllLines(p, StandardCharsets.UTF_8);
    Object defaultValue = ServerConfiguration.get(pKey);
    checkFileContents(String.format("%s,\"%s\"", pKey, defaultValue), userFile, mFileType);
}
Also used : Path(java.nio.file.Path) ArrayList(java.util.ArrayList) PropertyKey(alluxio.conf.PropertyKey) Test(org.junit.Test)

Example 23 with PropertyKey

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

the class GetConfTest method getConfByAlias.

@Test
public void getConfByAlias() {
    PropertyKey testProperty = new PropertyKey.Builder("alluxio.test.property").setAlias(new String[] { "alluxio.test.property.alias" }).setDefaultValue("testValue").build();
    ClientContext ctx = ClientContext.create(ServerConfiguration.global());
    assertEquals(0, GetConf.getConf(ctx, "alluxio.test.property.alias"));
    assertEquals("testValue\n", mOutputStream.toString());
    mOutputStream.reset();
    assertEquals(0, GetConf.getConf(ctx, "alluxio.test.property"));
    assertEquals("testValue\n", mOutputStream.toString());
    PropertyKey.unregister(testProperty);
}
Also used : ClientContext(alluxio.ClientContext) PropertyKey(alluxio.conf.PropertyKey) Test(org.junit.Test)

Example 24 with PropertyKey

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

the class LocalAlluxioClusterResource method start.

/**
 * Explicitly starts the {@link LocalAlluxioCluster}.
 */
public void start() throws Exception {
    AuthenticatedClientUser.remove();
    // Create a new cluster.
    mLocalAlluxioCluster = new LocalAlluxioCluster(mNumWorkers, mIncludeSecondary);
    // Init configuration for integration test
    mLocalAlluxioCluster.initConfiguration(mTestName);
    // Overwrite the test configuration with test specific parameters
    for (Entry<PropertyKey, Object> entry : mConfiguration.entrySet()) {
        ServerConfiguration.set(entry.getKey(), entry.getValue());
    }
    ServerConfiguration.global().validate();
    // Start the cluster
    mLocalAlluxioCluster.start();
}
Also used : LocalAlluxioCluster(alluxio.master.LocalAlluxioCluster) PropertyKey(alluxio.conf.PropertyKey)

Example 25 with PropertyKey

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

the class LocalAlluxioClusterResource method overrideConfiguration.

/**
 * @param config the array of strings for the configuration values to override
 */
private void overrideConfiguration(String[] config) {
    // Override the configuration parameters with any configuration params
    for (int i = 0; i < config.length; i += 2) {
        PropertyKey key = PropertyKey.fromString(config[i]);
        mConfiguration.put(key, key.parseValue(config[i + 1]));
    }
}
Also used : PropertyKey(alluxio.conf.PropertyKey)

Aggregations

PropertyKey (alluxio.conf.PropertyKey)49 HashMap (java.util.HashMap)28 Test (org.junit.Test)16 Map (java.util.Map)15 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 AlluxioURI (alluxio.AlluxioURI)7 ConfigCheckReport (alluxio.wire.ConfigCheckReport)6 File (java.io.File)6 List (java.util.List)6 ConfigurationRule (alluxio.ConfigurationRule)5 Scope (alluxio.grpc.Scope)5 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)5 Address (alluxio.wire.Address)5 ConfigProperty (alluxio.grpc.ConfigProperty)4 Closeable (java.io.Closeable)4 Optional (java.util.Optional)4 Constants (alluxio.Constants)3 AlluxioProperties (alluxio.conf.AlluxioProperties)3 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)3