1 package org.jbpm.graph.log; 2 3 import java.util.List ; 4 5 import junit.framework.TestCase; 6 7 import org.jbpm.graph.def.ProcessDefinition; 8 import org.jbpm.graph.exe.ProcessInstance; 9 import org.jbpm.graph.exe.Token; 10 import org.jbpm.logging.exe.LoggingInstance; 11 12 public class SignalLogTest extends TestCase { 13 14 public void testSignalLog() { 15 ProcessDefinition processDefinition = ProcessDefinition.parseXmlString( 16 "<process-definition>" + 17 " <start-state>" + 18 " <transition to='s' />" + 19 " </start-state>" + 20 " <state name='s'>" + 21 " <transition to='s' />" + 22 " </state>" + 23 "</process-definition>" 24 ); 25 26 ProcessInstance processInstance = new ProcessInstance(processDefinition); 28 Token token = processInstance.getRootToken(); 29 processInstance.signal(); 30 31 LoggingInstance loggingInstance = processInstance.getLoggingInstance(); 33 List processLogs = loggingInstance.getLogs(SignalLog.class); 34 35 assertEquals(1, processLogs.size()); 37 38 SignalLog signalLog = (SignalLog) processLogs.get(0); 39 assertSame(token, signalLog.getToken()); 40 assertNotNull(signalLog.getDate()); 41 42 processInstance.signal(); 44 assertEquals(2, loggingInstance.getLogs(SignalLog.class).size()); 46 } 47 48 49 } 50 | Popular Tags |