You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by an...@apache.org on 2007/03/06 09:26:05 UTC
svn commit: r515020 - in /incubator/cxf/trunk:
systests/src/test/java/org/apache/cxf/systest/handlers/
testutils/src/main/java/org/apache/cxf/testutil/handler/
Author: andreasmyth
Date: Tue Mar 6 00:26:04 2007
New Revision: 515020
URL: http://svn.apache.org/viewvc?view=rev&rev=515020
Log:
Restored system test testing use of a trivial SOAP handler (in handlers package along with other JAXWS handler tests).
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java (with props)
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java?view=auto&rev=515020
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java Tue Mar 6 00:26:04 2007
@@ -0,0 +1,37 @@
+/**
+ * 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.handlers;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+import org.apache.cxf.greeter_control.AbstractGreeterImpl;
+
+/**
+ *
+ */
+
+@WebService(serviceName = "GreeterService",
+ portName = "GreeterPort",
+ endpointInterface = "org.apache.cxf.greeter_control.Greeter",
+ targetNamespace = "http://cxf.apache.org/greeter_control")
+@HandlerChain(file = "trivial_soap_handler.xml")
+public class TrivialSOAPHandlerAnnotatedGreeterImpl extends AbstractGreeterImpl {
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerAnnotatedGreeterImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java?view=auto&rev=515020
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java Tue Mar 6 00:26:04 2007
@@ -0,0 +1,90 @@
+/**
+ * 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.handlers;
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.ws.Endpoint;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.TestServerBase;
+
+/**
+ * Tests the use of a SOAPHandler which does not use the underlying SOAP message but simply
+ * returns true instead.
+ */
+public class TrivialSOAPHandlerTest extends TestCase {
+
+ public static class Server extends TestServerBase {
+
+ protected void run() {
+ Object implementor = new TrivialSOAPHandlerAnnotatedGreeterImpl();
+ String address = "http://localhost:9020/SoapContext/GreeterPort";
+ Endpoint.publish(address, implementor);
+ }
+
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = new TestSuite(TrivialSOAPHandlerTest.class);
+ return new ClientServerSetupBase(suite) {
+ public void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
+ launchServer(Server.class));
+ }
+ };
+ }
+
+ public void testInvocation() throws Exception {
+
+ GreeterService service = new GreeterService();
+ assertNotNull(service);
+
+ try {
+ Greeter greeter = service.getGreeterPort();
+
+ String greeting = greeter.greetMe("Bonjour");
+ assertNotNull("no response received from service", greeting);
+ assertEquals("BONJOUR", greeting);
+
+ } catch (UndeclaredThrowableException ex) {
+ throw (Exception)ex.getCause();
+ }
+ }
+
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TrivialSOAPHandlerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml?view=auto&rev=515020
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml Tue Mar 6 00:26:04 2007
@@ -0,0 +1,9 @@
+<?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>TrivialSOAPHandler</jws:handler-name>
+ <jws:handler-class>org.apache.cxf.testutil.handler.TrivialSOAPHandler</jws:handler-class>
+ </jws:handler>
+ </jws:handler-chain>
+</jws:handler-chains>
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/trivial_soap_handler.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java?view=auto&rev=515020
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java Tue Mar 6 00:26:04 2007
@@ -0,0 +1,68 @@
+/**
+ * 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.testutil.handler;
+
+import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+
+public class TrivialSOAPHandler implements SOAPHandler<SOAPMessageContext> {
+
+ @Resource(name = "greeting")
+ private String greeting;
+
+ public TrivialSOAPHandler() {
+ System.out.println(this + " Construct");
+ }
+
+ @PostConstruct
+ public void init() {
+ System.out.println(this + " PostConstruct");
+ }
+
+ @PreDestroy
+ public void destroy() {
+ System.out.println(this + " PreDestroy");
+ }
+
+ public boolean handleMessage(SOAPMessageContext smc) {
+ System.out.println(this + " handleMessage(): " + greeting);
+ return true;
+ }
+
+ public boolean handleFault(SOAPMessageContext smc) {
+ System.out.println(this + " handleFault()");
+ return true;
+ }
+
+ public void close(MessageContext messageContext) {
+ System.out.println(this + " close()");
+ }
+
+ public Set<QName> getHeaders() {
+ return null;
+ }
+
+}
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/handler/TrivialSOAPHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date