KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > wsrp > testConsumer > TestPortletRegistry


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

5
6 package org.exoplatform.services.wsrp.testConsumer;
7
8 import org.exoplatform.services.wsrp.consumer.WSRPPortlet;
9 import org.exoplatform.services.wsrp.exceptions.WSRPException;
10 import org.exoplatform.services.wsrp.type.PortletContext;
11
12 /*
13  * @author Mestrallet Benjamin
14  * benjmestrallet@users.sourceforge.net
15  * Date: 5 févr. 2004
16  * Time: 11:07:10
17  */

18
19 public class TestPortletRegistry extends BaseTest{
20
21   public void testAddPortlet() throws WSRPException {
22     PortletContext portletContext = new PortletContext();
23     portletContext.setPortletHandle("hello/AppletClient");
24     WSRPPortlet p = createPortlet("hello/AppletClient", null, portletContext);
25     portletRegistry.addPortlet(p);
26     assertTrue(portletRegistry.existsPortlet(p.getPortletKey()));
27     assertTrue(portletRegistry.getAllPortlets().hasNext());
28     portletRegistry.removePortlet(p.getPortletKey());
29     assertFalse(portletRegistry.getAllPortlets().hasNext());
30   }
31
32   public void testRemoveAll() throws WSRPException {
33     PortletContext portletContext = new PortletContext();
34     portletContext.setPortletHandle("hello/AppletClient");
35     WSRPPortlet p = createPortlet("hello/AppletClient", null, portletContext);
36     portletRegistry.addPortlet(p);
37     portletRegistry.removeAllPortlets();
38     assertFalse(portletRegistry.getAllPortlets().hasNext());
39   }
40
41 }
Popular Tags