01: package vqwiki.file;
02:
03: import junit.framework.TestCase;
04:
05: /**
06: Very Quick Wiki - WikiWikiWeb clone
07: Copyright (C) 2001-2002 Gareth Cronin
08:
09: This program is free software; you can redistribute it and/or modify
10: it under the terms of the latest version of the GNU Lesser General
11: Public License as published by the Free Software Foundation;
12:
13: This program is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public License
19: along with this program (gpl.txt); if not, write to the Free Software
20: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21: */
22:
23: public class FileHandlerTest extends TestCase {
24:
25: // file/path separator for the platform
26: protected static String sep = System.getProperty("file.separator");
27: FileHandler handler;
28:
29: /**
30: *
31: */
32: public FileHandlerTest(String name) {
33: super (name);
34: }
35:
36: /**
37: *
38: */
39: public void testLocking() throws Exception {
40: String topicName = "NewTopic";
41: FileHandler handler = new FileHandler();
42: String key1 = "aKey";
43: String key2 = "bKey";
44: handler.lockTopic("", topicName, key1);
45: assertTrue(handler.lockTopic("", topicName, key1));
46: assertTrue(!handler.lockTopic("", topicName, key2));
47: handler.unlockTopic("", topicName);
48: handler.lockTopic("", topicName, key2);
49: assertTrue(handler.lockTopic("", topicName, key2));
50: assertTrue(!handler.lockTopic("", topicName, key1));
51: }
52: }
|