incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r482612 - in /incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba: ./ interceptors/
Date Tue, 05 Dec 2006 11:58:57 GMT
Author: enolan
Date: Tue Dec  5 03:58:56 2006
New Revision: 482612

URL: http://svn.apache.org/viewvc?view=rev&rev=482612
Log:
yoko-225 adding more new tests.

Added:
    incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java   (with props)
    incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java   (with props)
    incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase
Modified:
    incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingTest.java
    incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java

Modified: incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingTest.java?view=diff&rev=482612&r1=482611&r2=482612
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingTest.java (original)
+++ incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaBindingTest.java Tue Dec  5 03:58:56 2006
@@ -88,8 +88,10 @@
         assertNotNull(in);
         List<Interceptor> out = binding.getOutInterceptors();
         assertNotNull(out);
-        List<Interceptor> fault = binding.getFaultInterceptors();
-        assertNotNull(fault);
+        List<Interceptor> infault = binding.getFaultInInterceptors();
+        assertNotNull(infault);
+        List<Interceptor> outfault = binding.getFaultOutInterceptors();
+        assertNotNull(outfault);
         Message message = binding.createMessage();
         message.put(ORB.class, orb);
         assertNotNull(message);

Modified: incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java?view=diff&rev=482612&r1=482611&r2=482612
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java (original)
+++ incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java Tue Dec  5 03:58:56 2006
@@ -94,7 +94,7 @@
         props.put("yoko.orb.id", "Yoko-Server-Binding");
         orb = ORB.init(new String[0], props);
         
-        staxObject = new CorbaStaxObject();
+        staxObject = new CorbaStaxObject(orb);
         staxObject.setOrb(orb);
         TestUtils testUtils = new TestUtils();
         endpointInfo = testUtils.setupServiceInfo("http://yoko.apache.org/StaxTest",

Added: incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java?view=auto&rev=482612
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java Tue Dec  5 03:58:56 2006
@@ -0,0 +1,419 @@
+/**
+ * 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.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.corba2.ContextUtils;
+import org.apache.yoko.bindings.corba2.CorbaBindingFactory;
+import org.apache.yoko.bindings.corba2.CorbaDestination;
+import org.apache.yoko.bindings.corba2.CorbaMessage;
+import org.apache.yoko.bindings.corba2.CorbaStaxObject;
+import org.apache.yoko.bindings.corba2.CorbaStreamable;
+import org.apache.yoko.bindings.corba2.CorbaTypeMap;
+import org.apache.yoko.bindings.corba2.CorbaUtils;
+import org.apache.yoko.bindings.corba2.TestUtils;
+import org.apache.yoko.bindings.corba2.types.CorbaHandlerUtils;
+import org.apache.yoko.bindings.corba2.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba2.types.CorbaPrimitiveHandler;
+import org.apache.yoko.bindings.corba2.CorbaBinding;
+import org.apache.yoko.orb.CORBA.ServerRequest;
+import org.apache.yoko.tools.common.CORBAConstants;
+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/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java?view=auto&rev=482612
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptorTest.java Tue Dec  5 03:58:56 2006
@@ -0,0 +1,329 @@
+/**
+ * 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.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.corba2.ContextUtils;
+import org.apache.yoko.bindings.corba2.CorbaBindingFactory;
+import org.apache.yoko.bindings.corba2.CorbaConduit;
+import org.apache.yoko.bindings.corba2.CorbaDestination;
+import org.apache.yoko.bindings.corba2.CorbaMessage;
+import org.apache.yoko.bindings.corba2.CorbaStaxObject;
+import org.apache.yoko.bindings.corba2.CorbaStreamable;
+import org.apache.yoko.bindings.corba2.CorbaTypeMap;
+import org.apache.yoko.bindings.corba2.CorbaUtils;
+import org.apache.yoko.bindings.corba2.TestUtils;
+import org.apache.yoko.bindings.corba2.types.CorbaHandlerUtils;
+import org.apache.yoko.bindings.corba2.types.CorbaObjectHandler;
+import org.apache.yoko.bindings.corba2.types.CorbaPrimitiveHandler;
+import org.apache.yoko.bindings.corba2.CorbaBinding;
+import org.apache.yoko.tools.common.CORBAConstants;
+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();        
+    }
+    
+}
\ No newline at end of file

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

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

Added: incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase?view=auto&rev=482612
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/test/java/org/apache/yoko/bindings/corba/interceptors/TestBase Tue Dec  5 03:58:56 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);
+        
+
+    }
+}



Mime
View raw message