GetConfigCommand withExpertFlag();
GetConfigCommand withForceWriteFlag();
GetConfigCommand withShortDescription();
+ GetConfigCommand withLongDescription();
}
private final AtomicBoolean withExpertFlag = new AtomicBoolean();
private final AtomicBoolean withForceWriteFlag = new AtomicBoolean();
private final AtomicBoolean withShortDescription = new AtomicBoolean();
+ private final AtomicBoolean withLongDescription = new AtomicBoolean();
public GetConfigCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) {
this.threadPool = MoreExecutors.listeningDecorator(threadPool);
}
@Override
+ public GetConfigCommand withLongDescription() {
+ withLongDescription.set(true);
+ return this;
+ }
+
+ @Override
public ListenableFuture<ConfigData> execute() {
return threadPool.submit(this::executeDialog);
}
getConfig.setWithExpertFlag(withExpertFlag.get());
getConfig.setWithForceWriteFlag(withForceWriteFlag.get());
getConfig.setWithShortDescription(withShortDescription.get());
+ getConfig.setWithLongDescription(withLongDescription.get());
try (GetConfigDialog getConfigDialog = new GetConfigDialog()) {
return getConfigDialog.send(getConfig).get();
}
assertThat(configData.get().getShortDescription("foo"), is("bar"));
}
+ @Test
+ public void defaultFcpClientCanGetConfigWithLongDescription()
+ throws InterruptedException, ExecutionException, IOException {
+ Future<ConfigData> configData = fcpClient.getConfig().withLongDescription().execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "GetConfig",
+ "Identifier=" + identifier,
+ "WithLongDescription=true",
+ "EndMessage"
+ ));
+ fcpServer.writeLine(
+ "ConfigData",
+ "Identifier=" + identifier,
+ "longDescription.foo=bar",
+ "EndMessage"
+ );
+ assertThat(configData.get().getLongDescription("foo"), is("bar"));
+ }
+
}