01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.terracotta.session.util;
05:
06: import com.tc.object.bytecode.Manager;
07:
08: import junit.framework.TestCase;
09:
10: public class DefaultSessionIdTest extends TestCase {
11:
12: public final void testConstruction() {
13: final String id = "SomeSessionId";
14: DefaultSessionId sid = new DefaultSessionId(id, null, id,
15: Manager.LOCK_TYPE_WRITE, false);
16: assertNull(sid.getRequestedId());
17: assertEquals(id, sid.getKey());
18: assertEquals(id, sid.getExternalId());
19: assertFalse(sid.isServerHop());
20: assertTrue(sid.isNew());
21:
22: sid = new DefaultSessionId(id, id, id, Manager.LOCK_TYPE_WRITE,
23: false);
24: assertEquals(id, sid.getRequestedId());
25: assertEquals(id, sid.getExternalId());
26: assertEquals(id, sid.getKey());
27: assertFalse(sid.isServerHop());
28: assertFalse(sid.isNew());
29:
30: sid = new DefaultSessionId(id, id + id, id,
31: Manager.LOCK_TYPE_WRITE, true);
32: assertEquals(id + id, sid.getRequestedId());
33: assertEquals(id, sid.getExternalId());
34: assertEquals(id, sid.getKey());
35: assertTrue(sid.isServerHop());
36: assertFalse(sid.isNew());
37: }
38: }
|