Search in sources :

Example 11 with PluginOperationResult

use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldUninstallPlugin.

@Test
public void shouldUninstallPlugin() throws Exception {
    // given
    JarPluginArtifact artifact = new JarPluginArtifact(new File("src/test/resources/com/qcadoo/plugin/integration/plugin4.jar"));
    pluginManager.installPlugin(artifact);
    pluginManager.enablePlugin("plugin4");
    // when
    PluginOperationResult result = pluginManager.uninstallPlugin("plugin4");
    // then
    assertTrue(result.isSuccess());
    assertTrue(result.isRestartNeccessary());
    assertNull(pluginAccessor.getPlugin("plugin4"));
}
Also used : JarPluginArtifact(com.qcadoo.plugin.api.artifact.JarPluginArtifact) PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) File(java.io.File) Test(org.junit.Test)

Example 12 with PluginOperationResult

use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldEnableInstalledPlugin.

@Test
public void shouldEnableInstalledPlugin() 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.enablePlugin("plugin4");
    // then
    assertTrue(result.isSuccess());
    assertTrue(result.isRestartNeccessary());
    assertNotNull(pluginAccessor.getPlugin("plugin4"));
    assertTrue(pluginAccessor.getPlugin("plugin4").hasState(PluginState.ENABLING));
}
Also used : JarPluginArtifact(com.qcadoo.plugin.api.artifact.JarPluginArtifact) PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) File(java.io.File) Test(org.junit.Test)

Example 13 with PluginOperationResult

use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldNotEnablePluginWithDisabledDependencies.

@Test
public void shouldNotEnablePluginWithDisabledDependencies() throws Exception {
    // given
    pluginManager.disablePlugin("plugin1", "plugin2");
    // when
    PluginOperationResult result = pluginManager.enablePlugin("plugin2");
    // then
    assertFalse(result.isSuccess());
    assertFalse(result.isRestartNeccessary());
    assertEquals(1, result.getPluginDependencyResult().getDependenciesToEnable().size());
    assertEquals("plugin1", result.getPluginDependencyResult().getDependenciesToEnable().iterator().next().getIdentifier());
    assertEquals(PluginOperationStatus.DEPENDENCIES_TO_ENABLE, result.getStatus());
}
Also used : PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) Test(org.junit.Test)

Example 14 with PluginOperationResult

use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldInstallPlugin.

@Test
public void shouldInstallPlugin() throws Exception {
    // given
    JarPluginArtifact artifact = new JarPluginArtifact(new File("src/test/resources/com/qcadoo/plugin/integration/plugin4.jar"));
    // when
    PluginOperationResult result = pluginManager.installPlugin(artifact);
    // then
    assertTrue(result.isSuccess());
    assertFalse(result.isRestartNeccessary());
    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 15 with PluginOperationResult

use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldNotDisablePluginWithEnabledDependency.

@Test
public void shouldNotDisablePluginWithEnabledDependency() throws Exception {
    // given
    pluginManager.enablePlugin("plugin1", "plugin2");
    // when
    PluginOperationResult result = pluginManager.disablePlugin("plugin1");
    // then
    assertFalse(result.isSuccess());
    assertEquals(1, result.getPluginDependencyResult().getDependenciesToDisable().size());
    assertEquals(PluginOperationStatus.DEPENDENCIES_TO_DISABLE, result.getStatus());
}
Also used : PluginOperationResult(com.qcadoo.plugin.api.PluginOperationResult) 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