/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jbpm.examples.ch04;
import junit.framework.TestCase;
import org.jbpm.examples.ch02.Display;
import org.jbpm.examples.ch02.WaitState;
import org.jbpm.pvm.Execution;
import org.jbpm.pvm.ProcessDefinition;
import org.jbpm.pvm.ProcessFactory;
/**
* @author Tom Baeyens
*/
public class _01_ExecutionAndThreadTest extends TestCase {
public void testExecutionAndThread() {
ProcessDefinition processDefinition = ProcessFactory.build("automatic")
.node("wait 1").initial().behaviour(new WaitState())
.transition().to("automatic 1")
.node("automatic 1").behaviour(new Display("one"))
.transition().to("wait 2")
.node("wait 2").behaviour(new WaitState())
.transition().to("automatic 2")
.node("automatic 2").behaviour(new Display("two"))
.transition().to("automatic 3")
.node("automatic 3").behaviour(new Display("three"))
.transition().to("automatic 4")
.node("automatic 4").behaviour(new Display("four"))
.transition().to("wait 3")
.node("wait 3").behaviour(new WaitState())
.done();
Execution execution = processDefinition.startExecution();
assertEquals("wait 1", execution.getNode().getName());
execution.signal();
assertEquals("wait 2", execution.getNode().getName());
execution.signal();
assertEquals("wait 3", execution.getNode().getName());
}
}