diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableAction.java index 95c3dce1defb93cfadd76e83d78bcb22bb9dbdcd..99f04cd28a57eb0b45801325aae1629c69e90d7d 100644 --- a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableAction.java +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableAction.java @@ -57,11 +57,12 @@ public class SetEnableTechnologiesVariableAction implements PanelAction { // The technologyCheckBoxesAction is a 'preactivate' action to populate the technology check // boxes. - // But in case of console installation the 'preactivate' action isn't execute. We can - // execute it here without any check whether we are console or GUI based installation - // because the GUI sets the technology flags and naothing will be populated from existing + // But in case of console installation the 'preactivate' action isn't executed. We can + // execute it here without any check whether this is a console-based or GUI-based + // installation + // because the GUI sets the technology flags and nothing will be populated from existing // service.properties. - technologyCheckBoxesAction.executeAction(data, handler); + technologyCheckBoxesAction.executeAction(data, handler); boolean isFirstTimeInstallation = GlobalInstallationContext.isFirstTimeInstallation; File installDir = GlobalInstallationContext.installDir; updateEnabledTechnologyProperty(data, isFirstTimeInstallation, installDir); @@ -84,7 +85,7 @@ public class SetEnableTechnologiesVariableAction implements PanelAction private void updateDisabledDssPluginsProperty(AutomatedInstallData data, File installDir) { Set<String> disabledTechnologies = new LinkedHashSet<String>(); - Set<String> technologies = new HashSet<String>(); + Set<String> technologies = new LinkedHashSet<String>(); for (String technology : GlobalInstallationContext.TECHNOLOGIES) { String technologyFlag = data.getVariable(technology); @@ -96,12 +97,12 @@ public class SetEnableTechnologiesVariableAction implements PanelAction } File configFile = new File(installDir, Utils.DSS_PATH + Utils.SERVICE_PROPERTIES_PATH); List<String> list = FileUtilities.loadToStringList(configFile); - updateDisabledDssPluginsProperty(list, technologies, disabledTechnologies); + updateDisabledDssPluginsProperty(list, technologies, disabledTechnologies, installDir); Utils.updateConfigFile(configFile, list); } private void updateDisabledDssPluginsProperty(List<String> list, Set<String> technologies, - Set<String> disabledTechnologies) + Set<String> disabledTechnologies, File installDir) { for (int i = 0; i < list.size(); i++) { @@ -117,7 +118,17 @@ public class SetEnableTechnologiesVariableAction implements PanelAction return; } } - String pluginsList = mergeWithDisabledPluginsList("", technologies, disabledTechnologies); + String pluginsList; + if (Utils.hasCorePluginsFolder(installDir)) + { + pluginsList = mergeWithDisabledPluginsList("", technologies, disabledTechnologies); + } else + { + // A very old openBIS instance does not have a core plugins folder. Thus, all + // core plugins have to be disabled in order to avoid possible conflicts of + // existing DSS service.properties with a core plugin. + pluginsList = mergeWithDisabledPluginsList("", technologies, technologies); + } list.add(DISABLED_CORE_PLUGINS_KEY + " = " + pluginsList); } @@ -174,7 +185,6 @@ public class SetEnableTechnologiesVariableAction implements PanelAction builder.append(technology.toLowerCase()); } } - System.out.println("disabled technologies:"+builder); return builder.toString(); } diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/Utils.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/Utils.java index 9b4600843c78efd187b3f280aceb77aad58af893..67db2c2a8d62d2832e95ffe63d3afd24fe295c17 100644 --- a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/Utils.java +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/Utils.java @@ -39,11 +39,17 @@ import ch.systemsx.cisd.common.filesystem.FileUtilities; class Utils { private static final String SERVERS_PATH = "servers/"; + static final String CORE_PLUGINS_PATH = SERVERS_PATH + "core-plugins/"; static final String AS_PATH = SERVERS_PATH + "openBIS-server/jetty/"; static final String DSS_PATH = SERVERS_PATH + "datastore_server/"; static final String SERVICE_PROPERTIES_PATH = "etc/service.properties"; static final String JETTY_XML_PATH = "etc/jetty.xml"; static final String KEYSTORE_PATH = "etc/openBIS.keystore"; + + static boolean hasCorePluginsFolder(File installDir) + { + return new File(installDir, CORE_PLUGINS_PATH).isDirectory(); + } static String tryToGetServicePropertyOfAS(File installDir, String propertyKey) { diff --git a/installation/sourceTest/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableActionTest.java b/installation/sourceTest/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableActionTest.java index 361f9b203442563eb2337892f3427f5b1ac58718..e6002f6e15d108fa647a307e92a92d1b5f0866cd 100644 --- a/installation/sourceTest/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableActionTest.java +++ b/installation/sourceTest/java/ch/systemsx/cisd/openbis/installer/izpack/SetEnableTechnologiesVariableActionTest.java @@ -45,6 +45,7 @@ import ch.systemsx.cisd.common.filesystem.FileUtilities; */ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemTestCase { + private File corePluginsFolder; private File configFile; private File dssConfigFile; @@ -52,6 +53,8 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT @BeforeMethod public void setUp() { + corePluginsFolder = new File(workingDirectory, Utils.CORE_PLUGINS_PATH); + corePluginsFolder.mkdirs(); configFile = new File(workingDirectory, Utils.AS_PATH + Utils.SERVICE_PROPERTIES_PATH); configFile.getParentFile().mkdirs(); dssConfigFile = new File(workingDirectory, Utils.DSS_PATH + Utils.SERVICE_PROPERTIES_PATH); @@ -68,6 +71,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT @AfterMethod public void tearDown() { + FileUtilities.deleteRecursively(corePluginsFolder); configFile.delete(); dssConfigFile.delete(); } @@ -116,8 +120,9 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT } @Test - public void testUpdateUnchangedProperty() + public void testUpdateInstallationWithoutCorePluginsFolder() { + FileUtilities.deleteRecursively(corePluginsFolder); FileUtilities.writeToFile(configFile, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY + "=proteomics"); Properties variables = new Properties(); @@ -126,6 +131,23 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT updateEnabledTechnologyProperties(variables, false); + assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=proteomics]", FileUtilities + .loadToStringList(configFile).toString()); + assertEquals("[" + DISABLED_CORE_PLUGINS_KEY + " = proteomics, screening, illumina-ngs]", + FileUtilities.loadToStringList(dssConfigFile).toString()); + } + + @Test + public void testUpdateUnchangedProperty() + { + FileUtilities.writeToFile(configFile, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY + + "=proteomics"); + Properties variables = new Properties(); + variables.setProperty(TECHNOLOGY_PROTEOMICS, "true"); + variables.setProperty(TECHNOLOGY_SCREENING, "false"); + + updateEnabledTechnologyProperties(variables, false); + assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=proteomics]", FileUtilities .loadToStringList(configFile).toString()); }