cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaypai...@apache.org
Subject svn commit: r530775 - in /incubator/cxf/trunk: rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ systests/src/t...
Date Fri, 20 Apr 2007 12:42:04 GMT
Author: ajaypaibir
Date: Fri Apr 20 05:42:02 2007
New Revision: 530775

URL: http://svn.apache.org/viewvc?view=rev&rev=530775
Log:
Added system test for Coloc with Wrapped Style WSDL. Fixed a bug in WrapperClassOut Interceptor
around way the parameter list was created for the wrapper instance.

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
  (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocInInterceptor.java
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocInInterceptor.java?view=diff&rev=530775&r1=530774&r2=530775
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocInInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocInInterceptor.java
Fri Apr 20 05:42:02 2007
@@ -34,6 +34,8 @@
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
 
 public class ColocInInterceptor extends AbstractPhaseInterceptor<Message> {
 //    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ColocInInterceptor.class);
@@ -51,7 +53,7 @@
         if (ex.isOneWay()) {
             return;
         }
-       
+
         Bus bus = ex.get(Bus.class);
         List<Phase> phases = new ArrayList<Phase>(bus.getExtension(PhaseManager.class).getOutPhases());
 
@@ -64,8 +66,14 @@
         }
 
         //Initiate OutBound Processing
+        BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
         Message outBound = ex.getOutMessage();
-        outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);        
+        if (boi != null) {
+            outBound.put(MessageInfo.class, 
+                         boi.getOperationInfo().getOutput());
+        }
+
+        outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
         outBound.setInterceptorChain(chain);
         chain.doIntercept(outBound);
     }

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java?view=diff&rev=530775&r1=530774&r2=530775
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
Fri Apr 20 05:42:02 2007
@@ -38,6 +38,7 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transport.ChainInitiationObserver;
 
@@ -66,6 +67,10 @@
         inMsg.put(COLOCATED, Boolean.TRUE);
         inMsg.put(Message.REQUESTOR_ROLE, Boolean.FALSE);
         inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
+        OperationInfo oi = ex.get(OperationInfo.class);
+        if (oi != null) {
+            inMsg.put(MessageInfo.class, oi.getInput());
+        }
         ex.setInMessage(inMsg);
         inMsg.setExchange(ex);
         
@@ -80,7 +85,7 @@
         inMsg.setInterceptorChain(chain);
 
         chain.doIntercept(inMsg);
-        
+
         //Set Server OutBound Message onto InBound Exchange.
         setOutBoundMessage(ex, m.getExchange());
     }
@@ -103,9 +108,12 @@
         QName opName = (QName) m.get(Message.WSDL_OPERATION);
         BindingInfo bi = endpoint.getEndpointInfo().getBinding();
         BindingOperationInfo boi = bi.getOperation(opName);
+        if (boi != null && boi.isUnwrapped()) {
+            boi = boi.getWrappedOperation();
+        }
+        
         exchange.put(BindingInfo.class, bi);
         exchange.put(BindingOperationInfo.class, boi);
         exchange.put(OperationInfo.class, boi.getOperationInfo());
     }
-    
 }

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java?view=diff&rev=530775&r1=530774&r2=530775
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocOutInterceptor.java
Fri Apr 20 05:42:02 2007
@@ -100,8 +100,14 @@
             message.put(Message.WSDL_OPERATION, boi.getName());
             message.put(Message.WSDL_INTERFACE, boi.getBinding().getInterface().getName());
             invokeColocObserver(message, srv.getEndpoint(), bus);
-            invokeInboundChain(exchange, senderEndpoint);
+            if (!exchange.isOneWay()) {
+                invokeInboundChain(exchange, senderEndpoint);
+            }
         } else {
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.fine("Operation:" + boi.getName() + " dispatched as remote call.");
+            }
+            
             message.put(COLOCATED, Boolean.FALSE);
         }
     }
@@ -111,7 +117,7 @@
             colocObserver = new ColocMessageObserver(inboundEndpoint, bus);
         }
         if (LOG.isLoggable(Level.FINE)) {
-            LOG.finest("Invoke on Coloc Observer.");
+            LOG.fine("Invoke on Coloc Observer.");
         }
 
         colocObserver.onMessage(outMsg);

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java?view=diff&rev=530775&r1=530774&r2=530775
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
Fri Apr 20 05:42:02 2007
@@ -37,6 +37,8 @@
 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.MessageInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 
@@ -53,12 +55,14 @@
     private Service srv;
     private Endpoint ep;
     private Bus bus;
+    private OperationInfo oi;
 
     @Before
     public void setUp() throws Exception {
         ep = control.createMock(Endpoint.class);
         bus = control.createMock(Bus.class);
-        srv = control.createMock(Service.class);        
+        srv = control.createMock(Service.class);
+        oi = control.createMock(OperationInfo.class);
         BusFactory.setDefaultBus(bus);        
         msg = new MessageImpl();
         ex = new ExchangeImpl();
@@ -85,15 +89,24 @@
         EasyMock.expect(ei.getBinding()).andReturn(bi);
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bi.getOperation(opName)).andReturn(boi);
+        EasyMock.expect(boi.getOperationInfo()).andReturn(oi);        
 
         control.replay();
         observer.setExchangeProperties(ex, msg);
         control.verify();
 
+        assertNotNull("Bus should be set",
+                      ex.get(Bus.class));
+        assertNotNull("Endpoint should be set",
+                      ex.get(Endpoint.class));
         assertNotNull("Binding should be set",
                       ex.get(Binding.class));
         assertNotNull("Service should be set",
                       ex.get(Service.class));
+        assertNotNull("BindingOperationInfo should be set",
+                      ex.get(BindingOperationInfo.class));
+        assertNotNull("OperationInfo should be set",
+                      ex.get(OperationInfo.class));
     }
 
     @Test
@@ -106,7 +119,10 @@
         
         Message inMsg = new MessageImpl();
         EasyMock.expect(binding.createMessage()).andReturn(inMsg);
-        
+
+        MessageInfo mi = control.createMock(MessageInfo.class);
+        EasyMock.expect(oi.getInput()).andReturn(mi);
+
         EasyMock.expect(ep.getService()).andReturn(srv).anyTimes();
         EasyMock.expect(
             bus.getExtension(PhaseManager.class)).andReturn(
@@ -127,6 +143,8 @@
         assertEquals("Message.INBOUND_MESSAGE should be true",
                      Boolean.TRUE,
                      inMsg.get(Message.INBOUND_MESSAGE));
+        assertNotNull("MessageInfo should be present in the Message instance",          
          
+                     inMsg.get(MessageInfo.class));
         assertNotNull("Chain should be set", inMsg.getInterceptorChain());
         Exchange ex1 = msg.getExchange();
         assertNotNull("Exchange should be set", ex1);
@@ -141,6 +159,7 @@
             exchange.put(Bus.class, bus);
             exchange.put(Endpoint.class, ep);
             exchange.put(Service.class, srv);
+            exchange.put(OperationInfo.class, oi);
         }
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java?view=diff&rev=530775&r1=530774&r2=530775
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
Fri Apr 20 05:42:02 2007
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.jaxws.interceptors;
 
-import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.cxf.helpers.CastUtils;
@@ -76,7 +76,8 @@
                     i++;
                 }
                 
-                objs = Arrays.asList((Object)wrapperType);
+                objs = new ArrayList<Object>(1);
+                objs.add(wrapperType);
                 message.setContent(List.class, objs);
             } catch (Exception ex) {
                 throw new Fault(ex);

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java?view=auto&rev=530775
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
Fri Apr 20 05:42:02 2007
@@ -0,0 +1,131 @@
+/**
+ * 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.cxf.systest.coloc;
+
+import javax.xml.namespace.QName;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.hello_world_soap_http.BadRecordLitFault;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.GreeterImpl;
+import org.apache.hello_world_soap_http.NoSuchCodeLitFault;
+import org.junit.Before;
+//import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This class invokes the service described in /wsdl/greeter_control.wsdl.
+ * This WSDL contains operations with in-out parameters.
+ * It sets up the a client in "getPort()" to send requests to the
+ * server which is listening on port 9001 (SOAP/HTTP).
+ * The subclass defines where CXF configuration and the
+ * target server (transport, etc).
+ *
+ */
+public abstract class AbstractWrappedDocLitTest extends AbstractColocTest {
+    static final QName SERVICE_NAME = new QName("http://apache.org/hello_world_soap_http",
+                                                "SOAPService");
+    static final QName PORT_NAME = new QName("http://apache.org/hello_world_soap_http",
+                                             "SoapPort");
+    static final String WSDL_LOCATION = "/wsdl/hello_world.wsdl";
+
+    private Greeter port;
+    private GreeterImpl impl = new GreeterImpl();
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        port = getPort(
+                         getServiceQname(),
+                         getPortQName(),
+                         getWsdlLocation(),
+                         Greeter.class);
+    }
+
+    @Test
+    public void testTwoWayOperation() {
+        for (int idx = 0; idx < 2; idx++) {
+            verifySayHi(port);
+            verifyGreetMe(port);
+        }
+    }
+    
+    @Test
+    public void testOneWayOperation() {
+        for (int idx = 0; idx < 2; idx++) {
+            verifyGreetMeOneway(port);
+        }
+    }
+
+    @Test
+    public void testFault() {
+        for (int idx = 0; idx < 2; idx++) {
+            verifyTestDocLitFault(port);
+        }
+    }
+
+    protected void verifyTestDocLitFault(Greeter proxy) {
+        try {
+            proxy.testDocLitFault(BadRecordLitFault.class.getSimpleName());
+            fail("Should throw a BadRecordLitFault Exception");
+        } catch (BadRecordLitFault brlf) {
+            assertEquals(BadRecordLitFault.class.getSimpleName(), brlf.getFaultInfo());
+        } catch (NoSuchCodeLitFault nsclf) {
+            fail("Should not throw a NoSuchCodeLitFault Exception");
+        }
+    }
+
+    protected void verifyGreetMeOneway(Greeter proxy) {
+        int count = impl.getInvocationCount();
+        proxy.greetMeOneWay("oneWay");
+        assertTrue("Count Should not be same", count != impl.getInvocationCount());
+    }
+    
+    protected void verifySayHi(Greeter greeterPort) {
+        String resp = greeterPort.sayHi();
+        assertEquals("Bonjour", resp);
+    }
+
+    protected void verifyGreetMe(Greeter greeterPort) {
+        String resp = greeterPort.greetMe("BART");
+        assertEquals("Hello BART", resp);
+    }
+
+    protected Object getServiceImpl() {
+        return impl;
+    }
+
+    protected String getWsdlLocation() {
+        return WSDL_LOCATION;
+    }
+
+    protected QName getServiceQname() {
+        return SERVICE_NAME;
+    }
+
+    protected QName getPortQName() {
+        return PORT_NAME;
+    }
+
+    protected boolean isFaultCodeCheckEnabled() {
+        return false;
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractWrappedDocLitTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java?view=auto&rev=530775
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
Fri Apr 20 05:42:02 2007
@@ -0,0 +1,43 @@
+/**
+ * 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.cxf.systest.coloc;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+
+
+public class ColocWrappedDocLitTest extends AbstractWrappedDocLitTest {
+    static final String TRANSPORT_URI = "http://localhost:9000/SoapContext/SoapPort";
+
+    private Log logger = LogFactory.getLog(ColocWrappedDocLitTest.class);
+
+    protected Log getLogger() {
+        return logger;
+    }
+
+    protected String getTransportURI() {
+        return TRANSPORT_URI;
+    }
+    
+    @Test
+    public void testDummy() { }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/ColocWrappedDocLitTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message