use of org.exoplatform.container.xml.InitParams in project kernel by exoplatform.
the class TestPropertyManagerConfigurator method testFromProperties.
public void testFromProperties() throws Exception {
reset();
URL propertiesURL = TestPropertyManagerConfigurator.class.getResource("property-configurator.properties");
assertNotNull(propertiesURL);
System.setProperty(PropertyManager.PROPERTIES_URL, propertiesURL.toString());
System.setProperty("property_2", "property_value_2");
PropertiesParam propertiesParam = new PropertiesParam();
InitParams params = new InitParams();
params.put("properties", propertiesParam);
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.InitParams in project kernel by exoplatform.
the class TestPropertyManagerConfigurator method testSimple.
public void testSimple() {
reset();
PropertiesParam propertiesParam = new PropertiesParam();
propertiesParam.setProperty("property_1", "property_value_1");
InitParams params = new InitParams();
params.put("properties", propertiesParam);
new PropertyConfigurator(params, new ConfigurationManagerImpl(new HashSet<String>()));
Map<String, String> additions = reset();
assertEquals(Collections.singletonMap("property_1", "property_value_1"), additions);
}
use of org.exoplatform.container.xml.InitParams in project kernel by exoplatform.
the class TestPropertyManagerConfigurator method testFromPropertiesSkipBracket.
public void testFromPropertiesSkipBracket() throws Exception {
reset();
URL propertiesURL = TestPropertyManagerConfigurator.class.getResource("property-configurator.properties");
assertNotNull(propertiesURL);
System.setProperty(PropertyManager.PROPERTIES_URL, propertiesURL.toString());
PropertiesParam propertiesParam = new PropertiesParam();
InitParams params = new InitParams();
params.put("properties", propertiesParam);
new PropertyConfigurator(params, new ConfigurationManagerImpl(new HashSet<String>()));
Map<String, String> additions = reset();
assertEquals("property {0} value {1}", additions.get("property_5"));
assertEquals("property_value_1-property {0} value {1}", additions.get("property_6"));
}
use of org.exoplatform.container.xml.InitParams in project kernel by exoplatform.
the class TestCollectionValue method getCollection.
private List getCollection(String... profiles) throws Exception {
RootContainer config = getKernel("collection-configuration.xml", profiles);
InitParamsHolder holder = (InitParamsHolder) config.getComponentInstanceOfType(InitParamsHolder.class);
InitParams params = holder.getParams();
ObjectParameter op = params.getObjectParam("test.configuration");
ConfigParam cp = (ConfigParam) op.getObject();
return cp.getRole();
}
use of org.exoplatform.container.xml.InitParams in project kernel by exoplatform.
the class TestSimpleReplicatedExoCache method init.
@Before
public void init() throws Exception {
container = PortalContainer.getInstance();
ConfigurationManager configManager = container.getComponentInstanceOfType(ConfigurationManager.class);
InitParams params = new InitParams();
ValueParam paramConf = new ValueParam();
paramConf.setName("jgroups-configuration");
paramConf.setValue("jar:/conf/portal/udp.xml");
params.addParameter(paramConf);
service1 = new RPCServiceImpl(container.getContext(), params, configManager);
service2 = new RPCServiceImpl(container.getContext(), params, configManager);
cache1 = new SimpleReplicatedExoCache<String, String>(container.getContext(), service1);
cache2 = new SimpleReplicatedExoCache<String, String>(container.getContext(), service2);
cache1.setName("TestSimpleReplicatedExoCache");
cache2.setName("TestSimpleReplicatedExoCache");
service1.start();
service2.start();
}
Aggregations