1 5 package org.exoplatform.container.configuration.test; 6 7 import org.exoplatform.container.PortalContainer; 8 import org.exoplatform.container.RootContainer ; 9 import org.exoplatform.test.BasicTestCase; 10 import org.exoplatform.container.configuration.*; 11 import org.exoplatform.container.monitor.jvm.JVMRuntimeInfo; 12 19 public class TestConfigurationService extends BasicTestCase { 20 private ConfigurationManager service_ ; 21 22 public TestConfigurationService(String name) { 23 super(name); 24 } 25 26 public void setUp() throws Exception { 27 PortalContainer manager = PortalContainer.getInstance(); 28 service_ = (ConfigurationManager) manager.getComponentInstanceOfType(ConfigurationManager.class) ; 29 } 30 31 public void testConfigurationService() throws Exception { 32 ValuesParam param = service_.getGlobalInitParam("smtp.mail.server") ; 33 assertEquals("mail server", "localhost", param.getValue()); 34 ServiceConfiguration sconf = 35 service_.getServiceConfiguration("org.exoplatform.container.mocks.MockService") ; 36 ObjectParam objParam = sconf.getObjectParam("new.user.configuration") ; 37 objParam.getObject() ; 38 } 39 40 public void testJVMEnvironment() throws Exception { 41 JVMRuntimeInfo jvm = 42 (JVMRuntimeInfo)RootContainer.getInstance().getComponentInstanceOfType(JVMRuntimeInfo.class) ; 43 System.out.println(jvm.getSystemPropertiesAsText()) ; 44 } 45 46 protected String getDescription() { 47 return "Test Configuration Service" ; 48 } 49 } 50 | Popular Tags |