log.debug("Already disabled plugin '{}'", getPluginLabel(pluginDescriptor));
return true;
} else if (PluginState.STARTED == pluginState) {
- if (PluginState.STOPPED == stopPlugin(pluginId)) {
+ if (PluginState.STOPPED != stopPlugin(pluginId)) {
log.error("Failed to stop plugin '{}' on disable", getPluginLabel(pluginDescriptor));
return false;
}
assertSame(PluginState.DISABLED, plugin.getPluginState());
}
+ @Test
+ void shouldDisablePluginAfterStarting() throws IOException {
+ new PluginZip.Builder(pluginsPath.resolve("my-plugin-1.2.3.zip"), "myPlugin")
+ .pluginVersion("1.2.3")
+ .build();
+
+ pluginManager.loadPlugins();
+ pluginManager.startPlugins();
+ assertEquals(PluginState.STARTED, pluginManager.getPlugin("myPlugin").getPluginState());
+ pluginManager.disablePlugin("myPlugin");
+ assertEquals(PluginState.DISABLED, pluginManager.getPlugin("myPlugin").getPluginState());
+ }
+
@Test
public void deleteZipPlugin() throws Exception {
PluginZip pluginZip = new PluginZip.Builder(pluginsPath.resolve("my-plugin-1.2.3.zip"), "myPlugin")