KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > def > ThrowDbTest


1 package org.jbpm.bpel.def;
2
3 import javax.xml.namespace.QName JavaDoc;
4
5 import org.jbpm.bpel.data.def.SchemaTypeInfo;
6 import org.jbpm.bpel.data.def.VariableDefinition;
7 import org.jbpm.bpel.db.AbstractDbTestCase;
8
9 public class ThrowDbTest extends AbstractDbTestCase {
10   
11   public void testFaultVariable() {
12     BpelDefinition processDefinition = new BpelDefinition();
13     VariableDefinition var = new VariableDefinition();
14     var.setName("v");
15     var.setTypeInfo(new SchemaTypeInfo(new QName JavaDoc("aType")));
16     processDefinition.getScope().addVariable(var);
17     
18     Throw throwActivity = new Throw("child");
19     throwActivity.setFaultVariable(var);
20     processDefinition.addNode(throwActivity);
21     
22     processDefinition = saveAndReload(processDefinition);
23
24     throwActivity = (Throw) processDefinition.getNode("child");
25     assertEquals( processDefinition.getScope().getVariable("v"), throwActivity.getFaultVariable() );
26   }
27   
28   public void testFaultName() {
29     BpelDefinition processDefinition = new BpelDefinition();
30     Throw throwActivity = new Throw("child");
31     throwActivity.setFaultName(new QName JavaDoc(null, "catastrophicException"));
32     processDefinition.addNode(throwActivity);
33     
34     processDefinition = saveAndReload(processDefinition);
35
36     throwActivity = (Throw) processDefinition.getNode("child");
37     assertNotNull( throwActivity.getFaultName() );
38   }
39 }
40
Popular Tags