use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldEnablePluginWithDependencies.
@Test
public void shouldEnablePluginWithDependencies() throws Exception {
// given
pluginManager.disablePlugin("plugin2");
// when
PluginOperationResult result = pluginManager.enablePlugin("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 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());
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldNotDisableSystemPlugin.
@Test
public void shouldNotDisableSystemPlugin() throws Exception {
// given
pluginManager.enablePlugin("plugin3");
// when
PluginOperationResult result = pluginManager.disablePlugin("plugin3");
// then
assertFalse(result.isSuccess());
assertEquals(PluginOperationStatus.SYSTEM_PLUGIN_DISABLING, result.getStatus());
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginIntegrationTest method shouldEnablePluginAndDependency.
@Test
public void shouldEnablePluginAndDependency() throws Exception {
// given
pluginManager.disablePlugin("plugin1", "plugin2");
// when
PluginOperationResult result = pluginManager.enablePlugin("plugin1", "plugin2");
// then
assertTrue(result.isSuccess());
assertEquals(PluginOperationStatus.SUCCESS, result.getStatus());
}
use of com.qcadoo.plugin.api.PluginOperationResult in project qcadoo by qcadoo.
the class PluginManagmentPerformer method performInstall.
public String performInstall(final PluginArtifact artifact) {
PluginOperationResult result = pluginManagmentConnector.performInstall(artifact);
String url = null;
switch(result.getStatus()) {
case SUCCESS:
url = createSuccessPageUrl("install.success");
break;
case SUCCESS_WITH_RESTART:
url = createRestartPageUrl(createSuccessPageUrl("install.success"));
break;
case SUCCESS_WITH_MISSING_DEPENDENCIES:
url = createSuccessPageUrl("install.successWithMissingDependencies", result.getPluginDependencyResult().getUnsatisfiedDependencies());
break;
case DEPENDENCIES_CYCLES_EXISTS:
url = createErrorPageUrl("install.cyclingDependency");
break;
case CANNOT_UPLOAD_PLUGIN:
url = createErrorPageUrl("install.cannotUploadPlugin");
break;
case CORRUPTED_PLUGIN:
url = createErrorPageUrl("install.corruptedPlugin");
break;
case SYSTEM_PLUGIN_UPDATING:
url = createErrorPageUrl("install.systemPlugin");
break;
case CANNOT_DOWNGRADE_PLUGIN:
url = createErrorPageUrl("install.incorrectVersion");
break;
case CANNOT_INSTALL_PLUGIN_FILE:
url = createErrorPageUrl("install.cannotInstallPlugin");
break;
case DEPENDENCIES_TO_ENABLE:
url = createErrorPageUrl("install.dependenciesToEnable", result.getPluginDependencyResult().getDependenciesToEnable());
break;
case UNSATISFIED_DEPENDENCIES:
url = createErrorPageUrl("install.unsatisfiedDependencies", result.getPluginDependencyResult().getUnsatisfiedDependencies());
break;
case UNSATISFIED_DEPENDENCIES_AFTER_UPDATE:
url = createErrorPageUrl("install.unsatisfiedDependenciesAfterUpdate", result.getPluginDependencyResult().getDependenciesToDisableUnsatisfiedAfterUpdate());
break;
default:
throw new IllegalStateException(L_WRONG_STATUS);
}
return url;
}
Aggregations