KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > graph > log > NodeLogDbTest


1 package org.jbpm.graph.log;
2
3 import java.util.Date JavaDoc;
4
5 import org.jbpm.db.AbstractDbTestCase;
6 import org.jbpm.graph.def.Node;
7
8 public class NodeLogDbTest extends AbstractDbTestCase {
9
10   public void testNodeLogNode() {
11     Node node = new Node();
12     jbpmSession.getSession().save(node);
13     NodeLog nodeLog = new NodeLog(node, new Date JavaDoc(), new Date JavaDoc());
14     
15     nodeLog = (NodeLog) saveAndReload(nodeLog);
16     assertNotNull(nodeLog.getNode());
17   }
18
19   public void testNodeLogEnterDate() {
20     Node node = new Node();
21     jbpmSession.getSession().save(node);
22
23     Date JavaDoc enter = new Date JavaDoc();
24     Date JavaDoc leave = new Date JavaDoc(enter.getTime()+5);
25     NodeLog nodeLog = new NodeLog(node, enter, leave);
26     
27     nodeLog = (NodeLog) saveAndReload(nodeLog);
28     assertEquals(enter, nodeLog.getEnter());
29   }
30
31   public void testNodeLogLeaveDate() {
32     Node node = new Node();
33     jbpmSession.getSession().save(node);
34
35     Date JavaDoc enter = new Date JavaDoc();
36     Date JavaDoc leave = new Date JavaDoc(enter.getTime()+5);
37     NodeLog nodeLog = new NodeLog(node, enter, leave);
38     
39     nodeLog = (NodeLog) saveAndReload(nodeLog);
40     assertEquals(leave, nodeLog.getLeave());
41   }
42
43   public void testNodeLogDuration() {
44     Node node = new Node();
45     jbpmSession.getSession().save(node);
46
47     Date JavaDoc enter = new Date JavaDoc();
48     Date JavaDoc leave = new Date JavaDoc(enter.getTime()+5);
49     NodeLog nodeLog = new NodeLog(node, enter, leave);
50     
51     nodeLog = (NodeLog) saveAndReload(nodeLog);
52     assertEquals(5, nodeLog.getDuration());
53   }
54
55
56 }
57
Popular Tags