Author: chinthaka
Date: Mon Nov 6 02:47:51 2006
New Revision: 471688
URL: http://svn.apache.org/viewvc?view=rev&rev=471688
Log:
Adding a test case for WSCOMMONS-119. Yet to fix the issue.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace2.xml
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java?view=diff&rev=471688&r1=471687&r2=471688
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
Mon Nov 6 02:47:51 2006
@@ -326,7 +326,8 @@
/**
- * Method getDefaultEnvelope
+ * Method getDefaultEnvelope. This returns a SOAP envelope consisting with
an empty Header and a Body.
+ * This is just a util method which can be used everywhere.
*
* @return Returns SOAPEnvelope.
*/
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java?view=diff&rev=471688&r1=471687&r2=471688
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
Mon Nov 6 02:47:51 2006
@@ -1,7 +1,11 @@
package org.apache.axiom.om;
-import junit.framework.TestCase;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.jaxen.JaxenException;
+import org.jaxen.SimpleNamespaceContext;
+import org.jaxen.XPath;
import javax.xml.namespace.QName;
import javax.xml.stream.*;
@@ -23,7 +27,7 @@
* limitations under the License.
*/
-public class DefaultNSHandlingTest extends TestCase {
+public class DefaultNSHandlingTest extends XMLTestCase {
public void testDefaultNamespaceWithSameDefaultNSForAll() {
String testXML = "<html xmlns='http://www.w3.org/TR/REC-html40'>" +
@@ -122,6 +126,51 @@
}catch (Exception e) {
fail(e.getMessage());
}
+ }
+
+// public void testForIssueWSCOMMONS119() {
+//
+// try {
+// String planXML = "test-resources/xml/defaultNamespace2.xml";
+// XMLStreamReader parser = XMLInputFactory.newInstance().
+// createXMLStreamReader(new FileInputStream(new
File(planXML)));
+// StAXOMBuilder staxOMBuilder = new StAXOMBuilder(parser);
+// OMElement docEle = staxOMBuilder.getDocumentElement();
+// OMElement omElement = getOMElement("//ns:[EMAIL
PROTECTED]'ConnectionURL']",
+// docEle);
+//
omElement.setText("jdbc:derby:/home/azeez/.tungsten/database/TUNGSTEN_DB");
+//
+// String serializedXML = docEle.toString();
+//
+// System.out.println("serializedXML = " + serializedXML);
+//
+// assertTrue(serializedXML.indexOf("xmlns=\"\"") == -1);
+//
+// } catch (XMLStreamException e) {
+// fail();
+// e.printStackTrace();
+// } catch (FileNotFoundException e) {
+// fail();
+// e.printStackTrace();
+// } catch (JaxenException e) {
+// fail();
+// e.printStackTrace();
+// }
+// }
+
+
+ private OMElement getOMElement(String xpathString,
+ OMElement parentElement) throws
JaxenException {
+ XPath xpath = getXPath(xpathString);
+ return (OMElement) xpath.selectSingleNode(parentElement);
+ }
+
+ private XPath getXPath(String xpathString) throws JaxenException {
+ SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
+ nsCtx.addNamespace("ns",
"http://geronimo.apache.org/xml/ns/j2ee/connector-1.1");
+ XPath xpath = new AXIOMXPath(xpathString);
+ xpath.setNamespaceContext(nsCtx);
+ return xpath;
}
public static void main(String[] args) {
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace2.xml
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace2.xml?view=auto&rev=471688
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace2.xml
(added)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace2.xml
Mon Nov 6 02:47:51 2006
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
+ <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
+ <dep:moduleId>
+ <dep:groupId>tungsten</dep:groupId>
+ <dep:artifactId>tungsten_db</dep:artifactId>
+ <dep:version>1.0</dep:version>
+ <dep:type>rar</dep:type>
+ </dep:moduleId>
+ <dep:dependencies>
+ <dep:dependency>
+ <dep:groupId>org.apache.derby</dep:groupId>
+ <dep:artifactId>derby</dep:artifactId>
+ <dep:version>10.1.1.0</dep:version>
+ <dep:type>jar</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+ </dep:environment>
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>tungsten_db</name>
+ <config-property-setting
name="Password">tungsten</config-property-setting>
+ <config-property-setting
name="Driver">org.apache.derby.jdbc.EmbeddedDriver</config-property-setting>
+ <config-property-setting
name="UserName">tungsten</config-property-setting>
+ <config-property-setting
name="ConnectionURL">jdbc:derby:@tungsten_home@/database/TUNGSTEN_DB</config-property-setting>
+ <connectionmanager>
+ <local-transaction/>
+ <single-pool>
+ <max-size>50</max-size>
+ <min-size>1</min-size>
+ <match-one/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]