Class AbstractSourceCodeAwareNodeProcessingTest
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.schemageneration.postprocessing.javadoc.AbstractSourceCodeAwareNodeProcessingTest
-
- Direct Known Subclasses:
XsdAnnotationProcessorAndEnumsTest
,XsdAnnotationProcessorSemiDocumentedTest
,XsdAnnotationProcessorTest
,XsdEnumerationAnnotationProcessorTest
public abstract class AbstractSourceCodeAwareNodeProcessingTest extends Object
- Author:
- Lennart Jörelid, jGuru Europe AB
-
-
Field Summary
Fields Modifier and Type Field Description protected File
basedir
static String
DEFAULT_EMPTY_NAMESPACE_SYSTEM_ID
Default systemId for the empty namespace.protected SearchableDocumentation
docs
protected jakarta.xml.bind.JAXBContext
jaxbContext
protected BufferingLog
log
protected SortedMap<String,Document>
namespace2DocumentMap
protected SortedMap<String,String>
namespace2GeneratedSchemaMap
protected Map<String,String>
namespace2SystemIdMap
protected File
testJavaDir
protected SortedMap<String,Throwable>
xsdGenerationLog
protected List<String>
xsdGenerationWarnings
-
Constructor Summary
Constructors Constructor Description AbstractSourceCodeAwareNodeProcessingTest()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static org.custommonkey.xmlunit.Diff
compareXmlIgnoringWhitespace(String expected, String actual)
Compares XML documents provided by the two Readers.protected Document
createDocument(String xmlContent)
Creates a DOM Document from the supplied XML.protected File
getBasedir()
protected abstract List<Class<?>>
getJaxbAnnotatedClassesForJaxbContext()
protected void
onAcceptedAttribute(Node anAttribute)
Event callback when a nodeProcessor has accepted an Attribute.protected void
onAcceptedNode(Node aNode)
Event callback when a nodeProcessor has accepted a Node.static String
printDocument(Document doc)
Prints the content of the supplied DOM Document as a string.void
process(Node node, boolean recurseToChildren, NodeProcessor visitor)
Drives the supplied visitor to process the provided Node and all its children, should the recurseToChildren flag be set totrue
.protected static String
readFully(String path)
Utility method to read all (string formatted) data from the given classpath-relative file and return the data as a string.void
setupSharedState()
-
-
-
Field Detail
-
DEFAULT_EMPTY_NAMESPACE_SYSTEM_ID
public static final String DEFAULT_EMPTY_NAMESPACE_SYSTEM_ID
Default systemId for the empty namespace.- See Also:
- Constant Field Values
-
log
protected BufferingLog log
-
docs
protected SearchableDocumentation docs
-
basedir
protected final File basedir
-
testJavaDir
protected final File testJavaDir
-
jaxbContext
protected jakarta.xml.bind.JAXBContext jaxbContext
-
-
Method Detail
-
getJaxbAnnotatedClassesForJaxbContext
protected abstract List<Class<?>> getJaxbAnnotatedClassesForJaxbContext()
- Returns:
- A List containing all classes which should be part of the JAXBContext.
-
getBasedir
protected File getBasedir()
- Returns:
- The basedir directory, corresponding to the root of this project.
-
createDocument
protected final Document createDocument(String xmlContent)
Creates a DOM Document from the supplied XML.- Parameters:
xmlContent
- The non-empty XML which should be converted into a Document.- Returns:
- The Document created from the supplied XML Content.
-
process
public final void process(Node node, boolean recurseToChildren, NodeProcessor visitor)
Drives the supplied visitor to process the provided Node and all its children, should the recurseToChildren flag be set totrue
. All attributes of the current node are processed before recursing to children (i.e. breadth first recursion).- Parameters:
node
- The Node to process.recurseToChildren
- iftrue
, processes all children of the supplied node recursively.visitor
- The NodeProcessor instance which should process the nodes.
-
onAcceptedNode
protected void onAcceptedNode(Node aNode)
Event callback when a nodeProcessor has accepted a Node.- Parameters:
aNode
- the accepted Node
-
onAcceptedAttribute
protected void onAcceptedAttribute(Node anAttribute)
Event callback when a nodeProcessor has accepted an Attribute.- Parameters:
anAttribute
- the accepted attribute.
-
readFully
protected static String readFully(String path)
Utility method to read all (string formatted) data from the given classpath-relative file and return the data as a string.- Parameters:
path
- The classpath-relative file path.- Returns:
- The content of the supplied file.
-
compareXmlIgnoringWhitespace
protected static org.custommonkey.xmlunit.Diff compareXmlIgnoringWhitespace(String expected, String actual) throws SAXException, IOException
Compares XML documents provided by the two Readers.- Parameters:
expected
- The expected document data.actual
- The actual document data.- Returns:
- A DetailedDiff object, describing all differences in documents supplied.
- Throws:
SAXException
- If a SAXException was raised during parsing of the two Documents.IOException
- If an I/O-related exception was raised while acquiring the data from the Readers.
-
-