KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > admin > security > SecurityImplTest


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: SecurityImplTest.java,v $
31  * Revision 1.4 2005/04/10 20:32:01 colinmacleod
32  * Added new themes.
33  * Changed id type to String.
34  * Changed i tag to em and b tag to strong.
35  * Improved PicoContainerFactory with NanoContainer scripts.
36  *
37  * Revision 1.3 2005/04/09 17:19:11 colinmacleod
38  * Changed copyright text to GPL v2 explicitly.
39  *
40  * Revision 1.2 2005/03/16 12:47:28 colinmacleod
41  * Fixed SecurityImpl constructor.
42  *
43  * Revision 1.1.1.1 2005/03/10 17:50:14 colinmacleod
44  * Restructured ivata op around Hibernate/PicoContainer.
45  * Renamed ivata groupware.
46  *
47  * Revision 1.4 2004/11/12 18:17:25 colinmacleod
48  * Ordered imports.
49  *
50  * Revision 1.3 2004/11/12 15:57:07 colinmacleod
51  * Removed dependencies on SSLEXT.
52  * Moved Persistence classes to ivata masks.
53  *
54  * Revision 1.2 2004/09/30 15:15:53 colinmacleod
55  * Split off addressbook elements into security subproject.
56  *
57  * Revision 1.1 2004/07/13 19:41:17 colinmacleod
58  * Moved project to POJOs from EJBs.
59  * Applied PicoContainer to services layer (replacing session EJBs).
60  * Applied Hibernate to persistence layer (replacing entity EJBs).
61  * -----------------------------------------------------------------------------
62  */

63 package com.ivata.groupware.admin.security;
64 import net.sf.hibernate.HibernateException;
65
66 import com.ivata.groupware.admin.AdminTestCase;
67 import com.ivata.groupware.admin.security.server.PlainTextSecurityServer;
68 import com.ivata.groupware.admin.security.server.SecurityServer;
69 import com.ivata.groupware.admin.security.server.SecuritySession;
70 import com.ivata.groupware.business.addressbook.person.PersonDO;
71 import com.ivata.groupware.container.persistence.QueryPersistenceManager;
72 import com.ivata.mask.DefaultMaskFactory;
73 import com.ivata.mask.field.DefaultFieldValueConvertorFactory;
74 import com.ivata.mask.persistence.PersistenceSession;
75 import com.ivata.mask.util.SystemException;
76
77 /**
78  * @author Colin MacLeod
79  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
80  * @since Jun 3, 2004
81  * @version $Revision: 1.4 $
82  */

83 public class SecurityImplTest extends AdminTestCase {
84
85     QueryPersistenceManager persistenceManager;
86     PersistenceSession persistenceSession;
87
88     PersonDO person = null;
89
90     /**
91      * <p>
92      * This is the implementation instance which will be tested.
93      * </p>
94      */

95     private SecurityImpl security;
96
97     /**
98      * Constructor for SecurityImplTest.
99      * @param arg0
100      */

101     public SecurityImplTest(String JavaDoc arg0) throws HibernateException {
102         super(arg0);
103     }
104     SecuritySession securitySession;
105
106     /*
107      * @see GroupwareTestCase#setUp()
108      */

109     protected synchronized void setUp() throws Exception JavaDoc {
110         super.setUp();
111         securitySession = getSecuritySession();
112         persistenceManager = getHibernateManager();
113         persistenceSession = getHibernateSession();
114         SecurityServer server = new PlainTextSecurityServer(persistenceManager);
115         security = new SecurityImpl(persistenceManager, server,
116                 new DefaultMaskFactory(), Boolean.FALSE);
117     }
118
119     /*
120      * @see GroupwareTestCase#tearDown()
121      */

122     protected void tearDown() throws Exception JavaDoc {
123         super.tearDown();
124         if (person != null) {
125             persistenceManager.remove(persistenceSession, person);
126         }
127     }
128
129     private PersonDO createTestPerson() throws SystemException {
130         person = new PersonDO();
131         person.setCompany("test company");
132         person.setFileAs("file as");
133         person.setFirstNames("first names");
134         person.setLastName("security test");
135         persistenceManager.add(persistenceSession, person);
136         return person;
137     }
138
139
140     public void testAddUserToPerson() throws SystemException {
141 /* TODO
142         PersonDO person = createTestPerson();
143
144         security.addUserToPerson(securitySession, person, "security test user", true);
145
146         String id = person.getId();
147         person = (PersonDO)
148             persistenceManager.findByPrimaryKey(persistenceSession, PersonDO.class,
149                     id);
150         assertEquals(id, person.getId());
151         UserDO user = (UserDO)
152             persistenceManager.findInstance(persistenceSession, "adminUserByName",
153                     new Object [] {"security test user"});
154         assertNotNull(user.getId());
155         assertEquals(person.getUser(), user);
156         assertEquals("security test user", user.getName());
157         assertTrue(user.isEnabled());
158         assertFalse(user.isDeleted());
159 */

160     }
161
162     public void testAmendUserName() throws SystemException {
163     }
164
165     public void testCheckPassword() {
166     }
167
168     public void testCreatePrivateGroups() {
169     }
170
171     public void testEnableUser() {
172     }
173
174     public void testFindUserByName() {
175     }
176
177     public void testGetSystemUserName() {
178     }
179
180     public void testGetUserNameFromSystemUserName() {
181     }
182
183     public void testIsUserEnabled() {
184     }
185
186     public void testLogin() {
187     }
188
189     public void testLoginAgain() {
190     }
191
192     public void testLoginGuest() {
193     }
194
195     public void testRemoveUser() {
196     }
197
198     public void testRestoreUser() {
199     }
200
201     public void testSetPassword() {
202     }
203
204 }
205
Popular Tags