PluginOperationOptions pluginOptions = new PluginOperationOptions();
pluginOptions.setAction(PluginAction.LIST);
pluginOptions.setListMode(PluginListMode.REMOTE);
pluginOptions.setSnapshots(false);
PluginOperationResult pluginResult = client.plugin(pluginOptions);
String pluginDownloadUrl = null;
for (ExtendedPluginInfo pluginInfo : pluginResult.getPluginList()) {
if (pluginInfo.getRemotePluginInfo().getPluginId().equals("ftp")) {
pluginDownloadUrl = pluginInfo.getRemotePluginInfo().getDownloadUrl();
}
}
pluginOptions = new PluginOperationOptions();
pluginOptions.setAction(PluginAction.INSTALL);
pluginOptions.setPluginId(pluginDownloadUrl);
pluginResult = client.plugin(pluginOptions);
assertNotNull(pluginResult);
assertEquals(PluginResultCode.OK, pluginResult.getResultCode());
// Only one file should be in here: the jar for ftp.
assertEquals(1, (new File(configDir, "plugins/lib/")).list().length);
// Tear down