Author: jsdelfino
Date: Thu Apr 27 14:25:52 2006
New Revision: 397642

URL: http://svn.apache.org/viewcvs?rev=397642&view=rev
Log:
Applied Dan's patch for TUSCANY-206

Added:
    incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/
    incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
   (with props)
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
   (with props)
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
   (with props)
    incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/hello_world.wsdl
Modified:
    incubator/tuscany/sandbox/celtix/binding.celtix/.checkstyle
    incubator/tuscany/sandbox/celtix/binding.celtix/checkstyle.xml
    incubator/tuscany/sandbox/celtix/binding.celtix/pom.xml
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java
    
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java

Modified: incubator/tuscany/sandbox/celtix/binding.celtix/.checkstyle
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/.checkstyle?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- incubator/tuscany/sandbox/celtix/binding.celtix/.checkstyle (original)
+++ incubator/tuscany/sandbox/celtix/binding.celtix/.checkstyle Thu Apr 27 
14:25:52 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <fileset-config file-format-version="1.2.0" simple-config="true">
-    <fileset name="all" enabled="true" check-config-name="Celtix Checks" 
local="false">
+    <fileset name="all" enabled="true" check-config-name="Tuscany Checks" 
local="false">
         <file-match-pattern match-pattern="." include-pattern="true"/>
     </fileset>
 </fileset-config>

Modified: incubator/tuscany/sandbox/celtix/binding.celtix/checkstyle.xml
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/checkstyle.xml?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- incubator/tuscany/sandbox/celtix/binding.celtix/checkstyle.xml (original)
+++ incubator/tuscany/sandbox/celtix/binding.celtix/checkstyle.xml Thu Apr 27 
14:25:52 2006
@@ -4,7 +4,7 @@
         "http://www.puppycrawl.com/dtds/configuration_1_2.dtd";>
 
 <!--
-Checks to make sure the code meets the Celtix coding guidelines
+Checks to make sure the code meets the Tuscany coding guidelines
 http://java.sun.com/docs/codeconv/index.html
 
 It also enforces aa bunch of other "BestPractices like method
@@ -90,7 +90,7 @@
         </module>
         <module name="FileLength"/>
         <module name="LineLength">
-            <property name="max" value="110"/>
+            <property name="max" value="115"/>
         </module>
         <module name="MethodLength">
             <property name="max" value="150"/>
@@ -148,7 +148,11 @@
         <module name="EmptyStatement"/>
         <module name="EqualsHashCode"/>
         <!--<module name="FinalLocalVariable"/>-->
-        <module name="HiddenField"/>
+        <module name="HiddenField">
+           <property name="ignoreConstructorParameter" value="true"/>
+           <property name="ignoreSetter" value="true"/>
+           <property name="ignoreAbstractMethods" value="true"/>
+        </module>
         <module name="IllegalInstantiation"/>
         <!--<module name="IllegalToken"/>-->
         <!--<module name="IllegalTokenText"/>-->
@@ -206,10 +210,6 @@
         <module name="VisibilityModifier">
             <property name="protectedAllowed" value="true"/>
             <property name="packageAllowed" value="true"/>
-            <!-- this is needed for the resource injection unit tests.  It 
will removed
-                    when private member inject is supported.
-               -->
-            <property name="publicMemberPattern" value="resource[12].*"/>
         </module>
 
 

Modified: incubator/tuscany/sandbox/celtix/binding.celtix/pom.xml
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/pom.xml?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- incubator/tuscany/sandbox/celtix/binding.celtix/pom.xml (original)
+++ incubator/tuscany/sandbox/celtix/binding.celtix/pom.xml Thu Apr 27 14:25:52 
2006
@@ -60,6 +60,21 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+                                                                       
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <version>2.2</version>
+            <scope>test</scope>
+        </dependency>
+
         <!-- Celtix -->
         <dependency>
             <groupId>org.objectweb.celtix</groupId>

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java
 Thu Apr 27 14:25:52 2006
@@ -21,6 +21,8 @@
 import javax.wsdl.Service;
 
 import commonj.sdo.helper.TypeHelper;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
 import org.apache.tuscany.model.assembly.Binding;
 
 /**
@@ -67,4 +69,8 @@
     TypeHelper getTypeHelper();
 
     void setTypeHelper(TypeHelper typeHelper);
+    
+    ResourceLoader getResourceLoader();
+
+    void setResourceLoader(ResourceLoader resourceLoader);
 }

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java
 Thu Apr 27 14:25:52 2006
@@ -24,6 +24,7 @@
 
 import commonj.sdo.helper.TypeHelper;
 import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding;
+import org.apache.tuscany.common.resource.ResourceLoader;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.impl.BindingImpl;
 
@@ -37,6 +38,7 @@
     private Service service;
     private String portURI;
     private TypeHelper typeHelper;
+    private ResourceLoader resourceLoader;
 
     /**
      * Constructor
@@ -54,6 +56,8 @@
     public Service getWSDLService() {
         return service;
     }
+    
+
 
     /**
      * @see 
org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port)
@@ -93,6 +97,14 @@
         this.typeHelper = pTypeHelper;
     }
 
+    public ResourceLoader getResourceLoader() {
+        return resourceLoader;
+    }
+
+    public void setResourceLoader(ResourceLoader resourceLoader) {
+        this.resourceLoader = resourceLoader;
+    }
+    
     /**
      * @see 
BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext)
      */
@@ -117,7 +129,7 @@
             for (Definition def : definitions) {
 
                 // Find the port with the given name
-                for (Service serv : (Collection<Service>) 
def.getServices().values()) {
+                for (Service serv : 
(Collection<Service>)def.getServices().values()) {
                     Port p = serv.getPort(portName);
                     if (p != null) {
                         service = serv;

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java
 Thu Apr 27 14:25:52 2006
@@ -60,7 +60,7 @@
 
     public ExternalWebServiceClient(Bus b, ExternalService externalService) 
throws BuilderException {
         bus = b;
-        WebServiceBinding wsBinding = (WebServiceBinding) 
externalService.getBindings().get(0);
+        WebServiceBinding wsBinding = 
(WebServiceBinding)externalService.getBindings().get(0);
         typeHelper = wsBinding.getTypeHelper();
         Definition wsdlDef = wsBinding.getWSDLDefinition();
         wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort());
@@ -80,18 +80,18 @@
             if (null != binding) {
                 List list = binding.getExtensibilityElements();
                 if (!list.isEmpty()) {
-                    bindingId = ((ExtensibilityElement) 
list.get(0)).getElementType().getNamespaceURI();
+                    bindingId = 
((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI();
                 }
             }
             if (bindingId == null) {
                 List<?> list = 
wsBinding.getWSDLPort().getExtensibilityElements();
                 for (Object ep : list) {
-                    ExtensibilityElement ext = (ExtensibilityElement) ep;
+                    ExtensibilityElement ext = (ExtensibilityElement)ep;
                     if (ext instanceof SOAPAddress) {
-                        bindingId = ((SOAPAddress) ext).getLocationURI();
+                        bindingId = ((SOAPAddress)ext).getLocationURI();
                     }
                     if (ext instanceof AddressType) {
-                        bindingId = ((AddressType) ext).getLocation();
+                        bindingId = ((AddressType)ext).getLocation();
                     }
                 }
 
@@ -175,7 +175,7 @@
             inOutCount = 1;
             for (int x = 0; x < args.length; x++) {
                 if (opInfo.getWebParam(x).mode() != Mode.IN) {
-                    Holder<?> holder = (Holder<?>) realArgs[x];
+                    Holder<?> holder = (Holder<?>)realArgs[x];
                     ret[inOutCount] = holder.value;
                     inOutCount++;
                 }

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java
 Thu Apr 27 14:25:52 2006
@@ -67,11 +67,11 @@
                 te.addContextName(iContext.getName());
                 throw te;
             }
-            context = (ExternalServiceContext) iContext;
+            context = (ExternalServiceContext)iContext;
         }
-        ExternalWebServiceClient client = (ExternalWebServiceClient) 
context.getHandler();
+        ExternalWebServiceClient client = 
(ExternalWebServiceClient)context.getHandler();
         if (payload != null) {
-            return client.invoke(method.getName(), (Object[]) payload);
+            return client.invoke(method.getName(), (Object[])payload);
         } else {
             return client.invoke(method.getName(), null);
         }
@@ -99,7 +99,7 @@
 
     public Object clone() throws CloneNotSupportedException {
         try {
-            ExternalWebServiceTargetInvoker invoker = 
(ExternalWebServiceTargetInvoker) super.clone();
+            ExternalWebServiceTargetInvoker invoker = 
(ExternalWebServiceTargetInvoker)super.clone();
             invoker.container = container;
             invoker.context = this.context;
             invoker.esName = this.esName;

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java
 Thu Apr 27 14:25:52 2006
@@ -62,7 +62,7 @@
             List ips = object.getInstanceProperties();
             Object[] os = new Object[object.getInstanceProperties().size()];
             for (int i = 0; i < os.length; i++) {
-                os[i] = object.get((Property) ips.get(i));
+                os[i] = object.get((Property)ips.get(i));
             }
 
             if (callback.hasInOut()) {
@@ -91,7 +91,7 @@
         System.setProperty(DOMImplementationRegistry.PROPERTY,
                 
"com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
         DOMImplementationRegistry registry = 
DOMImplementationRegistry.newInstance();
-        DOMImplementationLS impl = (DOMImplementationLS) 
registry.getDOMImplementation("LS");
+        DOMImplementationLS impl = 
(DOMImplementationLS)registry.getDOMImplementation("LS");
         LSOutput output = impl.createLSOutput();
         RawByteArrayOutputStream bout = new RawByteArrayOutputStream();
         output.setByteStream(bout);

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java
 Thu Apr 27 14:25:52 2006
@@ -91,7 +91,7 @@
         List ips = dataObject.getInstanceProperties();
         for (int i = 0; i < ips.size(); i++) {
             if (os[i] instanceof Holder) {
-                Holder<?> holder = (Holder<?>) os[i];
+                Holder<?> holder = (Holder<?>)os[i];
                 dataObject.set(i, holder.value);
             } else {
                 dataObject.set(i, os[i]);
@@ -105,7 +105,7 @@
         Document doc;
 
         public NodeContentHandler(Node nd) {
-            current = (Element) nd;
+            current = (Element)nd;
             doc = nd.getOwnerDocument();
         }
 
@@ -126,7 +126,7 @@
         }
 
         public void endElement(String uri, String localName, String qName) {
-            current = (Element) current.getParentNode();
+            current = (Element)current.getParentNode();
         }
     }
 

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java
 Thu Apr 27 14:25:52 2006
@@ -36,7 +36,7 @@
     @SuppressWarnings("unchecked")
     public <T> DataWriter<T> createWriter(Class<T> cls) {
         if (cls == Node.class) {
-            return (DataWriter<T>) new NodeDataWriter(this);
+            return (DataWriter<T>)new NodeDataWriter(this);
         }
         return null;
     }
@@ -44,7 +44,7 @@
     @SuppressWarnings("unchecked")
     public <T> DataReader<T> createReader(Class<T> cls) {
         if (cls == Node.class) {
-            return (DataReader<T>) new NodeDataReader(this);
+            return (DataReader<T>)new NodeDataReader(this);
         }
         //REVISIT - need to figure out what to do with Faults
         return null;

Modified: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java?rev=397642&r1=397641&r2=397642&view=diff
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java
 (original)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java
 Thu Apr 27 14:25:52 2006
@@ -27,6 +27,7 @@
 import org.apache.tuscany.core.loader.LoaderContext;
 import org.apache.tuscany.core.loader.StAXElementLoader;
 import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.loader.WSDLDefinitionRegistry;
 import org.apache.tuscany.core.system.annotation.Autowire;
 import org.osoa.sca.annotations.Destroy;
 import org.osoa.sca.annotations.Init;
@@ -43,12 +44,18 @@
     private static final WebServiceAssemblyFactory WS_FACTORY = new 
WebServiceAssemblyFactoryImpl();
 
     protected StAXLoaderRegistry registry;
+    protected WSDLDefinitionRegistry wsdlRegistry;
 
     @Autowire
     public void setRegistry(StAXLoaderRegistry reg) {
         this.registry = reg;
     }
 
+    @Autowire
+    public void setWsdlRegistry(WSDLDefinitionRegistry wsdlReg) {
+        wsdlRegistry = wsdlReg;
+    }
+
     @Init(eager = true)
     public void start() {
         registry.registerLoader(BINDING_WS, this);
@@ -59,6 +66,7 @@
         registry.unregisterLoader(BINDING_WS, this);
     }
 
+    @SuppressWarnings("deprecation")
     public WebServiceBinding load(XMLStreamReader reader, LoaderContext 
loaderContext)
         throws XMLStreamException, ConfigurationLoadException {
 
@@ -66,6 +74,7 @@
         binding.setURI(reader.getAttributeValue(null, "uri"));
         binding.setPortURI(reader.getAttributeValue(null, "port"));
         binding.setTypeHelper(registry.getContext().getTypeHelper());
+        binding.setResourceLoader(loaderContext.getResourceLoader());
         return binding;
     }
 }

Added: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java?rev=397642&view=auto
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
 (added)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
 Thu Apr 27 14:25:52 2006
@@ -0,0 +1,95 @@
+package org.apache.tuscany.binding.celtix.assembly;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import junit.framework.TestCase;
+
+import 
org.apache.tuscany.binding.celtix.assembly.impl.WebServiceAssemblyFactoryImpl;
+import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceBindingImpl;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.easymock.EasyMock;
+
+public class WebServiceAssemblyFactoryTestCase extends TestCase {
+
+    
+    private void setupMocks(AssemblyContext modelContext,
+                            AssemblyModelLoader loader,
+                            List<Definition> wsdlList) {
+        EasyMock.reset(loader);
+        EasyMock.reset(modelContext);
+        modelContext.getAssemblyLoader();        
+        EasyMock.expectLastCall().andReturn(loader);
+        loader.loadDefinitions("http://objectweb.org/hello_world_soap_http";);
+        EasyMock.expectLastCall().andReturn(wsdlList);
+        EasyMock.replay(loader);
+        EasyMock.replay(modelContext);        
+    }
+    
+    public void testCreate() throws Exception {
+        WebServiceAssemblyFactoryImpl impl = new 
WebServiceAssemblyFactoryImpl();
+        WebServiceBinding bind = impl.createWebServiceBinding();
+        assertNotNull("Did not create the binding", bind);
+        assertTrue("bind object wrong class: " + bind.getClass(),
+                   bind instanceof WebServiceBindingImpl);
+        
+        assertNull("Should be initialized with null WSDL", 
bind.getWSDLDefinition());
+        assertNull("Should be initialized with null port", bind.getWSDLPort());
+        assertNull("Should be initialized with null service", 
bind.getWSDLService());
+        assertNull("Should be initialized with null URI", bind.getURI());
+        assertNull("Should be initialized with null TypeHelper",
+                   bind.getTypeHelper());
+        assertNull("Should be initialized with null ResourceLoader",
+                   bind.getResourceLoader());
+        
+        bind.setURI("http://objectweb.org/hello_world_soap_http";);
+        bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort";);
+        
+        AssemblyContext modelContext = 
EasyMock.createNiceMock(AssemblyContext.class);
+        AssemblyModelLoader loader = 
EasyMock.createNiceMock(AssemblyModelLoader.class);
+        
+        WSDLReader reader =  WSDLFactory.newInstance().newWSDLReader();
+        reader.setFeature("javax.wsdl.verbose", false);
+        URL url = getClass().getResource("/wsdl/hello_world.wsdl");
+        Definition definition = reader.readWSDL(url.toString());
+
+        List<Definition> wsdlList = new ArrayList<Definition>();
+        
+        setupMocks(modelContext, loader, wsdlList);
+        try {
+            bind.initialize(modelContext);
+            fail("Should have failed getting the wsdl");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+        
+        setupMocks(modelContext, loader, wsdlList);
+
+        
+        wsdlList.add(definition);
+        bind = impl.createWebServiceBinding();
+        bind.setURI("http://objectweb.org/hello_world_soap_http";);
+        bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort";);
+        bind.initialize(modelContext);
+    
+        setupMocks(modelContext, loader, wsdlList);
+        
+        wsdlList.add(definition);
+        bind = impl.createWebServiceBinding();
+        bind.setURI("http://objectweb.org/hello_world_soap_http";);
+        bind.setPortURI("http://objectweb.org/hello_world_soap_http#FooPort";);
+        
+        try {
+            bind.initialize(modelContext);
+            fail("Should have failed finding the port");
+        } catch (IllegalArgumentException ex) {
+            //expected
+        }
+    }
+}

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java?rev=397642&view=auto
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
 (added)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
 Thu Apr 27 14:25:52 2006
@@ -0,0 +1,83 @@
+package org.apache.tuscany.binding.celtix.handler.io;
+
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+import commonj.sdo.helper.TypeHelper;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.helper.XSDHelperImpl;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.objectweb.celtix.bindings.DataReader;
+import org.objectweb.celtix.bindings.DataWriter;
+import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache;
+import org.objectweb.celtix.context.ObjectMessageContext;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+
+
+
+public class NodeDataWriterTestCase extends TestCase {
+
+    private TypeHelper typeHelper;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        DataObjectUtil.initRuntime();
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        try {
+            
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            typeHelper = SDOUtil.createTypeHelper();
+            URL url = getClass().getResource("/wsdl/hello_world.wsdl");
+            new XSDHelperImpl(typeHelper).define(url.openStream(), null);
+        } finally {
+            Thread.currentThread().setContextClassLoader(cl);
+        }
+        
+
+    }
+    
+    public void testWriteWrapper() throws Exception {
+        WSDLReader wreader =  WSDLFactory.newInstance().newWSDLReader();
+        wreader.setFeature("javax.wsdl.verbose", false);
+        URL url = getClass().getResource("/wsdl/hello_world.wsdl");
+        Definition definition = wreader.readWSDL(url.toString());
+        Port port = definition.getService(new 
QName("http://objectweb.org/hello_world_soap_http";,
+                                                    
"SOAPService")).getPort("SoapPort");
+        
+        WSDLMetaDataCache wsdlCache = new WSDLMetaDataCache(definition,
+                                                            port);
+        
+        SCADataBindingCallback callback = new 
SCADataBindingCallback(wsdlCache.getOperationInfo("greetMe"),
+                                                                     
typeHelper,
+                                                                     false);
+        
+        DataWriter<Node> writer = callback.createWriter(Node.class);
+        Document doc = 
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+        Element element = doc.createElement("ROOT");
+        
+        ObjectMessageContext objCtx = new ObjectMessageContextImpl();
+        objCtx.setMessageObjects(new Object[] {"Hello"});
+        writer.writeWrapper(objCtx , false, element);
+        
+        assertEquals("Value not written", "Hello", 
element.getFirstChild().getTextContent().trim());
+        
+        DataReader<Node> reader = callback.createReader(Node.class);
+        reader.readWrapper(objCtx , false, element);
+        
+        assertEquals("Hello", objCtx.getReturn());
+    }
+
+}

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java?rev=397642&view=auto
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
 (added)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
 Thu Apr 27 14:25:52 2006
@@ -0,0 +1,38 @@
+package org.apache.tuscany.binding.celtix.loader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.core.loader.LoaderContext;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.model.assembly.AssemblyContext;
+import org.easymock.EasyMock;
+
+public class WebServiceBindingLoaderTestCase extends TestCase {
+
+    @SuppressWarnings("deprecation")
+    public void testLoad() throws Exception {
+        
+        WebServiceBindingLoader loader = new WebServiceBindingLoader();
+        StAXLoaderRegistry reg = 
EasyMock.createNiceMock(StAXLoaderRegistry.class);
+        reg.getContext();
+        
EasyMock.expectLastCall().andReturn(EasyMock.createNiceMock(AssemblyContext.class));
+        EasyMock.replay(reg);
+            
+        loader.setRegistry(reg);
+        
+        XMLStreamReader reader = 
EasyMock.createNiceMock(XMLStreamReader.class);
+        reader.getAttributeValue(null, "uri");
+        
EasyMock.expectLastCall().andReturn("http://objectweb.org/hello_world_soap_http";);
+        reader.getAttributeValue(null, "port");
+        EasyMock.expectLastCall().andReturn("SoapPort");
+        EasyMock.replay(reader);
+        
+        LoaderContext loaderContext = new LoaderContext(null);
+        
+        assertNotNull("Did not load binding", loader.load(reader, 
loaderContext));
+        
+    }
+
+}

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/hello_world.wsdl
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/hello_world.wsdl?rev=397642&view=auto
==============================================================================
--- 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/hello_world.wsdl
 (added)
+++ 
incubator/tuscany/sandbox/celtix/binding.celtix/src/test/resources/wsdl/hello_world.wsdl
 Thu Apr 27 14:25:52 2006
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" 
targetNamespace="http://objectweb.org/hello_world_soap_http"; 
+    xmlns="http://schemas.xmlsoap.org/wsdl/"; 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
+    xmlns:tns="http://objectweb.org/hello_world_soap_http";
+    xmlns:x1="http://objectweb.org/hello_world_soap_http/types";
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
+    <wsdl:types>
+        <schema 
targetNamespace="http://objectweb.org/hello_world_soap_http/types"; 
+            xmlns="http://www.w3.org/2001/XMLSchema";
+           xmlns:tns="http://objectweb.org/hello_world_soap_http/types";
+            elementFormDefault="qualified">
+           <simpleType name="MyStringType">
+               <restriction base="string">
+                   <maxLength value="30" />
+               </restriction>
+           </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType/>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="short"/>
+                        <element name="major" type="short"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeRequest">
+        <wsdl:part name="in" element="x1:pingMe"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeResponse">
+        <wsdl:part name="out" element="x1:pingMeResponse"/>
+    </wsdl:message>            
+    <wsdl:message name="pingMeFault">
+        <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" 
name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+            <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+            <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+        </wsdl:operation> 
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="pingMeFault">
+                <soap:fault name="pingMeFault" use="literal"/>
+            </wsdl:fault>
+        </wsdl:operation>
+        
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address 
location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+


Reply via email to