1 package org.jbpm.bpel.data.exe; 2 3 import org.jbpm.context.def.ContextDefinition; 4 import org.jbpm.graph.exe.ProcessInstance; 5 6 import org.jbpm.bpel.data.def.SchemaTypeInfo; 7 import org.jbpm.bpel.data.def.VariableDefinition; 8 import org.jbpm.bpel.db.AbstractDbTestCase; 9 import org.jbpm.bpel.def.BpelDefinition; 10 11 15 public class VariableInstanceDbTest extends AbstractDbTestCase { 16 17 BpelDefinition processDefinition; 18 ProcessInstance pi; 19 20 public void setUp() { 21 super.setUp(); 22 processDefinition = new BpelDefinition(); 23 processDefinition.addDefinition(new ContextDefinition()); 24 pi = new ProcessInstance(processDefinition); 25 } 26 27 28 public void testSimpleDefinition() { 29 VariableDefinition variable = new VariableDefinition(); 30 variable.setName("aName"); 31 variable.setTypeInfo(new SchemaTypeInfo()); 32 processDefinition.getScope().addVariable(variable); 33 graphSession.saveProcessDefinition(processDefinition); 34 variable.createInstance(pi.getRootToken()); 35 pi = saveAndReload(pi); 36 37 assertEquals( VariableDefinition.class, variable.getInstance(pi.getRootToken()).getDefinition().getClass() ); 38 } 39 40 public void testSimpleValue() { 41 VariableDefinition variable = new VariableDefinition(); 42 variable.setName("aName"); 43 variable.setTypeInfo(new SchemaTypeInfo()); 44 processDefinition.getScope().addVariable(variable); 45 graphSession.saveProcessDefinition(processDefinition); 46 variable.createInstance(pi.getRootToken()).setValue( new Integer (1) ); 47 pi = saveAndReload(pi); 48 49 assertEquals( 1, ((Integer ) variable.getInstance(pi.getRootToken()).getValue()).intValue() ); 50 } 51 52 80 } 81 | Popular Tags |