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

SSDM-2355: fixing bug and tests for SetEnableTechnologiesVariableAction

SVN: 34614
parent e1033d64
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,8 @@ import ch.systemsx.cisd.common.shared.basic.string.CommaSeparatedListBuilder; ...@@ -38,6 +38,8 @@ import ch.systemsx.cisd.common.shared.basic.string.CommaSeparatedListBuilder;
*/ */
public class SetEnableTechnologiesVariableAction implements PanelAction public class SetEnableTechnologiesVariableAction implements PanelAction
{ {
private static final String DROPBOX_MONITOR_MODULE = "dropbox-monitor";
static final String ENABLED_TECHNOLOGIES_VARNAME = "ENABLED_TECHNOLOGIES"; static final String ENABLED_TECHNOLOGIES_VARNAME = "ENABLED_TECHNOLOGIES";
private final SetTechnologyCheckBoxesAction technologyCheckBoxesAction = new SetTechnologyCheckBoxesAction(); private final SetTechnologyCheckBoxesAction technologyCheckBoxesAction = new SetTechnologyCheckBoxesAction();
...@@ -91,7 +93,8 @@ public class SetEnableTechnologiesVariableAction implements PanelAction ...@@ -91,7 +93,8 @@ public class SetEnableTechnologiesVariableAction implements PanelAction
{ {
Set<String> allTechnologies = new HashSet<String>(); Set<String> allTechnologies = new HashSet<String>();
CommaSeparatedListBuilder builder = new CommaSeparatedListBuilder(); CommaSeparatedListBuilder builder = new CommaSeparatedListBuilder();
builder.append("dropbox-monitor"); builder.append(DROPBOX_MONITOR_MODULE);
allTechnologies.add(DROPBOX_MONITOR_MODULE);
for (String technology : GlobalInstallationContext.TECHNOLOGIES) for (String technology : GlobalInstallationContext.TECHNOLOGIES)
{ {
String lowerCasedTechnology = technology.toLowerCase(); String lowerCasedTechnology = technology.toLowerCase();
......
...@@ -94,7 +94,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -94,7 +94,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
variables.setProperty(TECHNOLOGY_SCREENING, "true"); variables.setProperty(TECHNOLOGY_SCREENING, "true");
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[, enabled-modules = screening]", assertEquals("[, enabled-modules = dropbox-monitor, screening]",
FileUtilities.loadToStringList(corePluginsProperties).toString()); FileUtilities.loadToStringList(corePluginsProperties).toString());
} }
...@@ -102,14 +102,14 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -102,14 +102,14 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
public void testUpdateInstallationWithOtherEnabledTechnologiesInAs() public void testUpdateInstallationWithOtherEnabledTechnologiesInAs()
{ {
FileUtilities.writeToFile(corePluginsProperties, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY FileUtilities.writeToFile(corePluginsProperties, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY
+ "=proteomics, my-tech"); + "=dropbox-monitor, proteomics, my-tech");
Properties variables = new Properties(); Properties variables = new Properties();
variables.setProperty(TECHNOLOGY_PROTEOMICS, "true"); variables.setProperty(TECHNOLOGY_PROTEOMICS, "true");
variables.setProperty(TECHNOLOGY_SCREENING, "false"); variables.setProperty(TECHNOLOGY_SCREENING, "false");
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=proteomics, my-tech]", assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=dropbox-monitor, proteomics, my-tech]",
FileUtilities.loadToStringList(corePluginsProperties).toString()); FileUtilities.loadToStringList(corePluginsProperties).toString());
} }
...@@ -117,14 +117,14 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -117,14 +117,14 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
public void testUpdateUnchangedProperty() public void testUpdateUnchangedProperty()
{ {
FileUtilities.writeToFile(corePluginsProperties, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY FileUtilities.writeToFile(corePluginsProperties, "abc = 123\n" + ENABLED_TECHNOLOGIES_KEY
+ "=proteomics"); + "=dropbox-monitor, proteomics");
Properties variables = new Properties(); Properties variables = new Properties();
variables.setProperty(TECHNOLOGY_PROTEOMICS, "true"); variables.setProperty(TECHNOLOGY_PROTEOMICS, "true");
variables.setProperty(TECHNOLOGY_SCREENING, "false"); variables.setProperty(TECHNOLOGY_SCREENING, "false");
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=proteomics]", FileUtilities assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + "=dropbox-monitor, proteomics]", FileUtilities
.loadToStringList(corePluginsProperties).toString()); .loadToStringList(corePluginsProperties).toString());
} }
...@@ -139,7 +139,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -139,7 +139,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = proteomics, screening, answer = 42]", FileUtilities assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = dropbox-monitor, proteomics, screening, answer = 42]", FileUtilities
.loadToStringList(corePluginsProperties).toString()); .loadToStringList(corePluginsProperties).toString());
} }
...@@ -153,7 +153,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -153,7 +153,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = screening]", FileUtilities assertEquals("[abc = 123, " + ENABLED_TECHNOLOGIES_KEY + " = dropbox-monitor, screening]", FileUtilities
.loadToStringList(corePluginsProperties).toString()); .loadToStringList(corePluginsProperties).toString());
} }
...@@ -168,7 +168,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT ...@@ -168,7 +168,7 @@ public class SetEnableTechnologiesVariableActionTest extends AbstractFileSystemT
updateEnabledTechnologyProperties(variables, false); updateEnabledTechnologyProperties(variables, false);
assertEquals("[a = b, " + ENABLED_TECHNOLOGIES_KEY + " = screening, " assertEquals("[a = b, " + ENABLED_TECHNOLOGIES_KEY + " = dropbox-monitor, screening, "
+ "gamma = alpha]", FileUtilities.loadToStringList(corePluginsProperties).toString()); + "gamma = alpha]", FileUtilities.loadToStringList(corePluginsProperties).toString());
} }
......
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