Search in sources :

Example 6 with JarPluginArtifact

use of com.qcadoo.plugin.api.artifact.JarPluginArtifact 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 7 with JarPluginArtifact

use of com.qcadoo.plugin.api.artifact.JarPluginArtifact 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 8 with JarPluginArtifact

use of com.qcadoo.plugin.api.artifact.JarPluginArtifact in project qcadoo by qcadoo.

the class PluginIntegrationTest method shouldNotDowngradePlugin.

@Test
public void shouldNotDowngradePlugin() 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(artifact2);
    // when
    PluginOperationResult result = pluginManager.installPlugin(artifact);
    // then
    assertFalse(result.isSuccess());
    assertEquals(PluginOperationStatus.CANNOT_DOWNGRADE_PLUGIN, result.getStatus());
    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)

Example 9 with JarPluginArtifact

use of com.qcadoo.plugin.api.artifact.JarPluginArtifact 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 10 with JarPluginArtifact

use of com.qcadoo.plugin.api.artifact.JarPluginArtifact 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

JarPluginArtifact (com.qcadoo.plugin.api.artifact.JarPluginArtifact)10 File (java.io.File)10 Test (org.junit.Test)10 PluginOperationResult (com.qcadoo.plugin.api.PluginOperationResult)7 Version (com.qcadoo.plugin.api.Version)3 FileUtils.writeStringToFile (org.apache.commons.io.FileUtils.writeStringToFile)3 PluginArtifact (com.qcadoo.plugin.api.artifact.PluginArtifact)2 InternalPlugin (com.qcadoo.plugin.internal.api.InternalPlugin)1 FileInputStream (java.io.FileInputStream)1