use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginManagmentPerformer method performDisable.
public String performDisable(final List<String> pluginIdentifiers) {
PluginOperationResult result = pluginManagmentConnector.performDisable(pluginIdentifiers);
String url = null;
switch(result.getStatus()) {
case SUCCESS:
url = createSuccessPageUrl("disable.success");
break;
case SYSTEM_PLUGIN_DISABLING:
url = createErrorPageUrl("disable.systemPlugin");
break;
case DEPENDENCIES_TO_DISABLE:
url = createConfirmPageUrl("disable.dependenciesToDisable", "disable.dependenciesToDisableCancelLabel", "disable.dependenciesToDisableAcceptLabel", "performDisablingMultiplePlugins", result.getPluginDependencyResult().getDependenciesToDisable(), pluginIdentifiers);
break;
default:
throw new IllegalStateException(L_WRONG_STATUS);
}
return url;
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldEnablePlugin.
@Test
public void shouldEnablePlugin() throws Exception {
// given
pluginManager.disablePlugin("plugin1", "plugin2");
// when
PluginOperationResult result = pluginManager.enablePlugin("plugin1");
// then
assertTrue(result.isSuccess());
assertFalse(result.isRestartNeccessary());
assertEquals(2, pluginAccessor.getEnabledPlugins().size());
assertNotNull(pluginAccessor.getEnabledPlugin("plugin1"));
assertNull(pluginAccessor.getEnabledPlugin("plugin2"));
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldDisablePlugin.
@Test
public void shouldDisablePlugin() throws Exception {
// when
PluginOperationResult result = pluginManager.disablePlugin("plugin2");
// then
assertTrue(result.isSuccess());
assertEquals(PluginOperationStatus.SUCCESS, result.getStatus());
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldNotDisableTemporaryPlugin.
@Test
public void shouldNotDisableTemporaryPlugin() throws Exception {
// given
JarPluginArtifact artifact = new JarPluginArtifact(new File("src/test/resources/com/qcadoo/plugin/integration/plugin4.jar"));
pluginManager.installPlugin(artifact);
// when
PluginOperationResult result = pluginManager.disablePlugin("plugin4");
// then
assertTrue(result.isSuccess());
assertNotNull(pluginAccessor.getPlugin("plugin4"));
assertTrue(pluginAccessor.getPlugin("plugin4").hasState(PluginState.TEMPORARY));
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldUpdateTemporaryPlugin.
@Test
public void shouldUpdateTemporaryPlugin() throws Exception {
// given
JarPluginArtifact artifact = new JarPluginArtifact(new File("src/test/resources/com/qcadoo/plugin/integration/plugin4.jar"));
JarPluginArtifact artifact2 = new JarPluginArtifact(new File("src/test/resources/com/qcadoo/plugin/integration/plugin4.1.jar"));
pluginManager.installPlugin(artifact);
// when
PluginOperationResult result = pluginManager.installPlugin(artifact2);
// then
assertTrue(result.isSuccess());
assertFalse(result.isRestartNeccessary());
assertNotNull(pluginAccessor.getPlugin("plugin4"));
assertTrue(pluginAccessor.getPlugin("plugin4").hasState(PluginState.TEMPORARY));
assertEquals(new Version("1.2.4"), pluginAccessor.getPlugin("plugin4").getVersion());
}
Aggregations