use of com.qcadoo.plugin.api.artifact.JarPluginArtifact in project qcadoo by qcadoo.
the class JarPluginArtifactTest method shouldHaveFileName.
@Test
public void shouldHaveFileName() throws Exception {
// given
File file = folder.newFile("plugin.jar");
// when
PluginArtifact pluginArtifact = new JarPluginArtifact(file);
// then
assertEquals("plugin.jar", pluginArtifact.getName());
}
use of com.qcadoo.plugin.api.artifact.JarPluginArtifact in project qcadoo by qcadoo.
the class JarPluginArtifactTest method shouldThrowAnExceptionIfFileNotExist.
@Test(expected = IllegalStateException.class)
public void shouldThrowAnExceptionIfFileNotExist() throws Exception {
// given
File file = new File("xxxx");
// when
new JarPluginArtifact(file);
}
use of com.qcadoo.plugin.api.artifact.JarPluginArtifact in project qcadoo by qcadoo.
the class JarPluginArtifactTest method shouldHaveFileInputStream.
@Test
public void shouldHaveFileInputStream() throws Exception {
// given
File file = folder.newFile("plugin.jar");
writeStringToFile(file, "content");
// when
PluginArtifact pluginArtifact = new JarPluginArtifact(file);
// then
Assert.assertTrue(contentEquals(new FileInputStream(file), pluginArtifact.getInputStream()));
}
use of com.qcadoo.plugin.api.artifact.JarPluginArtifact in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldUpdateEnabledPlugin.
@Test
public void shouldUpdateEnabledPlugin() 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);
pluginManager.enablePlugin("plugin4");
((InternalPlugin) pluginAccessor.getPlugin("plugin4")).changeStateTo(PluginState.ENABLED);
// when
PluginOperationResult result = pluginManager.installPlugin(artifact2);
// then
assertTrue(result.isSuccess());
assertTrue(result.isRestartNeccessary());
assertNotNull(pluginAccessor.getPlugin("plugin4"));
assertTrue(pluginAccessor.getPlugin("plugin4").hasState(PluginState.ENABLING));
assertEquals(new Version("1.2.4"), pluginAccessor.getPlugin("plugin4").getVersion());
}
use of com.qcadoo.plugin.api.artifact.JarPluginArtifact 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"));
}
Aggregations