geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r545996 - in /geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main: java/org/apache/geronimo/test/GreeterLogicalHandler.java java/org/apache/geronimo/test/GreeterSOAPHandler.java resources/META-INF/ejb-jar.xml
Date Mon, 11 Jun 2007 03:12:56 GMT
Author: gawor
Date: Sun Jun 10 20:12:55 2007
New Revision: 545996

URL: http://svn.apache.org/viewvc?view=rev&rev=545996
Log:
improved tests to test handler injection

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

Modified: 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=diff&rev=545996&r1=545995&r2=545996
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
(original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterLogicalHandler.java
Sun Jun 10 20:12:55 2007
@@ -38,8 +38,11 @@
 
     @Resource WebServiceContext context;
 
+    @Resource(name="greeting")
+    private String greeting;
+
     public boolean handleMessage(LogicalMessageContext context) {
-        System.out.println(this + " HandleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        System.out.println(this + " HandleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)
+ " " + greeting);
         System.out.println(context.getMessage().getPayload());
         return true;
     }
@@ -63,7 +66,7 @@
     }
     
     public void close(MessageContext context) {
-        System.out.println(this + " cclose");
+        System.out.println(this + " close");
     }
 
 }

Modified: 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=diff&rev=545996&r1=545995&r2=545996
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
(original)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/java/org/apache/geronimo/test/GreeterSOAPHandler.java
Sun Jun 10 20:12:55 2007
@@ -27,6 +27,7 @@
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
+import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.Map;
@@ -40,6 +41,9 @@
     @Resource
     WebServiceContext context;
 
+    @Resource(name="greeting")
+    private String greeting;
+
     @PostConstruct
     public void init() {
         System.out.println(this + " init: " + context);
@@ -63,7 +67,7 @@
     }
 
     public boolean handleMessage(SOAPMessageContext context) {
-        System.out.println(this + " handleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        System.out.println(this + " handleMessage: " + context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)
+ " " + greeting);
         
         SOAPMessage message = context.getMessage();
         try {
@@ -72,7 +76,12 @@
 
             } else {
                 // inbound
-                message.getSOAPBody().getElementsByTagNameNS("*", "arg0").item(0).getFirstChild().setNodeValue("foo
bar");
+                SOAPElement element = findElement(message.getSOAPBody(), "arg0");
+                element.setValue("foo bar");
+
+                // XXX: this does not work with Axis2
+                //   message.getSOAPBody().getElementsByTagNameNS("*", "arg0").item(0).getFirstChild().setNodeValue("foo
bar");
+
                 message.saveChanges();
             }
 
@@ -82,6 +91,22 @@
         }
 
         return true;
+    }
+
+    private SOAPElement findElement(SOAPElement element, String name) {
+        Iterator iter = element.getChildElements();
+        while(iter.hasNext()) {
+            Node child = (Node)iter.next();
+            if (child instanceof SOAPElement) {
+                SOAPElement childEl = (SOAPElement)child;
+                if (name.equals(childEl.getElementName().getLocalName())) {
+                    return childEl;
+                } else {
+                    return findElement(childEl, name);
+                }
+            }
+        }
+        return null;
     }
 
     public Set<QName> getHeaders() {

Added: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/resources/META-INF/ejb-jar.xml?view=auto&rev=545996
==============================================================================
--- geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/resources/META-INF/ejb-jar.xml
(added)
+++ geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/resources/META-INF/ejb-jar.xml
Sun Jun 10 20:12:55 2007
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+  <display-name>JAXWSBean</display-name>
+  <enterprise-beans>
+    <session>
+      <display-name>JAXWSBean</display-name>
+      <ejb-name>JAXWSBean</ejb-name>
+      <service-endpoint>org.apache.geronimo.test.JAXWSGreeter</service-endpoint>
+      <ejb-class>org.apache.geronimo.test.JAXWSBean</ejb-class>
+      <session-type>Stateless</session-type>
+      <transaction-type>Container</transaction-type>
+
+      <env-entry>
+        <description>Welcome message</description>
+        <env-entry-name>greeting</env-entry-name>
+        <env-entry-type>java.lang.String</env-entry-type>
+        <env-entry-value>Hello</env-entry-value>
+      </env-entry>
+
+    </session>
+  </enterprise-beans>
+
+</ejb-jar>

Propchange: geronimo/server/trunk/testsuite/webservices-testsuite/jaxws-tests/jaxws-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message