Search in sources :

Example 31 with PluginOperationResult

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;
}
Also used : PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult)

Example 32 with PluginOperationResult

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"));
}
Also used : PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) Test(org.junit.Test)

Example 33 with PluginOperationResult

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());
}
Also used : PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) Test(org.junit.Test)

Example 34 with PluginOperationResult

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));
}
Also used : JarPluginArtifact(com.qcadoo.plugin.api.artifact.JarPluginArtifact) PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) File(java.io.File) Test(org.junit.Test)

Example 35 with PluginOperationResult

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());
}
Also used : JarPluginArtifact(com.qcadoo.plugin.api.artifact.JarPluginArtifact) Version(com.qcadoo.plugin.api.Version) PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) File(java.io.File) Test(org.junit.Test)

Aggregations

PluginOperationResult (com.qcadoo.plugin.api.PluginOperationResult)35 Test (org.junit.Test)31 PluginDependencyResult (com.qcadoo.plugin.api.PluginDependencyResult)15 SimplePluginStatusResolver (com.qcadoo.plugin.internal.dependencymanager.SimplePluginStatusResolver)15 InternalPlugin (com.qcadoo.plugin.internal.api.InternalPlugin)9 Plugin (com.qcadoo.plugin.api.Plugin)8 JarPluginArtifact (com.qcadoo.plugin.api.artifact.JarPluginArtifact)7 File (java.io.File)7 PluginDependencyInformation (com.qcadoo.plugin.api.PluginDependencyInformation)4 VersionOfDependency (com.qcadoo.plugin.api.VersionOfDependency)4 Version (com.qcadoo.plugin.api.Version)3 InOrder (org.mockito.InOrder)3