use of org.exoplatform.container.xml.Configuration 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.Configuration in project kernel by exoplatform.
the class TestConfigurationXML method testSystemPropertyResolving.
public void testSystemPropertyResolving() throws Exception {
System.setProperty("c_value", "c_external_value");
System.setProperty("d_value", "d_external_value");
System.setProperty("false_value", "false");
System.setProperty("true_value", "true");
System.setProperty("FALSE_value", "FALSE");
System.setProperty("TRUE_value", "TRUE");
System.setProperty("integer_value", "5");
System.setProperty("long_value", "41");
System.setProperty("double_value", "172.5");
//
IBindingFactory bfact = BindingDirectory.getFactory(XMLObject.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
URL url = TestConfigurationXML.class.getResource("../../../../test-resolved-property.xml");
Configuration conf = (Configuration) uctx.unmarshalDocument(url.openStream(), null);
assertNotNull(conf);
//
Component component = conf.getComponent("component");
assertNotNull(component);
//
assertValueParam("a_value", component, "a");
assertValueParam("${b_value}", component, "b");
assertValueParam("c_external_value", component, "c");
assertValueParam("_d_external_value_", component, "d");
//
assertPropertyParam("a_value", component, "e", "e_a");
assertPropertyParam("${b_value}", component, "e", "e_b");
assertPropertyParam("c_external_value", component, "e", "e_c");
assertPropertyParam("_d_external_value_", component, "e", "e_d");
//
ObjectParameter o = component.getInitParams().getObjectParam("f");
assertNotNull(o);
Person p = (Person) o.getObject();
assertNotNull(p);
assertEquals("a_value", p.address_a);
assertEquals("${b_value}", p.address_b);
assertEquals("c_external_value", p.address_c);
assertEquals("_d_external_value_", p.address_d);
assertEquals(true, p.male_a);
assertEquals(false, p.male_b);
assertEquals(true, p.male_c);
assertEquals(false, p.male_d);
assertEquals(true, p.male_e);
assertEquals(false, p.male_f);
assertEquals(4, p.age_a);
assertEquals(5, p.age_b);
assertEquals(40, p.weight_a);
assertEquals(41, p.weight_b);
assertEquals(172.4D, p.size_a);
assertEquals(172.5D, p.size_b);
}
Aggregations