![]() |
![]() |
selenium-server-standalone-2.42.2m_currentIncludeIndex++); } else { include = new XmlInclude(name, m_currentIncludeIndex++); } for (Map.Entry<String, String> entry : m_currentInclude.parameters.entrySet()) { include.addParameter((String)entry.getKey(), (String)entry.getValue()); } include.setDescription(m_currentInclude.description); m_currentIncludedMethods.add(include); } else if (null != m_currentDefines) { m_currentMetaGroup.add(name); } else if (null != m_currentRuns) { m_currentIncludedGroups.add(name); } else if (null != m_currentPackage) { m_currentPackage.getInclude().add(name); } popLocation(Location.INCLUDE); m_currentInclude = null; } } private void pushLocation(Location l) { m_locations.push(l); } private Location popLocation(Location location) { return (Location)m_locations.pop(); } private List<Integer> stringToList(String in) { String[] numbers = in.split(" "); List<Integer> result = Lists.newArrayList(); for (String n : numbers) { result.add(Integer.valueOf(Integer.parseInt(n))); } return result; } public void endElement(String uri, String localName, String qName) throws SAXException { if ("suite".equals(qName)) { xmlSuite(false, null); } else if ("suite-file".equals(qName)) { xmlSuiteFile(false, null); } else if ("test".equals(qName)) { xmlTest(false, null); } else if ("define".equals(qName)) { xmlDefine(false, null); } else if ("run".equals(qName)) { xmlRun(false, null); } else if ("methods".equals(qName)) { xmlMethod(false, null); } else if ("classes".equals(qName)) { xmlClasses(false, null); } else if ("packages".equals(qName)) { xmlPackages(false, null); } else if ("class".equals(qName)) { m_currentClass.setParameters(m_currentClassParameters); m_currentClassParameters = null; popLocation(Location.CLASS); } else if ("listeners".equals(qName)) { xmlListeners(false, null); } else if ("method-selector".equals(qName)) { xmlMethodSelector(false, null); } else if ("method-selectors".equals(qName)) { xmlMethodSelectors(false, null); } else if ("selector-class".equals(qName)) { xmlSelectorClass(false, null); } else if ("script".equals(qName)) { xmlScript(false, null); } else if ("packages".equals(qName)) { xmlPackages(false, null); } else if ("include".equals(qName)) { xmlInclude(false, null); } } public void error(SAXParseException e) throws SAXException { throw e; } private boolean areWhiteSpaces(char[] ch, int start, int length) { for (int i = start; i < start + length; i++) { char c = ch[i]; if ((c != '\n') && (c != '\t') && (c != ' ')) { return false; } } return true; } public void characters(char[] ch, int start, int length) { if ((null != m_currentLanguage) && (!areWhiteSpaces(ch, start, length))) { m_currentExpression += new String(ch, start, length); } } public XmlSuite getSuite() { return m_currentSuite; } private static String expandValue(String value) { StringBuffer result = null; int startIndex = 0; int endIndex = 0; int startPosition = 0; String property = null; while (((startIndex = value.indexOf("${", startPosition)) > -1) && ((endIndex = value.indexOf("}", startIndex + 3)) > -1)) { property = value.substring(startIndex + 2, endIndex); if (result == null) { result = new StringBuffer(value.substring(startPosition, startIndex)); } else { result.append(value.substring(startPosition, startIndex)); } String propertyValue = System.getProperty(property); if (propertyValue == null) { propertyValue = System.getenv(property); } if (propertyValue != null) { result.append(propertyValue); } else { result.append("${"); result.append(property); result.append("}"); } startPosition = startIndex + 3 + property.length(); } if (result != null) { result.append(value.substring(startPosition)); return result.toString(); } return value; } } /* Location: * Qualified Name: org.testng.xml.TestNGContentHandler * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.testng.TestNGException; import org.testng.internal.ClassHelper; import org.xml.sax.SAXException; public abstract class XMLParser<T> implements IFileParser<T> { protected static SAXParser m_saxParser; static { SAXParserFactory spf = loadSAXParserFactory(); if (supportsValidation(spf)) { spf.setValidating(true); } try { m_saxParser = spf.newSAXParser(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } } private static SAXParserFactory loadSAXParserFactory() { SAXParserFactory spf = null; StringBuffer errorLog = new StringBuffer(); try { Class factoryClass = ClassHelper.forName("com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); spf = (SAXParserFactory)factoryClass.newInstance(); } catch (Exception ex) { errorLog.append("JDK5 SAXParserFactory cannot be loaded: " + ex.getMessage()); } if (null == spf) { try { Class factoryClass = ClassHelper.forName("org.apache.crimson.jaxp.SAXParserFactoryImpl"); spf = (SAXParserFactory)factoryClass.newInstance(); } catch (Exception ex) { errorLog.append("\n").append("JDK1.4 SAXParserFactory cannot be loaded: " + ex.getMessage()); } } Throwable cause = null; if (null == spf) { try { spf = SAXParserFactory.newInstance(); } catch (FactoryConfigurationError fcerr) { cause = fcerr; } } if (null == spf) { throw new TestNGException("Cannot initialize a SAXParserFactory\n" + errorLog.toString(), cause); } return spf; } private static boolean supportsValidation(SAXParserFactory spf) { try { return spf.getFeature("http://xml.org/sax/features/validation"); } catch (Exception ex) {} return false; } } /* Location: * Qualified Name: org.testng.xml.XMLParser * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.io.Serializable; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import org.testng.TestNGException; import org.testng.collections.Lists; import org.testng.collections.Maps; import org.testng.collections.Objects; import org.testng.collections.Objects.ToStringHelper; import org.testng.internal.ClassHelper; import org.testng.reporters.IBuffer; import org.testng.reporters.XMLStringBuffer; public class XmlClass implements Serializable, Cloneable { private static final long serialVersionUID = 8885360896966149897L; private List<XmlInclude> m_includedMethods = Lists.newArrayList(); private List<String> m_excludedMethods = Lists.newArrayList(); private String m_name = null; private Class m_class = null; private int m_index; private boolean m_loadClasses = true; private Map<String, String> m_parameters = Maps.newHashMap(); private XmlTest m_xmlTest; public XmlClass() { init("", null, 0, false); } public XmlClass(String name) { init(name, null, 0); } public XmlClass(String name, boolean loadClasses) { init(name, null, 0, loadClasses); } public XmlClass(Class cls) { init(cls.getName(), cls, 0, true); } public XmlClass(Class cls, boolean loadClasses) { init(cls.getName(), cls, 0, loadClasses); } public XmlClass(String className, int index) { init(className, null, index, true); } public XmlClass(String className, int index, boolean loadClasses) { init(className, null, index, loadClasses); } private void init(String className, Class cls, int index) { init(className, cls, index, true); } private void init(String className, Class cls, int index, boolean resolveClass) { m_name = className; m_class = cls; m_index = index; if ((null == m_class) && (resolveClass)) { loadClass(); } } private void loadClass() { m_class = ClassHelper.forName(m_name); if (null == m_class) { throw new TestNGException("Cannot find class in classpath: " + m_name); } } public Class getSupportClass() { if (m_class == null) { loadClass(); } return m_class; } public void setClass(Class className) { m_class = className; } public List<String> getExcludedMethods() { return m_excludedMethods; } public void setExcludedMethods(List<String> excludedMethods) { m_excludedMethods = excludedMethods; } public List<XmlInclude> getIncludedMethods() { return m_includedMethods; } public void setIncludedMethods(List<XmlInclude> includedMethods) { m_includedMethods = includedMethods; } public String getName() { return m_name; } public void setName(String name) { m_name = name; } public boolean loadClasses() { return m_loadClasses; } public String toString() { return Objects.toStringHelper(getClass()).add("class", m_name).toString(); } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); Properties prop = new Properties(); prop.setProperty("name", getName()); boolean hasMethods = (!m_includedMethods.isEmpty()) || (!m_excludedMethods.isEmpty()); boolean hasParameters = !m_parameters.isEmpty(); if ((hasParameters) || (hasMethods)) { xsb.push("class", prop); XmlUtils.dumpParameters(xsb, m_parameters); if (hasMethods) { xsb.push("methods"); for (XmlInclude m : getIncludedMethods()) { xsb.getStringBuffer().append(m.toXml(indent + " ")); } for (String m : getExcludedMethods()) { Properties p = new Properties(); p.setProperty("name", m); xsb.addEmptyElement("exclude", p); } xsb.pop("methods"); } xsb.pop("class"); } else { xsb.addEmptyElement("class", prop); } return xsb.toXML(); } public static String listToString(List<Integer> invocationNumbers) { StringBuilder result = new StringBuilder(); int i = 0; for (Integer n : invocationNumbers) { if (i++ > 0) { result.append(" "); } result.append(n); } return result.toString(); } public Object clone() { XmlClass result = new XmlClass(getName(), getIndex(), loadClasses()); result.setExcludedMethods(getExcludedMethods()); result.setIncludedMethods(getIncludedMethods()); return result; } public int getIndex() { return m_index; } public void setIndex(int index) { m_index = index; } public int hashCode() { int prime = 31; int result = 1; result = 31 * result + (m_class == null ? 0 : m_class.hashCode()); result = 31 * result + (m_loadClasses ? 1 : 0); result = 31 * result + (m_excludedMethods == null ? 0 : m_excludedMethods.hashCode()); result = 31 * result + (m_includedMethods == null ? 0 : m_includedMethods.hashCode()); result = 31 * result + m_index; result = 31 * result + (m_name == null ? 0 : m_name.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return XmlSuite.f(); } if (getClass() != obj.getClass()) { return XmlSuite.f(); } XmlClass other = (XmlClass)obj; if (m_class == null) { if (m_class != null) { return false; } } else { if ((m_class != null) && (m_class != null) && (!m_class.equals(m_class))) { return false; } if (m_loadClasses != m_loadClasses) { return false; } if (!m_excludedMethods.equals(m_excludedMethods)) { return false; } } if (m_includedMethods == null) { if (m_includedMethods != null) { return XmlSuite.f(); } } else if (!m_includedMethods.equals(m_includedMethods)) { return XmlSuite.f(); } if (m_name == null) { if (m_name != null) { return XmlSuite.f(); } } else if (!m_name.equals(m_name)) { return XmlSuite.f(); } return true; } public void setParameters(Map<String, String> parameters) { m_parameters.clear(); m_parameters.putAll(parameters); } public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); Map<String, String> parameters = m_xmlTest.getLocalParameters(); for (Map.Entry<String, String> parameter : parameters.entrySet()) { result.put(parameter.getKey(), parameter.getValue()); } for (String key : m_parameters.keySet()) { result.put(key, m_parameters.get(key)); } return result; } public Map<String, String> getLocalParameters() { return m_parameters; } @Deprecated public Map<String, String> getParameters() { return getAllParameters(); } public void setXmlTest(XmlTest test) { m_xmlTest = test; } } /* Location: * Qualified Name: org.testng.xml.XmlClass * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.util.List; import org.testng.collections.CollectionUtils; import org.testng.collections.Lists; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.OnElement; public class XmlDefine { private String m_name; public void setName(String name) { m_name = name; } public String getName() { return m_name; } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); boolean hasElements = CollectionUtils.hasElements(m_includes); if (hasElements) { xsb.push("define", new String[] { "name", m_name }); } for (String s : m_includes) { xsb.addEmptyElement("include", new String[] { "name", s }); } if (hasElements) { xsb.pop("define"); } return xsb.toXML(); } private List<String> m_includes = Lists.newArrayList(); @OnElement(tag="include", attributes={"name"}) public void onElement(String name) { m_includes.add(name); } public List<String> getIncludes() { return m_includes; } } /* Location: * Qualified Name: org.testng.xml.XmlDefine * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import com.google.inject.internal.Maps; import java.util.Map; import java.util.Map.Entry; import org.testng.collections.CollectionUtils; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.OnElement; public class XmlDependencies { private Map<String, String> m_xmlDependencyGroups = Maps.newHashMap(); @OnElement(tag="group", attributes={"name", "depends-on"}) public void onGroup(String name, String dependsOn) { m_xmlDependencyGroups.put(name, dependsOn); } public Map<String, String> getDependencies() { return m_xmlDependencyGroups; } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); boolean hasElements = CollectionUtils.hasElements(m_xmlDependencyGroups); if (hasElements) { xsb.push("dependencies"); } for (Map.Entry<String, String> entry : m_xmlDependencyGroups.entrySet()) { xsb.addEmptyElement("include", new String[] { "name", (String)entry.getKey(), "depends-on", (String)entry.getValue() }); } if (hasElements) { xsb.pop("dependencies"); } return xsb.toXML(); } } /* Location: * Qualified Name: org.testng.xml.XmlDependencies * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import com.google.inject.internal.Lists; import java.util.List; import org.testng.collections.CollectionUtils; import org.testng.reporters.IBuffer; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.Tag; public class XmlGroups { private List<XmlDefine> m_defines = Lists.newArrayList(); private XmlRun m_run; private List<XmlDependencies> m_dependencies = Lists.newArrayList(); public List<XmlDefine> getDefines() { return m_defines; } @Tag(name="define") public void addDefine(XmlDefine define) { getDefines().add(define); } public void setDefines(List<XmlDefine> defines) { m_defines = defines; } public XmlRun getRun() { return m_run; } public void setRun(XmlRun run) { m_run = run; } public List<XmlDependencies> getDependencies() { return m_dependencies; } @Tag(name="dependencies") public void setXmlDependencies(XmlDependencies dependencies) { m_dependencies.add(dependencies); } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); String indent2 = indent + " "; boolean hasGroups = (CollectionUtils.hasElements(m_defines)) || (m_run != null) || (CollectionUtils.hasElements(m_dependencies)); if (hasGroups) { xsb.push("groups"); } for (XmlDefine d : m_defines) { xsb.getStringBuffer().append(d.toXml(indent2)); } xsb.getStringBuffer().append(m_run.toXml(indent2)); for (XmlDependencies d : m_dependencies) { xsb.getStringBuffer().append(d.toXml(indent2)); } if (hasGroups) { xsb.pop("groups"); } return xsb.toXML(); } } /* Location: * Qualified Name: org.testng.xml.XmlGroups * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.io.Serializable; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Properties; import org.testng.collections.Lists; import org.testng.collections.Maps; import org.testng.reporters.XMLStringBuffer; public class XmlInclude implements Serializable { private static final long serialVersionUID = 1L; private String m_name; private List<Integer> m_invocationNumbers = Lists.newArrayList(); private int m_index; private String m_description; private Map<String, String> m_parameters = Maps.newHashMap(); private XmlClass m_xmlClass; public XmlInclude() {} public XmlInclude(String n) { this(n, Collections.emptyList(), 0); } public XmlInclude(String n, int index) { this(n, Collections.emptyList(), index); } public XmlInclude(String n, List<Integer> list, int index) { m_name = n; m_invocationNumbers = list; m_index = index; } public void setDescription(String description) { m_description = description; } public String getDescription() { return m_description; } public String getName() { return m_name; } public List<Integer> getInvocationNumbers() { return m_invocationNumbers; } public int getIndex() { return m_index; } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); Properties p = new Properties(); p.setProperty("name", getName()); List<Integer> invocationNumbers = getInvocationNumbers(); if ((invocationNumbers != null) && (invocationNumbers.size() > 0)) { p.setProperty("invocation-numbers", XmlClass.listToString(invocationNumbers).toString()); } if (!m_parameters.isEmpty()) { xsb.push("include", p); XmlUtils.dumpParameters(xsb, m_parameters); xsb.pop("include"); } else { xsb.addEmptyElement("include", p); } return xsb.toXML(); } public int hashCode() { int prime = 31; int result = 1; result = 31 * result + m_index; result = 31 * result + (m_invocationNumbers == null ? 0 : m_invocationNumbers.hashCode()); result = 31 * result + (m_parameters == null ? 0 : m_parameters.hashCode()); result = 31 * result + (m_name == null ? 0 : m_name.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return XmlSuite.f(); } if (getClass() != obj.getClass()) { return XmlSuite.f(); } XmlInclude other = (XmlInclude)obj; if (m_invocationNumbers == null) { if (m_invocationNumbers != null) { return XmlSuite.f(); } } else if (!m_invocationNumbers.equals(m_invocationNumbers)) { return XmlSuite.f(); } if (m_name == null) { if (m_name != null) { return XmlSuite.f(); } } else if (!m_name.equals(m_name)) { return XmlSuite.f(); } if (m_parameters == null) { if (m_parameters != null) { return XmlSuite.f(); } } else if (!m_parameters.equals(m_parameters)) { return XmlSuite.f(); } return true; } public void addParameter(String name, String value) { m_parameters.put(name, value); } @Deprecated public Map<String, String> getParameters() { return getAllParameters(); } public Map<String, String> getLocalParameters() { return m_parameters; } public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); if (m_xmlClass != null) { result.putAll(m_xmlClass.getAllParameters()); } result.putAll(m_parameters); return result; } public void setXmlClass(XmlClass xmlClass) { m_xmlClass = xmlClass; } } /* Location: * Qualified Name: org.testng.xml.XmlInclude * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.io.PrintStream; import java.util.Properties; import org.testng.TestNGException; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.OnElement; public class XmlMethodSelector { private String m_className; private int m_priority; private XmlScript m_script = new XmlScript(); public void setClassName(String s) { m_className = s; } public String getClassName() { return m_className; } @OnElement(tag="selector-class", attributes={"name", "priority"}) public void setElement(String name, String priority) { setName(name); setPriority(Integer.parseInt(priority)); } public void setName(String name) { m_className = name; } public void setScript(XmlScript script) { m_script = script; } public String getExpression() { return m_script.getScript(); } public void setExpression(String expression) { m_script.setScript(expression); } public String getLanguage() { return m_script.getLanguage(); } public void setLanguage(String language) { m_script.setLanguage(language); } public int getPriority() { return m_priority; } public void setPriority(int priority) { m_priority = priority; } private void ppp(String s) { System.out.println("[XmlMethodSelector] " + s); } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); xsb.push("method-selector"); if (null != m_className) { Properties clsProp = new Properties(); clsProp.setProperty("name", getClassName()); if (getPriority() != -1) { clsProp.setProperty("priority", String.valueOf(getPriority())); } xsb.addEmptyElement("selector-class", clsProp); } else if (getLanguage() != null) { Properties scriptProp = new Properties(); scriptProp.setProperty("language", getLanguage()); xsb.push("script", scriptProp); xsb.addCDATA(getExpression()); xsb.pop("script"); } else { throw new TestNGException("Invalid Method Selector: found neither class name nor language"); } xsb.pop("method-selector"); return xsb.toXML(); } public int hashCode() { int prime = 31; int result = 1; result = 31 * result + (m_className == null ? 0 : m_className.hashCode()); result = 31 * result + (getExpression() == null ? 0 : getExpression().hashCode()); result = 31 * result + (getLanguage() == null ? 0 : getLanguage().hashCode()); result = 31 * result + m_priority; return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return XmlSuite.f(); } if (getClass() != obj.getClass()) { return XmlSuite.f(); } XmlMethodSelector other = (XmlMethodSelector)obj; if (m_className == null) { if (m_className != null) { return XmlSuite.f(); } } else if (!m_className.equals(m_className)) { return XmlSuite.f(); } if (getExpression() == null) { if (other.getExpression() != null) { return XmlSuite.f(); } } else if (!getExpression().equals(other.getExpression())) { return XmlSuite.f(); } if (getLanguage() == null) { if (other.getLanguage() != null) { return XmlSuite.f(); } } else if (!getLanguage().equals(other.getLanguage())) { return XmlSuite.f(); } if (m_priority != m_priority) { return XmlSuite.f(); } return true; } } /* Location: * Qualified Name: org.testng.xml.XmlMethodSelector * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.util.List; import org.testng.collections.CollectionUtils; import org.testng.collections.Lists; import org.testng.reporters.IBuffer; import org.testng.reporters.XMLStringBuffer; public class XmlMethodSelectors { private List<XmlMethodSelector> m_methodSelectors = Lists.newArrayList(); public List<XmlMethodSelector> getMethodSelectors() { return m_methodSelectors; } public void setMethodSelector(XmlMethodSelector xms) { m_methodSelectors.add(xms); } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); if (CollectionUtils.hasElements(m_methodSelectors)) { xsb.push("method-selectors"); for (XmlMethodSelector selector : m_methodSelectors) { xsb.getStringBuffer().append(selector.toXml(indent + " ")); } xsb.pop("method-selectors"); } return xsb.toXML(); } } /* Location: * Qualified Name: org.testng.xml.XmlMethodSelectors * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.io.IOException; import java.io.Serializable; import java.util.List; import java.util.Properties; import org.testng.collections.Lists; import org.testng.internal.PackageUtils; import org.testng.internal.Utils; import org.testng.reporters.XMLStringBuffer; public class XmlPackage implements Serializable { private static final long serialVersionUID = 1996341670354923204L; private String m_name; private List<String> m_include = Lists.newArrayList(); private List<String> m_exclude = Lists.newArrayList(); private List<XmlClass> m_xmlClasses = null; public XmlPackage() {} public XmlPackage(String name) { m_name = name; } public List<String> getExclude() { return m_exclude; } public void setExclude(List<String> exclude) { m_exclude = exclude; } public List<String> getInclude() { return m_include; } public void setInclude(List<String> include) { m_include = include; } public String getName() { return m_name; } public void setName(String name) { m_name = name; } public List<XmlClass> getXmlClasses() { if (null == m_xmlClasses) { m_xmlClasses = initializeXmlClasses(); } return m_xmlClasses; } private List<XmlClass> initializeXmlClasses() { List<XmlClass> result = Lists.newArrayList(); try { String[] classes = PackageUtils.findClassesInPackage(m_name, m_include, m_exclude); int index = 0; for (String className : classes) { result.add(new XmlClass(className, index++, false)); } } catch (IOException ioex) { Utils.log("XmlPackage", 1, ioex.getMessage()); } return result; } public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); Properties p = new Properties(); p.setProperty("name", getName()); if ((getInclude().isEmpty()) && (getExclude().isEmpty())) { xsb.addEmptyElement("package", p); } else { xsb.push("package", p); for (String m : getInclude()) { Properties includeProp = new Properties(); includeProp.setProperty("name", m); xsb.addEmptyElement("include", includeProp); } for (String m : getExclude()) { Properties excludeProp = new Properties(); excludeProp.setProperty("name", m); xsb.addEmptyElement("exclude", excludeProp); } xsb.pop("package"); } return xsb.toXML(); } public int hashCode() { int prime = 31; int result = 1; result = 31 * result + (m_exclude == null ? 0 : m_exclude.hashCode()); result = 31 * result + (m_include == null ? 0 : m_include.hashCode()); result = 31 * result + (m_name == null ? 0 : m_name.hashCode()); result = 31 * result + (m_xmlClasses == null ? 0 : m_xmlClasses.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return XmlSuite.f(); } if (getClass() != obj.getClass()) { return XmlSuite.f(); } XmlPackage other = (XmlPackage)obj; if (m_exclude == null) { if (m_exclude != null) { return XmlSuite.f(); } } else if (!m_exclude.equals(m_exclude)) { return XmlSuite.f(); } if (m_include == null) { if (m_include != null) { return XmlSuite.f(); } } else if (!m_include.equals(m_include)) { return XmlSuite.f(); } if (m_name == null) { if (m_name != null) { return XmlSuite.f(); } } else if (!m_name.equals(m_name)) { return XmlSuite.f(); } if (m_xmlClasses == null) { if (m_xmlClasses != null) { return XmlSuite.f(); } } else if (!m_xmlClasses.equals(m_xmlClasses)) { return XmlSuite.f(); } return true; } } /* Location: * Qualified Name: org.testng.xml.XmlPackage * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.util.List; import org.testng.collections.CollectionUtils; import org.testng.collections.Lists; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.OnElement; public class XmlRun { public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); boolean hasElements = (CollectionUtils.hasElements(m_excludes)) || (CollectionUtils.hasElements(m_includes)); if (hasElements) { xsb.push("run"); } for (String s : m_includes) { xsb.addEmptyElement("include", new String[] { "name", s }); } for (String s : m_excludes) { xsb.addEmptyElement("exclude", new String[] { "name", s }); } if (hasElements) { xsb.pop("run"); } return xsb.toXML(); } private List<String> m_excludes = Lists.newArrayList(); public List<String> getExcludes() { return m_excludes; } @OnElement(tag="exclude", attributes={"name"}) public void onExclude(String name) { m_excludes.add(name); } private List<String> m_includes = Lists.newArrayList(); public List<String> getIncludes() { return m_includes; } @OnElement(tag="include", attributes={"name"}) public void onInclude(String name) { m_includes.add(name); } } /* Location: * Qualified Name: org.testng.xml.XmlRun * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import org.testng.xml.dom.TagContent; public class XmlScript { private String m_language; private String m_script; public void setLanguage(String language) { m_language = language; } @TagContent(name="script") public void setScript(String script) { m_script = script; } public String getScript() { return m_script; } public String getLanguage() { return m_language; } } /* Location: * Qualified Name: org.testng.xml.XmlScript * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.util.HashSet; final class XmlSuite$1 extends HashSet<String> { XmlSuite$1() { add("tests"); add("methods"); add("classes"); add("instances"); add("none"); add("true"); add("false"); } } /* Location: * Qualified Name: org.testng.xml.XmlSuite.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.testng.xml; import java.io.PrintStream; import java.io.Serializable; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import org.testng.ITestObjectFactory; import org.testng.TestNG; import org.testng.collections.CollectionUtils; import org.testng.collections.Lists; import org.testng.collections.Maps; import org.testng.internal.Utils; import org.testng.reporters.IBuffer; import org.testng.reporters.XMLStringBuffer; import org.testng.xml.dom.OnElement; import org.testng.xml.dom.OnElementList; import org.testng.xml.dom.Tag; public class XmlSuite implements Serializable, Cloneable { public static final String PARALLEL_TESTS = "tests"; public static final String PARALLEL_METHODS = "methods"; public static final String PARALLEL_CLASSES = "classes"; public static final String PARALLEL_INSTANCES = "instances"; public static final String PARALLEL_NONE = "none"; public static Set<String> PARALLEL_MODES = new HashSet() {}; public static final String SKIP = "skip"; public static final String CONTINUE = "continue"; private String m_test; private static final String DEFAULT_SUITE_NAME = "Default Suite"; private String m_name = "Default Suite"; public static Integer DEFAULT_VERBOSE = Integer.valueOf(1); private Integer m_verbose = null; public static String DEFAULT_PARALLEL = "false"; private String m_parallel = DEFAULT_PARALLEL; public static String DEFAULT_CONFIG_FAILURE_POLICY = "skip"; private String m_configFailurePolicy = DEFAULT_CONFIG_FAILURE_POLICY; public static Boolean DEFAULT_JUNIT = Boolean.FALSE; private Boolean m_isJUnit = DEFAULT_JUNIT; public static Boolean DEFAULT_MIXED = Boolean.FALSE; private Boolean m_isMixed = DEFAULT_MIXED; public static Boolean DEFAULT_SKIP_FAILED_INVOCATION_COUNTS = Boolean.FALSE; private Boolean m_skipFailedInvocationCounts = DEFAULT_SKIP_FAILED_INVOCATION_COUNTS; public static Integer DEFAULT_THREAD_COUNT = Integer.valueOf(5); private int m_threadCount = DEFAULT_THREAD_COUNT.intValue(); public static final Integer DEFAULT_DATA_PROVIDER_THREAD_COUNT = Integer.valueOf(10); private int m_dataProviderThreadCount = DEFAULT_DATA_PROVIDER_THREAD_COUNT.intValue(); public static final Boolean DEFAULT_GROUP_BY_INSTANCES = Boolean.valueOf(false); private Boolean m_groupByInstances = DEFAULT_GROUP_BY_INSTANCES; public static Boolean DEFAULT_ALLOW_RETURN_VALUES = Boolean.FALSE; private Boolean m_allowReturnValues = DEFAULT_ALLOW_RETURN_VALUES; private List<XmlPackage> m_xmlPackages = Lists.newArrayList(); private String m_expression = null; private List<XmlMethodSelector> m_methodSelectors = Lists.newArrayList(); private List<XmlTest> m_tests = Lists.newArrayList(); private Map<String, String> m_parameters = Maps.newHashMap(); private String m_fileName; private String m_timeOut; private List<XmlSuite> m_childSuites = Lists.newArrayList(); private XmlSuite m_parentSuite; private List<String> m_suiteFiles = Lists.newArrayList(); private ITestObjectFactory m_objectFactory; private List<String> m_listeners = Lists.newArrayList(); private static final long serialVersionUID = 4999962288272750226L; public static String DEFAULT_PRESERVE_ORDER = "true"; private String m_preserveOrder = DEFAULT_PRESERVE_ORDER; private List<String> m_includedGroups = Lists.newArrayList(); private List<String> m_excludedGroups = Lists.newArrayList(); private XmlMethodSelectors m_xmlMethodSelectors; private XmlGroups m_xmlGroups; public String getFileName() { return m_fileName; } public void setFileName(String fileName) { m_fileName = fileName; } public String getParallel() { return m_parallel; } public ITestObjectFactory getObjectFactory() { return m_objectFactory; } public void setObjectFactory(ITestObjectFactory objectFactory) { m_objectFactory = objectFactory; } public void setParallel(String parallel) { m_parallel = parallel; } public void setConfigFailurePolicy(String configFailurePolicy) { m_configFailurePolicy = configFailurePolicy; } public String getConfigFailurePolicy() { return m_configFailurePolicy; } public Integer getVerbose() { return m_verbose != null ? m_verbose : TestNG.DEFAULT_VERBOSE; } public void setVerbose(Integer verbose) { m_verbose = verbose; } public String getName() { return m_name; } public void setName(String name) { m_name = name; } public String getTest() { return m_test; } public List<XmlTest> getTests() { return m_tests; } public void setTests(List<XmlTest> tests) { m_tests = tests; } public List<XmlMethodSelector> getMethodSelectors() { if (m_xmlMethodSelectors != null) { return m_xmlMethodSelectors.getMethodSelectors(); } return m_methodSelectors; } public void setMethodSelectors(List<XmlMethodSelector> methodSelectors) { m_methodSelectors = Lists.newArrayList(methodSelectors); } private void updateParameters() { if (m_parentSuite != null) { Set<String> keySet = m_parentSuite.getParameters().keySet(); for (String name : keySet) { if (!m_parameters.containsKey(name)) { m_parameters.put(name, m_parentSuite.getParameter(name)); } } } } public void setParameters(Map<String, String> parameters) { m_parameters = parameters; updateParameters(); } public Map<String, String> getParameters() { return m_parameters; } public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); for (Map.Entry<String, String> entry : m_parameters.entrySet()) { result.put(entry.getKey(), entry.getValue()); } for (XmlTest test : getTests()) { Map<String, String> tp = test.getLocalParameters(); for (Map.Entry<String, String> entry : tp.entrySet()) { result.put(entry.getKey() Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|