1 package org.melati.poem.test;
2
3 import java.util.Enumeration;
4
5 import org.melati.poem.AccessPoemException;
6 import org.melati.poem.AlreadyInSessionPoemException;
7 import org.melati.poem.Capability;
8 import org.melati.poem.Column;
9 import org.melati.poem.PoemThread;
10 import org.melati.poem.transaction.ToTidyList;
11
12
13
14
15
16
17 public class PoemThreadTest extends PoemTestCase {
18
19 public PoemThreadTest(String name) {
20 super(name);
21 }
22
23 protected void setUp() throws Exception {
24 super.setUp();
25 }
26
27 protected void tearDown() throws Exception {
28 super.tearDown();
29 }
30
31
32
33
34 public void testAlreadyInSession() {
35 try {
36 getDb().beginSession(PoemThread.accessToken());
37 fail("Should have blown up");
38 } catch (AlreadyInSessionPoemException e) {
39 e = null;
40 }
41 }
42
43
44
45
46
47 public void testOpenSessions() {
48 assertEquals(1, PoemThread.openSessions().size());
49 }
50
51
52
53
54 public void testToTidy() {
55 ToTidyList list = PoemThread.toTidy();
56 Enumeration<Object> en = list.elements();
57 int count = 0;
58 while (en.hasMoreElements()) {
59 count++;
60 en.nextElement();
61 }
62 assertEquals(0, count);
63 }
64
65
66
67
68 public void testTransaction() {
69
70 }
71
72
73
74
75 public void testInSession() {
76
77 }
78
79
80
81
82 public void testAccessToken() {
83
84 }
85
86
87
88
89
90 public void testSetAccessToken() {
91
92 }
93
94
95
96
97
98 public void testWithAccessToken() {
99
100 }
101
102
103
104
105
106
107 public void testAssertHasCapability() {
108 Column<?> c = getDb().getCapabilityTable().getNameColumn();
109 Capability canWrite = (Capability)c.firstWhereEq("canRead");
110 assertNotNull(canWrite);
111 PoemThread.assertHasCapability(canWrite);
112 PoemThread.assertHasCapability(null);
113 PoemThread.setAccessToken(getDb().guestAccessToken());
114 try {
115 PoemThread.assertHasCapability(canWrite);
116 fail("Should have blown up");
117 } catch (AccessPoemException e) {
118 e = null;
119 }
120 }
121
122
123
124
125 public void testDatabase() {
126
127 }
128
129
130
131
132 public void testWriteDown() {
133
134 }
135
136
137
138
139 public void testCommit() {
140
141 }
142
143
144
145
146 public void testRollback() {
147
148 }
149
150 }