axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r377681 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/client/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/transport/ core/src/org/apache/axis2/transport/http/ core/src/org/apache/axis2/transport/...
Date Tue, 14 Feb 2006 10:08:01 GMT
Author: chinthaka
Date: Tue Feb 14 02:07:59 2006
New Revision: 377681

URL: http://svn.apache.org/viewcvs?rev=377681&view=rev
Log:
- renaming getReplyToEPR of ListenerManager to getEPRForService
- Adding a test for fault handling, yet to be completed.

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ListenerManager.java
Tue Feb 14 02:07:59 2006
@@ -110,7 +110,7 @@
             TransportListenerState tsState = (TransportListenerState) listeners.get(transport);
 
             if (tsState != null) {
-                return tsState.listener.getReplyToEPR(serviceName);
+                return tsState.listener.getEPRForService(serviceName);
             } else {
                 throw new AxisFault(Messages.getMessage("replyNeedStarting", transport));
             }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
Tue Feb 14 02:07:59 2006
@@ -62,6 +62,8 @@
                 transportIn = ac.getTransportIn(new QName(listenerTransportProtocol));
 
                 if (transportIn == null) {
+                    // TODO : User should not be mandated to give an IN transport. If it
is not given, we should
+                    // ask from the ListenerManager to give any available transport for this
client.
                     throw new AxisFault(Messages.getMessage("unknownTransport",
                             listenerTransportProtocol));
                 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
Tue Feb 14 02:07:59 2006
@@ -35,5 +35,5 @@
 
     public abstract void stop() throws AxisFault;
 
-    public abstract EndpointReference getReplyToEPR(String serviceName) throws AxisFault;
+    public abstract EndpointReference getEPRForService(String serviceName) throws AxisFault;
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
Tue Feb 14 02:07:59 2006
@@ -246,9 +246,9 @@
      *
      * @param serviceName
      * @return an EndpointReference
-     * @see org.apache.axis2.transport.TransportListener#getReplyToEPR(String)
+     * @see org.apache.axis2.transport.TransportListener#getEPRForService(String)
      */
-    public EndpointReference getReplyToEPR(String serviceName) throws AxisFault {
+    public EndpointReference getEPRForService(String serviceName) throws AxisFault {
         String hostAddress ;
         try {
             hostAddress = SimpleHttpServerConnection.getIpAddress();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
Tue Feb 14 02:07:59 2006
@@ -250,7 +250,7 @@
         return properties;
     }
 
-    public EndpointReference getReplyToEPR(String serviceName) throws AxisFault {
+    public EndpointReference getEPRForService(String serviceName) throws AxisFault {
         try {
             JMSURLHelper url = new JMSURLHelper("jms:/" + destination);
             url.getProperties().putAll(properties);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
Tue Feb 14 02:07:59 2006
@@ -286,7 +286,7 @@
      *  (non-Javadoc)
      * @see org.apache.axis2.transport.TransportListener#replyToEPR(java.lang.String)
      */
-    public EndpointReference getReplyToEPR(String serviceName) throws AxisFault {
+    public EndpointReference getEPRForService(String serviceName) throws AxisFault {
         return new EndpointReference(replyTo + "/services/" + serviceName);
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
Tue Feb 14 02:07:59 2006
@@ -151,7 +151,7 @@
      *  (non-Javadoc)
      * @see org.apache.axis2.transport.TransportListener#replyToEPR(java.lang.String)
      */
-    public EndpointReference getReplyToEPR(String serviceName) throws AxisFault {
+    public EndpointReference getEPRForService(String serviceName) throws AxisFault {
 
         // todo this has to fix
         return new EndpointReference("tcp://127.0.0.1:" + (serversocket.getLocalPort())

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java?rev=377681&r1=377680&r2=377681&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java
Tue Feb 14 02:07:59 2006
@@ -25,9 +25,13 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.util.FaultHandler;
 import org.apache.axis2.engine.util.TestConstants;
+import org.apache.axis2.integration.TestingUtils;
 import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.ws.commons.om.OMAbstractFactory;
+import org.apache.ws.commons.om.OMElement;
 import org.apache.ws.commons.soap.SOAP11Constants;
 import org.apache.ws.commons.soap.SOAP12Constants;
 import org.apache.ws.commons.soap.SOAPEnvelope;
@@ -37,6 +41,7 @@
 
 import javax.xml.stream.XMLStreamException;
 import java.io.File;
+import java.util.ArrayList;
 
 public class FaultHandlingTest extends TestCase implements TestConstants {
 
@@ -44,6 +49,32 @@
 
     protected void setUp() throws Exception {
         UtilServer.start();
+    }
+
+    public void testFaultHandling() throws AxisFault {
+        ConfigurationContext configurationContext = UtilServer.getConfigurationContext();
+        ArrayList inPhasesUptoAndIncludingPostDispatch = configurationContext.getAxisConfiguration().getInPhasesUptoAndIncludingPostDispatch();
+        Phase phaseOne = (Phase) inPhasesUptoAndIncludingPostDispatch.get(0);
+        phaseOne.addHandler(new FaultHandler());
+
+
+        OMElement payload = TestingUtils.createDummyOMElement();
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        options.setExceptionToBeThrownOnSOAPFault(false);
+        options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(60000 *5));
+
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",
null);
+        ServiceClient sender = new ServiceClient(configContext, null);
+        sender.setOptions(options);
+
+        OMElement result = sender.sendReceive(payload);
+
+        System.out.println("result = " + result);
+
+
     }
 
     public void testTwoHeadersSOAPMessage() throws AxisFault, XMLStreamException {

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java?rev=377681&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
Tue Feb 14 02:07:59 2006
@@ -0,0 +1,57 @@
+package org.apache.axis2.engine.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.ws.commons.om.OMAbstractFactory;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPFactory;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultText;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ */
+
+public class FaultHandler extends AbstractHandler {
+
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        // this handler will be used to check the fault handling of Axis2.
+        // this will create some dummy faults and send
+
+        SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP11Factory();
+
+        // I have a sudden fake error ;)
+        SOAPFaultText soapFaultText = soapFac.createSOAPFaultText();
+        soapFaultText.setLang("en");
+        soapFaultText.setText("This is a test fault message which happened suddenly");
+        SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason();
+        soapFaultReason.setSOAPText(soapFaultText);
+
+        OMElement detailEntry = soapFac.createOMElement("MoreInfo", null);
+        detailEntry.setText("This error is a result due to a fake problem in Axis2 engine.
Do not worry ;)");
+        SOAPFaultDetail faultDetail = soapFac.createSOAPFaultDetail();
+        faultDetail.addDetailEntry(detailEntry);
+
+        msgContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
+        msgContext.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, faultDetail);
+
+        throw new AxisFault("A dummy exception has occurred");
+
+    }
+}



Mime
View raw message