1 package org.jbpm.bpel.hibernate; 2 3 import javax.xml.namespace.QName ; 4 5 import org.jbpm.bpel.db.AbstractDbTestCase; 6 import org.jbpm.bpel.def.BpelDefinition; 7 import org.jbpm.bpel.service.def.CorrelationSetDefinition; 8 import org.jbpm.bpel.wsdl.impl.PropertyImpl; 9 10 public class QNameTypeDbTest extends AbstractDbTestCase { 11 12 BpelDefinition processDefinition; 13 14 public void testLocalPart() { 15 QName qname = new QName (null, "someLocalName"); 16 setQName(qname); 17 18 processDefinition = saveAndReload(processDefinition); 19 20 assertEquals("someLocalName", getQName().getLocalPart()); 21 } 22 23 public void testNamespaceURI() { 24 QName qname = new QName ("aNamespace", "someLocalName"); 25 setQName(qname); 26 27 processDefinition = saveAndReload(processDefinition); 28 29 assertEquals("aNamespace", getQName().getNamespaceURI()); 30 assertEquals("someLocalName", getQName().getLocalPart()); 31 } 32 33 public void testNullQName() { 34 setQName(null); 35 36 processDefinition = saveAndReload(processDefinition); 37 38 assertNull(getQName()); 39 } 40 41 private void setQName(QName qname) { 42 processDefinition = new BpelDefinition(); 43 CorrelationSetDefinition correlationSet = new CorrelationSetDefinition(); 44 correlationSet.setName("cs"); 45 PropertyImpl property = new PropertyImpl(); 46 QName propertyQName = new QName ("aNamespace", "someLocalName"); 47 property.setQName(propertyQName); 48 property.setType(qname); 49 50 correlationSet.addProperty(property); 51 processDefinition.getScope().addCorrelationSet(correlationSet); 52 } 53 54 private QName getQName() { 55 CorrelationSetDefinition correlationSet = processDefinition.getScope().getCorrelationSet("cs"); 56 PropertyImpl property = (PropertyImpl) correlationSet.getProperties().iterator().next(); 57 return property.getType(); 58 } 59 60 } 61 | Popular Tags |