KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > portal > test > TestSkinConfigService


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.services.portal.test;
6
7
8 import java.io.InputStream JavaDoc;
9 import java.net.URL JavaDoc;
10 import java.util.* ;
11 import org.exoplatform.container.PortalContainer;
12 import org.exoplatform.services.portal.skin.SkinConfigService;
13 import org.exoplatform.services.portal.skin.model.*;
14 import org.exoplatform.test.BasicTestCase;
15
16 /**
17  * Thu, May 15, 2003 @
18  * @author: Tuan Nguyen
19  * @version: $Id: TestSkinConfigService.java,v 1.7 2004/07/24 16:34:06 tuan08 Exp $
20  * @since: 0.0
21  * @email: tuan08@yahoo.com
22  */

23 public class TestSkinConfigService extends BasicTestCase {
24   static protected SkinConfigService service_ ;
25
26   public TestSkinConfigService(String JavaDoc name) {
27     super(name);
28   }
29
30   public void setUp() throws Exception JavaDoc {
31     if (service_ == null) {
32       PortalContainer manager = PortalContainer.getInstance();
33       service_ =
34         (SkinConfigService) manager.getComponentInstanceOfType(SkinConfigService.class) ;
35     }
36   }
37
38   public void tearDown() throws Exception JavaDoc {
39   }
40   
41   public void testService() throws Exception JavaDoc {
42     
43     URL JavaDoc url = new URL JavaDoc("file:./src/test/org/exoplatform/services/portal/test/skin.xml");
44     InputStream JavaDoc is = url.openStream() ;
45     service_.addConfiguration(is) ;
46     
47     Decorator decorator = service_.getPageDecorator("default");
48     assertTrue("Expect decorator is found", decorator != null) ;
49     Collection list = service_.getPageDecorators();
50     assertEquals("Expect 1 decorator in the list", 1, list.size()) ;
51
52     
53     decorator = service_.getContainerDecorator("default");
54     assertTrue("Expect rendere info is found", decorator != null) ;
55     list = service_.getContainerDecorators();
56     assertEquals("Expect 3 decorators in the list", 3, list.size()) ;
57
58     decorator = service_.getPortletDecorator("default");
59     assertTrue("Expect decorator is found", decorator != null) ;
60     list = service_.getPortletDecorators();
61     assertEquals("Expect 4 Renderer info in the list", 3, list.size()) ;
62     
63     list = service_.getPortletStyles("default") ;
64     assertEquals("Expect 1 porlet style config in the list", 2, list.size()) ;
65     Style style = service_.getPortletStyle("default", "exo") ;
66     assertTrue("Expect style is found", style != null) ;
67   }
68   
69   protected String JavaDoc getDescription() {
70     return "Test Portal Configuration service" ;
71   }
72 }
Popular Tags