edu.internet2.middleware.shibboleth.idp
Class TestCaseBase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.custommonkey.xmlunit.XMLTestCase
              extended by edu.internet2.middleware.shibboleth.idp.TestCaseBase
All Implemented Interfaces:
junit.framework.Test, org.custommonkey.xmlunit.XMLConstants, org.custommonkey.xmlunit.XSLTConstants
Direct Known Subclasses:
BaseConf1TestCase

public abstract class TestCaseBase
extends org.custommonkey.xmlunit.XMLTestCase

Base unit test case for Spring configuration tests.


Field Summary
protected  XMLObjectBuilderFactory builderFactory
          Factory for XMLObject builders.
private  List<Resource> configResources
          Configuration resources to be loaded for all unit tests.
private static org.slf4j.Logger log
          Class logger.
protected  MarshallerFactory marshallerFactory
          Factory for XMLObject marshallers.
protected static BasicParserPool parser
          Parser manager used to parse XML.
protected  UnmarshallerFactory unmarshallerFactory
          Factory for XMLObject unmarshallers.
 
Fields inherited from interface org.custommonkey.xmlunit.XSLTConstants
JAVA5_XSLTC_FACTORY_NAME, XSLT_END, XSLT_IDENTITY_TEMPLATE, XSLT_START, XSLT_START_NO_VERSION, XSLT_STRIP_COMMENTS_TEMPLATE, XSLT_STRIP_WHITESPACE, XSLT_XML_OUTPUT_NOINDENT
 
Fields inherited from interface org.custommonkey.xmlunit.XMLConstants
CLOSE_NODE, END_CDATA, END_COMMENT, END_PROCESSING_INSTRUCTION, OPEN_END_NODE, OPEN_START_NODE, START_CDATA, START_COMMENT, START_DOCTYPE, START_PROCESSING_INSTRUCTION, W3C_XML_SCHEMA_INSTANCE_NO_NAMESPACE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_INSTANCE_NS_URI, W3C_XML_SCHEMA_INSTANCE_SCHEMA_LOCATION_ATTR, W3C_XML_SCHEMA_NS_URI, XML_DECLARATION, XMLNS_PREFIX, XPATH_ATTRIBUTE_IDENTIFIER, XPATH_CHARACTER_NODE_IDENTIFIER, XPATH_COMMENT_IDENTIFIER, XPATH_NODE_INDEX_END, XPATH_NODE_INDEX_START, XPATH_PROCESSING_INSTRUCTION_IDENTIFIER, XPATH_SEPARATOR
 
Constructor Summary
TestCaseBase()
           
 
Method Summary
 void assertEquals(Document expectedDOM, XMLObject xmlObject)
          Asserts a given XMLObject is equal to an expected DOM.
 void assertEquals(String failMessage, Document expectedDOM, XMLObject xmlObject)
          Asserts a given XMLObject is equal to an expected DOM.
protected  org.springframework.context.ApplicationContext createSpringContext()
          Creates a Spring application context from the instance defined config resources.
protected  org.springframework.context.ApplicationContext createSpringContext(List<Resource> configs)
          Creates a Spring context from the given resources.
protected  org.springframework.context.ApplicationContext createSpringContext(String config)
          Creates a Spring application context from the given configuration and any instance registered configurations.
protected  org.springframework.context.ApplicationContext createSpringContext(String[] configs)
          Creates a Spring application context from the given configurations and any instance registered configurations.
protected  void setUp()
          
protected  XMLObject unmarshallElement(String elementFile)
          Unmarshalls an element file into its SAMLObject.
 
Methods inherited from class org.custommonkey.xmlunit.XMLTestCase
assertNodeTestPasses, assertNodeTestPasses, assertNodeTestPasses, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLIdentical, assertXMLIdentical, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXpathEvaluatesTo, assertXpathEvaluatesTo, assertXpathEvaluatesTo, assertXpathExists, assertXpathExists, assertXpathExists, assertXpathNotExists, assertXpathNotExists, assertXpathNotExists, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, compareXML, compareXML, compareXML, compareXML, compareXML, compareXML
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parser

protected static BasicParserPool parser
Parser manager used to parse XML.


builderFactory

protected XMLObjectBuilderFactory builderFactory
Factory for XMLObject builders.


marshallerFactory

protected MarshallerFactory marshallerFactory
Factory for XMLObject marshallers.


unmarshallerFactory

protected UnmarshallerFactory unmarshallerFactory
Factory for XMLObject unmarshallers.


log

private static org.slf4j.Logger log
Class logger.


configResources

private List<Resource> configResources
Configuration resources to be loaded for all unit tests.

Constructor Detail

TestCaseBase

public TestCaseBase()
Method Detail

setUp

protected void setUp()
              throws Exception

Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

createSpringContext

protected org.springframework.context.ApplicationContext createSpringContext()
                                                                      throws ResourceException
Creates a Spring application context from the instance defined config resources.

Returns:
the created context
Throws:
ResourceException - thrown if there is a problem reading the configuration resources

createSpringContext

protected org.springframework.context.ApplicationContext createSpringContext(String config)
                                                                      throws ResourceException
Creates a Spring application context from the given configuration and any instance registered configurations.

Parameters:
config - spring configuration file to be located on the classpath
Returns:
the configured spring context
Throws:
ResourceException - thrown if the given resources can not be located

createSpringContext

protected org.springframework.context.ApplicationContext createSpringContext(String[] configs)
                                                                      throws ResourceException
Creates a Spring application context from the given configurations and any instance registered configurations.

Parameters:
configs - spring configuration files to be located on the classpath
Returns:
the configured spring context
Throws:
ResourceException - thrown if the given resources can not be located

createSpringContext

protected org.springframework.context.ApplicationContext createSpringContext(List<Resource> configs)
                                                                      throws ResourceException
Creates a Spring context from the given resources.

Parameters:
configs - context configuration resources
Returns:
the created context
Throws:
ResourceException - thrown if there is a problem reading the configuration resources

assertEquals

public void assertEquals(Document expectedDOM,
                         XMLObject xmlObject)
Asserts a given XMLObject is equal to an expected DOM. The XMLObject is marshalled and the resulting DOM object is compared against the expected DOM object for equality.

Parameters:
expectedDOM - the expected DOM
xmlObject - the XMLObject to be marshalled and compared against the expected DOM

assertEquals

public void assertEquals(String failMessage,
                         Document expectedDOM,
                         XMLObject xmlObject)
Asserts a given XMLObject is equal to an expected DOM. The XMLObject is marshalled and the resulting DOM object is compared against the expected DOM object for equality.

Parameters:
failMessage - the message to display if the DOMs are not equal
expectedDOM - the expected DOM
xmlObject - the XMLObject to be marshalled and compared against the expected DOM

unmarshallElement

protected XMLObject unmarshallElement(String elementFile)
Unmarshalls an element file into its SAMLObject.

Parameters:
elementFile - the classpath path to an XML document to unmarshall
Returns:
the SAMLObject from the file


Copyright © 1999-2012. All Rights Reserved.