incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r483586 [3/4] - in /incubator/yoko/trunk/bindings/src/test: java/org/apache/yoko/bindings/corba/ java/org/apache/yoko/bindings/corba/interceptors/ java/org/apache/yoko/bindings/corba/types/ resources/wsdl/
Date Thu, 07 Dec 2006 18:11:28 GMT
Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/TestUtils.java Thu Dec  7 10:11:27 2006
@@ -20,39 +20,73 @@
 
 import java.net.URL;
 import javax.xml.namespace.QName;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.apache.yoko.wsdl.CorbaConstants;
 
-import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
-import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
-
-public final class TestUtils {
+public class TestUtils { 
     
-    public EndpointReferenceType getSimpleTestEndpointReference() {
-        URL wsdlUrl = getClass().getResource("/wsdl/simpleIdl.wsdl");
-        QName serviceName = new QName("http://yoko.apache.org/simple", "SimpleCORBAService");
-        return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "SimpleCORBAPort");
-    }
+    protected static Bus bus;
+    protected CorbaBindingFactory factory;
+    protected EndpointInfo endpointInfo;
     
-    public EndpointReferenceType getStaxTestEndpointReference() {
-        URL wsdlUrl = getClass().getResource("/wsdl/StaxTest.wsdl");
-        QName serviceName = new QName("http://yoko.apache.org/StaxTest", "StaxTestCORBAService");
-        return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "StaxTestCORBAPort");
-    }
+    public TestUtils() {     
+        bus = BusFactoryHelper.newInstance().getDefaultBus();
+        BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
+        try {
+            factory = (CorbaBindingFactory)bfm.getBindingFactory("http://schemas.apache.org/yoko/bindings/corba");
+            bfm.registerBindingFactory(CorbaConstants.NU_WSDL_CORBA, factory);
+        } catch (BusException ex) {
+            ex.printStackTrace();            
+        }
+    }        
     
-    public EndpointReferenceType getComplexTypesEndpointReference() {
-        URL wsdlUrl = getClass().getResource("/wsdl/ComplexTypes.wsdl");
-        QName serviceName = new QName("http://yoko.apache.org/ComplexTypes", "ComplexTypesCORBAService");
-        return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "ComplexTypesCORBAPort");
+    public EndpointInfo setupServiceInfo(String ns, String wsdl, String serviceName, String portName) throws Exception {      
+        URL wsdlUrl = getClass().getResource(wsdl);
+        WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
+
+        Service service = factory.create();
+        EndpointInfo endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, portName));
+        return endpointInfo;
+
+    }                  
+
+    public CorbaDestination getSimpleTypesTestDestination() throws Exception {
+        endpointInfo = setupServiceInfo("http://yoko.apache.org/simple",
+                                                     "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
+                                                      "SimpleCORBAPort");
+        CorbaBindingFactory corbaBF = (CorbaBindingFactory)factory;
+        return (CorbaDestination)corbaBF.getDestination(endpointInfo);        
     }
     
-    public EndpointReferenceType getParamModesEndpointReference() {
-        URL wsdlUrl = getClass().getResource("/wsdl/ParamModes.wsdl");
-        QName serviceName = new QName("http://yoko.apache.org/ParamModes", "ParamModesCORBAService");
-        return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "ParamModesCORBAPort");
+    public CorbaDestination getExceptionTypesTestDestination() throws Exception {
+        endpointInfo = setupServiceInfo("http://schemas.apache.org/idl/except",
+                                                     "/wsdl/exceptions.wsdl", 
+                                                     "ExceptionTestCORBAService",
+                                                     "ExceptionTestCORBAPort");
+        CorbaBindingFactory corbaBF = (CorbaBindingFactory)factory;
+        return (CorbaDestination)corbaBF.getDestination(endpointInfo);        
     }
     
-    public EndpointReferenceType getNestedEndpointReference() {
-        URL wsdlUrl = getClass().getResource("/wsdl/Nested.wsdl");
-        QName serviceName = new QName("http://yoko.apache.org/nested", "NestedCORBAService");
-        return EndpointReferenceUtils.getEndpointReference(wsdlUrl, serviceName, "NestedCORBAPort");
+    public CorbaDestination getStaxTypesTestDestination() throws Exception {
+        endpointInfo = setupServiceInfo("http://yoko.apache.org/StaxTest",
+                                                     "/wsdl/StaxTest.wsdl", "StaxTestCORBAService",
+                                                     "StaxTestCORBAPort");
+        CorbaBindingFactory corbaBF = (CorbaBindingFactory)factory;
+        return (CorbaDestination)corbaBF.getDestination(endpointInfo);        
     }
+
+    public CorbaDestination getComplexTypesTestDestination() throws Exception {
+        endpointInfo = setupServiceInfo("http://yoko.apache.org/ComplexTypes",
+                                                     "/wsdl/ComplexTypes.wsdl", "ComplexTypesCORBAService",
+                                                     "ComplexTypesCORBAPort");
+        CorbaBindingFactory corbaBF = (CorbaBindingFactory)factory;        
+        return (CorbaDestination)corbaBF.getDestination(endpointInfo);
+    }        
+
 }

Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java?view=auto&rev=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java Thu Dec  7 10:11:27 2006
@@ -0,0 +1,418 @@
+/**
+ * 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.yoko.bindings.corba.interceptors;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.Holder;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.binding.BindingFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.databinding.DataReaderFactory;
+import org.apache.cxf.jaxb.io.EventDataReader;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.ServiceImpl;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+
+import org.apache.schemas.yoko.bindings.corba.ArgType;
+import org.apache.schemas.yoko.bindings.corba.MemberType;
+import org.apache.schemas.yoko.bindings.corba.ModeType;
+import org.apache.schemas.yoko.bindings.corba.OperationType;
+import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
+import org.apache.yoko.bindings.corba.ContextUtils;
+import org.apache.yoko.bindings.corba.CorbaBindingFactory;
+import org.apache.yoko.bindings.corba.CorbaDestination;
+import org.apache.yoko.bindings.corba.CorbaMessage;
+import org.apache.yoko.bindings.corba.CorbaStaxObject;
+import org.apache.yoko.bindings.corba.CorbaStreamable;
+import org.apache.yoko.bindings.corba.CorbaTypeMap;
+import org.apache.yoko.bindings.corba.CorbaUtils;
+import org.apache.yoko.bindings.corba.TestUtils;
+import org.apache.yoko.bindings.corba.types.CorbaHandlerUtils;
+import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba.types.CorbaPrimitiveHandler;
+import org.apache.yoko.bindings.corba.CorbaBinding;
+import org.apache.yoko.orb.CORBA.ServerRequest;
+import org.apache.yoko.wsdl.CorbaConstants;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+public class CorbaInInterceptorTest extends TestCase {
+    
+    private static IMocksControl control;
+    protected Bus bus;
+    protected EndpointInfo endpointInfo;
+    protected EndpointReferenceType target;    
+    protected MessageObserver observer;
+    protected Message inMessage;
+    BindingFactory factory;
+    ORB orb;
+    TestUtils testUtils;
+    
+    public CorbaInInterceptorTest(String arg0) {
+        super(arg0);
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(CorbaInInterceptorTest.class);
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        control = EasyMock.createNiceControl();      
+        java.util.Properties props = System.getProperties();
+        props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
+        props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
+        props.put("yoko.orb.id", "Yoko-Server-Binding");
+        orb = ORB.init(new String[0], props);
+        
+        testUtils = new TestUtils();
+    }
+    
+    public void tearDown() {
+        if (orb != null) {
+            try {
+                orb.destroy();
+            } catch (Exception ex) {
+                // Do nothing.  Throw an Exception?
+            }
+        }         
+    }
+    
+    public void testHandleMessage() throws Exception {        
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleNotRequestMessage", 
+                new Class[] {CorbaMessage.class, CorbaDestination.class, ServiceInfo.class});                                                       
+        CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});       
+                                                    
+        CorbaMessage msg = control.createMock(CorbaMessage.class);
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);    
+        EasyMock.expect(msg.getDestination()).andReturn(destination).times(2);        
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
+        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
+        EasyMock.expect(sInfo.getExtensors(TypeMappingType.class)).andReturn(null);
+        
+        inInterceptor.handleNotRequestMessage(msg, destination, sInfo);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        inInterceptor.handleMessage(msg);
+        control.verify();
+    }
+    
+    public void testHandleMessage1() throws Exception {        
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleRequestMessage", 
+                new Class[] {CorbaMessage.class, CorbaDestination.class, ServiceInfo.class});                                                       
+        CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});       
+                                                    
+        CorbaMessage msg = control.createMock(CorbaMessage.class);
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);        
+        EasyMock.expect(msg.getDestination()).andReturn(destination).times(2);        
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
+        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
+        EasyMock.expect(sInfo.getExtensors(TypeMappingType.class)).andReturn(null);
+        EasyMock.expect(msg.containsKey(Message.REQUESTOR_ROLE)).andReturn(true);
+        
+        inInterceptor.handleRequestMessage(msg, destination, sInfo);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        inInterceptor.handleMessage(msg);
+        control.verify();
+    }
+    
+    public void testHandleMessage2() throws Exception {        
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("handleRequestMessage", 
+                new Class[] {CorbaMessage.class, CorbaDestination.class, ServiceInfo.class});                                                       
+         CorbaInInterceptor inInterceptor = EasyMock.createMock(CorbaInInterceptor.class, new Method[] {m});       
+                                                    
+        CorbaMessage msg = control.createMock(CorbaMessage.class);
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
+        EasyMock.expect(msg.getDestination()).andReturn(null);
+        Exchange exchange = control.createMock(Exchange.class);
+        EasyMock.expect(msg.getExchange()).andReturn(exchange);
+        EasyMock.expect(exchange.getDestination()).andReturn(destination);        
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
+        EasyMock.expect(bInfo.getService()).andReturn(sInfo);
+        EasyMock.expect(sInfo.getExtensors(TypeMappingType.class)).andReturn(null);
+        EasyMock.expect(msg.containsKey(Message.REQUESTOR_ROLE)).andReturn(true);
+        
+        inInterceptor.handleRequestMessage(msg, destination, sInfo);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        inInterceptor.handleMessage(msg);
+        control.verify();
+    }
+        
+    
+    public void testHandleNotRequestMessage() throws Exception { 
+        
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("getDataReader", 
+                            new Class[] {CorbaMessage.class});      
+        Method m2 = CorbaInInterceptor.class.getDeclaredMethod("prepareArguments", 
+                            new Class[] {CorbaMessage.class, CorbaDestination.class,
+                                         InterfaceInfo.class, ServiceInfo.class,
+                                         OperationType.class, QName.class});      
+        Method m3 = CorbaInInterceptor.class.getDeclaredMethod("addUnmarshalParams", 
+                         new Class[] {CorbaMessage.class, CorbaMessage.class,                                       
+                                      List.class, InterfaceInfo.class,
+                                      OperationType.class, EventDataReader.class});      
+                                                                             
+        CorbaInInterceptor inInterceptor = control.createMock(CorbaInInterceptor.class, new Method[] {m, m2, m3});                                                                    
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);        
+        InterfaceInfo info = control.createMock(InterfaceInfo.class);
+        EasyMock.expect(bInfo.getInterface()).andReturn(info);        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
+        EventDataReader reader = control.createMock(EventDataReader.class);
+        inInterceptor.getDataReader(message);
+        EasyMock.expectLastCall().andReturn(reader);        
+        Exchange exchange = control.createMock(Exchange.class);                                   
+        EasyMock.expect(message.getExchange()).andReturn(exchange).times(2);
+        EasyMock.expect(exchange.get(String.class)).andReturn("opName");        
+        Collection<BindingOperationInfo> bopInfo = control.createMock(Collection.class);
+        Iterator iterator = control.createMock(Iterator.class);
+        EasyMock.expect(bInfo.getOperations()).andReturn(bopInfo);
+        EasyMock.expect(bopInfo.iterator()).andReturn(iterator);           
+        ServerRequest request = control.createMock(ServerRequest.class);
+        EasyMock.expect(exchange.get(org.omg.CORBA.ServerRequest.class)).andReturn(request);         
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);                      
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        inInterceptor.handleNotRequestMessage(message, destination, sInfo);
+        control.verify();           
+       }
+    
+    public void testHandleRequestMessage() throws Exception {        
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("getDataReader", 
+                                   new Class[] {CorbaMessage.class});        
+        Method m2 = CorbaInInterceptor.class.getDeclaredMethod("writeReturnValue", 
+                                   new Class[] {CorbaMessage.class, 
+                                                CorbaMessage.class,
+                                                ArgType.class,
+                                                EventDataReader.class});                                   
+        Method m3 = CorbaInInterceptor.class.getDeclaredMethod("addUnmarshalParams", 
+                    new Class[] {CorbaMessage.class, CorbaMessage.class, List.class, 
+                        InterfaceInfo.class, OperationType.class, EventDataReader.class});                                                                                                                    
+        CorbaInInterceptor inInterceptor = 
+            control.createMock(CorbaInInterceptor.class, new Method[] {m, m2, m3});
+        
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        CorbaMessage message = control.createMock(CorbaMessage.class);             
+        EventDataReader reader = control.createMock(EventDataReader.class);
+        inInterceptor.getDataReader(message);
+        EasyMock.expectLastCall().andReturn(reader);        
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);        
+        InterfaceInfo info = control.createMock(InterfaceInfo.class);
+        EasyMock.expect(bInfo.getInterface()).andReturn(info);                                                          
+        Exchange exchange = control.createMock(Exchange.class);               
+        EasyMock.expect(message.getExchange()).andReturn(exchange);        
+        BindingOperationInfo bopInfo = control.createMock(BindingOperationInfo.class);
+        OperationType opType = control.createMock(OperationType.class);
+        EasyMock.expect(exchange.get(BindingOperationInfo.class)).andReturn(bopInfo);
+        EasyMock.expect(bopInfo.getExtensor(OperationType.class)).andReturn(opType);        
+        EasyMock.expect(exchange.getOutMessage()).andReturn(message);
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
+                                         
+        control.replay();
+        inInterceptor.handleRequestMessage(message, destination, sInfo);
+        control.verify();           
+    }
+    
+    public void testWriteReturnValue() throws Exception {
+        CorbaInInterceptor inInterceptor = new CorbaInInterceptor();        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
+        CorbaStreamable streamable = control.createMock(CorbaStreamable.class);
+        EventDataReader reader = control.createMock(EventDataReader .class);
+        ArgType argType = control.createMock(ArgType.class);
+        EasyMock.expect(message.getStreamableReturn()).andReturn(streamable);
+        EasyMock.expect(streamable.getObject()).andReturn(null);
+        EasyMock.expect(argType.getName()).andReturn(null);       
+        
+        control.replay();
+        inInterceptor.writeReturnValue(message, message, argType, reader);
+        control.verify();                 
+    }
+    
+    /*public void testAddUnmarshalParams() throws Exception {
+       // NEED TO DO
+    }*/
+    
+    
+    public void testPrepareArguments() throws Exception {    
+        Method m = CorbaInInterceptor.class.getDeclaredMethod("prepareDIIArgsList", 
+                            new Class[] {CorbaMessage.class, 
+                                         CorbaStreamable[].class,
+                                         List.class, List.class});                                                                                   
+        CorbaInInterceptor inInterceptor = control.createMock(CorbaInInterceptor.class,
+                                             new Method[] {m});
+                                                                                                                       
+        CorbaDestination destination = control.createMock(CorbaDestination.class);
+        EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
+        ServiceInfo sInfo = control.createMock(ServiceInfo.class);
+        BindingInfo bInfo = control.createMock(BindingInfo.class);
+        InterfaceInfo info = control.createMock(InterfaceInfo.class);
+        BindingOperationInfo bopInfo = control.createMock(BindingOperationInfo.class);
+        OperationInfo opInfo = control.createMock(OperationInfo.class);
+        EasyMock.expect(destination.getBindingInfo()).andReturn(bInfo);
+        EasyMock.expect(destination.getEndPointInfo()).andReturn(endpointInfo);                
+        QName qname = new QName("" , "Test", "");
+        EasyMock.expect(bInfo.getOperation(qname)).andReturn(bopInfo);
+        EasyMock.expect(bopInfo.getOperationInfo()).andReturn(opInfo);                        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
+        Exchange exchange = control.createMock(Exchange.class);
+        EndpointReferenceType etype = control.createMock(EndpointReferenceType.class);
+        MessageInfo mInfo = control.createMock(MessageInfo.class);
+        EasyMock.expect(message.getExchange()).andReturn(exchange);      
+        EasyMock.expect(destination.getAddress()).andReturn(etype);
+        EasyMock.expect(opInfo.getInput()).andReturn(mInfo);
+        exchange.setInMessage(message);
+        EasyMock.expectLastCall();        
+        OperationType opType = control.createMock(OperationType.class);
+        List<ParamType> paramTypes = control.createMock(List.class);
+        EasyMock.expect(opType.getParam()).andReturn(paramTypes);
+        EasyMock.expect(paramTypes.size()).andReturn(0);
+        
+        control.replay();
+        inInterceptor.prepareArguments(message, destination, info, sInfo, opType, qname);
+        control.verify();    
+    }
+    
+    public void testprepareDIIArgsList() throws Exception {                        
+        CorbaInInterceptor inInterceptor = new CorbaInInterceptor();
+        CorbaStaxObject corbaStaxObject = new CorbaStaxObject();
+        Message msg = new MessageImpl();
+        CorbaMessage message = new CorbaMessage(msg);
+        List<CorbaTypeMap> typeMaps = new ArrayList<CorbaTypeMap>();
+        CorbaDestination destination = testUtils.getExceptionTypesTestDestination();
+        ServiceInfo service = destination.getBindingInfo().getService();        
+        List<TypeMappingType> corbaTypes = service.getExtensors(TypeMappingType.class);
+        if (corbaTypes != null) {
+            CorbaUtils.createCorbaTypeMap(typeMaps, corbaTypes);
+            corbaStaxObject.setTypeMaps(typeMaps);
+        }
+        
+        QName name = new QName("http://schemas.apache.org/idl/except", "review_data", "");
+        BindingInfo bInfo = destination.getBindingInfo();
+        BindingOperationInfo bopInfo = bInfo.getOperation(name);        
+        OperationType opType = bopInfo.getExtensor(OperationType.class);
+        List<ParamType> paramTypes = opType.getParam();
+                        
+        inInterceptor.setOrb(orb);                
+        CorbaStreamable[] streamables = new CorbaStreamable[1];    
+        NVList nvlist = inInterceptor.prepareDIIArgsList(message, streamables, paramTypes, typeMaps);
+        assertNotNull("NVList should not be null", nvlist != null);        
+        assertEquals("There should be one item in the list", nvlist.count(), 1);
+        assertEquals("Item name should be data", nvlist.item(0).name(), "data");
+        assertEquals("Item flags should be 1", nvlist.item(0).flags(), 1);     
+    }
+     
+    public void testprepareArgs() throws Exception {
+        CorbaInInterceptor inInterceptor = new CorbaInInterceptor();  
+        Message msg = new MessageImpl();
+        CorbaMessage message = new CorbaMessage(msg);        
+        List<ParamType> paramTypes  = new ArrayList<ParamType>(1);
+        ParamType param = new ParamType();
+        QName type = new QName("", "structure", "");
+        param.setName("param1");
+        param.setIdltype(type);
+        paramTypes.add(param);               
+        
+        inInterceptor.prepareArgs(message, paramTypes);
+        List<Object> args = message.getContent(List.class);
+        assertNotNull("args should exist and be empty", args !=  null);
+    }
+    
+    public void testGetEventReader() throws Exception {    
+        CorbaInInterceptor inInterceptor = new CorbaInInterceptor();
+        CorbaStreamable streamable = control.createMock(CorbaStreamable.class);        
+        EasyMock.expect(streamable.getObject()).andReturn(null);                       
+        
+        control.replay();
+        inInterceptor.getEventReader(streamable);
+        control.verify();                    
+    }
+    
+    public void testGetDataReader() throws Exception {        
+        
+        CorbaInInterceptor inInterceptor = new CorbaInInterceptor();        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
+        Exchange exchange = control.createMock(Exchange.class);
+        Service service = control.createMock(Service.class);
+        DataBinding databinding = control.createMock(DataBinding.class);        
+        
+        EasyMock.expect(message.getExchange()).andReturn(exchange);
+        EasyMock.expect(ServiceModelUtil.getService(exchange)).andReturn(service);
+        EasyMock.expect(service.getDataBinding()).andReturn(databinding);
+        EasyMock.expect(databinding.getDataReaderFactory()).andReturn(null);
+        
+        control.replay();
+        inInterceptor.getDataReader(message);
+        control.verify();                
+    }
+        
+}

Propchange: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java?view=auto&rev=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java Thu Dec  7 10:11:27 2006
@@ -0,0 +1,328 @@
+/**
+ * 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.yoko.bindings.corba.interceptors;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.binding.BindingFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.databinding.DataWriterFactory;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.jaxb.io.EventDataReader;
+import org.apache.cxf.jaxb.io.EventDataWriter;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.ServiceImpl;
+import org.apache.cxf.service.model.AbstractMessageContainer;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.service.model.ServiceModelUtil;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+
+import org.apache.schemas.yoko.bindings.corba.ArgType;
+import org.apache.schemas.yoko.bindings.corba.OperationType;
+import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
+import org.apache.yoko.bindings.corba.ContextUtils;
+import org.apache.yoko.bindings.corba.CorbaBindingFactory;
+import org.apache.yoko.bindings.corba.CorbaConduit;
+import org.apache.yoko.bindings.corba.CorbaDestination;
+import org.apache.yoko.bindings.corba.CorbaMessage;
+import org.apache.yoko.bindings.corba.CorbaStaxObject;
+import org.apache.yoko.bindings.corba.CorbaStreamable;
+import org.apache.yoko.bindings.corba.CorbaTypeMap;
+import org.apache.yoko.bindings.corba.CorbaUtils;
+import org.apache.yoko.bindings.corba.TestUtils;
+import org.apache.yoko.bindings.corba.types.CorbaHandlerUtils;
+import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba.types.CorbaPrimitiveHandler;
+import org.apache.yoko.bindings.corba.CorbaBinding;
+import org.apache.yoko.wsdl.CorbaConstants;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+public class CorbaOutInterceptorTest extends TestCase {
+    
+    private static IMocksControl control;
+    protected Bus bus;
+    protected EndpointInfo endpointInfo;
+    protected EndpointReferenceType target;    
+    protected MessageObserver observer;
+    protected Message inMessage;
+    TestUtils testUtils;
+    BindingFactory factory;
+    ORB orb;
+    
+    public CorbaOutInterceptorTest(String arg0) {
+        super(arg0);
+    }
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(CorbaInInterceptorTest.class);
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        control = EasyMock.createNiceControl();
+        bus = BusFactoryHelper.newInstance().getDefaultBus();       
+        BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);        
+        factory = (BindingFactory)bfm.getBindingFactory("http://schemas.apache.org/yoko/bindings/corba");
+        bfm.registerBindingFactory(CorbaConstants.NU_WSDL_CORBA, factory);
+        
+        testUtils = new TestUtils();
+    
+    }
+    
+    public void tearDown() {
+        bus.shutdown(true);
+        if (orb != null) {
+            try {
+                orb.destroy();
+            } catch (Exception ex) {
+                // Do nothing.  Throw an Exception?
+            }
+        }
+
+    }            
+    
+    public void testHandleMessage() throws Exception {        
+        Method m = CorbaOutInterceptor.class.getDeclaredMethod("handleInBoundMessage", 
+                new Class[] {CorbaMessage.class, OperationType.class});                                                       
+        Method m2 = CorbaOutInterceptor.class.getDeclaredMethod("getDataWriter", 
+                                               new Class[] {CorbaMessage.class});                                                       
+         CorbaOutInterceptor outInterceptor = EasyMock.createMock(CorbaOutInterceptor.class, new Method[] {m, m2});       
+                                                    
+        CorbaMessage msg = control.createMock(CorbaMessage.class);
+        ORB mOrb = control.createMock(ORB.class);
+        EasyMock.expect(msg.get("orb")).andReturn(mOrb);        
+        Exchange exg = control.createMock(Exchange.class);
+        EasyMock.expect(msg.getExchange()).andReturn(exg);
+        ServiceInfo service = control.createMock(ServiceInfo.class);
+        EasyMock.expect(exg.get(ServiceInfo.class)).andReturn(service);                     
+        BindingOperationInfo bInfo = control.createMock(BindingOperationInfo.class);
+        OperationType opType = control.createMock(OperationType.class);
+        EasyMock.expect(exg.get(BindingOperationInfo.class)).andReturn(bInfo);
+        EasyMock.expect(bInfo.getExtensor(OperationType.class)).andReturn(opType);
+                      
+        outInterceptor.handleInBoundMessage(msg, opType);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        outInterceptor.handleMessage(msg);
+        control.verify();
+    }
+    
+    public void testHandleMessage2() throws Exception {
+        Method m = CorbaOutInterceptor.class.getDeclaredMethod("handleOutBoundMessage", 
+                new Class[] {CorbaMessage.class, OperationType.class});
+        Method m2 = CorbaOutInterceptor.class.getDeclaredMethod("getDataWriter", 
+                                               new Class[] {CorbaMessage.class});                                                       
+        CorbaOutInterceptor outInterceptor = EasyMock.createMock(CorbaOutInterceptor.class, new Method[] {m, m2});       
+        
+        CorbaMessage msg = control.createMock(CorbaMessage.class);
+        EasyMock.expect(msg.containsKey(Message.REQUESTOR_ROLE)).andReturn(true);
+        ORB mOrb = control.createMock(ORB.class);
+        EasyMock.expect(msg.get("orb")).andReturn(mOrb);               
+        
+        Exchange exg = control.createMock(Exchange.class);
+        EasyMock.expect(msg.getExchange()).andReturn(exg);
+        ServiceInfo service = control.createMock(ServiceInfo.class);
+        EasyMock.expect(exg.get(ServiceInfo.class)).andReturn(service);                             
+        BindingOperationInfo bInfo = control.createMock(BindingOperationInfo.class);
+        OperationType opType = control.createMock(OperationType.class);
+        EasyMock.expect(exg.get(BindingOperationInfo.class)).andReturn(bInfo);
+        EasyMock.expect(bInfo.getExtensor(OperationType.class)).andReturn(opType);
+                      
+        outInterceptor.handleOutBoundMessage(msg, opType);
+        EasyMock.expectLastCall();
+               
+        control.replay();
+        outInterceptor.handleMessage(msg);
+        control.verify();
+    }
+   
+    // NEED TO REVISIT
+    /*public void testHandleOutBoundMessage() throws Exception {
+        Method m = CorbaOutInterceptor.class.getDeclaredMethod("getDataWriter", 
+                               new Class[] {CorbaMessage.class});
+        Method m1 = CorbaOutInterceptor.class.getDeclaredMethod("addMarshalParams", 
+                        new Class[] {CorbaMessage.class, List.class, 
+                                     MessageInfo.class, List.class,
+                                     XMLInputFactory.class, XMLOutputFactory.class,
+                                     EventDataWriter.class});
+                                        
+        CorbaOutInterceptor outInterceptor = 
+            EasyMock.createMock(CorbaOutInterceptor.class, new Method[] {m, m1});
+                
+        CorbaMessage message = control.createMock(CorbaMessage.class);             
+        EventDataWriter writer = control.createMock(EventDataWriter.class);
+        outInterceptor.getDataWriter(message);
+        EasyMock.expectLastCall().andReturn(writer);       
+        
+        OperationType opType = control.createMock(OperationType.class);
+        List<ParamType> paramTypes = control.createMock(List.class);
+        EasyMock.expect(opType.getParam()).andReturn(paramTypes);
+        
+        Exchange exchange = control.createMock(Exchange.class);
+        Service service = control.createMock(Service.class);
+        DataBinding databinding = control.createMock(DataBinding.class);                
+        EasyMock.expect(message.getExchange()).andReturn(exchange);
+        EasyMock.expect(ServiceModelUtil.getService(exchange)).andReturn(service);
+        EasyMock.expect(service.getDataBinding()).andReturn(databinding);
+        EasyMock.expect(databinding.getDataWriterFactory()).andReturn(null);        
+        
+        List<Object> args = control.createMock(List.class);
+        MessageInfo msgInfo = control.createMock(MessageInfo.class);
+        XMLInputFactory xif = control.createMock(XMLInputFactory.class);
+        XMLOutputFactory xof = control.createMock(XMLOutputFactory.class);        
+
+        EasyMock.expect(message.getContent(List.class)).andReturn(args);
+        EasyMock.expect(message.get(MessageInfo.class)).andReturn(msgInfo);
+        
+        outInterceptor.addMarshalParams(message, args, msgInfo, paramTypes, xif, xof, writer);
+        EasyMock.expectLastCall();
+
+        ArgType returnParam = EasyMock.createMock(ArgType.class);
+        EasyMock.expect(opType.getReturn()).andReturn(returnParam);
+                
+        QName name = new QName("", "reason", "");
+        EasyMock.expect(returnParam.getName()).andReturn("reason");
+        EasyMock.expect(returnParam.getIdltype()).andReturn(name);
+                
+        List<CorbaTypeMap> typeMaps = control.createMock(List.class);
+        
+        //CorbaObjectHandler obj = CorbaHandlerUtils
+          //  .initializeObjectHandler(orb, name, name, typeMaps);
+        
+        CorbaStreamable streamable = EasyMock.createMock(CorbaStreamable.class);
+        message.setStreamableReturn(streamable);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        outInterceptor.handleOutBoundMessage(message, opType);
+        control.verify();
+    }
+    
+    public void testHandleOutBoundMessage2() throws Exception {
+        CorbaOutInterceptor outInterceptor = new CorbaOutInterceptor();
+        CorbaDestination destination = testUtils.getSimpleTypesTestDestination();
+        endpointInfo = destination.getEndPointInfo();
+        
+        Message msg = new MessageImpl();
+        Exchange exg = new ExchangeImpl();
+        exg.setDestination(destination);       
+        
+        Service service = new ServiceImpl(endpointInfo.getBinding().getService());        
+        Service ser = (Service)service;
+        
+        Endpoint endpoint = new EndpointImpl(bus, null, endpointInfo);
+        //exg.put("Service.class", service);
+        exg.put("org.apache.cxf.service.Service", ser);
+        exg.put("Endpoint.class", endpoint);
+        msg.setExchange(exg);
+        CorbaMessage message = new CorbaMessage(msg);
+        
+        
+        EventDataWriter writer = (EventDataWriter)outInterceptor.getDataWriter(message);        
+        
+    }*/
+
+    /* NEED TO DO
+    public void testHandleInBoundMessage() throws Exception {
+        
+    }
+    
+    public void testAddMarshalParams()  throws Exception {
+        
+    }*/
+        
+    public void testGetMessagePartInfo() throws Exception {
+        CorbaOutInterceptor outInterceptor = new CorbaOutInterceptor();
+        MessageInfo mInfo = control.createMock(MessageInfo.class);
+        List<MessagePartInfo> parts = control.createMock(List.class);        
+        EasyMock.expect(mInfo.getMessageParts()).andReturn(parts);
+        EasyMock.expect(parts.size()).andReturn(0);
+        
+        control.replay();
+        outInterceptor.getMessagePartInfo(mInfo, "reason");
+        control.verify();
+    }
+    
+    public void testGetMessagePartInfo1() throws Exception {
+        CorbaOutInterceptor outInterceptor = new CorbaOutInterceptor();
+        MessageInfo mInfo = control.createMock(MessageInfo.class);
+        List<MessagePartInfo> parts = new ArrayList<MessagePartInfo>(1);        
+        EasyMock.expect(mInfo.getMessageParts()).andReturn(parts);
+        OperationInfo info = new OperationInfo();
+        QName name = new QName("", "Reason", "");   
+        MessageInfo minfo = new MessageInfo(info, name);
+        MessagePartInfo part = new MessagePartInfo(name,(AbstractMessageContainer)minfo);        
+        part.setName(name);
+        parts.add(part);        
+        control.replay();
+        outInterceptor.getMessagePartInfo(mInfo, "Reason");
+        control.verify();        
+    }
+    
+    
+    public void testgetDataWriter() throws Exception {
+        CorbaOutInterceptor outInterceptor = new CorbaOutInterceptor();        
+        CorbaMessage message = control.createMock(CorbaMessage.class);
+        Exchange exchange = control.createMock(Exchange.class);
+        Service service = control.createMock(Service.class);
+        DataBinding databinding = control.createMock(DataBinding.class);        
+        
+        EasyMock.expect(message.getExchange()).andReturn(exchange);
+        EasyMock.expect(ServiceModelUtil.getService(exchange)).andReturn(service);
+        EasyMock.expect(service.getDataBinding()).andReturn(databinding);
+        EasyMock.expect(databinding.getDataWriterFactory()).andReturn(null);
+        
+        control.replay();
+        outInterceptor.getDataWriter(message);
+        control.verify();        
+    }
+    
+}

Propchange: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase?view=auto&rev=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase (added)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase Thu Dec  7 10:11:27 2006
@@ -0,0 +1,168 @@
+/**
+ * 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.yoko.bindings.corba2.interceptors;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.xml.XMLBindingFactory;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.WSDLManagerImpl;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+public class TestBase extends TestCase {
+
+    protected PhaseInterceptorChain chain;
+
+    protected Message xmlMessage;
+    
+    protected Bus bus;
+
+    protected IMocksControl control;
+    
+    protected ServiceInfo serviceInfo;
+    
+    public void setUp() throws Exception {
+        List<Phase> phases = new ArrayList<Phase>();
+        Phase phase1 = new Phase("phase1", 1);
+        Phase phase2 = new Phase("phase2", 2);
+        Phase phase3 = new Phase("phase3", 3);
+        phases.add(phase1);
+        phases.add(phase2);
+        phases.add(phase3);
+        chain = new PhaseInterceptorChain(phases);
+
+        Exchange exchange = new ExchangeImpl();
+        MessageImpl messageImpl = new MessageImpl();
+        messageImpl.setInterceptorChain(chain);
+        messageImpl.setExchange(exchange);
+        xmlMessage = messageImpl;
+    }
+
+    public void tearDown() throws Exception {
+    }
+
+    public InputStream getTestStream(Class<?> clz, String file) {
+        return clz.getResourceAsStream(file);
+    }
+
+    public XMLStreamReader getXMLStreamReader(InputStream is) {
+        return StaxUtils.createXMLStreamReader(is);
+    }
+
+    public XMLStreamWriter getXMLStreamWriter(OutputStream os) {
+        return StaxUtils.createXMLStreamWriter(os);
+    }
+
+    public Method getTestMethod(Class<?> sei, String methodName) {
+        Method[] iMethods = sei.getMethods();
+        for (Method m : iMethods) {
+            if (methodName.equals(m.getName())) {
+                return m;
+            }
+        }
+        return null;
+    }
+    
+    protected void common(String wsdl, QName portName, Class... jaxbClasses) throws Exception {
+        control = EasyMock.createNiceControl();
+        
+        bus = control.createMock(Bus.class);
+        EasyMock.expect(bus.getExtension(WSDLManager.class)).andStubReturn(new WSDLManagerImpl());
+        
+        BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
+        EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andStubReturn(bindingFactoryManager);
+        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
+        EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
+        
+        control.replay();        
+        
+        assertNotNull(bus.getExtension(WSDLManager.class));
+        
+        WSDLServiceFactory factory = 
+            new WSDLServiceFactory(bus, getClass().getResource(wsdl),
+                                   new QName(portName.getNamespaceURI(), "XMLService"));
+
+        org.apache.cxf.service.Service service = factory.create();
+
+        serviceInfo = service.getServiceInfo();
+        
+        EndpointInfo epi = service.getServiceInfo().getEndpoint(portName);
+        assertNotNull(epi);
+        Binding corbaBinding = new CorbaBindingFactory().createBinding(epi.getBinding());
+
+        control.reset();
+        JAXBDataBinding db = new JAXBDataBinding();
+        db.initialize(serviceInfo);
+        db.setContext(JAXBContext.newInstance(jaxbClasses));
+        service.setDataBinding(db);
+
+        Endpoint endpoint = control.createMock(EndpointImpl.class);
+        EasyMock.expect(endpoint.getEndpointInfo()).andStubReturn(epi);
+        EasyMock.expect(endpoint.getBinding()).andStubReturn(xmlBinding);
+        EasyMock.expect(endpoint.getService()).andStubReturn(service);
+
+        control.replay();
+
+        xmlMessage.getExchange().put(Endpoint.class, endpoint);
+        xmlMessage.getExchange().put(org.apache.cxf.service.Service.class, service);
+        exg.put(BindingInfo.class, endpointInfo.getBinding());
+        exg.put(InterfaceInfo.class, endpointInfo.getInterface());
+        exg.put(EndpointInfo.class, endpointInfo);
+        exg.put(EndpointReferenceType.class, destination.getAddress());        
+        exg.put(ServiceInfo.class, endpointInfo.getService());
+        exg.put(BindingOperationInfo.class, bOpInfo);        
+        exg.put(OperationInfo.class, opInfo);                
+        exg.put(MessageInfo.class, opInfo.getInput());
+        exg.put(String.class, opName.getLocalPart());
+        exg.put(Service.class, service);
+        exg.setDestination(destination);
+        
+
+    }
+}

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandlerTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandlerTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandlerTest.java Thu Dec  7 10:11:27 2006
@@ -1,25 +1,5 @@
-/**
- * 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.yoko.bindings.corba.types;
 
-import java.util.Properties;
 import javax.xml.namespace.QName;
 
 import org.apache.yoko.wsdl.CorbaConstants;
@@ -34,7 +14,7 @@
 public class CorbaAnyHandlerTest extends TestCase {
 
     private ORB orb;
-
+    
     public CorbaAnyHandlerTest(String arg0) {
         super(arg0);
     }
@@ -42,18 +22,17 @@
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaAnyHandlerTest.class);
     }
-
+    
     protected void setUp() throws Exception {
         super.setUp();
 
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
     }
-
+    
     protected void tearDown() throws Exception {
         if (orb != null) {
             try {
@@ -61,26 +40,26 @@
             } catch (Exception ex) {
                 // Do nothing.  Throw an Exception?
             }
-        }
+        } 
     }
-
+    
     public void testGetSetSchemaType() {
         String testSchemaType = "xs:string";
         QName anyName = new QName("TestAny");
         QName anyIdlType = CorbaConstants.NT_CORBA_ANY;
         TypeCode anyTC = orb.get_primitive_tc(TCKind.tk_any);
-
+        
         CorbaAnyHandler anyHandler = new CorbaAnyHandler(anyName, anyIdlType, anyTC, null);
         anyHandler.setSchemaType(testSchemaType);
         String result = anyHandler.getSchemaType();
         assert(result.equals(testSchemaType));
     }
-
+    
     public void testGetSetValue() {
         QName anyName = new QName("TestAny");
         QName anyIdlType = CorbaConstants.NT_CORBA_ANY;
         TypeCode anyTC = orb.get_primitive_tc(TCKind.tk_any);
-
+        
         CorbaAnyHandler anyHandler = new CorbaAnyHandler(anyName, anyIdlType, anyTC, null);
         Any any = orb.create_any();
         String expectedSchemaType = null;
@@ -218,7 +197,7 @@
         assertTrue(floatResult == floatValue);
         resultSchemaType = anyHandler.getSchemaType();
         assertTrue(resultSchemaType.equals(expectedSchemaType));
-
+        
         String stringValue = "test string";
         any.insert_string(stringValue);
         anyHandler.setValue(any);
@@ -241,7 +220,7 @@
         resultSchemaType = anyHandler.getSchemaType();
         assertTrue(resultSchemaType.equals(expectedSchemaType));
     }
-
+    
     public void testGetSetValueData() {
         QName anyName = new QName("TestAny");
         QName anyIdlType = CorbaConstants.NT_CORBA_ANY;
@@ -253,13 +232,13 @@
         String schemaType = null;
         String resultSchemaType = null;
         Any resultAny = null;
-
+        
         value = "false";
         schemaType = "xs:boolean";
         anyHandler.setValueFromData(orb, value, schemaType);
         resultValue = anyHandler.getValueData();
         resultSchemaType = anyHandler.getSchemaType();
-        assertTrue(resultValue.equals(value));
+        assertTrue(resultValue.equals(value));        
         assertTrue(resultSchemaType.equals(schemaType));
         resultAny = anyHandler.getValue();
         assertTrue(resultAny.type().kind().value() == TCKind._tk_boolean);

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandlerTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandlerTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandlerTest.java Thu Dec  7 10:11:27 2006
@@ -18,7 +18,6 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import java.util.Properties;
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
@@ -36,7 +35,7 @@
     private QName objName;
     private QName objIdlType;
     private TypeCode objTypeCode;
-
+    
     public CorbaArrayHandlerTest(String arg0) {
         super(arg0);
     }
@@ -44,12 +43,11 @@
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaArrayHandlerTest.class);
     }
-
+    
     protected void setUp() throws Exception {
         super.setUp();
-
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
@@ -59,7 +57,7 @@
         objIdlType = null;
         objTypeCode = null;
     }
-
+    
     protected void tearDown() throws Exception {
         if (orb != null) {
             try {

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandlerTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandlerTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandlerTest.java Thu Dec  7 10:11:27 2006
@@ -18,7 +18,6 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import java.util.Properties;
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
@@ -33,26 +32,25 @@
 public class CorbaEnumHandlerTest extends TestCase {
 
     private ORB orb;
-
+    
     public CorbaEnumHandlerTest(String arg0) {
         super(arg0);
     }
-
+    
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaObjectHandlerTest.class);
     }
-
+    
     protected void setUp() throws Exception {
         super.setUp();
-
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
     }
-
+    
     protected void tearDown() throws Exception {
         if (orb != null) {
             try {
@@ -62,12 +60,12 @@
             }
         }
     }
-
+    
     public void testCorbaEnumHandler() {
         Enum enumType = new Enum();
         enumType.setName("EnumType");
         enumType.setRepositoryID("IDL:EnumType:1.0");
-
+        
         Enumerator enumerator0 = new Enumerator();
         enumerator0.setValue("ENUM0");
         Enumerator enumerator1 = new Enumerator();
@@ -77,22 +75,22 @@
         enumType.getEnumerator().add(enumerator0);
         enumType.getEnumerator().add(enumerator1);
         enumType.getEnumerator().add(enumerator2);
-
+        
         QName enumName = new QName("EnumType");
-        QName enumIdlType =
+        QName enumIdlType = 
             new QName(CorbaConstants.NU_WSDL_CORBA, "EnumType", CorbaConstants.NP_WSDL_CORBA);
         String members[] = new String[3];
         members[0] = enumerator0.getValue();
         members[1] = enumerator1.getValue();
         members[2] = enumerator2.getValue();
         TypeCode enumTC = orb.create_enum_tc(enumType.getRepositoryID(), enumType.getName(), members);
-
+        
         CorbaEnumHandler obj = new CorbaEnumHandler(enumName, enumIdlType, enumTC, enumType);
         assertNotNull(obj);
-
+        
         obj.setValue(members[1]);
         assertTrue(obj.getValue().equals(enumerator1.getValue()));
-
+        
         assertTrue(obj.getIndex() == (long)1);
     }
 }

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandlerTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandlerTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandlerTest.java Thu Dec  7 10:11:27 2006
@@ -18,7 +18,6 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import java.util.Properties;
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
@@ -32,26 +31,25 @@
 public class CorbaFixedHandlerTest extends TestCase {
 
     private ORB orb;
-
+    
     public CorbaFixedHandlerTest(String arg0) {
         super(arg0);
     }
-
+    
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaObjectHandlerTest.class);
     }
-
+    
     protected void setUp() throws Exception {
         super.setUp();
-
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
     }
-
+    
     protected void tearDown() throws Exception {
         if (orb != null) {
             try {
@@ -61,28 +59,28 @@
             }
         }
     }
-
+    
     public void testCorbaFixedHandler() {
         Fixed fixedType = new Fixed();
         fixedType.setName("FixedType");
         fixedType.setDigits((long)3);
         fixedType.setScale((long)2);
-
+        
         QName fixedName = new QName(fixedType.getName());
-        QName fixedIdlType =
+        QName fixedIdlType = 
             new QName(CorbaConstants.NU_WSDL_CORBA, "FixedType", CorbaConstants.NP_WSDL_CORBA);
         TypeCode fixedTC = orb.create_fixed_tc((short)fixedType.getDigits(), (short)fixedType.getScale());
         CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
         assertNotNull(obj);
-
+        
         java.math.BigDecimal value = new java.math.BigDecimal(123.45);
         obj.setValue(value);
-
+        
         assertTrue(value.equals(obj.getValue()));
-
+        
         String valueData = obj.getValueData();
         assertTrue(valueData.equals(value.toString()));
-
+        
         assertTrue(fixedType.getDigits() == obj.getDigits());
         assertTrue(fixedType.getScale() == obj.getScale());
     }

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtilsTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtilsTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtilsTest.java Thu Dec  7 10:11:27 2006
@@ -1,36 +1,33 @@
-/**
- * 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.yoko.bindings.corba.types;
 
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
-
 import javax.xml.namespace.QName;
 
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.yoko.bindings.corba.CorbaBindingFactory;
-import org.apache.yoko.bindings.corba.CorbaBindingImpl;
+import org.apache.yoko.bindings.corba.CorbaBinding;
+import org.apache.yoko.bindings.corba.CorbaDestination;
+import org.apache.yoko.bindings.corba.CorbaUtils;
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
 import org.apache.yoko.bindings.corba.TestUtils;
 import org.apache.yoko.wsdl.CorbaConstants;
 
-import org.objectweb.celtix.Bus;
-import org.objectweb.celtix.bindings.BindingManager;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactoryHelper;
+import org.apache.cxf.binding.BindingFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.wsdl11.WSDLServiceFactory;
+
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 import org.omg.CORBA.ORB;
 
 import junit.framework.TestCase;
@@ -38,65 +35,84 @@
 public class CorbaHandlerUtilsTest extends TestCase {
 
     private final String complexTypesNamespaceURI = "http://yoko.apache.org/ComplexTypes/idl_types";
-    private final String complexTypesPrefix = "corbatm";
-
-    private TestUtils testUtils;
+    private final String complexTypesPrefix = "corbatm";    
     private ORB orb;
-    private Bus bus;
-
+    private Bus bus;    
+    protected EndpointInfo endpointInfo;
+    BindingFactory factory;
+    List<CorbaTypeMap> typeMaps;
+    
     public CorbaHandlerUtilsTest(String arg0) {
         super(arg0);
     }
 
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaHandlerUtilsTest.class);
-    }
-
+    }    
+    
     protected void setUp() throws Exception {
         super.setUp();
 
-        testUtils = new TestUtils();
+        bus = BusFactoryHelper.newInstance().getDefaultBus();              
+        BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);        
+        factory = (BindingFactory)bfm.getBindingFactory("http://schemas.apache.org/yoko/bindings/corba");
+        bfm.registerBindingFactory(CorbaConstants.NU_WSDL_CORBA, factory);        
 
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
-
-        bus = Bus.init(new String[0]);
-
-        // programmatically add the corba binding factory
-        BindingManager manager = bus.getBindingManager();
-        CorbaBindingFactory corbaBF = new CorbaBindingFactory();
-        corbaBF.init(bus);
-        manager.registerBinding(CorbaConstants.NU_WSDL_CORBA, corbaBF);
-
+        
+        TestUtils testUtils = new TestUtils();
+        typeMaps = new ArrayList<CorbaTypeMap>();
+        //CorbaDestination destination = (CorbaDestination)getDestination();
+        CorbaDestination destination = testUtils.getComplexTypesTestDestination();
+        ServiceInfo service = destination.getBindingInfo().getService();           
+        List<TypeMappingType> corbaTypes = service.getExtensors(TypeMappingType.class);        
+        CorbaUtils.createCorbaTypeMap(typeMaps, corbaTypes);
     }
-
+    
     protected void tearDown() throws Exception {
+        bus.shutdown(true); 
         if (orb != null) {
             try {
                 orb.destroy();
             } catch (Exception ex) {
                 // Do nothing.  Throw an Exception?
             }
-        }
+        } 
     }
-
+            
+    /*protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {        
+        URL wsdlUrl = getClass().getResource(wsdl);
+        assertNotNull(wsdlUrl);
+        WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName));
+
+        Service service = factory.create();        
+        endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, portName));
+   
+    }
+    
+    public Destination getDestination() throws Exception {    
+        setupServiceInfo("http://yoko.apache.org/ComplexTypes", 
+                         "/wsdl/ComplexTypes.wsdl", 
+                         "ComplexTypesCORBAService", 
+                         "ComplexTypesCORBAPort");
+        CorbaBindingFactory corbaBF = (CorbaBindingFactory)factory;
+        Destination destination = corbaBF.getDestination(endpointInfo);
+        assertNotNull(destination);
+        return destination;
+    }*/
+    
     public void testCreateTypeHandler() {
-        CorbaBindingImpl bindingImpl = new CorbaBindingImpl(bus,
-                                                            testUtils.getComplexTypesEndpointReference(),
-                                                            orb,
-                                                            false);
         QName objName = null;
         QName objIdlType = null;
-        CorbaObjectHandler result = null;
-        List<CorbaTypeMap> typeMaps = bindingImpl.getCorbaTypeMaps();
-
+        CorbaObjectHandler result = null;     
+        
         // Test for an array handler
         objName = new QName("object");
-        objIdlType = new QName(complexTypesNamespaceURI, "TestArray", complexTypesPrefix);
+        objIdlType = new QName(complexTypesNamespaceURI, "TestArray", complexTypesPrefix);        
         result = CorbaHandlerUtils.createTypeHandler(orb, objName, objIdlType, typeMaps);
         assertTrue(result instanceof CorbaArrayHandler);
 
@@ -114,7 +130,7 @@
 
         // Test for a primitive handler
         objName = new QName("object");
-        objIdlType = CorbaConstants.NT_CORBA_BOOLEAN;
+        objIdlType = CorbaConstants.NT_CORBA_BOOLEAN;  
         result = CorbaHandlerUtils.createTypeHandler(orb, objName, objIdlType, typeMaps);
         assertTrue(result instanceof CorbaPrimitiveHandler);
 
@@ -136,16 +152,11 @@
         result = CorbaHandlerUtils.createTypeHandler(orb, objName, objIdlType, typeMaps);
         assertTrue(result instanceof CorbaUnionHandler);
     }
-
-    public void testInitializeObjectHandler() {
-        CorbaBindingImpl bindingImpl = new CorbaBindingImpl(bus,
-                                                            testUtils.getComplexTypesEndpointReference(),
-                                                            orb,
-                                                            false);
+    
+    public void testInitializeObjectHandler() {        
         QName objName = null;
         QName objIdlType = null;
-        CorbaObjectHandler result = null;
-        List<CorbaTypeMap> typeMaps = bindingImpl.getCorbaTypeMaps();
+        CorbaObjectHandler result = null;        
 
         // Test for an array handler
         objName = new QName("object");
@@ -155,7 +166,7 @@
         CorbaArrayHandler arrayHandler = (CorbaArrayHandler)result;
         // WSDL defines the array to have 5 elements
         assertTrue(arrayHandler.getElements().size() == 5);
-
+        
 
         // Test for a sequence handler
         objName = new QName("object");
@@ -167,7 +178,7 @@
         // element has been set.
         assertTrue(seqHandler.getElements().size() == 0);
         assertNotNull(seqHandler.getTemplateElement());
-
+        
         // Test for a bounded sequence handler
         objName = new QName("object");
         objIdlType = new QName(complexTypesNamespaceURI, "TestBoundedSequence", complexTypesPrefix);
@@ -176,7 +187,7 @@
         CorbaSequenceHandler boundedSeqHandler = (CorbaSequenceHandler)result;
         // This is a bounded sequence with WSDL defining 5 elements.
         assertTrue(boundedSeqHandler.getElements().size() == 5);
-
+        
         // Test for a struct handler
         objName = new QName("object");
         objIdlType = new QName(complexTypesNamespaceURI, "TestStruct", complexTypesPrefix);

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandlerTest.java?view=diff&rev=483586&r1=483585&r2=483586
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandlerTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandlerTest.java Thu Dec  7 10:11:27 2006
@@ -18,7 +18,6 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import java.util.Properties;
 import javax.xml.namespace.QName;
 
 import junit.framework.TestCase;
@@ -32,26 +31,25 @@
 public class CorbaObjectHandlerTest extends TestCase {
 
     private ORB orb;
-
+    
     public CorbaObjectHandlerTest(String arg0) {
         super(arg0);
     }
-
+    
     public static void main(String[] args) {
         junit.textui.TestRunner.run(CorbaObjectHandlerTest.class);
     }
-
+    
     protected void setUp() throws Exception {
         super.setUp();
-
-        java.util.Properties props = new Properties();
-        props.putAll(System.getProperties());
+        
+        java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
     }
-
+    
     protected void tearDown() throws Exception {
         if (orb != null) {
             try {
@@ -61,7 +59,7 @@
             }
         }
     }
-
+    
     public void testCreateCorbaObjectHandler() {
         QName objName = new QName("object");
         QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
@@ -69,7 +67,7 @@
         CorbaObjectHandler obj = new CorbaObjectHandler(objName, objIdlType, objTypeCode, null);
         assertNotNull(obj);
     }
-
+    
     public void testGetObjectAttributes() {
         QName objName = new QName("object");
         QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
@@ -79,15 +77,15 @@
         QName name = obj.getName();
         assertNotNull(name);
         assertTrue(name.equals(objName));
-
+        
         QName idlType = obj.getIdlType();
         assertNotNull(idlType);
         assertTrue(idlType.equals(objIdlType));
-
+        
         TypeCode tc = obj.getTypeCode();
         assertNotNull(tc);
         assertTrue(tc.kind().value() == objTypeCode.kind().value());
-
+        
         Object objDef = obj.getType();
         assertNull(objDef);
     }



Mime
View raw message