Search in sources :

Example 11 with ConfigurationManagerImpl

use of org.exoplatform.container.configuration.ConfigurationManagerImpl in project kernel by exoplatform.

the class TestTemplateConfigurationHelper method testFilters.

public void testFilters() {
    // create helper with predefined include and exclude patterns
    TemplateConfigurationHelper helper = new TemplateConfigurationHelper(new String[] { "^foo-.*", "^jgroups-configuration" }, new String[] { "^foo-configuration" }, new ConfigurationManagerImpl());
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("foo-configuration", "");
    parameters.put("foo-cache.loader", "");
    parameters.put("foo-clustername", "");
    parameters.put("max-volatile-size", "");
    Map<String, String> preparedParameters = helper.prepareParameters(parameters);
    assertEquals(2, preparedParameters.size());
    // "foo-configuration" and "max-volatile-size" should be excluded
    assertFalse(preparedParameters.containsKey("${foo-configuration}"));
    assertFalse(preparedParameters.containsKey("${max-volatile-size}"));
    assertTrue(preparedParameters.containsKey("${foo-cache.loader}"));
    assertTrue(preparedParameters.containsKey("${foo-clustername}"));
}
Also used : HashMap(java.util.HashMap) ConfigurationManagerImpl(org.exoplatform.container.configuration.ConfigurationManagerImpl)

Aggregations

ConfigurationManagerImpl (org.exoplatform.container.configuration.ConfigurationManagerImpl)11 URL (java.net.URL)5 HashSet (java.util.HashSet)5 InitParams (org.exoplatform.container.xml.InitParams)5 PropertiesParam (org.exoplatform.container.xml.PropertiesParam)4 HashMap (java.util.HashMap)3 MockConfigurationManagerImpl (org.exoplatform.test.MockConfigurationManagerImpl)3 File (java.io.File)2 PrivilegedActionException (java.security.PrivilegedActionException)2 J2EEServerInfo (org.exoplatform.container.monitor.jvm.J2EEServerInfo)2 ContainerException (org.exoplatform.container.spi.ContainerException)2 MockServletContext (org.exoplatform.test.MockServletContext)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ServletContext (javax.servlet.ServletContext)1 ConfigurationManager (org.exoplatform.container.configuration.ConfigurationManager)1 Configuration (org.exoplatform.container.xml.Configuration)1 ValueParam (org.exoplatform.container.xml.ValueParam)1