KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > wsdl > impl > MessageImplDbTest


1 package org.jbpm.bpel.wsdl.impl;
2
3 import javax.xml.namespace.QName JavaDoc;
4
5 import org.jbpm.bpel.data.def.MessageTypeInfo;
6 import org.jbpm.bpel.data.def.VariableDefinition;
7 import org.jbpm.bpel.db.AbstractDbTestCase;
8 import org.jbpm.bpel.def.BpelDefinition;
9
10 public class MessageImplDbTest extends AbstractDbTestCase {
11   
12   BpelDefinition processDefinition;
13   
14   public void testQName() {
15     processDefinition = new BpelDefinition();
16     MessageImpl message = new MessageImpl();
17     message.setQName(new QName JavaDoc(null, "anyname"));
18     MessageTypeInfo typeInfo = new MessageTypeInfo(message);
19     VariableDefinition variable = new VariableDefinition();
20     variable.setName("aName");
21     variable.setTypeInfo(typeInfo);
22     processDefinition.getScope().addVariable(variable);
23     
24     processDefinition = saveAndReload(processDefinition);
25     
26     variable = processDefinition.getScope().getVariable("aName");
27     typeInfo = (MessageTypeInfo) variable.getTypeInfo();
28     assertNotNull( typeInfo.getMessage().getQName() );
29   }
30   
31   public void testPart() {
32     processDefinition = new BpelDefinition();
33     MessageImpl message = new MessageImpl();
34     PartImpl part = new PartImpl();
35     part.setName("partName");
36     part.setElementName(new QName JavaDoc(null, "anElementName"));
37     part.setTypeName(new QName JavaDoc(null, "aType"));
38     message.addPart(part);
39     MessageTypeInfo typeInfo = new MessageTypeInfo(message);
40     VariableDefinition variable = new VariableDefinition();
41     variable.setName("aName");
42     variable.setTypeInfo(typeInfo);
43     processDefinition.getScope().addVariable(variable);
44     
45     processDefinition = saveAndReload(processDefinition);
46     
47     variable = processDefinition.getScope().getVariable("aName");
48     typeInfo = (MessageTypeInfo) variable.getTypeInfo();
49     part = (PartImpl) typeInfo.getMessage().getPart("partName");
50     assertEquals("partName", part.getName() );
51     assertNotNull( part.getElementName() );
52     assertNotNull( part.getTypeName() );
53   }
54 }
55
Popular Tags