Skip to content
Snippets Groups Projects
Commit 793e66d3 authored by cramakri's avatar cramakri
Browse files

BIS-224 SP-531 : Fixed broken test

SVN: 28524
parent 34f94475
No related branches found
No related tags found
No related merge requests found
...@@ -27,8 +27,6 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.Constants; ...@@ -27,8 +27,6 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.Constants;
import ch.systemsx.cisd.openbis.dss.generic.shared.dto.PluginServletConfig; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.PluginServletConfig;
/** /**
*
*
* @author Franz-Josef Elmer * @author Franz-Josef Elmer
*/ */
public class ConfigParametersTest extends AssertJUnit public class ConfigParametersTest extends AssertJUnit
...@@ -37,7 +35,7 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -37,7 +35,7 @@ public class ConfigParametersTest extends AssertJUnit
public void testMinimumConfig() public void testMinimumConfig()
{ {
ConfigParameters configParameters = new ConfigParameters(createMandatoryProperties()); ConfigParameters configParameters = new ConfigParameters(createMandatoryProperties());
assertEquals("store", configParameters.getStorePath().getPath()); assertEquals("store", configParameters.getStorePath().getPath());
assertEquals(4711, configParameters.getPort()); assertEquals(4711, configParameters.getPort());
assertEquals("my-url", configParameters.getServerURL()); assertEquals("my-url", configParameters.getServerURL());
...@@ -51,11 +49,11 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -51,11 +49,11 @@ public class ConfigParametersTest extends AssertJUnit
configParameters.getAuthCacheCleanupTimerPeriodMins()); configParameters.getAuthCacheCleanupTimerPeriodMins());
assertEquals(ConfigParameters.DEFAULT_AUTH_CACHE_EXPIRATION_TIME_MINS, assertEquals(ConfigParameters.DEFAULT_AUTH_CACHE_EXPIRATION_TIME_MINS,
configParameters.getAuthCacheExpirationTimeMins()); configParameters.getAuthCacheExpirationTimeMins());
assertEquals(0, configParameters.getPluginServlets().size()); assertEquals(1, configParameters.getPluginServlets().size());
assertEquals(ConfigParameters.WEBSTART_JAR_PATH_DEFAULT, assertEquals(ConfigParameters.WEBSTART_JAR_PATH_DEFAULT,
configParameters.getWebstartJarPath()); configParameters.getWebstartJarPath());
} }
@Test @Test
public void testPluginServices() public void testPluginServices()
{ {
...@@ -67,16 +65,16 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -67,16 +65,16 @@ public class ConfigParametersTest extends AssertJUnit
properties.setProperty("s2." + ConfigParameters.PLUGIN_SERVICE_PATH_KEY, "path2"); properties.setProperty("s2." + ConfigParameters.PLUGIN_SERVICE_PATH_KEY, "path2");
properties.setProperty("s2.a", "alpha"); properties.setProperty("s2.a", "alpha");
ConfigParameters configParameters = new ConfigParameters(properties); ConfigParameters configParameters = new ConfigParameters(properties);
List<PluginServletConfig> pluginServlets = configParameters.getPluginServlets(); List<PluginServletConfig> pluginServlets = configParameters.getPluginServlets();
assertEquals("class1", pluginServlets.get(0).getServletClass()); assertEquals("class1", pluginServlets.get(1).getServletClass());
assertEquals("path1", pluginServlets.get(0).getServletPath()); assertEquals("path1", pluginServlets.get(1).getServletPath());
assertEquals("class2", pluginServlets.get(1).getServletClass()); assertEquals("class2", pluginServlets.get(2).getServletClass());
assertEquals("path2", pluginServlets.get(1).getServletPath()); assertEquals("path2", pluginServlets.get(2).getServletPath());
assertTrue(pluginServlets.get(1).getServletProperties().containsKey("a")); assertTrue(pluginServlets.get(2).getServletProperties().containsKey("a"));
assertEquals(2, pluginServlets.size()); assertEquals(3, pluginServlets.size());
} }
@Test @Test
public void testPluginServicesWithDuplicatedPath() public void testPluginServicesWithDuplicatedPath()
{ {
...@@ -97,21 +95,22 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -97,21 +95,22 @@ public class ConfigParametersTest extends AssertJUnit
+ "configured for the path 'path1'.", ex.getMessage()); + "configured for the path 'path1'.", ex.getMessage());
} }
} }
@Test @Test
public void testAddServletProperties() public void testAddServletProperties()
{ {
ConfigParameters configParameters = new ConfigParameters(createMandatoryProperties()); ConfigParameters configParameters = new ConfigParameters(createMandatoryProperties());
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty(ConfigParameters.PLUGIN_SERVICE_CLASS_KEY, "class1"); properties.setProperty(ConfigParameters.PLUGIN_SERVICE_CLASS_KEY, "class1");
properties.setProperty(ConfigParameters.PLUGIN_SERVICE_PATH_KEY, "path1"); properties.setProperty(ConfigParameters.PLUGIN_SERVICE_PATH_KEY, "path1");
configParameters.addServletProperties("my-servlet", properties); configParameters.addServletProperties("my-servlet", properties);
List<PluginServletConfig> pluginServlets = configParameters.getPluginServlets(); List<PluginServletConfig> pluginServlets = configParameters.getPluginServlets();
assertEquals("class1", pluginServlets.get(0).getServletClass()); // System-injected servlets come first. Of these, there are one.
assertEquals("path1", pluginServlets.get(0).getServletPath()); assertEquals("class1", pluginServlets.get(1).getServletClass());
assertEquals(1, pluginServlets.size()); assertEquals("path1", pluginServlets.get(1).getServletPath());
assertEquals(2, pluginServlets.size());
} }
@Test @Test
...@@ -136,7 +135,7 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -136,7 +135,7 @@ public class ConfigParametersTest extends AssertJUnit
+ "configured for the path 'path1'.", ex.getMessage()); + "configured for the path 'path1'.", ex.getMessage());
} }
} }
private Properties createMandatoryProperties() private Properties createMandatoryProperties()
{ {
Properties properties = new Properties(); Properties properties = new Properties();
...@@ -150,6 +149,5 @@ public class ConfigParametersTest extends AssertJUnit ...@@ -150,6 +149,5 @@ public class ConfigParametersTest extends AssertJUnit
properties.setProperty(ConfigParameters.KEYSTORE_KEY_PASSWORD_KEY, "key-store-key-password"); properties.setProperty(ConfigParameters.KEYSTORE_KEY_PASSWORD_KEY, "key-store-key-password");
return properties; return properties;
} }
} }
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