1 package org.jbpm.graph.log; 2 3 import java.util.Date ; 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 (), new Date ()); 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 enter = new Date (); 24 Date leave = new Date (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 enter = new Date (); 36 Date leave = new Date (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 enter = new Date (); 48 Date leave = new Date (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 |