01: // Copyright 2004, 2005 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package hivemind.test.services;
16:
17: import hivemind.test.FrameworkTestCase;
18:
19: import org.apache.hivemind.service.ThreadLocalStorage;
20: import org.apache.hivemind.service.impl.ThreadLocalStorageImpl;
21:
22: /**
23: * Tests for {@link org.apache.hivemind.service.impl.ThreadLocalStorageImpl}.
24: *
25: * @author Howard Lewis Ship, Harish Krishnaswamy
26: */
27: public class TestThreadLocalStorage extends FrameworkTestCase {
28: private ThreadLocalStorage _s = new ThreadLocalStorageImpl();
29:
30: public void testGetEmpty() {
31: assertNull(_s.get("foo"));
32: }
33:
34: public void testPutGet() {
35: _s.put("foo", "bar");
36: _s.put("baz", "spiff");
37:
38: assertEquals("bar", _s.get("foo"));
39: assertEquals("spiff", _s.get("baz"));
40: }
41:
42: public void testClear() {
43: _s.put("foo", "bar");
44:
45: _s.clear();
46:
47: assertNull(_s.get("foo"));
48: }
49:
50: public void testClearNull() {
51: _s.clear();
52:
53: assertNull(_s.get("foo"));
54: }
55: }
|