KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > terracotta > session > util > DefaultSessionIdTest


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.terracotta.session.util;
5
6 import com.tc.object.bytecode.Manager;
7
8 import junit.framework.TestCase;
9
10 public class DefaultSessionIdTest extends TestCase {
11
12   public final void testConstruction() {
13     final String JavaDoc id = "SomeSessionId";
14     DefaultSessionId sid = new DefaultSessionId(id, null, id, Manager.LOCK_TYPE_WRITE);
15     assertNull(sid.getRequestedId());
16     assertEquals(id, sid.getKey());
17     assertEquals(id, sid.getExternalId());
18     assertFalse(sid.isServerHop());
19     assertTrue(sid.isNew());
20
21     sid = new DefaultSessionId(id, id, id, Manager.LOCK_TYPE_WRITE);
22     assertEquals(id, sid.getRequestedId());
23     assertEquals(id, sid.getExternalId());
24     assertEquals(id, sid.getKey());
25     assertFalse(sid.isServerHop());
26     assertFalse(sid.isNew());
27
28     sid = new DefaultSessionId(id, id + id, id, Manager.LOCK_TYPE_WRITE);
29     assertEquals(id + id, sid.getRequestedId());
30     assertEquals(id, sid.getExternalId());
31     assertEquals(id, sid.getKey());
32     assertTrue(sid.isServerHop());
33     assertFalse(sid.isNew());
34   }
35 }
36
Popular Tags