01: /*
02: * Bossa Workflow System
03: *
04: * $Id: TransactionsTest.java,v 1.3 2004/01/15 22:13:32 gdvieira Exp $
05: *
06: * Copyright (C) 2004 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.history;
26:
27: import java.util.Date;
28: import java.util.HashMap;
29: import java.util.List;
30:
31: import junit.framework.TestCase;
32:
33: import com.bigbross.bossa.notify.Event;
34:
35: public class TransactionsTest extends TestCase {
36:
37: private Historian historian;
38:
39: public TransactionsTest(String name) {
40: super (name);
41: }
42:
43: protected void setUp() {
44: historian = new Historian(null);
45: HashMap attributes = new HashMap();
46: Date aTime = new Date();
47: aTime.setTime(HistorianTest.t1);
48: historian.newEvent(new Event("teste0", Event.WFNET_EVENT,
49: attributes, aTime));
50: aTime = new Date();
51: aTime.setTime(HistorianTest.t2);
52: historian.newEvent(new Event("teste1", Event.WFNET_EVENT,
53: attributes, aTime));
54: aTime = new Date();
55: aTime.setTime(HistorianTest.t3);
56: historian.newEvent(new Event("teste2", Event.WFNET_EVENT,
57: attributes, aTime));
58: aTime = new Date();
59: aTime.setTime(HistorianTest.t4);
60: historian.newEvent(new Event("teste3", Event.WFNET_EVENT,
61: attributes, aTime));
62: }
63:
64: public void testPurgeHistory() {
65: Date end = new Date();
66: end.setTime(HistorianTest.t3);
67: PurgeHistory transaction = new PurgeHistory(end);
68: transaction.execute(historian);
69: List events = historian.getHistory();
70: assertEquals(2, events.size());
71: }
72: }
|