Search in sources :

Example 1 with InitParams

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"));
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) PropertiesParam(org.exoplatform.container.xml.PropertiesParam) ConfigurationManagerImpl(org.exoplatform.container.configuration.ConfigurationManagerImpl) URL(java.net.URL) HashSet(java.util.HashSet)

Example 2 with InitParams

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);
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) PropertiesParam(org.exoplatform.container.xml.PropertiesParam) ConfigurationManagerImpl(org.exoplatform.container.configuration.ConfigurationManagerImpl) HashSet(java.util.HashSet)

Example 3 with InitParams

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"));
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) PropertiesParam(org.exoplatform.container.xml.PropertiesParam) ConfigurationManagerImpl(org.exoplatform.container.configuration.ConfigurationManagerImpl) URL(java.net.URL) HashSet(java.util.HashSet)

Example 4 with InitParams

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();
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) ObjectParameter(org.exoplatform.container.xml.ObjectParameter) RootContainer(org.exoplatform.container.RootContainer)

Example 5 with InitParams

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();
}
Also used : InitParams(org.exoplatform.container.xml.InitParams) ValueParam(org.exoplatform.container.xml.ValueParam) ConfigurationManager(org.exoplatform.container.configuration.ConfigurationManager) RPCServiceImpl(org.exoplatform.services.rpc.jgv3.RPCServiceImpl) Before(org.junit.Before)

Aggregations

InitParams (org.exoplatform.container.xml.InitParams)26 ValueParam (org.exoplatform.container.xml.ValueParam)16 RPCServiceImpl (org.exoplatform.services.rpc.jgv3.RPCServiceImpl)7 HashSet (java.util.HashSet)5 ConfigurationManagerImpl (org.exoplatform.container.configuration.ConfigurationManagerImpl)5 Component (org.exoplatform.container.xml.Component)5 PropertiesParam (org.exoplatform.container.xml.PropertiesParam)5 RemoteCommand (org.exoplatform.services.rpc.RemoteCommand)5 URL (java.net.URL)4 ArrayList (java.util.ArrayList)4 ObjectParameter (org.exoplatform.container.xml.ObjectParameter)4 RPCException (org.exoplatform.services.rpc.RPCException)4 ConfigurationManager (org.exoplatform.container.configuration.ConfigurationManager)3 Configuration (org.exoplatform.container.xml.Configuration)3 Serializable (java.io.Serializable)2 DataSource (javax.sql.DataSource)2 RootContainer (org.exoplatform.container.RootContainer)2 DataSourceProvider (org.exoplatform.services.jdbc.DataSourceProvider)2 MemberHasLeftException (org.exoplatform.services.rpc.impl.AbstractRPCService.MemberHasLeftException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1