KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > wsrp > test > TestPersistentStateManager


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 package org.exoplatform.services.wsrp.test;
6
7 import org.exoplatform.container.PortalContainer;
8 import org.exoplatform.services.wsrp.producer.*;
9 import org.exoplatform.services.wsrp.producer.impl.PersistentStateManagerImpl;
10 import org.exoplatform.services.wsrp.producer.impl.StateData;
11 import org.exoplatform.services.wsrp.type.*;
12 /*
13  * @author Mestrallet Benjamin
14  * benjmestrallet@users.sourceforge.net
15  * Date: 25 janv. 2004
16  * Time: 19:29:55
17  */

18
19 public class TestPersistentStateManager extends BaseTest{
20   private PersistentStateManagerImpl psmanager_ ;
21
22   public TestPersistentStateManager(String JavaDoc s) {
23     super(s);
24   }
25
26   public void setUp() throws Exception JavaDoc {
27     super.setUp() ;
28     PortalContainer manager = PortalContainer.getInstance();
29     psmanager_ = (PersistentStateManagerImpl) manager.
30         getComponentInstanceOfType(PersistentStateManager.class);
31   }
32   
33   public void testPersistentStateData() throws Exception JavaDoc {
34     RegistrationData registrationData = new RegistrationData();
35     registrationData.setConsumerName("www.exoplatform.com");
36     registrationData.setConsumerAgent("exoplatform.1.0");
37     registrationData.setMethodGetSupported(false);
38     registrationData.setConsumerModes(CONSUMER_MODES);
39     registrationData.setConsumerWindowStates(CONSUMER_STATES);
40     registrationData.setConsumerUserScopes(CONSUMER_SCOPES);
41     registrationData.setCustomUserProfileData(CONSUMER_CUSTOM_PROFILES);
42     registrationData.setRegistrationProperties(null);//allows extension of the specs
43
registrationData.setExtensions(null);//allows extension of the specs
44

45     psmanager_.save("test" , "RegistrationData" , registrationData) ;
46
47     StateData data = psmanager_.load("test");
48     assertTrue("Expect data is not null", data != null ) ;
49
50     psmanager_.remove("test");
51     data = psmanager_.load("test");
52     assertTrue("Expect data is null", data == null ) ;
53   }
54 }
55
Popular Tags