public class Parser
extends java.lang.Object
Parser
is a parser for a TestNG XML test suite file.Modifier and Type | Field and Description |
---|---|
private static ISuiteParser |
DEFAULT_FILE_PARSER |
static java.lang.String |
DEFAULT_FILENAME
The default file name for the TestNG test suite if none is specified (testng.xml).
|
private static java.lang.String |
HTTPS_OLD_TESTNG_DTD_URL |
static java.lang.String |
HTTPS_TESTNG_DTD_URL |
private java.lang.String |
m_fileName
The file name of the xml suite being parsed.
|
private java.io.InputStream |
m_inputStream |
private boolean |
m_loadClasses |
private IPostProcessor |
m_postProcessor |
private static java.lang.String |
OLD_TESTNG_DTD_URL
The URL to the deprecated TestNG DTD.
|
private static java.util.List<ISuiteParser> |
PARSERS |
static java.lang.String |
TESTNG_DTD
The name of the TestNG DTD.
|
private static java.lang.String |
TESTNG_DTD_URL
The URL to the TestNG DTD.
|
private static java.util.List<java.lang.String> |
URLS |
Constructor and Description |
---|
Parser()
Creates a parser that will try to find the DEFAULT_FILENAME from the jar.
|
Parser(java.io.InputStream is) |
Parser(java.lang.String fileName)
Constructs a
Parser to use the inputStream as the source of the xml test suite to
parse. |
Modifier and Type | Method and Description |
---|---|
static boolean |
canParse(java.lang.String fileName) |
private static java.net.URI |
constructURI(java.lang.String text) |
private static IFileParser |
getParser(java.lang.String fileName) |
static boolean |
hasFileScheme(java.lang.String uri) |
private void |
init(java.lang.String fileName,
java.io.InputStream is) |
(package private) static boolean |
isUnRecognizedPublicId(java.lang.String publicId) |
private static Parser |
newParser(java.io.InputStream is,
IPostProcessor processor) |
private static Parser |
newParser(java.lang.String path,
IPostProcessor processor) |
java.util.Collection<XmlSuite> |
parse()
Parses the TestNG test suite and returns the corresponding XmlSuite, and possibly, other
XmlSuite that are pointed to by
|
static java.util.Collection<XmlSuite> |
parse(java.io.InputStream is,
IPostProcessor processor) |
static java.util.Collection<XmlSuite> |
parse(java.lang.String suite,
IPostProcessor processor) |
java.util.List<XmlSuite> |
parseToList() |
void |
setLoadClasses(boolean loadClasses)
If false, don't try to load the classes during the parsing.
|
void |
setPostProcessor(IPostProcessor processor) |
public static final java.lang.String TESTNG_DTD
private static final java.lang.String OLD_TESTNG_DTD_URL
private static final java.lang.String HTTPS_OLD_TESTNG_DTD_URL
private static final java.lang.String TESTNG_DTD_URL
public static final java.lang.String HTTPS_TESTNG_DTD_URL
private static final java.util.List<java.lang.String> URLS
public static final java.lang.String DEFAULT_FILENAME
private static final ISuiteParser DEFAULT_FILE_PARSER
private static final java.util.List<ISuiteParser> PARSERS
private java.lang.String m_fileName
private java.io.InputStream m_inputStream
private IPostProcessor m_postProcessor
private boolean m_loadClasses
public Parser(java.lang.String fileName)
Parser
to use the inputStream as the source of the xml test suite to
parse.fileName
- the filename corresponding to the inputStream or null if unknown.public Parser()
public Parser(java.io.InputStream is)
static boolean isUnRecognizedPublicId(java.lang.String publicId)
private void init(java.lang.String fileName, java.io.InputStream is)
public void setPostProcessor(IPostProcessor processor)
public void setLoadClasses(boolean loadClasses)
private static IFileParser getParser(java.lang.String fileName)
public java.util.Collection<XmlSuite> parse() throws java.io.IOException
java.io.IOException
- if an I/O error occurs while parsing the test suite file or if the default
testng.xml file is not found.public static boolean hasFileScheme(java.lang.String uri)
uri
- - The uri to be verified.true
if the uri has "file:" as its scheme.public java.util.List<XmlSuite> parseToList() throws java.io.IOException
java.io.IOException
public static java.util.Collection<XmlSuite> parse(java.lang.String suite, IPostProcessor processor) throws java.io.IOException
java.io.IOException
public static java.util.Collection<XmlSuite> parse(java.io.InputStream is, IPostProcessor processor) throws java.io.IOException
java.io.IOException
public static boolean canParse(java.lang.String fileName)
private static Parser newParser(java.lang.String path, IPostProcessor processor)
private static Parser newParser(java.io.InputStream is, IPostProcessor processor)
private static java.net.URI constructURI(java.lang.String text)