return this::execute;
}
+ @Override
+ public Executable<Optional<PluginInfo>> officialFromHttps(String pluginIdentifier) {
+ loadPlugin.setUrlType(UrlType.OFFICIAL);
+ loadPlugin.setOfficialSource(OfficialSource.HTTPS);
+ loadPlugin.setPluginUrl(pluginIdentifier);
+ return this::execute;
+ }
+
private ListenableFuture<Optional<PluginInfo>> execute() {
return threadPool.submit(this::executeDialog);
}
}
@Test
+ public void defaultFcpClientCanLoadPluginFromHttps() throws ExecutionException, InterruptedException,
+ IOException {
+ Future<Optional<PluginInfo>> pluginInfo = fcpClient.loadPlugin().officialFromHttps("superPlugin").execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "LoadPlugin",
+ "Identifier=" + identifier,
+ "PluginURL=superPlugin",
+ "URLType=official",
+ "OfficialSource=https",
+ "EndMessage"
+ ));
+ fcpServer.writeLine(
+ "PluginInfo",
+ "Identifier=" + identifier,
+ "PluginName=superPlugin",
+ "IsTalkable=true",
+ "LongVersion=1.2.3",
+ "Version=42",
+ "OriginUri=superPlugin",
+ "Started=true",
+ "EndMessage"
+ );
+ assertThat(pluginInfo.get().get().getPluginName(), is("superPlugin"));
+ assertThat(pluginInfo.get().get().getOriginalURI(), is("superPlugin"));
+ assertThat(pluginInfo.get().get().isTalkable(), is(true));
+ assertThat(pluginInfo.get().get().getVersion(), is("42"));
+ assertThat(pluginInfo.get().get().getLongVersion(), is("1.2.3"));
+ assertThat(pluginInfo.get().get().isStarted(), is(true));
+ }
+
+ @Test
public void failedLoadingPluginIsRecognized() throws ExecutionException, InterruptedException,
IOException {
Future<Optional<PluginInfo>> pluginInfo = fcpClient.loadPlugin().officialFromFreenet("superPlugin").execute();