01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
03: * Steven Grimm <koreth[remove] at midwinter dot com>
04: * Distributed under the terms of either:
05: * - the common development and distribution license (CDDL), v1.0; or
06: * - the GNU Lesser General Public License, v2.1 or later
07: * $Id: TestMemorySessions.java 3308 2006-06-15 18:54:14Z gbevin $
08: */
09: package com.uwyn.rife.authentication.sessionvalidators;
10:
11: import com.uwyn.rife.authentication.SessionValidator;
12: import com.uwyn.rife.ioc.HierarchicalProperties;
13: import junit.framework.TestCase;
14:
15: public class TestSimpleSessionValidatorFactory extends TestCase {
16: private SimpleSessionValidatorFactory mFactory = null;
17: private HierarchicalProperties mProperties = null;
18:
19: public TestSimpleSessionValidatorFactory(String name) {
20: super (name);
21: }
22:
23: public void setUp() {
24: // For most of our tests we'll use a BasicSessionValidator.
25: mProperties = new HierarchicalProperties();
26: mProperties
27: .put(
28: SimpleSessionValidatorFactory.PROPERTYNAME_MANAGER_CLASS,
29: BasicSessionValidator.class.getName());
30:
31: mFactory = new SimpleSessionValidatorFactory();
32: }
33:
34: public void testInstantiation() {
35: SessionValidator sessions = null;
36:
37: sessions = new SimpleSessionValidatorFactory()
38: .getValidator(mProperties);
39:
40: assertNotNull(sessions);
41: assertTrue(sessions instanceof BasicSessionValidator);
42: }
43:
44: public void testNotSingleton() {
45: SessionValidator v1, v2;
46:
47: v1 = mFactory.getValidator(mProperties);
48: v2 = mFactory.getValidator(mProperties);
49:
50: assertNotSame(v1, v2);
51: }
52: }
|