Package ghidra.util.xml
Class XmlTestHelper
- java.lang.Object
 - 
- ghidra.util.xml.XmlTestHelper
 
 
- 
public class XmlTestHelper extends java.lang.Object 
- 
- 
Constructor Summary
Constructors Constructor Description XmlTestHelper(java.lang.String tmpDirPath)XmlTestHelper(java.lang.String tmpDirPath, GhidraProject gp) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String xml)static voidassertXMLFilesEquals(XmlPullParser expectedXMLParser, XmlPullParser testXMLParser)Compares 2 xml files and fails if there is any difference between the two.static voidassertXMLFilesEquals(java.io.File expectedXMLFile, java.io.File testXMLFile)voidclearXml()voidcompareXml(java.io.File file)booleancontainsXml(java.lang.String line)Return true if the given line is in the the xml list.voiddispose()GhidraProjectgetProject()java.io.FilegetTempFile(java.lang.String name)XmlPullParsergetXmlParser(java.lang.String name)ProgramloadResourceProgram(java.lang.String programName)voidloadXmlResource(java.lang.Package pkg, java.lang.String name)Read an XML file as a resource.voidprintExpectedLines() 
 - 
 
- 
- 
Constructor Detail
- 
XmlTestHelper
public XmlTestHelper(java.lang.String tmpDirPath, GhidraProject gp) throws java.lang.Exception- Throws:
 java.lang.Exception
 
- 
XmlTestHelper
public XmlTestHelper(java.lang.String tmpDirPath) throws java.lang.Exception- Throws:
 java.lang.Exception
 
 - 
 
- 
Method Detail
- 
dispose
public void dispose()
 
- 
add
public void add(java.lang.String xml)
 
- 
loadXmlResource
public void loadXmlResource(java.lang.Package pkg, java.lang.String name) throws java.io.IOExceptionRead an XML file as a resource.- Parameters:
 package- where resource residesname- name of the resource that is in the given package- Throws:
 java.io.IOException
 
- 
getTempFile
public java.io.File getTempFile(java.lang.String name)
 
- 
getProject
public GhidraProject getProject()
 
- 
compareXml
public void compareXml(java.io.File file) throws java.lang.Exception- Throws:
 java.lang.Exception
 
- 
containsXml
public boolean containsXml(java.lang.String line)
Return true if the given line is in the the xml list. 
- 
printExpectedLines
public void printExpectedLines()
 
- 
getXmlParser
public XmlPullParser getXmlParser(java.lang.String name) throws java.io.IOException, org.xml.sax.SAXException
- Throws:
 java.io.IOExceptionorg.xml.sax.SAXException
 
- 
clearXml
public void clearXml()
 
- 
loadResourceProgram
public Program loadResourceProgram(java.lang.String programName) throws java.io.IOException, CancelledException, DuplicateNameException, InvalidNameException, VersionException
- Parameters:
 string-- Returns:
 - Throws:
 VersionExceptionInvalidNameExceptionDuplicateNameExceptionCancelledExceptionjava.io.IOException
 
- 
assertXMLFilesEquals
public static void assertXMLFilesEquals(java.io.File expectedXMLFile, java.io.File testXMLFile) throws org.xml.sax.SAXException, java.io.IOException- Parameters:
 expectedXMLFile-testXMLFile-- Throws:
 org.xml.sax.SAXExceptionjava.io.IOException
 
- 
assertXMLFilesEquals
public static void assertXMLFilesEquals(XmlPullParser expectedXMLParser, XmlPullParser testXMLParser) throws org.xml.sax.SAXException, java.io.IOException
Compares 2 xml files and fails if there is any difference between the two.Elements must be ordered in the same order. Attribute values are not order sensitive.
Inter-node whitespace differences are ignored.
DTD definitions are ignored.
- Parameters:
 expectedXMLParser-testXMLParser-- Throws:
 org.xml.sax.SAXExceptionjava.io.IOException
 
 - 
 
 -