-
1. Re: I can not run websale application?
aaw_tom Aug 2, 2005 4:06 AM (in response to tom.baeyens)Ok, I got it. When I created new simple process that following to jdp, it don't work. I create the hello world project. I create the helloTest, it i's ok. I create MessageActionHandler, it's ok. When I deploy it, it can show in http://localhost:8080/jbpm. When I start the project, I don't get the task. How to solve it?
processdefinition.xml
<process-definition name="jbay">
<!-- SWIMLANES (= process roles) -->
<!-- Node -->
<start-state name="start">
</start-state>
<!-- END -->
<end-state name="end1"></end-state>
</process-definition>
MessageActionHandler.java
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
public class MessageActionHandler implements ActionHandler {
public static boolean isExecuted = false;
private static final long serialVersionUID = 1L;
String message;
public void execute(ExecutionContext executionContext) {
executionContext.getContextInstance().createVariable("greeting","Hello world");
}
}
HelloTest.java
import junit.framework.TestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
public class HelloTest extends TestCase {
public void testHelloTest() throws Exception {
// Extract a process definition from the processdefinition.xml file.
ProcessDefinition definition = ProcessDefinition.parseXmlResource("aeaw.par/processdefinition.xml");
assertNotNull("Definition should not be null", definition);
// Create an instance of the process definition.
ProcessInstance instance = new ProcessInstance(definition);
assertEquals(
"Instance is in start state",
instance.getRootToken().getNode().getName(),
"start");
assertNull(
"Message variable should not exist yet",
instance.getContextInstance().getVariable("message"));
// Move the process instance from its start state to the first state.
// The configured action should execute and the appropriate message
// should appear in the message process variable.
instance.signal();
assertEquals(
"Instance is in first state",
instance.getRootToken().getNode().getName(),
"auction");
assertEquals(
"Message variable contains message",
instance.getContextInstance().getVariable("greeting"),
null);
// Move the process instance to the end state. The configured action
// should execute again. The message variable contains a new value.
instance.signal();
assertEquals(
"Instance is in end state",
instance.getRootToken().getNode().getName(),
"end1");
assertTrue("Instance has ended", instance.hasEnded());
assertEquals(
"Message variable is changed",
instance.getContextInstance().getVariable("greeting"),
null);
}
}
Have anyone help me? thanks.