use of org.neo4j.configuration.ConfigValue in project neo4j by neo4j.
the class ServerSettingsTest method connectorSettingHasItsOwnValues.
@Test
public void connectorSettingHasItsOwnValues() throws Exception {
Config config = Config.serverDefaults(stringMap("dbms.connector.http.address", "localhost:123"));
ConfigValue address = config.getConfigValues().entrySet().stream().filter(c -> c.getKey().equals("dbms.connector.http.address")).map(Entry::getValue).findAny().orElseThrow(() -> new RuntimeException("Setting not present!"));
assertTrue(address.deprecated());
assertEquals(Optional.of("dbms.connector.http.listen_address"), address.replacement());
}
use of org.neo4j.configuration.ConfigValue in project neo4j-documentation by neo4j.
the class ConfigDocsTool method main.
public static void main(String[] args) throws IOException {
Args arguments = Args.parse(args);
printUsage();
List<String> orphans = arguments.orphans();
Path outFile = orphans.size() == 1 ? Paths.get(orphans.get(0)) : null;
String id = arguments.has("id") || warnMissingOption("ID", "--id=my-id", DEFAULT_ID) ? arguments.get("id") : DEFAULT_ID;
String title = arguments.has("title") || warnMissingOption("title", "--title=my-title", DEFAULT_TITLE) ? arguments.get("title") : DEFAULT_TITLE;
String idPrefix = arguments.has("id-prefix") || warnMissingOption("ID prefix", "--id-prefix=my-id-prefix", DEFAULT_ID_PREFIX) ? arguments.get("id-prefix") : DEFAULT_ID_PREFIX;
Predicate<ConfigValue> filter = filters(arguments);
System.out.printf("[+++] id=%s title=%s idPrefix=%s%n", id, title, idPrefix);
try {
String doc = new ConfigDocsGenerator().document(filter, id, title, idPrefix);
if (null != outFile) {
Path parentDir = outFile.getParent();
if (!Files.exists(parentDir)) {
Files.createDirectories(parentDir);
}
System.out.println("Saving docs in '" + outFile.toFile().getAbsolutePath() + "'.");
Files.write(outFile, doc.getBytes());
} else {
System.out.println(doc);
}
} catch (NoSuchElementException nse) {
nse.printStackTrace();
throw nse;
} catch (NoSuchFileException nsf) {
nsf.printStackTrace();
throw nsf;
}
}
use of org.neo4j.configuration.ConfigValue in project neo4j-documentation by neo4j.
the class ConfigDocsGenerator method document.
public String document(Predicate<ConfigValue> filter, String id, String title, String idPrefix) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
out = new PrintStream(baos);
settingDescriptions = config.getConfigValues().values().stream().filter(filter).sorted((cv1, cv2) -> cv1.name().compareTo(cv2.name())).map(c -> new DocsConfigValue(idFromName(idPrefix, c.name()), c.name(), c.description(), c.deprecated(), c.valueDescription(), c.documentedDefaultValue().isPresent() ? c.documentedDefaultValue() : valueAsString(c), c.internal(), c.replacement(), c.dynamic())).collect(Collectors.toList());
out.print(documentSummary(id, title, settingDescriptions));
settingDescriptions.forEach(this::documentForAllOutputs);
out.flush();
return baos.toString();
}
Aggregations