tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r513285 - in /incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src: main/java/org/apache/tuscany/binding/axis2/ test/java/org/apache/tuscany/binding/axis2/
Date Thu, 01 Mar 2007 11:46:23 GMT
Author: antelder
Date: Thu Mar  1 03:46:18 2007
New Revision: 513285

URL: http://svn.apache.org/viewvc?view=rev&rev=513285
Log:
Start at getting the WS binding to determine the WS endpoint based on the spec alogorithim

Added:
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
  (with props)
Modified:
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
    incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=513285&r1=513284&r2=513285
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
Thu Mar  1 03:46:18 2007
@@ -18,6 +18,9 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import javax.wsdl.Port;
 import javax.wsdl.PortType;
 
@@ -52,6 +55,9 @@
 public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBindingDefinition>
{
     private static final String OM_DATA_BINDING = OMElement.class.getName();
 
+    // TODO: what to do about the base URI?
+    private static final String BASE_URI = "http://localhost:8080/";
+
     private ServletHost servletHost;
 
     private ConfigurationContext configContext;
@@ -102,7 +108,7 @@
                 outboundContract.setDataBinding(OM_DATA_BINDING);
             }
 
-            // TODO: TUSCANY-xxx, <binding.ws> with no wsdl only works with <interface.wsdl>
+            // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
             if (wsBinding.getWSDLDefinition() == null) {
                 if (outboundContract instanceof WSDLServiceContract) {
                     String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI();
@@ -156,54 +162,56 @@
         WebServiceBindingDefinition wsBinding,
         DeploymentContext deploymentContext) {
 
-        try {
-            // Set the default binding
-            ServiceContract inboundContract = boundReferenceDefinition.getServiceContract();
-            if (inboundContract instanceof WSDLServiceContract) {
-                inboundContract.setDataBinding(OM_DATA_BINDING);
-            }
+        // Set the default binding
+        ServiceContract inboundContract = boundReferenceDefinition.getServiceContract();
+        if (inboundContract instanceof WSDLServiceContract) {
+            inboundContract.setDataBinding(OM_DATA_BINDING);
+        }
 
-            // TODO: TUSCANY-xxx, <binding.ws> with no wsdl only works with <interface.wsdl>
-            if (wsBinding.getWSDLDefinition() == null) {
-                if (inboundContract instanceof WSDLServiceContract) {
-                    String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
-                    wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
-                } else {
-                    throw new IllegalStateException("<binding.ws> with no WSDL requires
using <interface.wsdl>");
-                }
+        // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
+        if (wsBinding.getWSDLDefinition() == null) {
+            if (inboundContract instanceof WSDLServiceContract) {
+                String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
+                wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+            } else {
+                throw new IllegalStateException("<binding.ws> with no WSDL requires
using <interface.wsdl>");
             }
+        }
 
-            // FIXME: We need to define how the WSDL PortType is honored in the case that
-            // both the binding.ws and interface.wsdl are in place
-            // The WSDL portType from the WSDL Port decides the incoming SOAP message format
-
-            ServiceContract<?> outboundContract = inboundContract;
-            Port port = wsBinding.getWSDLPort();
-            if (port == null) {
-                // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create
one from
-                // the inbound service contract if it's JavaServiceContract
-                outboundContract = inboundContract;
-            }
-            PortType portType = port.getBinding().getPortType();
+        // FIXME: We need to define how the WSDL PortType is honored in the case that
+        // both the binding.ws and interface.wsdl are in place
+        // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+
+        ServiceContract<?> outboundContract = inboundContract;
+        Port port = wsBinding.getWSDLPort();
+        if (port == null) {
+            // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one
from
+            // the inbound service contract if it's JavaServiceContract
+            outboundContract = inboundContract;
+        }
+        PortType portType = port.getBinding().getPortType();
+        try {
             outboundContract = introspector.introspect(portType);
+        } catch (InvalidServiceContractException e) {
+            new Axis2BindingBuilderRuntimeException(e);
+        }
 
-            // Set the default databinding
-            outboundContract.setDataBinding(OM_DATA_BINDING);
-            //FIXME ... need to figure out how to specify scope on wsdl.
-            outboundContract.setInteractionScope(inboundContract.getInteractionScope());
-
-            try {
-                wireService.checkCompatibility(inboundContract, outboundContract, true);
-            } catch (IncompatibleServiceContractException e) {
-                throw new Axis2BindingBuilderRuntimeException(e);
-            }
-
-            return new Axis2ReferenceBinding(boundReferenceDefinition.getName(), parent,
wsBinding,
-                inboundContract, outboundContract, workContext);
+        // Set the default databinding
+        outboundContract.setDataBinding(OM_DATA_BINDING);
+        //FIXME ... need to figure out how to specify scope on wsdl.
+        outboundContract.setInteractionScope(inboundContract.getInteractionScope());
 
-        } catch (InvalidServiceContractException e) {
+        try {
+            wireService.checkCompatibility(inboundContract, outboundContract, true);
+        } catch (IncompatibleServiceContractException e) {
             throw new Axis2BindingBuilderRuntimeException(e);
         }
+
+        String endpoint = computeActualURI(wsBinding, BASE_URI, parent.getName(), boundReferenceDefinition.getName());
+
+        return new Axis2ReferenceBinding(boundReferenceDefinition.getName(), parent, wsBinding,
+            inboundContract, outboundContract, workContext, endpoint);
+
     }
 
     protected Class<WebServiceBindingDefinition> getBindingType() {
@@ -216,6 +224,62 @@
             this.configContext = new TuscanyAxisConfigurator().getConfigurationContext();
         } catch (AxisFault e) {
             throw new BuilderConfigException(e);
+        }
+    }
+    
+    /**
+     * Compute the endpoint URI based on section 2.1.1 of the WS binding spec
+     * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative
+     * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which
may be relative
+     * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which
may be relative,
+     * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec 
+     * If the <binding.ws> has no wsdlElement but does have a uri attribute then the
uri takes precidence
+     * over any implicitly used WSDL.
+     */
+    protected String computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI,
String compositeName, String name) {
+        try {
+
+            URI portURI = null;         
+            if ((wsBinding.getServiceName() != null || wsBinding.getPortName() == null) &&
wsBinding.getBindingName() == null) {
+                // <binding.ws> explicitly points at a wsdl port, may be a relative
URI
+                portURI = wsBinding.getPortURI();
+            }
+            if (portURI != null && portURI.isAbsolute()) {
+                return portURI.toString();
+            }
+            
+            URI explicitURI = null;
+            if (wsBinding.getURI() != null) {
+                explicitURI = new URI(wsBinding.getURI());
+            }
+
+            String actualURI = "";
+            if (explicitURI == null || !explicitURI.isAbsolute()) {
+                actualURI = baseURI + "/" + compositeName + "/" + name + "/";
+            }
+
+            if (explicitURI != null) {
+                if (portURI != null) {
+                    actualURI = actualURI + explicitURI.toString() + "/" + portURI.toString();
+                } else {
+                    if (explicitURI != null) {
+                        actualURI = actualURI + explicitURI;
+                    }
+                    if (portURI != null) {
+                        actualURI = actualURI + portURI;
+                    }
+                }
+            } else {
+                if (portURI != null) {
+                    actualURI = actualURI + portURI.toString();
+                }
+            }
+            
+            // normalize to handle any . or .. occurances 
+            return new URI(actualURI).normalize().toString();
+
+        } catch (URISyntaxException e) {
+            throw new Axis2BindingBuilderRuntimeException(e);
         }
     }
 

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java?view=diff&rev=513285&r1=513284&r2=513285
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
Thu Mar  1 03:46:18 2007
@@ -60,14 +60,15 @@
                                  WebServiceBindingDefinition wsBinding,
                                  ServiceContract contract,
                                  ServiceContract<?> bindingServiceContract,
-                                 WorkContext workContext) {
+                                 WorkContext workContext,
+                                 String endpointURI) {
         super(theName, parent);
         this.bindingServiceContract = bindingServiceContract;
         this.workContext = workContext;
         try {
             Definition wsdlDefinition = wsBinding.getWSDLDefinition();
             wsPortMetaData =
-                new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(),
false);
+                new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), endpointURI,
false);
             serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData);
         } catch (AxisFault e) {
             throw new Axis2BindingRunTimeException(e);

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java?view=diff&rev=513285&r1=513284&r2=513285
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingDefinition.java
Thu Mar  1 03:46:18 2007
@@ -19,12 +19,16 @@
 package org.apache.tuscany.binding.axis2;
 
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
 import java.util.Map;
 
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.spi.model.BindingDefinition;
@@ -124,6 +128,25 @@
         return uri;
     }
 
+    public URI getPortURI() {
+        URI portURI = null;
+        if (definition != null) {
+            Port port = getWSDLPort();
+            final List wsdlPortExtensions = port.getExtensibilityElements();
+            for (final Object extension : wsdlPortExtensions) {
+                if (extension instanceof SOAPAddress) {
+                    try {
+                        portURI = new URI(((SOAPAddress) extension).getLocationURI());
+                    } catch (URISyntaxException e) {
+                        throw new RuntimeException(e);
+                    }
+                    break;
+                }
+            }
+        }
+        return portURI;
+    }
+
     public void setURI(String theUri) {
         this.uri = theUri;
     }
@@ -144,5 +167,17 @@
 
     public String getWSDLNamepace() {
         return namespace;
+    }
+
+    public String getPortName() {
+        return portName;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getBindingName() {
+        return bindingName;
     }
 }

Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java?view=auto&rev=513285
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
(added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
Thu Mar  1 03:46:18 2007
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.binding.axis2;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+
+/**
+ * Tests for the WebServicebindingLoader class
+ */
+@SuppressWarnings("deprecation")
+public class Axis2BindingBuilderTestCase extends TestCase {
+
+    private static final String NAME = "MyService";
+    private static final String COMPOSITE_NAME = "MyComposite";
+    private static final String BASE_URI = "http://localhost/services";
+
+    public void testDefaultURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null,
null, null, null, null);
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://localhost/services/MyComposite/MyService/", uri);
+    }
+
+    public void testExplicitURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(null, null,
null, null, null, "http://foo/bar");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://foo/bar", uri);
+    }
+    
+    public void testExplicitWSDL() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"),
"myService", "myPort", null, null);
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://my/wsdl/uri", uri);
+    }
+    
+    public void testExplicitWSDLExplicitURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("http://my/wsdl/uri"),
"myService", "myPort", null, "foo");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+
+        // explicit URI 'foo' should be ignored
+        assertEquals("http://my/wsdl/uri", uri);
+    }
+
+    public void testExplicitWSDLBindingExplicitURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"),
null, null, "myBinding", "http://my/uri");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+
+        // explicit URI should be used as the WSDL binding is used not the wsdl service/port
+        assertEquals("http://my/uri", uri);
+    }
+
+    public void testExplicitWSDLBindingExplicitRelativeURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"),
null, null, "myBinding", "x/y");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+
+        // explicit URI should be used as the WSDL binding is used not the wsdl service/port
+        assertEquals("http://localhost/services/MyComposite/MyService/x/y", uri);
+    }
+
+    public void testExplicitWSDLBindingExplicitRelativeURIWithDot() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"),
null, null, "myBinding", "x/./y");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+
+        // explicit URI should be used as the WSDL binding is used not the wsdl service/port
+        assertEquals("http://localhost/services/MyComposite/MyService/x/y", uri);
+    }
+
+    public void testExplicitWSDLBindingExplicitRelativeURIWithDots() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDLBinding("http://my/wsdl/uri"),
null, null, "myBinding", "../../x/y");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+
+        // explicit URI should be used as the WSDL binding is used not the wsdl service/port
+        assertEquals("http://localhost/services/x/y", uri);
+    }
+
+    public void testExplicitRelativeWSDL() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"),
"myService", "myPort", null, null);
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://localhost/services/MyComposite/MyService/foo/bar", uri);
+    }
+
+    public void testExplicitRelativeWSDLWithDots() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"),
"myService", "myPort", null, null);
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://localhost/services/MyComposite/foo/bar", uri);
+    }
+
+    public void testExplicitRelativeWSDLExplicitURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"),
"myService", "myPort", null, "http://my/wsdl/uri");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://my/wsdl/uri/foo/bar", uri);
+    }
+
+    public void testExplicitRelativeWSDLWithDotsExplicitURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("../foo/bar"),
"myService", "myPort", null, "http://my/wsdl/uri");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://my/wsdl/foo/bar", uri);
+    }
+
+    public void testExplicitRelativeWSDLExplicitRelativeURI() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"),
"myService", "myPort", null, "x/y");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://localhost/services/MyComposite/MyService/x/y/foo/bar", uri);
+    }
+
+    public void testExplicitRelativeWSDLExplicitRelativeURIWithDots() throws Exception {
+        Axis2BindingBuilder builder = new Axis2BindingBuilder();
+        WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition("myNS", createMockWSDL("foo/bar"),
"myService", "myPort", null, "../x/y");
+        String uri = builder.computeActualURI(wsBinding, BASE_URI, COMPOSITE_NAME, NAME);
+        assertEquals("http://localhost/services/MyComposite/x/y/foo/bar", uri);
+    }
+
+    protected Definition createMockWSDL(String endpoint) {
+        Definition mockDef = createMock(Definition.class);
+        
+        Service wsdlService = createMock(Service.class);
+        expect(wsdlService.getQName()).andReturn(new QName("myNS", "myService"));
+
+        Port wsdlPort = createMock(Port.class);
+        List<SOAPAddress> ees = new ArrayList<SOAPAddress>();
+        SOAPAddress sa = createMock(SOAPAddress.class);
+        expect(sa.getLocationURI()).andReturn(endpoint);
+        ees.add(sa);
+        expect(wsdlPort.getExtensibilityElements()).andReturn(ees);
+
+        expect(wsdlService.getPort("myPort")).andReturn(wsdlPort);
+
+        Map<String, Service> services = new HashMap<String, Service>();
+        services.put("myService", wsdlService);
+        expect(mockDef.getServices()).andReturn(services);
+
+        replay(mockDef);
+        replay(wsdlService);
+        replay(wsdlPort);
+        replay(sa);
+        return mockDef;
+    }
+    protected Definition createMockWSDLBinding(String endpoint) {
+        Definition mockDef = createMock(Definition.class);
+        replay(mockDef);
+        return mockDef;
+    }
+}

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilderTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java?view=diff&rev=513285&r1=513284&r2=513285
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
(original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/axis2/binding/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
Thu Mar  1 03:46:18 2007
@@ -18,9 +18,12 @@
  */
 package org.apache.tuscany.binding.axis2;
 
+import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
+
 import java.lang.reflect.Type;
 import java.net.URL;
 import java.util.HashMap;
+
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
 import javax.wsdl.Service;
@@ -28,20 +31,18 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
-import org.xml.sax.InputSource;
+import junit.framework.TestCase;
 
+import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.idl.java.JavaServiceContract;
 import org.apache.tuscany.spi.model.Operation;
-import static org.apache.tuscany.spi.model.Operation.NO_CONVERSATION;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.InboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.WireService;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
 import org.easymock.EasyMock;
+import org.xml.sax.InputSource;
 
 public class Axis2ReferenceTestCase extends TestCase {
 
@@ -104,6 +105,7 @@
             parent,
             wsBinding,
             contract,
+            null,
             null,
             null);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message