diff options
Diffstat (limited to 'tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreConformanceTest.java')
-rw-r--r-- | tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreConformanceTest.java | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreConformanceTest.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreConformanceTest.java deleted file mode 100644 index eed9baccd..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreConformanceTest.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.wst.wsi.tests.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.eclipse.wst.wsi.internal.WSITestToolsProperties; -import org.eclipse.wst.wsi.internal.report.AssertionError; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import junit.framework.TestCase; - -public class CoreConformanceTest extends TestCase { - - public static final String TEST_CASE_FILE = "testcase.xml"; - public static final String TAD_ID_AP = "AP10"; - public static final String TAD_ID_SSBP = "SSBP10"; - - protected String pluginURI = null; - protected String tadID = TAD_ID_AP; - - public CoreConformanceTest(String name) { - super(name); - pluginURI = WSITestsPlugin.getInstallURL(); - } - - protected void setup() - { - } - - /** - * Retrieve the expected assertion failures. - * @param filename - the location of the testcase.xml file. - * @return the expected assertion failures. - */ - protected List getExpectedAssertionFailures(String filename) { - List assertionFailures = new ArrayList(); - try { - DocumentBuilder builder = DocumentBuilderFactory.newInstance(). - newDocumentBuilder(); - Document doc = builder.parse(filename); - NodeList list = doc.getElementsByTagName("assertion"); - if (list != null) - for (int i=0; i<list.getLength(); i++) { - Element element = (Element)list.item(i); - String tad = element.getAttribute("tadID"); - if ((tad != null) && tad.equals(this.tadID)) - assertionFailures.add(element.getAttribute("id")); - } - } catch (Exception e) { - assertionFailures = null; - } - return assertionFailures; - } - - /** - * Compare the actual errors with the expected errors. - * @param errors the actual assertion failures - * @param expectedErrors the expected assertion failures - */ - protected void analyzeResults(List errors, List expectedErrors) { - List actualErrors = new ArrayList(); - if ((errors != null) && (expectedErrors != null)) { - Iterator i = errors.iterator(); - while (i.hasNext()) { - AssertionError e = (AssertionError)i.next(); - String assertionId = e.getAssertionID(); - actualErrors.add(assertionId); - - if (!expectedErrors.contains(assertionId)) { - fail("Unexpected assertion failure: " + assertionId); - } - } - - i = expectedErrors.iterator(); - while (i.hasNext()) { - String assertionId = (String)i.next(); - - if (!actualErrors.contains(assertionId)) { - fail("Expected assertion failure: " + assertionId); - } - } - assertEquals(expectedErrors.size(), errors.size()); - } - } - - /** - * Return the location of the given tad. - * @param tid the tad id. - * @return the location of the tad. - */ - protected String getTADURI(String tid) - { - if (tid.equals(TAD_ID_AP)) - return WSITestToolsProperties.AP_ASSERTION_FILE; - else - return WSITestToolsProperties.SSBP_ASSERTION_FILE; - } -} |