KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > container > configuration > test > TestConfigurationService


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

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 /*
13  * Thu, May 15, 2003 @
14  * @author: Tuan Nguyen
15  * @version: $Id: TestConfigurationService.java,v 1.5 2004/10/29 01:55:23 tuan08 Exp $
16  * @since: 0.0
17  * @email: tuan08@yahoo.com
18  */

19 public class TestConfigurationService extends BasicTestCase {
20     private ConfigurationManager service_ ;
21   
22   public TestConfigurationService(String JavaDoc name) {
23     super(name);
24   }
25
26   public void setUp() throws Exception JavaDoc {
27     PortalContainer manager = PortalContainer.getInstance();
28     service_ = (ConfigurationManager) manager.getComponentInstanceOfType(ConfigurationManager.class) ;
29   }
30
31   public void testConfigurationService() throws Exception JavaDoc {
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 JavaDoc {
41     JVMRuntimeInfo jvm =
42       (JVMRuntimeInfo)RootContainer.getInstance().getComponentInstanceOfType(JVMRuntimeInfo.class) ;
43     System.out.println(jvm.getSystemPropertiesAsText()) ;
44   }
45   
46   protected String JavaDoc getDescription() {
47     return "Test Configuration Service" ;
48   }
49 }
50
Popular Tags