Executable<Optional<PluginInfo>> officialFromFreenet(String pluginIdentifier);
Executable<Optional<PluginInfo>> officialFromHttps(String pluginIdentifier);
Executable<Optional<PluginInfo>> fromFile(String filename);
+ Executable<Optional<PluginInfo>> fromUrl(String url);
}
return this::execute;
}
+ @Override
+ public Executable<Optional<PluginInfo>> fromUrl(String url) {
+ loadPlugin.setUrlType(UrlType.URL);
+ loadPlugin.setPluginUrl(url);
+ return this::execute;
+ }
+
private ListenableFuture<Optional<PluginInfo>> execute() {
return threadPool.submit(this::executeDialog);
}
}
@Test
+ public void fromUrl() throws ExecutionException, InterruptedException, IOException {
+ Future<Optional<PluginInfo>> pluginInfo =
+ fcpClient.loadPlugin().fromUrl("http://server.com/plugin.jar").execute();
+ connectNode();
+ List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+ String identifier = extractIdentifier(lines);
+ assertThat(lines, matchesFcpMessage(
+ "LoadPlugin",
+ "Identifier=" + identifier,
+ "PluginURL=http://server.com/plugin.jar",
+ "URLType=url",
+ "EndMessage"
+ ));
+ replyWithPluginInfo(identifier);
+ verifyPluginInfo(pluginInfo);
+ }
+
+ @Test
public void failedLoad() throws ExecutionException, InterruptedException, IOException {
Future<Optional<PluginInfo>> pluginInfo =
fcpClient.loadPlugin().officialFromFreenet("superPlugin").execute();