use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.
the class TestInitParamProfile method testFooBarProfiles.
public void testFooBarProfiles() throws Exception {
Configuration config = getConfiguration("init-param-configuration.xml", "foo", "bar");
Component component = config.getComponent("Component");
InitParams initParams = component.getInitParams();
ValueParam valueParam = initParams.getValueParam("param");
assertEquals("bar", valueParam.getValue());
}
use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.
the class PortalContainerConfig method initName.
/**
* Initialize the value of the portal container name
*/
private void initName(InitParams params, PortalContainerDefinition def) {
if (def.getName() == null || def.getName().trim().length() == 0) {
// The name is empty
// We first set the default value
def.setName(DEFAULT_PORTAL_CONTAINER_NAME);
if (params == null) {
return;
}
final ValueParam vp = params.getValueParam("default.portal.container");
if (vp != null && vp.getValue().trim().length() > 0) {
// A name has been defined in the value parameter, thus we use it
def.setName(Deserializer.resolveVariables(vp.getValue().trim()));
}
} else {
// We ensure that the name doesn't contain any useless characters
def.setName(def.getName().trim());
}
}
use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.
the class PortalContainerConfig method initRestContextName.
/**
* Initialize the value of the rest context name
*/
private void initRestContextName(InitParams params, PortalContainerDefinition def) {
if (def.getRestContextName() == null || def.getRestContextName().trim().length() == 0) {
// The rest context name is empty
// We first set the default value
def.setRestContextName(DEFAULT_REST_CONTEXT_NAME);
if (params == null) {
return;
}
final ValueParam vp = params.getValueParam("default.rest.context");
if (vp != null && vp.getValue().trim().length() > 0) {
// A rest context name has been defined in the value parameter, thus we use it
def.setRestContextName(Deserializer.resolveVariables(vp.getValue().trim()));
}
} else {
// We ensure that the rest context name doesn't contain any useless characters
def.setRestContextName(def.getRestContextName().trim());
}
}
use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.
the class TestPropertyManagerConfigurator method testFromPropertiesByParam.
public void testFromPropertiesByParam() throws Exception {
reset();
URL propertiesURL = TestPropertyManagerConfigurator.class.getResource("property-configurator.properties");
assertNotNull(propertiesURL);
System.setProperty("property_2", "property_value_2");
ValueParam propertiesPathParam = new ValueParam();
propertiesPathParam.setName("properties.url");
propertiesPathParam.setValue(propertiesURL.toString());
InitParams params = new InitParams();
params.put("properties.url", propertiesPathParam);
new PropertyConfigurator(params, new ConfigurationManagerImpl(new HashSet<String>()));
Map<String, String> additions = reset();
assertEquals("property_value_1", additions.get("property_1"));
assertEquals("property_value_2", additions.get("property_2"));
assertEquals("${property_3}", additions.get("property_3"));
assertEquals("property_value_1-property_value_2", additions.get("property_4"));
}
use of org.exoplatform.container.xml.ValueParam in project kernel by exoplatform.
the class TestConfigurationXML method assertValueParam.
private void assertValueParam(String expectedValue, Component component, String paramName) {
InitParams initParams = component.getInitParams();
assertNotNull(initParams);
ValueParam valueParam = initParams.getValueParam(paramName);
assertNotNull(paramName);
assertEquals(expectedValue, valueParam.getValue());
}
Aggregations