Skip to content
Snippets Groups Projects
Commit 4dc17ecc authored by felmer's avatar felmer
Browse files

SP-71, BIS-52: bug concerning disabling of core plugins fixed

SVN: 25425
parent 4c2caaee
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,7 @@
<panel classname="com.izforge.izpack.panels.userinput.UserInputPanel" id="UserInputPanel.TECHNOLOGIES" condition="isStandardTechnologies">
<actions>
<action stage="preactivate" classname="ch.systemsx.cisd.openbis.installer.izpack.SetTechnologyCheckBoxesAction" />
<action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.SetDisableTechnologiesVariableAction" />
<action stage="postvalidate" classname="ch.systemsx.cisd.openbis.installer.izpack.SetEnableTechnologiesVariableAction" />
</actions>
</panel>
......
......@@ -35,11 +35,11 @@ KEY_STORE_PASSWORD = changeit
# Password of the key
KEY_PASSWORD = changeit
# Standard technology PROTEOMICS is enabled by default
#PROTEOMICS = false
# Standard technology PROTEOMICS is disabled by default
#PROTEOMICS = true
# Standard technology SCREENING is enabled by default
#SCREENING = false
# Standard technology SCREENING is disabled by default
#SCREENING = true
# Standard technology ILLUMINA-NGS is enabled by default
#ILLUMINA-NGS = false
\ No newline at end of file
# Standard technology ILLUMINA-NGS is disabled by default
#ILLUMINA-NGS = true
\ No newline at end of file
......@@ -39,9 +39,10 @@ import ch.systemsx.cisd.common.shared.basic.utils.CommaSeparatedListBuilder;
*
* @author Franz-Josef Elmer
*/
public class SetDisableTechnologiesVariableAction implements PanelAction
public class SetEnableTechnologiesVariableAction implements PanelAction
{
static final String ENABLED_TECHNOLOGIES_VARNAME = "ENABLED_TECHNOLOGIES";
static final String DISABLED_TECHNOLOGIES_VARNAME = "DISABLED_TECHNOLOGIES";
static final String DISABLED_CORE_PLUGINS_KEY = "disabled-core-plugins";
public void initialize(PanelActionConfiguration configuration)
......@@ -58,6 +59,7 @@ public class SetDisableTechnologiesVariableAction implements PanelAction
void updateEnabledTechnologyProperty(AutomatedInstallData data,
boolean isFirstTimeInstallation, File installDir)
{
data.setVariable(DISABLED_TECHNOLOGIES_VARNAME, createListOfDisabledTechnologies(data));
String newTechnologyList = createListOfEnabledTechnologies(data);
data.setVariable(ENABLED_TECHNOLOGIES_VARNAME, newTechnologyList);
if (isFirstTimeInstallation == false)
......@@ -149,5 +151,19 @@ public class SetDisableTechnologiesVariableAction implements PanelAction
}
return builder.toString();
}
private String createListOfDisabledTechnologies(AutomatedInstallData data)
{
CommaSeparatedListBuilder builder = new CommaSeparatedListBuilder();
for (String technology : GlobalInstallationContext.TECHNOLOGIES)
{
String technologyFlag = data.getVariable(technology);
if (technologyFlag == null || Boolean.FALSE.toString().equalsIgnoreCase(technologyFlag))
{
builder.append(technology.toLowerCase());
}
}
return builder.toString();
}
}
......@@ -29,7 +29,7 @@ import com.izforge.izpack.data.PanelAction;
* Action which sets the variables which are the values of check boxes on the technology page. If
* the variable is already set nothing is done. Otherwise the behavior depends on whether this is
* installation or upgrading. In case of installation the flag will be <code>true</code>. In case of
* upgrading <code>service.properties</code> files are scanned in order to check whether a certain
* upgrading <code>service.properties</code> file of AS is scanned in order to check whether a certain
* technology is enabled or not.
*
* @author Franz-Josef Elmer
......@@ -98,7 +98,7 @@ public class SetTechnologyCheckBoxesAction implements PanelAction
String variable = data.getVariable(technology);
if (variable == null)
{
boolean technologyFlag = true;
boolean technologyFlag = false;
if (GlobalInstallationContext.isUpdateInstallation)
{
technologyFlag =
......
......@@ -18,8 +18,8 @@ package ch.systemsx.cisd.openbis.installer.izpack;
import static ch.systemsx.cisd.openbis.installer.izpack.GlobalInstallationContext.TECHNOLOGY_PROTEOMICS;
import static ch.systemsx.cisd.openbis.installer.izpack.GlobalInstallationContext.TECHNOLOGY_SCREENING;
import static ch.systemsx.cisd.openbis.installer.izpack.SetDisableTechnologiesVariableAction.DISABLED_CORE_PLUGINS_KEY;
import static ch.systemsx.cisd.openbis.installer.izpack.SetDisableTechnologiesVariableAction.ENABLED_TECHNOLOGIES_VARNAME;
import static ch.systemsx.cisd.openbis.installer.izpack.SetEnableTechnologiesVariableAction.DISABLED_CORE_PLUGINS_KEY;
import static ch.systemsx.cisd.openbis.installer.izpack.SetEnableTechnologiesVariableAction.ENABLED_TECHNOLOGIES_VARNAME;
import static ch.systemsx.cisd.openbis.installer.izpack.SetTechnologyCheckBoxesAction.ENABLED_TECHNOLOGIES_KEY;
import java.io.File;
......@@ -43,7 +43,7 @@ import ch.systemsx.cisd.common.filesystem.FileUtilities;
*
* @author Franz-Josef Elmer
*/
public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystemTestCase
public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemTestCase
{
private File configFile;
private File dssConfigFile;
......@@ -79,7 +79,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "true");
variables.setProperty(TECHNOLOGY_SCREENING, "false");
AutomatedInstallData data = updateDisabledTechnologyProperties(variables, true);
AutomatedInstallData data = updateEnabledTechnologyProperties(variables, true);
assertEquals("proteomics", data.getVariable(ENABLED_TECHNOLOGIES_VARNAME));
}
......@@ -91,7 +91,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "false");
variables.setProperty(TECHNOLOGY_SCREENING, "false");
AutomatedInstallData data = updateDisabledTechnologyProperties(variables, true);
AutomatedInstallData data = updateEnabledTechnologyProperties(variables, true);
assertEquals("", data.getVariable(ENABLED_TECHNOLOGIES_VARNAME));
}
......@@ -105,7 +105,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
try
{
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
fail("Exception expected.");
} catch (RuntimeException ex)
{
......@@ -124,7 +124,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "true");
variables.setProperty(TECHNOLOGY_SCREENING, "false");
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=proteomics]", FileUtilities
.loadToStringList(configFile).toString());
......@@ -139,7 +139,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "true");
variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = proteomics, screening, answer = 42]", FileUtilities
.loadToStringList(configFile).toString());
......@@ -155,7 +155,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "false");
variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = screening]", FileUtilities
.loadToStringList(configFile).toString());
......@@ -163,6 +163,23 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
.loadToStringList(dssConfigFile).toString());
}
@Test
public void testUpdateAppendPropertyWithEmptyDisabledCorePluginsProperty()
{
FileUtilities.writeToFile(configFile, "abc = 123");
FileUtilities.writeToFile(dssConfigFile, DISABLED_CORE_PLUGINS_KEY + "= ");
Properties variables = new Properties();
variables.setProperty(TECHNOLOGY_PROTEOMICS, "false");
variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = screening]", FileUtilities
.loadToStringList(configFile).toString());
assertEquals("[" + DISABLED_CORE_PLUGINS_KEY + " = proteomics]", FileUtilities
.loadToStringList(dssConfigFile).toString());
}
@Test
public void testUpdateDisabledPluginsForSwitchedTechnologies()
{
......@@ -173,7 +190,7 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "false");
variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
assertEquals("[a = b, " + DISABLED_CORE_PLUGINS_KEY + " = proteomics:a:b, proteomics, "
+ "gamma = alpha]", FileUtilities.loadToStringList(dssConfigFile).toString());
......@@ -189,14 +206,14 @@ public class SetDisableTechnologiesVariableActionTest extends AbstractFileSystem
variables.setProperty(TECHNOLOGY_PROTEOMICS, "false");
variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateDisabledTechnologyProperties(variables, false);
updateEnabledTechnologyProperties(variables, false);
}
private AutomatedInstallData updateDisabledTechnologyProperties(Properties variables,
private AutomatedInstallData updateEnabledTechnologyProperties(Properties variables,
boolean isFirstTimeInstallation)
{
InstallData data = new InstallData(variables, new VariableSubstitutorImpl(new Properties()));
SetDisableTechnologiesVariableAction action = new SetDisableTechnologiesVariableAction();
SetEnableTechnologiesVariableAction action = new SetEnableTechnologiesVariableAction();
action.updateEnabledTechnologyProperty(data, isFirstTimeInstallation, workingDirectory);
return data;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment