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