ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1164707 - in /webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom: attachments/ om/ds/ om/impl/llom/ om/util/
Date Fri, 02 Sep 2011 20:48:24 GMT
Author: veithen
Date: Fri Sep  2 20:48:23 2011
New Revision: 1164707

URL: http://svn.apache.org/viewvc?rev=1164707&view=rev
Log:
Use factory methods instead of instantiating OM implementation classes directly.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java?rev=1164707&r1=1164706&r2=1164707&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
Fri Sep  2 20:48:23 2011
@@ -26,8 +26,6 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.llom.OMElementImpl;
-import org.apache.axiom.om.impl.llom.OMTextImpl;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
 
@@ -93,16 +91,16 @@ public class ImageSampleTest extends Abs
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMNamespace soap = fac.createOMNamespace(
                 "http://schemas.xmlsoap.org/soap/envelope/", "soap");
-        OMElement envelope = new OMElementImpl("Envelope", soap, fac);
-        OMElement body = new OMElementImpl("Body", soap, fac);
+        OMElement envelope = fac.createOMElement("Envelope", soap);
+        OMElement body = fac.createOMElement("Body", soap);
 
         OMNamespace dataName = fac.createOMNamespace(
                 "http://www.example.org/stuff", "m");
-        OMElement data = new OMElementImpl("data", dataName, fac);
+        OMElement data = fac.createOMElement("data", dataName);
 
         DataSource dataSource = getTestResourceDataSource(imageInFileName);
         expectedDH = new DataHandler(dataSource);
-        OMText binaryNode = new OMTextImpl(expectedDH, true, fac);
+        OMText binaryNode = fac.createOMText(expectedDH, true);
 
         envelope.addChild(body);
         body.addChild(data);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java?rev=1164707&r1=1164706&r2=1164707&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/ds/WrappedTextNodeOMDataSourceTest.java
Fri Sep  2 20:48:23 2011
@@ -31,7 +31,6 @@ import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromReader;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 
 public class WrappedTextNodeOMDataSourceTest extends TestCase {
     public void testFromReader() throws Exception {
@@ -44,7 +43,7 @@ public class WrappedTextNodeOMDataSource
         QName qname = new QName("data");
         OMDataSource ds = new WrappedTextNodeOMDataSourceFromReader(qname, new StringReader(testData));
         OMFactory factory = OMAbstractFactory.getOMFactory();
-        OMSourcedElement element = new OMSourcedElementImpl(qname, factory, ds);
+        OMSourcedElement element = factory.createOMElement(ds, qname);
         assertEquals(testData, element.getText());
     }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java?rev=1164707&r1=1164706&r2=1164707&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
Fri Sep  2 20:48:23 2011
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMText;
 
 import javax.activation.DataHandler;
 import java.io.File;
@@ -65,24 +66,24 @@ public class OMOutputTest extends Abstra
 
         OMNamespace soap = fac.createOMNamespace(
                 "http://schemas.xmlsoap.org/soap/envelope/", "soap");
-        envelope = new OMElementImpl("Envelope", soap, fac);
-        OMElement body = new OMElementImpl("Body", soap, fac);
+        envelope = fac.createOMElement("Envelope", soap);
+        OMElement body = fac.createOMElement("Body", soap);
 
         OMNamespace dataName = fac.createOMNamespace(
                 "http://www.example.org/stuff", "m");
-        OMElement data = new OMElementImpl("data", dataName, fac);
+        OMElement data = fac.createOMElement("data", dataName);
 
         OMNamespace mime = fac.createOMNamespace(
                 "http://www.w3.org/2003/06/xmlmime", "mime");
 
-        OMElement text = new OMElementImpl("name", dataName, fac);
-        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
-                                                 "text/plain", fac);
+        OMElement text = fac.createOMElement("name", dataName);
+        OMAttribute cType1 = fac.createOMAttribute("contentType", mime,
+                                                 "text/plain");
         text.addAttribute(cType1);
         byte[] byteArray = new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                 98 };
         dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
-        OMTextImpl textData = new OMTextImpl(dataHandler, false, fac);
+        OMText textData = fac.createOMText(dataHandler, false);
 
         envelope.addChild(body);
         body.addChild(data);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java?rev=1164707&r1=1164706&r2=1164707&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
Fri Sep  2 20:48:23 2011
@@ -28,6 +28,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.ds.CharArrayDataSource;
@@ -82,7 +83,7 @@ public class OMSourcedElementTest extend
                     "<author>DuCharme, Bob</author><publisher>Manning</publisher>"
+
                     "<price>29.95</price></book></library>";
 
-    private OMSourcedElementImpl element;
+    private OMSourcedElement element;
     private OMElement root;
 
     /** @param testName  */
@@ -94,7 +95,7 @@ public class OMSourcedElementTest extend
         OMFactory f = new OMLinkedListImplFactory();
         OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
-        element = new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument));
+        element = f.createOMElement(new TestDataSource(testDocument), "library", ns);
         root = f.createOMElement("root", rootNS);
         root.addChild(element);
     }
@@ -109,7 +110,7 @@ public class OMSourcedElementTest extend
         OMFactory f = new OMLinkedListImplFactory();
         OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
-        OMElement child = new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument));
+        OMElement child = f.createOMElement(new TestDataSource(testDocument), "library",
ns);
         OMElement root = f.createOMElement("root", rootNS);
         
         // Trigger expansion of the child OMSE
@@ -128,7 +129,7 @@ public class OMSourcedElementTest extend
         
         // Now repeat the test, but this time trigger the 
         // partial parsing of the child after adding it to the root.
-        child = new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument));
+        child = f.createOMElement(new TestDataSource(testDocument), "library", ns);
         root = f.createOMElement("root", rootNS);
         
         root.addChild(child);
@@ -313,7 +314,7 @@ public class OMSourcedElementTest extend
         OMNamespace ns =
                 f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument));
+                f.createOMElement(new TestDataSource(testDocument), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -373,7 +374,7 @@ public class OMSourcedElementTest extend
         OMNamespace ns =
                 f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument));
+                f.createOMElement(new TestDataSource(testDocument), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -417,7 +418,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument));
+                f.createOMElement(new TestDataSource(testDocument), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -486,7 +487,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument));
+                f.createOMElement(new TestDataSource(testDocument), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -527,7 +528,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument2));
+                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -586,7 +587,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument2));
+                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -629,7 +630,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument2));
+                f.createOMElement(new TestDataSource(testDocument2), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -698,7 +699,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument2));
+                f.createOMElement(new TestDataSource(testDocument2), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -741,7 +742,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("", "");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument3));
+                f.createOMElement(new TestDataSource(testDocument3), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -799,7 +800,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("", "");
         OMElement element =
-                new OMSourcedElementImpl("library", ns, f, new TestDataSource(testDocument3));
+                f.createOMElement(new TestDataSource(testDocument3), "library", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -840,7 +841,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument3));
+                f.createOMElement(new TestDataSource(testDocument3), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -908,7 +909,7 @@ public class OMSourcedElementTest extend
         OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
         OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "");
         OMElement element =
-                new OMSourcedElementImpl("DUMMYNAME", ns, f, new TestDataSource(testDocument3));
+                f.createOMElement(new TestDataSource(testDocument3), "DUMMYNAME", ns);
         OMElement root = f.createOMElement("root", rootNS);
         root.addChild(element);
 
@@ -1059,7 +1060,7 @@ public class OMSourcedElementTest extend
         assertFalse(ds.isDestructiveWrite());
         
         OMFactory f = new OMLinkedListImplFactory();
-        OMElement element = new OMSourcedElementImpl("element", null, f, ds);
+        OMElement element = f.createOMElement(ds, "element", null);
         
         element.getFirstElement().setText("TEST");
         

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java?rev=1164707&r1=1164706&r2=1164707&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/ElementHelperTest.java
Fri Sep  2 20:48:23 2011
@@ -42,7 +42,6 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.ds.WrappedTextNodeOMDataSourceFromDataSource;
-import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 import org.apache.axiom.om.util.AXIOMUtil;
 import org.apache.axiom.om.util.ElementHelper;
 import org.apache.axiom.testutils.activation.RandomDataSource;
@@ -71,8 +70,8 @@ public class ElementHelperTest extends T
         DataSource ds = new RandomDataSource(445566, 32, 128, 20000000);
         QName qname = new QName("a");
         Charset cs = Charset.forName("ascii");
-        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
-                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, cs));
+        OMSourcedElement element = factory.createOMElement(
+                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, cs), qname);
         Reader in = ElementHelper.getTextAsStream(element, true);
         assertFalse(in instanceof StringReader);
         IOTestUtils.compareStreams(new InputStreamReader(ds.getInputStream(), cs), in);
@@ -118,8 +117,8 @@ public class ElementHelperTest extends T
         OMFactory factory = OMAbstractFactory.getOMFactory();
         DataSource ds = new RandomDataSource(665544, 32, 128, 20000000);
         QName qname = new QName("a");
-        OMSourcedElement element = new OMSourcedElementImpl(qname, factory,
-                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, Charset.forName("ascii")));
+        OMSourcedElement element = factory.createOMElement(
+                new WrappedTextNodeOMDataSourceFromDataSource(qname, ds, Charset.forName("ascii")),
qname);
         Reader in = new InputStreamReader(ds.getInputStream(), "ascii");
         Writer out = new CharacterStreamComparator(in);
         ElementHelper.writeTextTo(element, out, true); // cache doesn't matter here



Mime
View raw message