com.mockrunner.mock.jdbc
Class MockSQLXML

java.lang.Object
  extended by com.mockrunner.mock.jdbc.MockSQLXML
All Implemented Interfaces:
java.lang.Cloneable, java.sql.SQLXML

public class MockSQLXML
extends java.lang.Object
implements java.sql.SQLXML, java.lang.Cloneable

Mock implementation of MockSQLXML. Uses JDOM for XML handling.


Constructor Summary
MockSQLXML()
           
MockSQLXML(org.w3c.dom.Document documentContent)
           
MockSQLXML(java.io.InputStream inputStreamContent)
           
MockSQLXML(java.io.Reader readerContent)
           
MockSQLXML(java.lang.String stringContent)
           
 
Method Summary
 java.lang.Object clone()
           
protected  javax.xml.parsers.DocumentBuilder createDocumentBuilder()
           
protected  org.jdom.input.DOMBuilder createJDOMDOMBuilder()
           
protected  org.jdom.output.DOMOutputter createJDOMDOMOutputter()
           
protected  org.jdom.input.SAXBuilder createJDOMSAXBuilder()
           
protected  org.jdom.output.XMLOutputter createJDOMXMLCompareOutputter()
           
protected  org.jdom.output.XMLOutputter createJDOMXMLPrintOutputter()
           
protected  javax.xml.parsers.SAXParser createSAXParser()
           
protected  javax.xml.stream.XMLInputFactory createXMLInputFactory()
           
protected  javax.xml.stream.XMLOutputFactory createXMLOutputFactory()
           
 boolean equals(java.lang.Object otherObject)
           
 void free()
           
 java.io.InputStream getBinaryStream()
           
 java.io.Reader getCharacterStream()
           
 java.io.InputStream getContentAsInputStream()
          Returns the XML content as an InputStream without affecting the state of the object.
 java.io.Reader getContentAsReader()
          Returns the XML content as a Reader without affecting the state of the object.
 java.lang.String getContentAsString()
          Returns the XML content as a string without affecting the state of the object.
 org.w3c.dom.Document getContentAsW3CDocument()
          Returns the XML content as a W3C Document without affecting the state of the object.
 javax.xml.transform.Source getSource(java.lang.Class sourceClass)
           
 java.lang.String getString()
           
 int hashCode()
           
 boolean isReadable()
          Returns if this object is readable.
 boolean isWriteable()
          Returns if this object is writeable.
 java.io.OutputStream setBinaryStream()
           
 java.io.Writer setCharacterStream()
           
 javax.xml.transform.Result setResult(java.lang.Class resultClass)
           
 void setString(java.lang.String value)
           
 java.lang.String toString()
           
 boolean wasFreeCalled()
          Returns if free() has been called.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MockSQLXML

public MockSQLXML()

MockSQLXML

public MockSQLXML(java.lang.String stringContent)

MockSQLXML

public MockSQLXML(java.io.Reader readerContent)

MockSQLXML

public MockSQLXML(java.io.InputStream inputStreamContent)

MockSQLXML

public MockSQLXML(org.w3c.dom.Document documentContent)
Method Detail

createDocumentBuilder

protected javax.xml.parsers.DocumentBuilder createDocumentBuilder()

createSAXParser

protected javax.xml.parsers.SAXParser createSAXParser()

createXMLOutputFactory

protected javax.xml.stream.XMLOutputFactory createXMLOutputFactory()

createXMLInputFactory

protected javax.xml.stream.XMLInputFactory createXMLInputFactory()

createJDOMSAXBuilder

protected org.jdom.input.SAXBuilder createJDOMSAXBuilder()

createJDOMDOMBuilder

protected org.jdom.input.DOMBuilder createJDOMDOMBuilder()

createJDOMXMLPrintOutputter

protected org.jdom.output.XMLOutputter createJDOMXMLPrintOutputter()

createJDOMXMLCompareOutputter

protected org.jdom.output.XMLOutputter createJDOMXMLCompareOutputter()

createJDOMDOMOutputter

protected org.jdom.output.DOMOutputter createJDOMDOMOutputter()

getContentAsString

public java.lang.String getContentAsString()
Returns the XML content as a string without affecting the state of the object. This method can be called multiple times unlike the get methods of java.sql.SQLXML.

Returns:
the XML content as a string

getContentAsInputStream

public java.io.InputStream getContentAsInputStream()
                                            throws java.sql.SQLException
Returns the XML content as an InputStream without affecting the state of the object. This method can be called multiple times unlike the get methods of java.sql.SQLXML.

Returns:
the XML content as an InputStream
Throws:
java.sql.SQLException

getContentAsReader

public java.io.Reader getContentAsReader()
                                  throws java.sql.SQLException
Returns the XML content as a Reader without affecting the state of the object. This method can be called multiple times unlike the get methods of java.sql.SQLXML.

Returns:
the XML content as a Reader
Throws:
java.sql.SQLException

getContentAsW3CDocument

public org.w3c.dom.Document getContentAsW3CDocument()
Returns the XML content as a W3C Document without affecting the state of the object. This method can be called multiple times unlike the get methods of java.sql.SQLXML.

Returns:
the XML content as a W3C Document

getBinaryStream

public java.io.InputStream getBinaryStream()
                                    throws java.sql.SQLException
Specified by:
getBinaryStream in interface java.sql.SQLXML
Throws:
java.sql.SQLException

getCharacterStream

public java.io.Reader getCharacterStream()
                                  throws java.sql.SQLException
Specified by:
getCharacterStream in interface java.sql.SQLXML
Throws:
java.sql.SQLException

getSource

public javax.xml.transform.Source getSource(java.lang.Class sourceClass)
                                     throws java.sql.SQLException
Specified by:
getSource in interface java.sql.SQLXML
Throws:
java.sql.SQLException

getString

public java.lang.String getString()
                           throws java.sql.SQLException
Specified by:
getString in interface java.sql.SQLXML
Throws:
java.sql.SQLException

setBinaryStream

public java.io.OutputStream setBinaryStream()
                                     throws java.sql.SQLException
Specified by:
setBinaryStream in interface java.sql.SQLXML
Throws:
java.sql.SQLException

setCharacterStream

public java.io.Writer setCharacterStream()
                                  throws java.sql.SQLException
Specified by:
setCharacterStream in interface java.sql.SQLXML
Throws:
java.sql.SQLException

setResult

public javax.xml.transform.Result setResult(java.lang.Class resultClass)
                                     throws java.sql.SQLException
Specified by:
setResult in interface java.sql.SQLXML
Throws:
java.sql.SQLException

setString

public void setString(java.lang.String value)
               throws java.sql.SQLException
Specified by:
setString in interface java.sql.SQLXML
Throws:
java.sql.SQLException

free

public void free()
          throws java.sql.SQLException
Specified by:
free in interface java.sql.SQLXML
Throws:
java.sql.SQLException

wasFreeCalled

public boolean wasFreeCalled()
Returns if free() has been called.

Returns:
true if free() has been called, false otherwise

isReadable

public boolean isReadable()
Returns if this object is readable.

Returns:
true this object is readable, false otherwise

isWriteable

public boolean isWriteable()
Returns if this object is writeable.

Returns:
true this object is writeable, false otherwise

equals

public boolean equals(java.lang.Object otherObject)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object