1 package org.jbpm.bpel.xml; 2 3 import java.util.Collections ; 4 5 import javax.wsdl.Output; 6 7 import org.xml.sax.SAXException ; 8 9 import com.ibm.wsdl.OutputImpl; 10 11 import org.jbpm.bpel.data.def.MessageTypeInfo; 12 import org.jbpm.bpel.def.Reply; 13 import org.jbpm.bpel.service.def.CorrelationSetDefinition; 14 15 19 public class ReplyReaderTest extends AbstractReaderTestCase { 20 21 public void setUp() throws Exception { 22 super.setUp(); 23 initMessageProperties(); 24 } 25 26 public void testPartnerLink() throws Exception { 27 String xml = "<reply partnerLink='aPartner' operation='o' variable='iv'/>"; 28 Reply reply = (Reply) readActivity(xml); 29 assertEquals(pLink, reply.getReplier().getPartnerLink() ); 30 } 31 32 public void testPortType() { 33 String xml = "<reply partnerLink='aPartner' portType='tns:mpt' operation='o' variable='iv'" + 34 " xmlns:tns='http://manufacturing.org/wsdl/purchase'/>"; 35 try { 36 readActivity(xml); 37 } 38 catch (Exception e) { 39 fail(e.toString()); 40 } 41 } 42 43 public void testPortTypeDefault() { 44 String xml = "<reply partnerLink='aPartner' operation='o' variable='iv'/>"; 45 try { 46 readActivity(xml); 47 } 48 catch (Exception e) { 49 fail(e.toString()); 50 } 51 } 52 53 public void testPortTypeNotFound() throws SAXException { 54 String xml = "<reply partnerLink='aPartner' portType='invalidPT' operation='o'/>"; 55 ProblemCollector collector = new ProblemCollector(); 56 reader.setProblemHandler(collector); 57 readActivity(xml); 58 if(!collector.hasErrors()) { 59 fail("invoke parse must fail when portType doesn't match partnerRole's portType"); 60 } 61 } 62 63 public void testOperation() throws Exception { 64 String xml = "<reply partnerLink='aPartner' operation='o' variable='iv'/>"; 65 Reply reply = (Reply) readActivity(xml); 66 assertEquals( "o", reply.getReplier().getOperation().getName() ); 67 } 68 69 public void testVariable() throws Exception { 70 MessageTypeInfo typeInfo = (MessageTypeInfo) messageVariable.getTypeInfo(); 71 Output output = new OutputImpl(); 72 output.setMessage(typeInfo.getMessage()); 73 operation.setOutput(output); 74 75 String xml = 76 "<reply partnerLink='aPartner' operation='o' variable='iv'/>"; 77 Reply reply = (Reply) readActivity(xml); 78 assertEquals(messageVariable, reply.getReplier().getVariable() ); 79 } 80 81 public void testCorrelations() throws Exception { 82 CorrelationSetDefinition corr = new CorrelationSetDefinition(); 83 corr.setName("corr"); 84 corr.setProperties(Collections.EMPTY_SET); 85 scope.addCorrelationSet(corr); 86 87 String correlationXml = 88 "<reply partnerLink='aPartner' operation='o' variable='iv'>" + 89 " <correlations>" + 90 " <correlation set='corr'/> " + 91 " </correlations>" + 92 "</reply>"; 93 94 Reply reply = (Reply) readActivity(correlationXml); 95 assertNotNull( reply.getReplier().getCorrelations() ); 96 97 } 98 } 99 | Popular Tags |