You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/03/04 17:03:27 UTC
svn commit: r750059 - in /cxf/trunk: parent/pom.xml
systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java
Author: dkulp
Date: Wed Mar 4 16:03:27 2009
New Revision: 750059
URL: http://svn.apache.org/viewvc?rev=750059&view=rev
Log:
Workaround two more tests with sjsxp
Add profile for jaxp-ri (requires java 6)
Modified:
cxf/trunk/parent/pom.xml
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java
Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=750059&r1=750058&r2=750059&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Wed Mar 4 16:03:27 2009
@@ -283,10 +283,10 @@
<name>spring.validation.mode</name>
<value>${spring.validation.mode}</value>
</property>
- <property>
- <name>surefire.fork.vmargs</name>
- <value>${surefire.fork.vmargs}</value>
- </property>
+ <property>
+ <name>surefire.fork.vmargs</name>
+ <value>${surefire.fork.vmargs}</value>
+ </property>
<property>
<!-- If we close the port after a client in the same JVM has opened a keep-alive
connection, on some Linux's, the socket remains consumed until
@@ -1036,30 +1036,43 @@
<profiles>
<profile>
- <id>sjsxp</id>
- <properties>
- <stax.impl.groupId>com.sun.xml.stream</stax.impl.groupId>
- <stax.impl.artifactId>sjsxp</stax.impl.artifactId>
- <stax.impl.version>1.0.1</stax.impl.version>
- </properties>
- </profile>
- <profile>
- <id>woodstox4</id>
- <properties>
- <stax.impl.groupId>org.codehaus.woodstox</stax.impl.groupId>
- <stax.impl.artifactId>woodstox-core-asl</stax.impl.artifactId>
- <stax.impl.version>4.0.2</stax.impl.version>
- </properties>
- </profile>
-
- <profile>
- <id>axis2-saaj</id>
- <properties>
- <saaj.impl.groupId>org.apache.axis2</saaj.impl.groupId>
- <saaj.impl.artifactId>axis2-saaj</saaj.impl.artifactId>
- <saaj.impl.version>1.4.1</saaj.impl.version>
- </properties>
- </profile>
+ <!-- sjsxp is really the precursor to the jaxp-ri jars. However, getting the jaxp-ri jar to work on
+ Java 5 requires endorsing it which is non-trivial in maven :-(.
+ -->
+ <id>sjsxp</id>
+ <properties>
+ <stax.impl.groupId>com.sun.xml.stream</stax.impl.groupId>
+ <stax.impl.artifactId>sjsxp</stax.impl.artifactId>
+ <stax.impl.version>1.0.1</stax.impl.version>
+ </properties>
+ </profile>
+ <profile>
+ <!-- This really only works with Java 6 as the classes are identically named with the same classes in the Java 5 JDK
+ and the Java 5 versions get picked up instead -->
+ <id>jaxpri</id>
+ <properties>
+ <stax.impl.groupId>com.sun.xml.parsers</stax.impl.groupId>
+ <stax.impl.artifactId>jaxp-ri</stax.impl.artifactId>
+ <stax.impl.version>1.4.2</stax.impl.version>
+ </properties>
+ </profile>
+ <profile>
+ <id>woodstox4</id>
+ <properties>
+ <stax.impl.groupId>org.codehaus.woodstox</stax.impl.groupId>
+ <stax.impl.artifactId>woodstox-core-asl</stax.impl.artifactId>
+ <stax.impl.version>4.0.2</stax.impl.version>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>axis2-saaj</id>
+ <properties>
+ <saaj.impl.groupId>org.apache.axis2</saaj.impl.groupId>
+ <saaj.impl.artifactId>axis2-saaj</saaj.impl.artifactId>
+ <saaj.impl.version>1.4.1</saaj.impl.version>
+ </properties>
+ </profile>
<profile>
<id>fastinstall</id>
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=750059&r1=750058&r2=750059&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Wed Mar 4 16:03:27 2009
@@ -424,6 +424,9 @@
// Test request-response
InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml");
InputSource inputSource = new InputSource(is);
+ inputSource.setPublicId(getClass()
+ .getResource("resources/GreetMeDocLiteralSOAPBodyReq.xml").toString());
+ inputSource.setSystemId(inputSource.getPublicId());
SAXSource saxSourceReq = new SAXSource(inputSource);
assertNotNull(saxSourceReq);
SAXSource saxSourceResp = disp.invoke(saxSourceReq);
@@ -434,6 +437,9 @@
// Test oneway
InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq1.xml");
InputSource inputSource1 = new InputSource(is1);
+ inputSource1.setPublicId(getClass()
+ .getResource("resources/GreetMeDocLiteralSOAPBodyReq1.xml").toString());
+ inputSource1.setSystemId(inputSource1.getPublicId());
SAXSource saxSourceReq1 = new SAXSource(inputSource1);
assertNotNull(saxSourceReq1);
disp.invokeOneWay(saxSourceReq1);
@@ -441,6 +447,9 @@
// Test async polling
InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq2.xml");
InputSource inputSource2 = new InputSource(is2);
+ inputSource2.setPublicId(getClass()
+ .getResource("resources/GreetMeDocLiteralSOAPBodyReq2.xml").toString());
+ inputSource2.setSystemId(inputSource2.getPublicId());
SAXSource saxSourceReq2 = new SAXSource(inputSource2);
assertNotNull(saxSourceReq2);
Response response = disp.invokeAsync(saxSourceReq2);
@@ -452,6 +461,9 @@
// Test async callback
InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq3.xml");
InputSource inputSource3 = new InputSource(is3);
+ inputSource3.setPublicId(getClass()
+ .getResource("resources/GreetMeDocLiteralSOAPBodyReq3.xml").toString());
+ inputSource3.setSystemId(inputSource3.getPublicId());
SAXSource saxSourceReq3 = new SAXSource(inputSource3);
assertNotNull(saxSourceReq3);
Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java?rev=750059&r1=750058&r2=750059&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java Wed Mar 4 16:03:27 2009
@@ -21,10 +21,13 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
import java.io.InputStream;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
+import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
@@ -44,6 +47,9 @@
import org.xml.sax.InputSource;
+import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.staxutils.StaxUtils;
+
//The following wsdl file is used.
//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
@@ -65,13 +71,12 @@
factory = MessageFactory.newInstance();
InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
Document sayHiDocument = factory.createMessage(null, is).getSOAPBody().extractContentAsDocument();
- sayHiInputSource = new InputSource(getSOAPBodyStream(sayHiDocument));
+ sayHiInputSource = new InputSource(getSOAPBodyFile(sayHiDocument).toURI().toString());
InputStream is2 = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
Document greetMeDocument =
factory.createMessage(null, is2).getSOAPBody().extractContentAsDocument();
- greetMeInputSource = new InputSource(getSOAPBodyStream(greetMeDocument));
-
+ greetMeInputSource = new InputSource(getSOAPBodyFile(greetMeDocument).toURI().toString());
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -101,27 +106,13 @@
return response;
}
- private InputStream getSOAPBodyStream(Document doc) throws Exception {
- // Try to get the DOMImplementation from the doc before
- // defaulting to the sun implementation class (which uses
- // sun internal xerces classes not found in the ibm jdk).
- DOMImplementationLS impl = null;
- DOMImplementation docImpl = doc.getImplementation();
- if (docImpl != null && docImpl.hasFeature("LS", "3.0")) {
- impl = (DOMImplementationLS)docImpl.getFeature("LS", "3.0");
- } else {
- System.setProperty(DOMImplementationRegistry.PROPERTY,
- "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
- DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
- impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
- }
- LSOutput output = impl.createLSOutput();
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- output.setByteStream(byteArrayOutputStream);
- LSSerializer writer = impl.createLSSerializer();
- writer.write(doc, output);
- byte[] buf = byteArrayOutputStream.toByteArray();
- return new ByteArrayInputStream(buf);
+ private File getSOAPBodyFile(Document doc) throws Exception {
+ File file = FileUtils.createTempFile("cxf-systest", "xml");
+ FileOutputStream out = new FileOutputStream(file);
+ XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
+ StaxUtils.writeDocument(doc, writer, true);
+ writer.close();
+ return file;
}
}