private final AtomicBoolean withCurrent = new AtomicBoolean();
private final AtomicBoolean withDefaults = new AtomicBoolean();
private final AtomicBoolean withSortOrder = new AtomicBoolean();
+ private final AtomicBoolean withExpertFlag = new AtomicBoolean();
public GetConfigCommandImpl(ExecutorService threadPool, ConnectionSupplier connectionSupplier) {
this.threadPool = MoreExecutors.listeningDecorator(threadPool);
}
@Override
+ public GetConfigCommand withExpertFlag() {
+ withExpertFlag.set(true);
+ return this;
+ }
+
+ @Override
public ListenableFuture<ConfigData> execute() {
return threadPool.submit(this::executeDialog);
}
getConfig.setWithCurrent(withCurrent.get());
getConfig.setWithDefaults(withDefaults.get());
getConfig.setWithSortOrder(withSortOrder.get());
+ getConfig.setWithExpertFlag(withExpertFlag.get());
try (GetConfigDialog getConfigDialog = new GetConfigDialog()) {
return getConfigDialog.send(getConfig).get();
}
assertThat(configData.get().getSortOrder("foo"), is(17));
}
+ @Test
+ public void defaultFcpClientCanGetConfigWithExpertFlag()
+ throws InterruptedException, ExecutionException, IOException {
+ Future<ConfigData> configData = fcpClient.getConfig().withExpertFlag().execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "GetConfig",
+ "Identifier=" + identifier,
+ "WithExpertFlag=true",
+ "EndMessage"
+ ));
+ fcpServer.writeLine(
+ "ConfigData",
+ "Identifier=" + identifier,
+ "expertFlag.foo=true",
+ "EndMessage"
+ );
+ assertThat(configData.get().getExpertFlag("foo"), is(true));
+ }
+
}