1 5 package org.exoplatform.services.portal.test; 6 7 8 import java.io.InputStream ; 9 import java.net.URL ; 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 23 public class TestSkinConfigService extends BasicTestCase { 24 static protected SkinConfigService service_ ; 25 26 public TestSkinConfigService(String name) { 27 super(name); 28 } 29 30 public void setUp() throws Exception { 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 { 39 } 40 41 public void testService() throws Exception { 42 43 URL url = new URL ("file:./src/test/org/exoplatform/services/portal/test/skin.xml"); 44 InputStream 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 getDescription() { 70 return "Test Portal Configuration service" ; 71 } 72 } | Popular Tags |