@Test public void nullPortName() throws Exception { Service service = WSDLUtil.getService("MultiplePortService.wsdl", new PortName(null)); Assert.assertNotNull(service); Assert.assertEquals( service.getQName(), new QName("urn:switchyard-component-soap:test-ws:1.0", "GoodbyeWebService")); Port port = WSDLUtil.getPort(service, new PortName(null)); Assert.assertNotNull(port); Assert.assertEquals(port.getName(), "GoodbyeWebServicePort"); service = WSDLUtil.getService("MultiplePortService.wsdl", new PortName("HelloWebService:")); Assert.assertNotNull(service); Assert.assertEquals( service.getQName(), new QName("urn:switchyard-component-soap:test-ws:1.0", "HelloWebService")); port = WSDLUtil.getPort(service, new PortName(null)); Assert.assertEquals(port.getName(), "HelloWebServicePortFrench"); }
@Test(expected = WSDLException.class) public void nonExistentPortName() throws Exception { Service service = WSDLUtil.getService("MultiplePortService.wsdl", new PortName("HelloWebService:")); Assert.assertNotNull(service); Assert.assertEquals( service.getQName(), new QName("urn:switchyard-component-soap:test-ws:1.0", "HelloWebService")); WSDLUtil.getPort(service, new PortName("HelloWebServiceSpanishPort")); }
@Test public void halfQualifiedPortName() throws Exception { PortName portName = new PortName("HelloWebService:HelloWebServicePort"); Service service = WSDLUtil.getService("MultiplePortService.wsdl", portName); Assert.assertNotNull(service); Assert.assertEquals( service.getQName(), new QName("urn:switchyard-component-soap:test-ws:1.0", "HelloWebService")); Port port = WSDLUtil.getPort(service, portName); Assert.assertNotNull(port); Assert.assertEquals(port.getName(), "HelloWebServicePort"); }
@Test public void soapAction() throws Exception { Service service = WSDLUtil.getService("HelloWebService.wsdl", new PortName("HelloWebService:")); Assert.assertNotNull(service); Assert.assertEquals( service.getQName(), new QName("urn:switchyard-component-soap:test-ws:1.0", "HelloWebService")); Port port = WSDLUtil.getPort(service, new PortName("HelloWebServicePort")); Assert.assertNotNull(port); String action = WSDLUtil.getSoapAction(port, "sayHello"); Assert.assertEquals(action, "uri:something:that:needs#tobevalid"); action = WSDLUtil.getSoapAction(port, "helloWS"); Assert.assertEquals(action, ""); }