01: ///////////////////////////////
02: // Makumba, Makumba tag library
03: // Copyright (C) 2000-2003 http://www.makumba.org
04: //
05: // This library is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU Lesser General Public
07: // License as published by the Free Software Foundation; either
08: // version 2.1 of the License, or (at your option) any later version.
09: //
10: // This library is distributed in the hope that it will be useful,
11: // but WITHOUT ANY WARRANTY; without even the implied warranty of
12: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: // Lesser General Public License for more details.
14: //
15: // You should have received a copy of the GNU Lesser General Public
16: // License along with this library; if not, write to the Free Software
17: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: //
19: // -------------
20: // $Id: lock.java 2119 2007-11-22 01:12:14Z cristian_bogdan $
21: // $Name$
22: /////////////////////////////////////
23:
24: package test;
25:
26: import junit.framework.Test;
27: import junit.framework.TestCase;
28: import junit.framework.TestSuite;
29:
30: import org.makumba.Transaction;
31: import org.makumba.providers.TransactionProvider;
32:
33: /**
34: * Testing locking related operations
35: *
36: * run "ant test.lock" from a number of consoles to test locks
37: *
38: * @author cristi
39: */
40: public class lock extends TestCase {
41:
42: public lock(String name) {
43: super (name);
44: }
45:
46: public static void main(String[] args) {
47: junit.textui.TestRunner.run(suite());
48: }
49:
50: public static Test suite() {
51: return new TestSuite(lock.class);
52: }
53:
54: Transaction db;
55:
56: public void setUp() {
57: TransactionProvider tp = new TransactionProvider();
58:
59: db = tp.getConnectionTo(tp
60: .getDataSourceName("test/testDatabase.properties"));
61: }
62:
63: public void tearDown() {
64: db.close();
65: }
66:
67: public void testLock() {
68: System.out.println("locking");
69: db.lock("something");
70: System.out.println("waiting");
71: try {
72: Thread.sleep(10000);
73: } catch (InterruptedException e) {
74: }
75: System.out.println("closing");
76: }
77: }
|