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