KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jbpm.bpel.wsdl.impl;
2
3 import javax.xml.namespace.QName JavaDoc;
4
5 import org.jbpm.bpel.db.AbstractDbTestCase;
6 import org.jbpm.bpel.def.BpelDefinition;
7 import org.jbpm.bpel.service.def.PartnerLinkDefinition;
8 import org.jbpm.bpel.wsdl.def.PartnerLinkType;
9 import org.jbpm.bpel.wsdl.impl.PartnerLinkTypeImpl.RoleImpl;
10
11 public class PartnerLinkTypeImplDbTest extends AbstractDbTestCase {
12   
13   BpelDefinition processDefinition;
14   PartnerLinkTypeImpl plinkType;
15   
16   public void setUp() {
17     super.setUp();
18     processDefinition = new BpelDefinition();
19     PartnerLinkDefinition plinkDefinition = new PartnerLinkDefinition();
20     plinkDefinition.setName("pl");
21     plinkType = new PartnerLinkTypeImpl();
22     plinkDefinition.setPartnerLinkType(plinkType);
23     processDefinition.getScope().addPartnerLink(plinkDefinition);
24   }
25   
26   public void testQName() {
27     plinkType.setQName(new QName JavaDoc(null, "rfqPLT"));
28     
29     processDefinition = saveAndReload(processDefinition);
30     
31     assertNotNull( getPartnerLinkType().getQName());
32   }
33
34   public void testFirstRole() {
35     PartnerLinkTypeImpl.RoleImpl role = new PartnerLinkTypeImpl.RoleImpl();
36     plinkType.setFirstRole(role);
37     role.setName("first");
38     
39     processDefinition = saveAndReload(processDefinition);
40     
41     assertEquals("first", getPartnerLinkType().getFirstRole().getName());
42   }
43
44   public void testSecondRole() {
45     PartnerLinkTypeImpl.RoleImpl role = new PartnerLinkTypeImpl.RoleImpl();
46     role.setName("second");
47     PortTypeImpl portType = new PortTypeImpl();
48     portType.setQName(new QName JavaDoc(null, "bloodyPortType"));
49     role.setPortType(portType);
50     plinkType.setSecondRole(role);
51     
52     processDefinition = saveAndReload(processDefinition);
53     
54     role = (RoleImpl) getPartnerLinkType().getSecondRole();
55     assertEquals("second", role.getName());
56     assertNotNull(role.getPortType().getQName());
57   }
58   
59   private PartnerLinkType getPartnerLinkType() {
60     return processDefinition.getScope().getPartnerLink("pl").getPartnerLinkType();
61   }
62 }
63
Popular Tags