assertThat(newConfigData.get().getCurrent("foo.bar"), is("baz"));
}
- public class PluginCommands {
+ private List<String> lines;
+ private String identifier;
- private static final String CLASS_NAME = "foo.plugin.Plugin";
+ private void connectAndAssert(Supplier<Matcher<List<String>>> requestMatcher)
+ throws InterruptedException, ExecutionException, IOException {
+ connectNode();
+ lines = fcpServer.collectUntil(is("EndMessage"));
+ identifier = extractIdentifier(lines);
+ assertThat(lines, requestMatcher.get());
+ }
- private List<String> lines;
- private String identifier;
+ public class PluginCommands {
- private void connectAndAssert(Supplier<Matcher<List<String>>> requestMatcher)
- throws InterruptedException, ExecutionException, IOException {
- connectNode();
- lines = fcpServer.collectUntil(is("EndMessage"));
- identifier = extractIdentifier(lines);
- assertThat(lines, requestMatcher.get());
- }
+ private static final String CLASS_NAME = "foo.plugin.Plugin";
private void replyWithPluginInfo() throws IOException {
fcpServer.writeLine(
}
+ public class UskSubscriptionCommands {
+
+ private static final String URI = "SSK@some,uri/file.txt";
+
+ @Test
+ public void subscriptionWorks() throws InterruptedException, ExecutionException, IOException {
+ Future<Optional<UskSubscription>> uskSubscription = fcpClient.subscribeUsk().uri(URI).execute();
+ connectAndAssert(() -> matchesFcpMessage("SubscribeUSK", "URI=" + URI, "EndMessage"));
+ fcpServer.writeLine(
+ "SubscribedUSK",
+ "Identifier=" + identifier,
+ "URI=" + URI,
+ "DontPoll=false",
+ "EndMessage"
+ );
+ assertThat(uskSubscription.get().get().getUri(), is(URI));
+ }
+
+ }
+
}