diff options
Diffstat (limited to 'tests/org.eclipse.wst.wsi.tests/src/org/eclipse')
5 files changed, 0 insertions, 568 deletions
diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreWSDLConformanceTest.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreWSDLConformanceTest.java deleted file mode 100644 index a97e9df5c..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/CoreWSDLConformanceTest.java +++ /dev/null @@ -1,289 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.tests.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import javax.wsdl.Binding; -import javax.wsdl.Definition; -import javax.wsdl.Message; -import javax.wsdl.Port; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.xml.WSDLReader; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import junit.framework.TestCase; - -import org.eclipse.wst.wsi.internal.WSIPreferences; -import org.eclipse.wst.wsi.internal.WSITestToolsProperties; -import org.eclipse.wst.wsi.internal.analyzer.WSDLAnalyzer; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLReaderImpl; -import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; -import org.eclipse.wst.wsi.internal.report.AssertionError; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -public class CoreWSDLConformanceTest extends TestCase -{ - public static final String WSDL_BASE_DIRECTORY = "testResources/samples/wsdl"; - public static final String TEST_CASE_FILE = "testcase.xml"; - public static final String WSDL_EXTENSION = ".wsdl"; - - 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 CoreWSDLConformanceTest(String name) - { - super(name); - pluginURI = WSITestsPlugin.getInstallURL(); - } - - protected void setup() - { - - } - - /** - * JUnit test: validate the wsdl document against the specified WS-I Profile. - * @param tad he WS-I Test Assertion Document - * @param testName the name of the test containing the wsdl document - */ - protected void runTest(String category, String testName, String tadID) - { - this.tadID = tadID; - - assertNotNull("Problems determining base url", pluginURI); - String testDirectory = pluginURI + WSDL_BASE_DIRECTORY + "/" + category + "/" + testName; - String wsdlFile = "file://" + testDirectory + "/" + testName + WSDL_EXTENSION; - String testcaseFile = testDirectory + "/" + TEST_CASE_FILE; - - // validate the WSDL document - WSDLAnalyzer analyzer = validateConformance(wsdlFile, tadID); - assertNotNull("Unknown problems during validation", analyzer); - - // retrieve the expected assertion failures - List expectedErrors = getExpectedAssertionFailures(testcaseFile); - assertNotNull("Problems retrieving expected failures", expectedErrors); - - // compare the actual errors with the expected errors - analyzeResults(analyzer.getAssertionErrors(), expectedErrors); - } - - /** - * Validate the wsdl document against the specified WS-I Profile. - * @param tad the WS-I Test Assertion Document - * @param filename the wsdl document - * @return the WSDLAnalyzer object containing the validation results - */ - protected WSDLAnalyzer validateConformance(String filename, String tadID) - { - WSDLAnalyzer analyzer = null; - try - { - WSIPreferences preferences = new WSIPreferences(); - preferences.setComplianceLevel( WSITestToolsProperties.STOP_NON_WSI); - preferences.setTADFile(getTADURI(tadID)); - - analyzer = new WSDLAnalyzer(filename, preferences); - setConfigurations(filename, analyzer); - - // run the conformance check and add errors and warnings as needed - analyzer.validateConformance(); - } - catch (Exception e) - { - return null; - } - return analyzer; - } - - /** - * 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()); - } - } - - /** - * Gather configuration information from the WSDL file. - * @param fileName the wsdl location. - * @param a WSDLAnalyzer object containg configuration info. - */ - protected void setConfigurations(String filename, WSDLAnalyzer analyzer) - { - try - { - WSDLReader wsdlReader = new WSDLReaderImpl(); - - // Set features - wsdlReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false); - wsdlReader.setFeature(com.ibm.wsdl.Constants.FEATURE_IMPORT_DOCUMENTS, true); - - // Parse the WSDL document - Document document = XMLUtils.parseXMLDocument(filename); - Definition definition = wsdlReader.readWSDL(filename, document); - //Definition definition = reader.readWSDL(filename); - - String namespace = definition.getTargetNamespace(); - - // get all the collections we may need to validate - Collection services = definition.getServices().values(); - Collection bindings = definition.getBindings().values(); - Collection portTypes = definition.getPortTypes().values(); - Collection messages = definition.getMessages().values(); - - // The WS-I conformance tools require that each service be analyzed separately. - // Get all the services and analyze them. - if (services != null && !services.isEmpty()) - { - Iterator serviceIterator = services.iterator(); - - while (serviceIterator.hasNext()) - { - Service service = (Service) serviceIterator.next(); - - String servicename = service.getQName().getLocalPart(); - - Collection ports = service.getPorts().values(); - if (ports != null && !ports.isEmpty()) - { - // The WS-I tools must be called once for each port within each service. - Iterator portIterator = ports.iterator(); - while (portIterator.hasNext()) - { - Port port = (Port) portIterator.next(); - analyzer.addConfigurationToTest(servicename, namespace, port.getName(), WSDLAnalyzer.PORT); - } - } - // validate at the binding level - check for every binding - else if (bindings != null && !bindings.isEmpty()) - { - Iterator bindingIterator = bindings.iterator(); - - while (bindingIterator.hasNext()) - { - Binding binding = (Binding) bindingIterator.next(); - String bindingname = binding.getQName().getLocalPart(); - analyzer.addConfigurationToTest(null, namespace, bindingname, WSDLAnalyzer.BINDING); - } - } - // validate at the portType level - check for every portType - else if (portTypes != null && !portTypes.isEmpty()) - { - Iterator portTypeIterator = portTypes.iterator(); - while (portTypeIterator.hasNext()) - { - PortType portType = (PortType) portTypeIterator.next(); - String portTypename = portType.getQName().getLocalPart(); - analyzer.addConfigurationToTest(null, namespace, portTypename, WSDLAnalyzer.PORTTYPE); - } - } - // validate at the message level - check for every message - else if (messages != null && !messages.isEmpty()) - { - Iterator messageIterator = messages.iterator(); - while (messageIterator.hasNext()) - { - Message message = (Message) messageIterator.next(); - String messagename = message.getQName().getLocalPart(); - analyzer.addConfigurationToTest(null, namespace, messagename, WSDLAnalyzer.MESSAGE); - } - } - } - } - } - catch (Exception e) - { - fail("Unexpected problems setting configurations"); - } - } - - /** - * 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; - } -} diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/RegressionBucket.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/RegressionBucket.java deleted file mode 100644 index 6192f9bbd..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/RegressionBucket.java +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (c) 2001, 2004 IBM Corporation and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* IBM Corporation - initial API and implementation -*******************************************************************************/ -package org.eclipse.wst.wsi.tests.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -import org.eclipse.wst.wsi.internal.WSITestToolsProperties; - -import junit.framework.Test; -import junit.framework.TestSuite; -/** - * JUnit tests that runs all of the tests implemented - * in this plugin. - * - * @author lauzond - */ -public class RegressionBucket extends TestSuite { - - public static Test suite() - { - TestSuite suite= new TestSuite("Regression Bucket"); - if (tadIsAvailable(WSITestToolsProperties.SSBP_ASSERTION_FILE)) - suite.addTest(new TestSuite(WSDLConformanceSSBPTest.class)); - if (tadIsAvailable(WSITestToolsProperties.AP_ASSERTION_FILE)) - suite.addTest(new TestSuite(WSDLConformanceAPTest.class)); - - return suite; - } - - public static boolean tadIsAvailable(String tadURI) - { - boolean result = true; - InputStream is = null; - try - { - URL url = new URL(tadURI); - is = url.openStream(); - is.close(); - } - catch (IOException e) - { - result = false; - } - return result; - } - -} diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceAPTest.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceAPTest.java deleted file mode 100644 index 4bd448139..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceAPTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2001, 2004 IBM Corporation and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* IBM Corporation - initial API and implementation -*******************************************************************************/ -package org.eclipse.wst.wsi.tests.internal; -/** - * JUnit tests that test wsdl documents against - * the WS-I Attachments profile. - * - * @author lauzond - */ -public class WSDLConformanceAPTest extends CoreWSDLConformanceTest -{ - public WSDLConformanceAPTest(String name) - { - super(name); - } -//ws-i wsdls - public void test_addressBook() { runTest("wsi", "addressBook", TAD_ID_AP); } - public void test_addressBook_rpc() { runTest("wsi", "addressBook-rpc", TAD_ID_AP); } - public void test_sampleAppCatalog() { runTest("wsi", "sampleAppCatalog", TAD_ID_AP); } - public void test_sampleAppManufacturer() { runTest("wsi", "sampleAppManufacturer", TAD_ID_AP); } - public void test_sampleAppWarehouse() { runTest("wsi", "sampleAppWarehouse", TAD_ID_AP); } - - // bp tests - public void test_2012_1() { runTest("bp", "2012-1", TAD_ID_AP); } - public void test_2013_1() { runTest("bp", "2013-1", TAD_ID_AP); } - public void test_2014_1() { runTest("bp", "2014-1", TAD_ID_AP); } - public void test_2014_2() { runTest("bp", "2014-2", TAD_ID_AP); } - public void test_2014_3() { runTest("bp", "2014-3", TAD_ID_AP); } - public void test_2017_1() { runTest("bp", "2017-1", TAD_ID_AP); } - public void test_2017_2() { runTest("bp", "2017-2", TAD_ID_AP); } - public void test_2018_1() { runTest("bp", "2018-1", TAD_ID_AP); } - public void test_2018_2() { runTest("bp", "2018-2", TAD_ID_AP); } - public void test_2018_3() { runTest("bp", "2018-3", TAD_ID_AP); } - public void test_2018_4() { runTest("bp", "2018-4", TAD_ID_AP); } - public void test_2019_1() { runTest("bp", "2019-1", TAD_ID_AP); } - public void test_2019_2() { runTest("bp", "2019-2", TAD_ID_AP); } - public void test_2019_3() { runTest("bp", "2019-3", TAD_ID_AP); } - public void test_2019_4() { runTest("bp", "2019-4", TAD_ID_AP); } - public void test_2020_1() { runTest("bp", "2020-1", TAD_ID_AP); } - public void test_2020_2() { runTest("bp", "2020-2", TAD_ID_AP); } - public void test_2105_1() { runTest("bp", "2105-1", TAD_ID_AP); } - public void test_2105_2() { runTest("bp", "2105-2", TAD_ID_AP); } - public void test_2117_1() { runTest("bp", "2117-1", TAD_ID_AP); } - public void test_2117_2() { runTest("bp", "2117-2", TAD_ID_AP); } - public void test_2117_3() { runTest("bp", "2117-3", TAD_ID_AP); } - public void test_2406_1() { runTest("bp", "2406-1", TAD_ID_AP); } - - // redundant tests -- assertions failures caught by base wsdl validator. - public void test_2010_1() { runTest("redundant", "2010-1", TAD_ID_AP); } - public void test_2011_1() { runTest("redundant", "2011-1", TAD_ID_AP); } - public void test_2011_2() { runTest("redundant", "2011-2", TAD_ID_AP); } - public void test_2011_3() { runTest("redundant", "2011-3", TAD_ID_AP); } - public void test_2011_4() { runTest("redundant", "2011-4", TAD_ID_AP); } - //public void test_2011_5() { runTest("redundant", "2011-5", TAD_ID_AP); } - public void test_2021_1() { runTest("redundant", "2021-1", TAD_ID_AP); } - public void test_2021_2() { runTest("redundant", "2021-2", TAD_ID_AP); } - public void test_2021_3() { runTest("redundant", "2021-3", TAD_ID_AP); } - public void test_2021_4() { runTest("redundant", "2021-4", TAD_ID_AP); } - public void test_2021_5() { runTest("redundant", "2021-5", TAD_ID_AP); } - public void test_2021_6() { runTest("redundant", "2021-6", TAD_ID_AP); } - public void test_2022_1() { runTest("redundant", "2022-1", TAD_ID_AP); } - public void test_2022_2() { runTest("redundant", "2022-2", TAD_ID_AP); } - public void test_2032_1() { runTest("redundant", "2032-1", TAD_ID_AP); } - public void test_2032_2() { runTest("redundant", "2032-2", TAD_ID_AP); } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceSSBPTest.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceSSBPTest.java deleted file mode 100644 index 9db221cb6..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSDLConformanceSSBPTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (c) 2001, 2004 IBM Corporation and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* IBM Corporation - initial API and implementation -*******************************************************************************/ -package org.eclipse.wst.wsi.tests.internal; -/** - * JUnit tests that test wsdl documents against - * the WS-I Simple Soap Binding profile. - * - * @author lauzond - */ -public class WSDLConformanceSSBPTest extends CoreWSDLConformanceTest -{ - public WSDLConformanceSSBPTest(String name) - { - super(name); - } - // ws-i wsdls - public void test_addressBook() { runTest("wsi", "addressBook", TAD_ID_SSBP); } - public void test_addressBook_rpc() { runTest("wsi", "addressBook-rpc", TAD_ID_SSBP); } - public void test_sampleAppCatalog() { runTest("wsi", "sampleAppCatalog", TAD_ID_SSBP); } - public void test_sampleAppManufacturer() { runTest("wsi", "sampleAppManufacturer", TAD_ID_SSBP); } - public void test_sampleAppWarehouse() { runTest("wsi", "sampleAppWarehouse", TAD_ID_SSBP); } - - // bp tests - public void test_2012_1() { runTest("bp", "2012-1", TAD_ID_SSBP); } - public void test_2013_1() { runTest("bp", "2013-1", TAD_ID_SSBP); } - public void test_2014_1() { runTest("bp", "2014-1", TAD_ID_SSBP); } - public void test_2014_2() { runTest("bp", "2014-2", TAD_ID_SSBP); } - public void test_2014_3() { runTest("bp", "2014-3", TAD_ID_SSBP); } - public void test_2017_1() { runTest("bp", "2017-1", TAD_ID_SSBP); } - public void test_2017_2() { runTest("bp", "2017-2", TAD_ID_SSBP); } - public void test_2018_1() { runTest("bp", "2018-1", TAD_ID_SSBP); } - public void test_2018_2() { runTest("bp", "2018-2", TAD_ID_SSBP); } - public void test_2018_3() { runTest("bp", "2018-3", TAD_ID_SSBP); } - public void test_2018_4() { runTest("bp", "2018-4", TAD_ID_SSBP); } - public void test_2019_1() { runTest("bp", "2019-1", TAD_ID_SSBP); } - public void test_2019_2() { runTest("bp", "2019-2", TAD_ID_SSBP); } - public void test_2019_3() { runTest("bp", "2019-3", TAD_ID_SSBP); } - public void test_2019_4() { runTest("bp", "2019-4", TAD_ID_SSBP); } - public void test_2020_1() { runTest("bp", "2020-1", TAD_ID_SSBP); } - public void test_2020_2() { runTest("bp", "2020-2", TAD_ID_SSBP); } - public void test_2105_1() { runTest("bp", "2105-1", TAD_ID_SSBP); } - public void test_2105_2() { runTest("bp", "2105-2", TAD_ID_SSBP); } - public void test_2117_1() { runTest("bp", "2117-1", TAD_ID_SSBP); } - public void test_2117_2() { runTest("bp", "2117-2", TAD_ID_SSBP); } - public void test_2117_3() { runTest("bp", "2117-3", TAD_ID_SSBP); } - public void test_2406_1() { runTest("bp", "2406-1", TAD_ID_SSBP); } - - // redundant tests -- assertions failures caught by base wsdl validator. - public void test_2010_1() { runTest("redundant", "2010-1", TAD_ID_SSBP); } - public void test_2011_1() { runTest("redundant", "2011-1", TAD_ID_SSBP); } - public void test_2011_2() { runTest("redundant", "2011-2", TAD_ID_SSBP); } - public void test_2011_3() { runTest("redundant", "2011-3", TAD_ID_SSBP); } - public void test_2011_4() { runTest("redundant", "2011-4", TAD_ID_SSBP); } - //public void test_2011_5() { runTest("redundant", "2011-5", TAD_ID_SSBP); } - public void test_2021_1() { runTest("redundant", "2021-1", TAD_ID_SSBP); } - public void test_2021_2() { runTest("redundant", "2021-2", TAD_ID_SSBP); } - public void test_2021_3() { runTest("redundant", "2021-3", TAD_ID_SSBP); } - public void test_2021_4() { runTest("redundant", "2021-4", TAD_ID_SSBP); } - public void test_2021_5() { runTest("redundant", "2021-5", TAD_ID_SSBP); } - public void test_2021_6() { runTest("redundant", "2021-6", TAD_ID_SSBP); } - public void test_2022_1() { runTest("redundant", "2022-1", TAD_ID_SSBP); } - public void test_2022_2() { runTest("redundant", "2022-2", TAD_ID_SSBP); } - public void test_2032_1() { runTest("redundant", "2032-1", TAD_ID_SSBP); } - public void test_2032_2() { runTest("redundant", "2032-2", TAD_ID_SSBP); } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSITestsPlugin.java b/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSITestsPlugin.java deleted file mode 100644 index b0b975c03..000000000 --- a/tests/org.eclipse.wst.wsi.tests/src/org/eclipse/wst/wsi/tests/internal/WSITestsPlugin.java +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2001, 2004 IBM Corporation and others. -* All rights reserved. This program and the accompanying materials -* are made available under the terms of the Eclipse Public License v1.0 -* which accompanies this distribution, and is available at -* http://www.eclipse.org/legal/epl-v10.html -* -* Contributors: -* IBM Corporation - initial API and implementation -*******************************************************************************/ -package org.eclipse.wst.wsi.tests.internal; - -import java.io.IOException; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -/** -* The main plugin class to be used in the desktop. -*/ -public class WSITestsPlugin extends Plugin -{ - //The shared instance. - private static WSITestsPlugin plugin; - private static Bundle pluginBundle = null; - - /** - * The constructor. - */ - public WSITestsPlugin() - { - super(); - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception - { - super.start(context); - pluginBundle = context.getBundle(); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception - { - super.stop(context); - } - - /** - * Returns the shared instance. - */ - public static WSITestsPlugin getDefault() - { - return plugin; - } - - /** - * Get the install URL of this plugin. - * - * @return the install url of this plugin - */ - public static String getInstallURL() - { - try - { - return Platform.resolve(pluginBundle.getEntry("/")).getFile(); - } - catch (IOException e) - { - return null; - } - } -} |