geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r537051 - in /geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb: ./ src/main/java/org/apache/geronimo/test/ src/test/resources/
Date Fri, 11 May 2007 00:15:17 GMT
Author: gawor
Date: Thu May 10 17:15:16 2007
New Revision: 537051

URL: http://svn.apache.org/viewvc?view=rev&rev=537051
Log:
much improved jaxws ejb test (includes basic handler testing)

Added:
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
  (with props)
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
  (with props)
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
  (with props)
Modified:
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/pom.xml
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/JAXWSBean.java
    geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/resources/request1.xml

Modified: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/pom.xml?view=diff&rev=537051&r1=537050&r2=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/pom.xml (original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/pom.xml Thu
May 10 17:15:16 2007
@@ -46,6 +46,7 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-ejb_3.0_spec</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -62,12 +63,14 @@
             <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-kernel</artifactId>
             <version>${version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>
             <artifactId>geronimo-security</artifactId>
             <version>${version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -82,9 +85,30 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>javax.xml.ws</groupId>
+            <artifactId>jaxws-api</artifactId>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.xml.bind</groupId>
+                    <artifactId>jsr173_api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
     </dependencies>
 
     <build>
+
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+             </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+
         <plugins>
             <plugin>
                 <groupId>org.apache.geronimo.genesis.plugins</groupId>

Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java?view=auto&rev=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
(added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
Thu May 10 17:15:16 2007
@@ -0,0 +1,69 @@
+/**
+ *  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.geronimo.test;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.WebServiceContext;
+
+import javax.annotation.PreDestroy;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.soap.*;
+
+public class GreeterLogicalHandler implements javax.xml.ws.handler.LogicalHandler<LogicalMessageContext>
{ 
+
+    @Resource WebServiceContext context;
+
+    public boolean handleMessage(LogicalMessageContext context) {
+        System.out.println(this + " HandleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        System.out.println(context.getMessage().getPayload());
+        return true;
+    }
+
+    @PostConstruct
+    public void init() {
+        System.out.println(this + " init " + context);
+    }
+
+    @PreDestroy
+    public void destroy() {
+        System.out.println(this + " destroy");
+    }
+    
+    public void init(Map<String,Object> config) {
+    }
+    
+    public boolean handleFault(LogicalMessageContext context) {
+        System.out.println(this + " handleFault");
+        return true;
+    }
+    
+    public void close(MessageContext context) {
+        System.out.println(this + " cclose");
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java?view=auto&rev=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
(added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
Thu May 10 17:15:16 2007
@@ -0,0 +1,92 @@
+/**
+ *  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.geronimo.test;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.WebServiceContext;
+
+import javax.annotation.PreDestroy;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.soap.*;
+
+public class GreeterSOAPHandler implements SOAPHandler<SOAPMessageContext> {
+
+    @Resource
+    WebServiceContext context;
+
+    @PostConstruct
+    public void init() {
+        System.out.println(this + " init: " + context);
+    }
+
+    @PreDestroy
+    public void destroy() {
+        System.out.println(this + " destroy");
+    }
+
+    public void init(Map<String,Object> config) {
+    }
+
+    public boolean handleFault(SOAPMessageContext context) {
+        System.out.println(this + " handleFault");
+        return true;
+    }
+
+    public void close(MessageContext context) {
+        System.out.println(this + " close");
+    }
+
+    public boolean handleMessage(SOAPMessageContext context) {
+        System.out.println(this + " handleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        
+        SOAPMessage message = context.getMessage();
+        try {
+            if ((Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
+                // outbound
+
+            } else {
+                // inbound
+                message.getSOAPBody().getElementsByTagNameNS("*", "arg0").item(0).getFirstChild().setNodeValue("foo
bar");
+                message.saveChanges();
+            }
+
+            //  message.writeTo(System.out);
+        } catch (Exception e) {
+            throw new RuntimeException("handler failed", e);
+        }
+
+        return true;
+    }
+
+    public Set<QName> getHeaders() {
+        System.out.println(this + " getHeaders");
+        return new TreeSet<QName>();
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/JAXWSBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/JAXWSBean.java?view=diff&rev=537051&r1=537050&r2=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/JAXWSBean.java
(original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/JAXWSBean.java
Thu May 10 17:15:16 2007
@@ -20,14 +20,24 @@
 
 import javax.ejb.Stateless;
 import javax.jws.WebService;
+import javax.jws.HandlerChain;
+import javax.jws.soap.SOAPBinding;
 
 @WebService
 @Stateless(mappedName="JAXWSBean")
+@HandlerChain(file="handlers.xml")
+@SOAPBinding(style=SOAPBinding.Style.RPC, 
+             use=SOAPBinding.Use.LITERAL,
+             parameterStyle=SOAPBinding.ParameterStyle.WRAPPED
+)
 public class JAXWSBean implements JAXWSGreeter { 
 
     public String greetMe(String me) {
-        System.out.println("i'm a ejb ws!!!!");
+        System.out.println("i'm a ejb ws: " + me);
+        if (!"foo bar".equals(me)) {
+            throw new RuntimeException("Wrong parameter");
+        }
         return "Hello " + me;
     }
-
+    
 }

Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml?view=auto&rev=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
(added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
Thu May 10 17:15:16 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+  <jws:handler-chain>
+
+    <jws:handler>
+      <jws:handler-name>GreeterSOAPHandler</jws:handler-name>
+      <jws:handler-class>org.apache.geronimo.test.GreeterSOAPHandler</jws:handler-class>
+    </jws:handler>
+
+    <jws:handler>
+      <jws:handler-name>GreeterLogicalHandler</jws:handler-name>
+      <jws:handler-class>org.apache.geronimo.test.GreeterLogicalHandler</jws:handler-class>
+    </jws:handler>
+
+  </jws:handler-chain>
+</jws:handler-chains>

Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/handlers.xml
------------------------------------------------------------------------------
    svn:executable = *

Modified: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/resources/request1.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/resources/request1.xml?view=diff&rev=537051&r1=537050&r2=537051
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/resources/request1.xml
(original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/test/resources/request1.xml
Thu May 10 17:15:16 2007
@@ -19,8 +19,8 @@
 -->
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
-     <greetMe xmlns="http://apache.org/greeter_control/types">
-       <requestType>foo bar</requestType>
-     </greetMe>
+      <greetMe xmlns="http://test.geronimo.apache.org/">
+        <arg0>changeme</arg0>
+      </greetMe>
    </soap:Body>
 </soap:Envelope>



Mime
View raw message