use of org.apache.commons.configuration2.PropertiesConfiguration in project janusgraph by JanusGraph.
the class CQLInputFormatIT method getGraphConfiguration.
private PropertiesConfiguration getGraphConfiguration(final String filename) throws ConfigurationException, IOException {
final PropertiesConfiguration config = ConfigurationUtil.loadPropertiesConfig(filename, false);
Path baseOutDir = Paths.get((String) config.getProperty("gremlin.hadoop.outputLocation"));
baseOutDir.toFile().mkdirs();
String outDir = Files.createTempDirectory(baseOutDir, null).toAbsolutePath().toString();
config.setProperty("gremlin.hadoop.outputLocation", outDir);
config.setProperty("janusgraphmr.ioformat.conf.storage.port", String.valueOf(cql.getMappedCQLPort()));
return config;
}
use of org.apache.commons.configuration2.PropertiesConfiguration in project accumulo by apache.
the class MiniAccumuloClusterTest method testRandomPorts.
@Test
public void testRandomPorts() throws Exception {
File confDir = new File(testDir, "conf");
File accumuloProps = new File(confDir, "accumulo.properties");
var config = new PropertiesConfiguration();
try (var reader = new FileReader(accumuloProps, UTF_8)) {
config.read(reader);
}
for (Property randomPortProp : new Property[] { Property.TSERV_CLIENTPORT, Property.MONITOR_PORT, Property.MANAGER_CLIENTPORT, Property.GC_PORT }) {
String value = config.getString(randomPortProp.getKey());
assertNotNull("Found no value for " + randomPortProp, value);
assertEquals("0", value);
}
}
use of org.apache.commons.configuration2.PropertiesConfiguration in project accumulo by apache.
the class ClientConfiguration method serialize.
public String serialize() {
var propConfig = new PropertiesConfiguration();
propConfig.copy(compositeConfig);
StringWriter writer = new StringWriter();
try {
propConfig.write(writer);
} catch (ConfigurationException | IOException e) {
// this should never happen
throw new IllegalStateException(e);
}
return writer.toString();
}
use of org.apache.commons.configuration2.PropertiesConfiguration in project accumulo by apache.
the class VolumeIT method updateConfig.
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths provided by test")
private void updateConfig(Consumer<PropertiesConfiguration> updater) throws Exception {
var file = new File(cluster.getAccumuloPropertiesPath());
var config = new PropertiesConfiguration();
try (FileReader out = new FileReader(file, UTF_8)) {
config.read(out);
}
updater.accept(config);
try (FileWriter out = new FileWriter(file, UTF_8)) {
config.write(out);
}
}
Aggregations