KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > taskmgmt > log > TaskLogDbTest


1 package org.jbpm.taskmgmt.log;
2
3 import org.jbpm.db.AbstractDbTestCase;
4 import org.jbpm.taskmgmt.exe.TaskInstance;
5
6 public class TaskLogDbTest extends AbstractDbTestCase {
7   
8   TaskInstance taskInstance = null;
9   
10   public void setUp() {
11     super.setUp();
12     
13     taskInstance = new TaskInstance();
14     jbpmSession.getSession().save(taskInstance);
15   }
16
17   public void testTaskCreateLog() {
18     TaskCreateLog taskCreateLog = new TaskCreateLog(taskInstance,"someone else");
19     jbpmSession.getSession().save(taskCreateLog);
20     
21     newTransaction();
22     
23     taskCreateLog = (TaskCreateLog) jbpmSession.getSession().load(TaskCreateLog.class, new Long JavaDoc(taskCreateLog.getId()));
24     assertNotNull(taskCreateLog);
25     assertNotNull(taskCreateLog.getTaskInstance());
26     assertEquals("someone else", (taskCreateLog.getTaskActorId()));
27   }
28
29   public void testTaskAssignLog() {
30     TaskAssignLog taskAssignLog = new TaskAssignLog(taskInstance,"me","toyou");
31     jbpmSession.getSession().save(taskAssignLog);
32     
33     newTransaction();
34     
35     taskAssignLog = (TaskAssignLog) jbpmSession.getSession().load(TaskAssignLog.class, new Long JavaDoc(taskAssignLog.getId()));
36     assertNotNull(taskAssignLog);
37     assertNotNull(taskAssignLog.getTaskInstance());
38     assertEquals("me", (taskAssignLog.getTaskOldActorId()));
39     assertEquals("toyou", (taskAssignLog.getTaskNewActorId()));
40   }
41
42   public void testTaskEndLog() {
43     TaskEndLog taskEndLog = new TaskEndLog(taskInstance);
44     jbpmSession.getSession().save(taskEndLog);
45     
46     newTransaction();
47     
48     taskEndLog = (TaskEndLog) jbpmSession.getSession().load(TaskEndLog.class, new Long JavaDoc(taskEndLog.getId()));
49     assertNotNull(taskEndLog);
50     assertNotNull(taskEndLog.getTaskInstance());
51   }
52 }
53
Popular Tags