1 package org.jbpm.bpel.service.def; 2 3 import org.jbpm.bpel.db.AbstractDbTestCase; 4 import org.jbpm.bpel.def.BpelDefinition; 5 import org.jbpm.bpel.wsdl.impl.PartnerLinkTypeImpl; 6 7 public class PartnerLinkDefinitionDbTest extends AbstractDbTestCase { 8 9 BpelDefinition processDefinition; 10 PartnerLinkDefinition plinkDefinition; 11 12 public void setUp() { 13 super.setUp(); 14 processDefinition = new BpelDefinition(); 15 plinkDefinition = new PartnerLinkDefinition(); 16 plinkDefinition.setName("pl"); 17 processDefinition.getScope().addPartnerLink(plinkDefinition); 18 } 19 20 public void testName() { 21 processDefinition = saveAndReload(processDefinition); 22 assertEquals("pl", getPartnerLinkDefinition().getName()); 23 } 24 25 public void testPartnerLinkType() { 26 PartnerLinkTypeImpl plinkType = new PartnerLinkTypeImpl(); 27 plinkDefinition.setPartnerLinkType(plinkType); 28 processDefinition = saveAndReload(processDefinition); 29 assertNotNull(getPartnerLinkDefinition().getPartnerLinkType()); 30 } 31 32 public void testPartnerRole() { 33 PartnerLinkTypeImpl plinkType = new PartnerLinkTypeImpl(); 34 PartnerLinkTypeImpl.RoleImpl partnerRole = new PartnerLinkTypeImpl.RoleImpl(); 35 partnerRole.setName("partner"); 36 plinkType.setSecondRole(partnerRole); 37 plinkDefinition.setPartnerLinkType(plinkType); 38 plinkDefinition.setPartnerRole(partnerRole); 39 processDefinition = saveAndReload(processDefinition); 40 assertEquals("partner", getPartnerLinkDefinition().getPartnerRole().getName()); 41 } 42 43 public void testMyRole() { 44 PartnerLinkTypeImpl plinkType = new PartnerLinkTypeImpl(); 45 PartnerLinkTypeImpl.RoleImpl myRole = new PartnerLinkTypeImpl.RoleImpl(); 46 myRole.setName("myself"); 47 plinkType.setSecondRole(myRole); 48 plinkDefinition.setPartnerLinkType(plinkType); 49 plinkDefinition.setMyRole(myRole); 50 processDefinition = saveAndReload(processDefinition); 51 assertEquals("myself", getPartnerLinkDefinition().getMyRole().getName()); 52 } 53 54 private PartnerLinkDefinition getPartnerLinkDefinition() { 55 return processDefinition.getScope().getPartnerLink("pl"); 56 } 57 } 58 | Popular Tags |