public abstract class XMLObjectBaseTestCase extends OpenSAMLInitBaseTestCase
| Modifier and Type | Field and Description |
|---|---|
private static Calendar |
baseline
Baseline for duration calculations (comes from XML Schema standard).
|
protected static org.opensaml.core.xml.XMLObjectBuilderFactory |
builderFactory
XMLObject builder factory
|
private org.slf4j.Logger |
log
Logger
|
protected static org.opensaml.core.xml.io.MarshallerFactory |
marshallerFactory
XMLObject marshaller factory
|
protected static ParserPool |
parserPool
Parser pool
|
protected static QName |
simpleXMLObjectQName
QName for SimpleXMLObject
|
protected static org.opensaml.core.xml.io.UnmarshallerFactory |
unmarshallerFactory
XMLObject unmarshaller factory
|
| Constructor and Description |
|---|
XMLObjectBaseTestCase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertXMLEquals(Document expectedDOM,
org.opensaml.core.xml.XMLObject xmlObject)
Asserts a given XMLObject is equal to an expected DOM.
|
protected void |
assertXMLEquals(String failMessage,
Document expectedDOM,
org.opensaml.core.xml.XMLObject xmlObject)
Asserts a given XMLObject is equal to an expected DOM.
|
protected <T extends org.opensaml.core.xml.XMLObject> |
buildXMLObject(QName name)
Builds the requested XMLObject.
|
static long |
fetchDuration(Element element,
QName name)
Helper method to extract the value of an XML duration attribute in milliseconds.
|
protected <T extends org.opensaml.core.xml.XMLObject> |
getBuilder(QName qname)
Lookup the XMLObjectBuilder for a QName.
|
protected org.opensaml.core.xml.io.Marshaller |
getMarshaller(QName qname)
Lookup the marshaller for a QName
|
protected org.opensaml.core.xml.io.Marshaller |
getMarshaller(org.opensaml.core.xml.XMLObject xmlObject)
Lookup the marshaller for an XMLObject.
|
protected org.opensaml.core.xml.io.Unmarshaller |
getUnmarshaller(Element element)
Lookup the unmarshaller for a DOM Element.
|
protected org.opensaml.core.xml.io.Unmarshaller |
getUnmarshaller(QName qname)
Lookup the unmarshaller for a QName.
|
protected org.opensaml.core.xml.io.Unmarshaller |
getUnmarshaller(org.opensaml.core.xml.XMLObject xmlObject)
Lookup the unmarshaller for an XMLObject.
|
protected void |
initXMLObjectSupport() |
protected Document |
parseXMLDocument(String xmlFilename)
Parse an XML file as a classpath resource.
|
protected void |
printXML(Node node,
String filename)
For convenience when testing, pretty-print the specified DOM node to a file, or to
the console if filename is null.
|
protected void |
printXML(org.opensaml.core.xml.XMLObject xmlObject,
String filename)
For convenience when testing, pretty-print the specified XMLObject to a file, or to
the console if filename is null.
|
protected <T extends org.opensaml.core.xml.XMLObject> |
unmarshallElement(String elementFile)
Unmarshalls an element file into its XMLObject.
|
protected <T extends org.opensaml.core.xml.XMLObject> |
unmarshallElement(String elementFile,
boolean propagateErrors)
Unmarshalls an element file into its XMLObject.
|
initOpenSAMLprivate final org.slf4j.Logger log
protected static ParserPool parserPool
protected static org.opensaml.core.xml.XMLObjectBuilderFactory builderFactory
protected static org.opensaml.core.xml.io.MarshallerFactory marshallerFactory
protected static org.opensaml.core.xml.io.UnmarshallerFactory unmarshallerFactory
protected static QName simpleXMLObjectQName
private static Calendar baseline
public static long fetchDuration(@Nonnull Element element, @Nonnull QName name) throws DatatypeConfigurationException
element - element to pull attribute fromname - name of attributeDatatypeConfigurationException - if a DatatypeFactory can't be constructedprotected void assertXMLEquals(Document expectedDOM, org.opensaml.core.xml.XMLObject xmlObject)
expectedDOM - the expected DOMxmlObject - the XMLObject to be marshalled and compared against the expected DOMprotected void assertXMLEquals(String failMessage, Document expectedDOM, org.opensaml.core.xml.XMLObject xmlObject)
failMessage - the message to display if the DOMs are not equalexpectedDOM - the expected DOMxmlObject - the XMLObject to be marshalled and compared against the expected DOMprotected <T extends org.opensaml.core.xml.XMLObject> T buildXMLObject(QName name)
name - name of the XMLObjectprotected <T extends org.opensaml.core.xml.XMLObject> T unmarshallElement(String elementFile)
protected <T extends org.opensaml.core.xml.XMLObject> T unmarshallElement(String elementFile, boolean propagateErrors) throws XMLParserException, org.opensaml.core.xml.io.UnmarshallingException
propagateErrors - if true, checked exceptions will be thrown, if false then they cause assertion of test failureXMLParserExceptionorg.opensaml.core.xml.io.UnmarshallingExceptionprotected void printXML(Node node, String filename)
protected void printXML(org.opensaml.core.xml.XMLObject xmlObject,
String filename)
protected <T extends org.opensaml.core.xml.XMLObject> org.opensaml.core.xml.XMLObjectBuilder<T> getBuilder(QName qname)
qname - the QName for which to find the builderprotected org.opensaml.core.xml.io.Marshaller getMarshaller(QName qname)
qname - the QName for which to find the marshallerprotected org.opensaml.core.xml.io.Marshaller getMarshaller(org.opensaml.core.xml.XMLObject xmlObject)
xmlObject - the XMLObject for which to find the marshallerprotected org.opensaml.core.xml.io.Unmarshaller getUnmarshaller(QName qname)
qname - the QName for which to find the unmarshallerprotected org.opensaml.core.xml.io.Unmarshaller getUnmarshaller(org.opensaml.core.xml.XMLObject xmlObject)
xmlObject - the XMLObject for which to find the unmarshallerprotected org.opensaml.core.xml.io.Unmarshaller getUnmarshaller(Element element)
element - the Element for which to find the unmarshallerprotected Document parseXMLDocument(String xmlFilename) throws XMLParserException
xmlFilename - the file to parseXMLParserException - if parsing did not succeedCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.