Author: veithen
Date: Sat Apr 14 09:24:54 2012
New Revision: 1326075

URL: http://svn.apache.org/viewvc?rev=1326075&view=rev
Log:
AXIOM-412: Made the factories in DOOM singletons and updated various Javadocs.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java
   (with props)
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java
   (with props)
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMMetaFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/dom/DOMMetaFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
 Sat Apr 14 09:24:54 2012
@@ -68,6 +68,8 @@ public class OMAbstractFactory {
     /**
      * Feature for Axiom implementations that implement DOM in addition to the 
Axiom API. The
      * {@link OMMetaFactory} for such an Axiom implementation must implement 
{@link DOMMetaFactory}.
+     * See the documentation of {@link DOMMetaFactory} for more information 
about the requirements
+     * and constraints that apply to Axiom implementations that support this 
feature.
      */
     public static final String FEATURE_DOM = "dom";
     

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMMetaFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMMetaFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMMetaFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMMetaFactory.java
 Sat Apr 14 09:24:54 2012
@@ -29,37 +29,32 @@ import org.apache.axiom.util.stax.xop.Mi
 import org.xml.sax.InputSource;
 
 /**
- * Object model meta factory.
- * This interface encapsulates a particular object model and provides instances
- * for plain XML, SOAP 1.1 and SOAP 1.2 object model factories for the
- * given object model implementation. Currently the two OM implementations 
provided by
- * Axiom are LLOM (linked list) and DOM.
+ * Object model meta factory. This interface encapsulates a particular Axiom 
implementation and
+ * provides instances for plain XML, SOAP 1.1 and SOAP 1.2 object model 
factories for that
+ * implementation. Currently the two OM implementations provided by Axiom are 
LLOM (linked list) and
+ * DOOM (DOM compatible).
  * <p>
  * The factories returned by {@link #getOMFactory()}, {@link 
#getSOAP11Factory()} and
- * {@link #getSOAP12Factory()} might be stateless (and thread safe) or not. In 
the former
- * case the implementation should return the same instance on every 
invocation, i.e.
- * instantiate the factory for each OM type only once. In the latter case, the 
implementation
- * must return a new instance on every invocation. In order to work with any 
OM implementation,
- * code using an implementation of this class must call the relevant method 
once and only once
- * for every document processed.
+ * {@link #getSOAP12Factory()} MUST be stateless (and thread safe). The 
implementation MUST return
+ * the same instance on every invocation, i.e. instantiate the factory for 
each OM type only once.
  */
 public interface OMMetaFactory {
     /**
-     * Get an OM factory instance for the XML infoset model.
+     * Get the OM factory instance for the XML infoset model.
      *
      * @return the OM factory instance
      */
     OMFactory getOMFactory();
     
     /**
-     * Get an OM factory instance for the SOAP 1.1 infoset model.
+     * Get the OM factory instance for the SOAP 1.1 infoset model.
      *
      * @return the OM factory instance
      */
     SOAPFactory getSOAP11Factory();
     
     /**
-     * Get an OM factory instance for the SOAP 1.2 infoset model.
+     * Get the OM factory instance for the SOAP 1.2 infoset model.
      *
      * @return the OM factory instance
      */

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/dom/DOMMetaFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/dom/DOMMetaFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/dom/DOMMetaFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/dom/DOMMetaFactory.java
 Sat Apr 14 09:24:54 2012
@@ -18,14 +18,128 @@
  */
 package org.apache.axiom.om.dom;
 
+import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 
 import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMInformationItem;
 import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMProcessingInstruction;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.soap.SOAPFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
 
 /**
  * Extension interface for {@link OMMetaFactory} implementations that support
  * {@link OMAbstractFactory#FEATURE_DOM}.
+ * <p>
+ * Axiom implementations supporting this feature MUST conform to the Axiom API 
as well as the DOM
+ * API, and nodes created by the implementation MUST implement both the Axiom 
interfaces and the DOM
+ * interfaces corresponding, as specified by the following table:
+ * <table border="2" rules="all" cellpadding="4" cellspacing="0">
+ * <p>
+ * <tr>
+ * <th>Axiom interface</th>
+ * <th>DOM interface</th>
+ * </tr>
+ * <tr>
+ * <td>{@link OMDocument}</td>
+ * <td>{@link Document}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMDocType}</td>
+ * <td>{@link DocumentType}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMElement}</td>
+ * <td>{@link Element} [1]</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMAttribute}</td>
+ * <td>{@link Attr} [2]</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMText}</td>
+ * <td>{@link Text}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMComment}</td>
+ * <td>{@link Comment}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OMProcessingInstruction}</td>
+ * <td>{@link ProcessingInstruction}</td>
+ * </tr>
+ * </table>
+ * <dl>
+ * <dt>[1]
+ * <dd>Only applies to elements created using DOM 2 methods such as
+ * {@link Document#createElementNS(String, String)}.
+ * <dt>[2]
+ * <dd>Only applies to attributes created using DOM 2 methods such as
+ * {@link Document#createAttributeNS(String, String)} and that don't represent 
namespace
+ * declarations. Axiom doesn't use {@link OMAttribute} to represent namespace 
declarations, and
+ * {@link OMNamespace} instances representing a namespace declarations are not 
expected to implement
+ * {@link Attr}.
+ * </dl>
+ * <p>
+ * The Axiom API is designed such that nodes are created using a factory 
({@link OMFactory} or
+ * {@link SOAPFactory}) that is expected to be a singleton and stateless. On 
the other hand, in the
+ * DOM API, the {@link Document} instance plays the role of node factory, and 
each node (explicitly
+ * or implicitly) keeps a reference to the {@link Document} instance from 
which it was created (the
+ * <i>owner document</i>). To address this difference in a consistent way and 
to make it possible to
+ * use both the Axiom API and the DOM API on the same object model instance, 
the implementation MUST
+ * conform to the following rules:
+ * <ol>
+ * <li>Nodes created using the Axiom API and for which a parent node is 
specified will have as their
+ * owner document the owner document of the parent. Note that this is simply a 
consequence of the
+ * fact that DOM is designed such that two nodes that are part of the same 
tree must have the same
+ * owner document.
+ * <li>Nodes created using the Axiom API and for which no parent node is 
specified will get a new
+ * owner document.
+ * <li>When the Axiom API is used to add a node A as a child of another node 
B, then the owner
+ * document of B becomes the new owner document of A and all its descendants. 
In DOM parlance, this
+ * means that node A is automatically adopted by the owner document of B. This 
implies that no
+ * method defined by the Axiom API will ever trigger a {@link 
DOMException#WRONG_DOCUMENT_ERR}
+ * error.
+ * <li>When a node is detached from its parent using the Axiom API, it will 
get a new owner
+ * document. This rule exists for consistency because together with the other 
rules it implies that
+ * every tree has a distinct owner document as long as only the Axiom API is 
used to manipulate the
+ * nodes. That rule applies to the following methods:
+ * <ul>
+ * <li>{@link OMNode#detach()}
+ * <li>{@link OMElement#removeAttribute(OMAttribute)}
+ * <li>{@link OMElement#setText(String)} and {@link OMElement#setText(QName)} 
(in the case where the
+ * side effect of the invocation is to detach preexisting nodes)
+ * <li>{@link OMElement#addAttribute(OMAttribute)} and
+ * {@link OMElement#addAttribute(String, String, OMNamespace)} (in the case 
where the new attribute
+ * replaces an existing one, which will be removed from its owner)
+ * </ul>
+ * <li>Any node created using the DOM API as well as the {@link Document} 
instance implicitly
+ * created for the owner document (when the Axiom API is used) will have as 
its {@link OMFactory}
+ * (as reported by {@link OMInformationItem#getOMFactory()}) the instance 
returned by
+ * {@link OMMetaFactory#getOMFactory()}.
+ * </ol>
+ * <p>
+ * The implementation SHOULD instantiate the implicitly created owner 
documents lazily (typically
+ * when explicitly requested using DOM's {@link Node#getOwnerDocument()} API) 
to avoid creating a
+ * large number of temporary {@link Document} instances when the Axiom API is 
used. Note however
+ * that this no impact on the behavior visible to the application code.
  */
 public interface DOMMetaFactory extends OMMetaFactory {
     /**
@@ -37,4 +151,11 @@ public interface DOMMetaFactory extends 
      * @return the factory instance
      */
     DocumentBuilderFactory newDocumentBuilderFactory();
+    
+    /**
+     * Get the {@link DOMImplementation} instance.
+     * 
+     * @return the {@link DOMImplementation} instance
+     */
+    DOMImplementation getDOMImplementation();
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
 Sat Apr 14 09:24:54 2012
@@ -68,8 +68,9 @@ public abstract class ChildNode extends 
      */
     DocumentImpl ownerDocument() {
         if (ownerNode == null) {
-            // TODO: it is currently unspecified/untested if the factory 
should be inherited from the root node or if it should always be a plain 
OMFactory
-            DocumentImpl document = new DocumentImpl(factory);
+            // As specified by DOMMetaFactory, the OMFactory for an implicitly 
created owner
+            // document is always the OMFactory for plain XML.
+            DocumentImpl document = new 
DocumentImpl(factory.getMetaFactory().getOMFactory());
             ownerNode = document;
             return document;
         } else if (ownerNode instanceof DocumentImpl) {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
 Sat Apr 14 09:24:54 2012
@@ -19,6 +19,7 @@
 
 package org.apache.axiom.om.impl.dom;
 
+import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.w3c.dom.DOMException;
@@ -27,6 +28,11 @@ import org.w3c.dom.Document;
 import org.w3c.dom.DocumentType;
 
 public class DOMImplementationImpl implements DOMImplementation {
+    private final OMFactory factory;
+    
+    public DOMImplementationImpl(OMFactory factory) {
+        this.factory = factory;
+    }
 
     public boolean hasFeature(String feature, String version) {
         boolean anyVersion = version == null || version.length() == 0;
@@ -38,12 +44,11 @@ public class DOMImplementationImpl imple
                                    DocumentType doctype) throws DOMException {
 
         // TODO Handle docType stuff
-        OMDOMFactory fac = new OMDOMFactory();
-        DocumentImpl doc = new DocumentImpl(fac);
+        DocumentImpl doc = new DocumentImpl(factory);
 
         new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName),
                         new OMNamespaceImpl(namespaceURI, DOMUtil
-                                .getPrefix(qualifiedName)), fac);
+                                .getPrefix(qualifiedName)), factory);
 
         return doc;
     }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
 Sat Apr 14 09:24:54 2012
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.dom.DOMMetaFactory;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.common.OMDocumentImplUtil;
@@ -300,7 +301,7 @@ public class DocumentImpl extends Parent
     }
 
     public DOMImplementation getImplementation() {
-        return new DOMImplementationImpl();
+        return 
((DOMMetaFactory)factory.getMetaFactory()).getDOMImplementation();
     }
 
     public Node importNode(Node importedNode, boolean deep) throws 
DOMException {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
 Sat Apr 14 09:24:54 2012
@@ -24,32 +24,43 @@ import javax.xml.parsers.DocumentBuilder
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.dom.DOMMetaFactory;
 import org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory;
+import org.apache.axiom.om.impl.dom.DOMImplementationImpl;
 import org.apache.axiom.om.impl.dom.jaxp.DOOMDocumentBuilderFactory;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
 import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
+import org.w3c.dom.DOMImplementation;
 
 /**
  * Meta factory for the DOOM implementation.
- * <p>
- * As explained in {@link OMDOMFactory}, OM factories for DOOM are not 
stateless.
- * Therefore {@link #getOMFactory()}, {@link #getSOAP11Factory()} and
- * {@link #getSOAP12Factory()} will return a new instance on every invocation.
  */
 public class OMDOMMetaFactory extends AbstractOMMetaFactory implements 
DOMMetaFactory {
+    // This singleton is necessary to support the no-arg constructor in 
DOOMDocumentBuilderFactory.
+    // Since that method is deprecated, this singleton should disappear in 
Axiom 1.3.
+    public static final OMDOMMetaFactory INSTANCE = new OMDOMMetaFactory();
+    
+    private final OMFactory omFactory = new OMDOMFactory(this);
+    private final SOAPFactory soap11Factory = new SOAP11Factory(this);
+    private final SOAPFactory soap12Factory = new SOAP12Factory(this);
+    private final DOMImplementation domImplementation = new 
DOMImplementationImpl(omFactory);
+    
     public OMFactory getOMFactory() {
-        return new OMDOMFactory(this);
+        return omFactory;
     }
 
     public SOAPFactory getSOAP11Factory() {
-        return new SOAP11Factory(this);
+        return soap11Factory;
     }
 
     public SOAPFactory getSOAP12Factory() {
-        return new SOAP12Factory(this);
+        return soap12Factory;
     }
 
     public DocumentBuilderFactory newDocumentBuilderFactory() {
-        return new DOOMDocumentBuilderFactory();
+        return new DOOMDocumentBuilderFactory(omFactory);
+    }
+
+    public DOMImplementation getDOMImplementation() {
+        return domImplementation;
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
 Sat Apr 14 09:24:54 2012
@@ -25,6 +25,6 @@ import org.apache.axiom.om.OMMetaFactory
 
 public class OMDOMMetaFactoryLoader implements OMMetaFactoryLoader {
     public OMMetaFactory load(Map properties) {
-        return new OMDOMMetaFactory();
+        return OMDOMMetaFactory.INSTANCE;
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilder.java
 Sat Apr 14 09:24:54 2012
@@ -19,10 +19,10 @@
 
 package org.apache.axiom.om.impl.dom.jaxp;
 
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.dom.DOMMetaFactory;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.impl.dom.DOMImplementationImpl;
 import org.apache.axiom.om.impl.dom.DocumentImpl;
-import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.apache.axiom.om.util.StAXUtils;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
@@ -42,9 +42,11 @@ import java.io.IOException;
 import java.io.InputStream;
 
 public class DOOMDocumentBuilder extends DocumentBuilder {
+    private final OMFactory factory;
     private final Schema schema;
     
-    DOOMDocumentBuilder(Schema schema) {
+    DOOMDocumentBuilder(OMFactory factory, Schema schema) {
+        this.factory = factory;
         this.schema = schema;
     }
 
@@ -73,7 +75,7 @@ public class DOOMDocumentBuilder extends
     }
 
     public DOMImplementation getDOMImplementation() {
-        return new DOMImplementationImpl();
+        return 
((DOMMetaFactory)factory.getMetaFactory()).getDOMImplementation();
     }
 
     /**
@@ -82,7 +84,6 @@ public class DOOMDocumentBuilder extends
      * @see javax.xml.parsers.DocumentBuilder#newDocument()
      */
     public Document newDocument() {
-        OMDOMFactory factory = new OMDOMFactory();
         DocumentImpl documentImpl = new DocumentImpl(factory);
         documentImpl.setComplete(true);
         return documentImpl;
@@ -99,7 +100,6 @@ public class DOOMDocumentBuilder extends
     public Document parse(InputSource inputSource) throws SAXException,
             IOException {
         try {
-            OMDOMFactory factory = new OMDOMFactory();
             // Not really sure whether this will work :-?
             XMLStreamReader reader = StAXUtils
                     .createXMLStreamReader(inputSource.getCharacterStream());
@@ -115,7 +115,6 @@ public class DOOMDocumentBuilder extends
     /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */
     public Document parse(InputStream is) throws SAXException, IOException {
         try {
-            OMDOMFactory factory = new OMDOMFactory();
             XMLStreamReader reader = StAXUtils
                     .createXMLStreamReader(is);
             StAXOMBuilder builder = new StAXOMBuilder(factory, reader);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DOOMDocumentBuilderFactory.java
 Sat Apr 14 09:24:54 2012
@@ -24,15 +24,33 @@ import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.validation.Schema;
 
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.dom.DOMMetaFactory;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
+
 /**
  * Document builder factory that conforms to JAXP.
  */
 public class DOOMDocumentBuilderFactory extends DocumentBuilderFactory {
+    private final OMFactory factory;
     private Schema schema;
     
+    /**
+     * @deprecated Application code should not instantiate this class 
directly, but use
+     *             {@link DOMMetaFactory#newDocumentBuilderFactory()} to get 
an Axiom compatible
+     *             {@link DocumentBuilderFactory}.
+     */
+    public DOOMDocumentBuilderFactory() {
+        this(OMDOMMetaFactory.INSTANCE.getOMFactory());
+    }
+    
+    public DOOMDocumentBuilderFactory(OMFactory factory) {
+        this.factory = factory;
+    }
+    
     public DocumentBuilder newDocumentBuilder()
             throws ParserConfigurationException {
-        return new DOOMDocumentBuilder(schema);
+        return new DOOMDocumentBuilder(factory, schema);
     }
 
     public Object getAttribute(String name) throws IllegalArgumentException {

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
 Sat Apr 14 09:24:54 2012
@@ -20,10 +20,10 @@
 package org.apache.axiom.om.impl.dom.jaxp;
 
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.impl.dom.DOMImplementationImpl;
 import org.apache.axiom.om.impl.dom.DocumentImpl;
 import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
 import org.apache.axiom.om.util.StAXUtils;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
@@ -75,7 +75,7 @@ public class DocumentBuilderImpl extends
     }
 
     public DOMImplementation getDOMImplementation() {
-        return new DOMImplementationImpl();
+        return OMDOMMetaFactory.INSTANCE.getDOMImplementation();
     }
 
     /**

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
 Sat Apr 14 09:24:54 2012
@@ -21,12 +21,12 @@ package org.apache.axiom.om.impl.dom;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.axiom.om.impl.dom.jaxp.DOOMDocumentBuilderFactory;
+import org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory;
 import org.apache.axiom.ts.dom.DOMTestSuiteBuilder;
 
 public class DOMImplementationTest extends TestCase {
     public static TestSuite suite() {
-        DOMTestSuiteBuilder builder = new DOMTestSuiteBuilder(new 
DOOMDocumentBuilderFactory());
+        DOMTestSuiteBuilder builder = new DOMTestSuiteBuilder(new 
OMDOMMetaFactory().newDocumentBuilderFactory());
         return builder.build();
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
 Sat Apr 14 09:24:54 2012
@@ -27,10 +27,6 @@ import org.apache.axiom.soap.impl.llom.s
 
 /**
  * Meta factory for the linked list OM implementation.
- * <p>
- * Since all OM factories for LLOM are stateless, {@link #getOMFactory()},
- * {@link #getSOAP11Factory()} and {@link #getSOAP12Factory()} will return the
- * same instance on every invocation.
  */
 public class OMLinkedListMetaFactory extends AbstractOMMetaFactory {
     private final OMFactory omFactory = new OMLinkedListImplFactory(this);

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
 Sat Apr 14 09:24:54 2012
@@ -291,6 +291,7 @@ public class OMTestSuiteBuilder extends 
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMText(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMTextFromDataHandlerProvider(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.factory.TestCreateOMTextWithNullParent(metaFactory));
+        addTest(new 
org.apache.axiom.ts.om.factory.TestFactoryIsSingleton(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.factory.TestGetMetaFactory(metaFactory));
         addTest(new org.apache.axiom.ts.om.namespace.TestEquals(metaFactory));
         addTest(new 
org.apache.axiom.ts.om.namespace.TestEqualsWithNullPrefix(metaFactory));

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java?rev=1326075&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java
 Sat Apr 14 09:24:54 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.ts.om.factory;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that the {@link OMFactory} returned by {@link OMMetaFactory} is a 
singleton. More precisely
+ * this unit test checks that subsequent calls to {@link 
OMMetaFactory#getOMFactory()} return the
+ * same instance.
+ */
+public class TestFactoryIsSingleton extends AxiomTestCase {
+    public TestFactoryIsSingleton(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        assertSame(metaFactory.getOMFactory(), metaFactory.getOMFactory());
+        assertSame(metaFactory.getSOAP11Factory(), 
metaFactory.getSOAP11Factory());
+        assertSame(metaFactory.getSOAP12Factory(), 
metaFactory.getSOAP12Factory());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/factory/TestFactoryIsSingleton.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
 Sat Apr 14 09:24:54 2012
@@ -36,6 +36,8 @@ public class OMDOMTestSuiteBuilder exten
 
     protected void addTests() {
         addTest(new 
org.apache.axiom.ts.omdom.attr.TestGetNamespaceNormalized(metaFactory));
+        addTest(new 
org.apache.axiom.ts.omdom.document.TestGetOMFactory1(metaFactory));
+        addTest(new 
org.apache.axiom.ts.omdom.document.TestGetOMFactory2(metaFactory));
         addTest(new 
org.apache.axiom.ts.omdom.document.TestImportNode(metaFactory));
         addTest(new 
org.apache.axiom.ts.omdom.element.TestAddAttributeReplace(metaFactory));
         addTest(new 
org.apache.axiom.ts.omdom.element.TestAddChildFromForeignDocument(metaFactory));

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java?rev=1326075&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java
 Sat Apr 14 09:24:54 2012
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.ts.omdom.document;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMInformationItem;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.dom.DOMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.w3c.dom.Document;
+
+/**
+ * Tests that {@link OMInformationItem#getOMFactory()} returns the expected 
instance for a
+ * {@link Document} created with the {@link DocumentBuilder#newDocument()}.
+ */
+public class TestGetOMFactory1 extends AxiomTestCase {
+    public TestGetOMFactory1(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        Document document = 
((DOMMetaFactory)metaFactory).newDocumentBuilderFactory().newDocumentBuilder().newDocument();
+        assertSame(metaFactory.getOMFactory(), 
((OMDocument)document).getOMFactory());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java?rev=1326075&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java
 Sat Apr 14 09:24:54 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.ts.omdom.document;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMInformationItem;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.dom.DOMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+
+/**
+ * Tests that {@link OMInformationItem#getOMFactory()} returns the expected 
instance for a
+ * {@link Document} created with the
+ * {@link DOMImplementation#createDocument(String, String, DocumentType)}.
+ */
+public class TestGetOMFactory2 extends AxiomTestCase {
+    public TestGetOMFactory2(OMMetaFactory metaFactory) {
+        super(metaFactory);
+    }
+
+    protected void runTest() throws Throwable {
+        Document document = 
((DOMMetaFactory)metaFactory).getDOMImplementation().createDocument("urn:test", 
"root", null);
+        assertSame(metaFactory.getOMFactory(), 
((OMDocument)document).getOMFactory());
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/document/TestGetOMFactory2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1326075&r1=1326074&r2=1326075&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
 Sat Apr 14 09:24:54 2012
@@ -54,6 +54,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new 
org.apache.axiom.ts.soap.envelope.TestHasFaultWithParser(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelope(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelopeWithCustomPrefix(metaFactory,
 spec));
+        addTest(new 
org.apache.axiom.ts.soap.factory.TestFactoryIsSingleton(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.factory.TestGetDefaultEnvelope(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope(metaFactory, 
spec));
         addTest(new 
org.apache.axiom.ts.soap.factory.TestGetMetaFactory(metaFactory, spec));

Added: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java?rev=1326075&view=auto
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java
 (added)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java
 Sat Apr 14 09:24:54 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.axiom.ts.soap.factory;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests that the SOAP factories returned by {@link OMMetaFactory} are 
singletons. More precisely
+ * this unit test checks that subsequent calls to {@link 
OMMetaFactory#getSOAP11Factory()} and
+ * {@link OMMetaFactory#getSOAP12Factory()} return the same instances.
+ */
+public class TestFactoryIsSingleton extends SOAPTestCase {
+    public TestFactoryIsSingleton(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        assertSame(spec.getFactory(metaFactory), spec.getFactory(metaFactory));
+    }
+}

Propchange: 
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestFactoryIsSingleton.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to