01: /*
02: * Bossa Workflow System
03: *
04: * $Id: WorkManagerTest.java,v 1.11 2003/10/28 17:02:31 gdvieira Exp $
05: *
06: * Copyright (C) 2003 OpenBR Sistemas S/C Ltda.
07: *
08: * This file is part of Bossa.
09: *
10: * Bossa is free software; you can redistribute it and/or modify it
11: * under the terms of version 2 of the GNU General Public License as
12: * published by the Free Software Foundation.
13: *
14: * This program is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * General Public License for more details.
18: *
19: * You should have received a copy of the GNU General Public
20: * License along with this program; if not, write to the
21: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22: * Boston, MA 02111-1307, USA.
23: */
24:
25: package com.bigbross.bossa.work;
26:
27: import junit.framework.TestCase;
28:
29: import com.bigbross.bossa.Bossa;
30: import com.bigbross.bossa.BossaTestUtil;
31: import com.bigbross.bossa.resource.Resource;
32: import com.bigbross.bossa.wfnet.WorkItem;
33:
34: public class WorkManagerTest extends TestCase {
35:
36: private Resource frank, sally;
37: private WorkManager workManager;
38:
39: public WorkManagerTest(String name) {
40: super (name);
41: }
42:
43: protected void setUp() throws Exception {
44: Bossa bossa = BossaTestUtil.createCompleteTestBossa();
45: workManager = bossa.getWorkManager();
46: frank = bossa.getResourceManager().getResource("frank");
47: sally = bossa.getResourceManager().getResource("sally");
48: }
49:
50: public void testWorkItemList() {
51: assertEquals(0, workManager.getWorkItems(frank).size());
52: assertEquals(1, workManager.getWorkItems(frank, true).size());
53: }
54:
55: public void testMetaResource() throws Exception {
56: WorkItem work = (WorkItem) workManager
57: .getWorkItems(frank, true).get(0);
58: assertTrue(work.open(frank).close());
59: assertEquals(0, workManager.getWorkItems(frank).size());
60:
61: work = (WorkItem) workManager.getWorkItems(sally).get(0);
62: assertTrue(work.open(sally).close());
63: assertEquals(1, workManager.getWorkItems(frank).size());
64: assertEquals(0, workManager.getWorkItems(sally).size());
65: }
66:
67: public void testActivitiesList() throws Exception {
68: WorkItem work = (WorkItem) workManager
69: .getWorkItems(frank, true).get(0);
70: work.open(frank);
71: assertEquals(1, workManager.getActivities(frank).size());
72: }
73: }
|