1 17 package org.apache.servicemix.jbi.servicedesc; 18 19 import javax.xml.namespace.QName ; 20 21 import junit.framework.TestCase; 22 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 import org.apache.servicemix.jbi.jaxp.SourceTransformer; 26 import org.apache.servicemix.jbi.util.DOMUtil; 27 import org.w3c.dom.DocumentFragment ; 28 import org.w3c.dom.Element ; 29 30 public class EndpointReferenceBuilderTest extends TestCase { 31 32 private static final Log log = LogFactory.getLog(EndpointReferenceBuilderTest.class); 33 34 37 public void testGetReference() throws Exception { 38 InternalEndpoint endpoint = new InternalEndpoint(null, "myEndpoint", new QName ("http://foo.bar.com", "myService")); 39 DocumentFragment df = EndpointReferenceBuilder.getReference(endpoint); 40 assertNotNull(df); 41 log.info(new SourceTransformer().toString(df)); 42 Element e = (Element ) df.getFirstChild(); 43 assertEquals("http://java.sun.com/jbi/end-point-reference", e.getNamespaceURI()); 44 assertEquals("end-point-reference", e.getLocalName()); 45 assertEquals("myEndpoint", e.getAttributeNodeNS("http://java.sun.com/jbi/end-point-reference", "end-point-name").getValue()); 46 assertEquals(new QName ("http://foo.bar.com", "myService"), 47 DOMUtil.createQName(e, e.getAttributeNS("http://java.sun.com/jbi/end-point-reference", "service-name"))); 48 } 49 50 } 51 | Popular Tags |