You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/03/10 10:16:09 UTC
svn commit: r1299167 -
/axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java
Author: veithen
Date: Sat Mar 10 09:16:09 2012
New Revision: 1299167
URL: http://svn.apache.org/viewvc?rev=1299167&view=rev
Log:
Fixed a broken test case.
Modified:
axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java
Modified: axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java?rev=1299167&r1=1299166&r2=1299167&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java (original)
+++ axis/axis1/java/trunk/integration/src/test/java/test/functional/TestJWSFault.java Sat Mar 10 09:16:09 2012
@@ -17,7 +17,8 @@
package test.functional;
import junit.framework.TestCase;
-import org.apache.axis.AxisFault;
+
+import test.HttpTestUtil;
import javax.xml.messaging.URLEndpoint;
import javax.xml.soap.MessageFactory;
@@ -29,56 +30,32 @@ import javax.xml.soap.SOAPConnectionFact
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
-import java.net.SocketException;
-
/**
* Test the JAX-RPC compliance samples.
*/
public class TestJWSFault extends TestCase {
public void testJWSFault() throws Exception {
- try {
- SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
- SOAPConnection con = scFactory.createConnection();
-
- MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage message = factory.createMessage();
-
- SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
- SOAPBody body = envelope.getBody();
-
- Name bodyName = envelope.createName("echo");
- SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
-
- Name name = envelope.createName("arg0");
- SOAPElement symbol = bodyElement.addChildElement(name);
- symbol.addTextNode("Hello");
-
- URLEndpoint endpoint = new URLEndpoint("http://localhost:8080/axis/FaultTest.jws");
- SOAPMessage response = con.call(message, endpoint);
- SOAPBody respBody = response.getSOAPPart().getEnvelope().getBody();
- assertTrue(respBody.hasFault());
- } catch (javax.xml.soap.SOAPException e) {
- Throwable t = e.getCause();
- if (t != null) {
- t.printStackTrace();
- if (t instanceof AxisFault) {
- AxisFault af = (AxisFault) t;
- if ((af.detail instanceof SocketException)
- || (af.getFaultCode().getLocalPart().equals("HTTP"))) {
- System.out.println("Connect failure caused testJWSFault to be skipped.");
- return;
- }
- }
- throw new Exception("Fault returned from test: " + t);
- } else {
- e.printStackTrace();
- throw new Exception("Exception returned from test: " + e);
- }
- } catch (Throwable t) {
- t.printStackTrace();
- throw new Exception("Fault returned from test: " + t);
- }
+ SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
+ SOAPConnection con = scFactory.createConnection();
+
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage message = factory.createMessage();
+
+ SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ Name bodyName = envelope.createName("echo");
+ SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
+
+ Name name = envelope.createName("arg0");
+ SOAPElement symbol = bodyElement.addChildElement(name);
+ symbol.addTextNode("Hello");
+
+ URLEndpoint endpoint = new URLEndpoint(HttpTestUtil.getTestEndpoint("http://localhost:8080/axis/FaultTest.jws").toString());
+ SOAPMessage response = con.call(message, endpoint);
+ SOAPBody respBody = response.getSOAPPart().getEnvelope().getBody();
+ assertTrue(respBody.hasFault());
}
}