Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst')
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/Activator.java94
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/AllWSDLUITests.java44
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/BaseTestCase.java61
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/UnusedWSDLImportsTests.java264
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLUnusedTests.java124
-rw-r--r--tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLXMLNSCleanupTests.java380
6 files changed, 0 insertions, 967 deletions
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/Activator.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/Activator.java
deleted file mode 100644
index 410cc5ef7..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/Activator.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin
-{
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.wsdl.ui.tests";
- private static Bundle pluginBundle = null;
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator()
- {
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- plugin = this;
- pluginBundle = context.getBundle();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- public void stop(BundleContext context) throws Exception
- {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault()
- {
- return plugin;
- }
-
- /**
- * Get the install URL of this plugin.
- *
- * @return the install url of this plugin
- */
- public static String getInstallURL()
- {
- try
- {
- return FileLocator.resolve(pluginBundle.getEntry("/")).getFile();
- }
- catch (IOException e)
- {
- return null;
- }
- }
-}
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/AllWSDLUITests.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/AllWSDLUITests.java
deleted file mode 100644
index 872464ddb..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/AllWSDLUITests.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests.internal;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper test suite for all WSDL UI tests.
- */
-public class AllWSDLUITests extends TestSuite
-{
- /**
- * Create this test suite.
- *
- * @return This test suite.
- */
- public static Test suite()
- {
- return new AllWSDLUITests();
- }
-
- /**
- * Constructor
- */
- public AllWSDLUITests()
- {
- super("AllWSDLUITests");
- // Unused XSD imports tests in WSDL files
- addTest(WSDLUnusedTests.suite());
- // WSDL xml ns table cleanup
- addTest(WSDLXMLNSCleanupTests.suite());
- // Unused WSDL Imports
- addTest(UnusedWSDLImportsTests.suite());
- }
-}
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/BaseTestCase.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/BaseTestCase.java
deleted file mode 100644
index 478f0811f..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/BaseTestCase.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests.internal;
-
-import junit.framework.TestCase;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.ui.internal.util.WSDLImportManager;
-import org.eclipse.wst.wsdl.ui.tests.Activator;
-import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.util.XSDResourceImpl;
-
-public class BaseTestCase extends TestCase
-{
- protected static final String PLUGIN_ABSOLUTE_PATH = Activator.getInstallURL();
- protected static final String RESOURCES_FOLDER = "testresources"; //$NON-NLS-1$
- protected static final String TC_ROOT_FOLDER = PLUGIN_ABSOLUTE_PATH + "/" + RESOURCES_FOLDER + "/WSDL"; //$NON-NLS-1$
- protected WSDLImportManager importManager = new WSDLImportManager();
-
- public BaseTestCase()
- {
- }
-
- public BaseTestCase(String name)
- {
- super(name);
- }
-
- protected XSDSchema getXSDSchema(String path)
- {
- URI uri = URI.createFileURI(path);
- ResourceSet resourceSet = new ResourceSetImpl();
- XSDResourceImpl resource = (XSDResourceImpl) resourceSet.getResource(uri, true);
- XSDSchema schema = resource.getSchema();
- assertNotNull(schema);
- return schema;
- }
-
- protected Definition getDefinition(String path)
- {
- URI uri = URI.createFileURI(path);
- ResourceSet resourceSet = new ResourceSetImpl();
- WSDLResourceImpl resource = (WSDLResourceImpl) resourceSet.getResource(uri, true);
- Definition definition = resource.getDefinition();
- assertNotNull(definition);
- return definition;
- }
-
-}
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/UnusedWSDLImportsTests.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/UnusedWSDLImportsTests.java
deleted file mode 100644
index 1f2c21125..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/UnusedWSDLImportsTests.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests.internal;
-
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.Import;
-
-public class UnusedWSDLImportsTests extends BaseTestCase
-{
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(UnusedWSDLImportsTests.class);
- }
-
-//
-// Testing USED WSDL imports (That they aren't removed mistakenly)
-//
-
- public void testUsedWSDLImport001()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main002.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 0);
- importManager.cleanup();
- }
-
- public void testUsedWSDLImport002()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main004.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 0);
- }
-
- public void testUsedWSDLImport003()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main006.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 0);
- }
-
- public void testUsedWSDLImport004()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main008.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 0);
- }
-
- //
-// Testing of UNUSED WSDL imports
-//
-
- public void testUnusedWSDLImport001()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main001.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 1);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
-
- }
-
- public void testUnusedWSDLImport002()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main003.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 1);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- }
-
- public void testUnusedWSDLImport003()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main005.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 1);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- }
-
- public void testUnusedWSDLImport004()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main007.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 1);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains(null));
- }
-
- public void testUnusedWSDLImport005()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/core/Main009.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 1);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/FileNotFound/"));
- assertTrue(imp1.getLocationURI().equals("WSDLFileNotFound.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- public void testUnusedWSDLImport006()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main001.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 2);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
- Import imp2 = (Import) list.get(1);
- assertTrue(imp2.getNamespaceURI().equals("http://www.example.org/Import002/"));
- assertTrue(imp2.getLocationURI().equals("Import002.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 2);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- assertTrue(unusedWSDLPrefixes.contains("wsdl2"));
- }
-
- public void testMixWSDLImport001()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main002.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 4);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
- Import imp2 = (Import) list.get(1);
- assertTrue(imp2.getNamespaceURI().equals("http://www.example.org/Import002/"));
- assertTrue(imp2.getLocationURI().equals("Import002.wsdl"));
- Import imp3 = (Import) list.get(2);
- assertTrue(imp3.getNamespaceURI().equals("http://www.example.org/Import"));
- assertTrue(imp3.getLocationURI().equals("../../../XSD/Unused/Import1.xsd"));
- Import imp4 = (Import) list.get(3);
- assertTrue(imp4.getNamespaceURI().equals("http://www.example.org/Import6"));
- assertTrue(imp4.getLocationURI().equals("../../../XSD/Unused/Import6.xsd"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 4);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- assertTrue(unusedWSDLPrefixes.contains("wsdl2"));
- assertTrue(unusedWSDLPrefixes.contains("xsd1"));
- assertTrue(unusedWSDLPrefixes.contains("xsd2"));
- }
-
- public void testMixWSDLImport002()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main003.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 2);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
- Import imp2 = (Import) list.get(1);
- assertTrue(imp2.getNamespaceURI().equals("http://www.example.org/Import002/"));
- assertTrue(imp2.getLocationURI().equals("Import002.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 2);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- assertTrue(unusedWSDLPrefixes.contains("wsdl2"));
- }
-
- public void testMixWSDLImport003()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main004.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 2);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import001/"));
- assertTrue(imp1.getLocationURI().equals("Import001.wsdl"));
- Import imp2 = (Import) list.get(1);
- assertTrue(imp2.getNamespaceURI().equals("http://www.example.org/Import002/"));
- assertTrue(imp2.getLocationURI().equals("Import002.wsdl"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 2);
- assertTrue(unusedWSDLPrefixes.contains("wsdl1"));
- assertTrue(unusedWSDLPrefixes.contains("wsdl2"));
- }
-
- public void testMixWSDLImport004()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main005.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- public void testMixWSDLImport005()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/WSDLImports/test/Main006.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getWSDLUnusedImports();
- assertTrue(list.size() == 2);
- Import imp1 = (Import) list.get(0);
- assertTrue(imp1.getNamespaceURI().equals("http://www.example.org/Import"));
- assertTrue(imp1.getLocationURI().equals("../../../XSD/Unused/Import1.xsd"));
- Import imp2 = (Import) list.get(1);
- assertTrue(imp2.getNamespaceURI().equals("http://www.example.org/Import6"));
- assertTrue(imp2.getLocationURI().equals("../../../XSD/Unused/Import6.xsd"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 2);
- assertTrue(unusedWSDLPrefixes.contains("xsd1"));
- assertTrue(unusedWSDLPrefixes.contains("xsd2"));
- }
-
-}
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLUnusedTests.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLUnusedTests.java
deleted file mode 100644
index 85e602319..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLUnusedTests.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests.internal;
-
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.xsd.XSDSchemaDirective;
-
-public class WSDLUnusedTests extends BaseTestCase
-{
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(WSDLUnusedTests.class);
- }
-
- public void testUnusedImport001()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main1.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 2);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("A.xsd".equals(d1.getSchemaLocation()));
- XSDSchemaDirective d2 = (XSDSchemaDirective) list.get(1);
- assertTrue("B.xsd".equals(d2.getSchemaLocation()));
- }
-
- public void testUnusedImport002()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main2.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 2);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("A.xsd".equals(d1.getSchemaLocation()));
- XSDSchemaDirective d2 = (XSDSchemaDirective) list.get(1);
- assertTrue("B.xsd".equals(d2.getSchemaLocation()));
- }
-
- public void testUnusedImport003()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main3.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 2);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("A.xsd".equals(d1.getSchemaLocation()));
- XSDSchemaDirective d2 = (XSDSchemaDirective) list.get(1);
- assertTrue("B.xsd".equals(d2.getSchemaLocation()));
- }
-
- public void testUnusedImport004()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main4.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 7);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("A.xsd".equals(d1.getSchemaLocation()));
- XSDSchemaDirective d2 = (XSDSchemaDirective) list.get(1);
- assertTrue("B.xsd".equals(d2.getSchemaLocation()));
- XSDSchemaDirective d3 = (XSDSchemaDirective) list.get(2);
- assertTrue("C.xsd".equals(d3.getSchemaLocation()));
- XSDSchemaDirective d4 = (XSDSchemaDirective) list.get(3);
- assertTrue("C.xsd".equals(d4.getSchemaLocation()));
- XSDSchemaDirective d5 = (XSDSchemaDirective) list.get(4);
- assertTrue("D.xsd".equals(d5.getSchemaLocation()));
- XSDSchemaDirective d6 = (XSDSchemaDirective) list.get(5);
- assertTrue("E.xsd".equals(d6.getSchemaLocation()));
- XSDSchemaDirective d7 = (XSDSchemaDirective) list.get(6);
- assertTrue("F.xsd".equals(d7.getSchemaLocation()));
- }
-
- public void testUnusedImport005()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main5.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 1);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("../Import2.xsd".equals(d1.getSchemaLocation()));
- }
-
- public void testUnusedImport006()
- {
- /* duplicate unused imports in two inline schemas */
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main6.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 2);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("../Import2.xsd".equals(d1.getSchemaLocation()));
- XSDSchemaDirective d2 = (XSDSchemaDirective) list.get(1);
- assertTrue("../Import2.xsd".equals(d2.getSchemaLocation()));
- }
-
- public void testUnusedImport007()
- {
- /* duplicate unused imports in two inline schemas */
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main7.wsdl");
- importManager.performRemoval(definition);
- List list = importManager.getUnusedImports();
- assertTrue(list.size() == 1);
- XSDSchemaDirective d1 = (XSDSchemaDirective) list.get(0);
- assertTrue("../Import3.xsd".equals(d1.getSchemaLocation()));
- }
-} \ No newline at end of file
diff --git a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLXMLNSCleanupTests.java b/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLXMLNSCleanupTests.java
deleted file mode 100644
index c43579195..000000000
--- a/tests/org.eclipse.wst.wsdl.ui.tests/src/org/eclipse/wst/wsdl/ui/tests/internal/WSDLXMLNSCleanupTests.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.wsdl.ui.tests.internal;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement;
-import org.eclipse.xsd.XSDSchema;
-
-public class WSDLXMLNSCleanupTests extends BaseTestCase
-{
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(WSDLXMLNSCleanupTests.class);
- }
-
- public void testCleanup001()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main001.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Two inline schemas
- assertTrue(schemas.size() == 2);
- assertTrue(extElements.size() == 2);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 2);
- assertTrue(unusedPrefixes01.contains("tns03"));
- assertTrue(unusedPrefixes01.contains("tns04"));
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 2);
- assertTrue(unusedPrefixes02.contains("tns05"));
- assertTrue(unusedPrefixes02.contains("tns06"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 2);
- assertTrue(unusedWSDLPrefixes.contains("tns01"));
- assertTrue(unusedWSDLPrefixes.contains("tns02"));
- }
-
- public void testCleanup002()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main002.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // One inline schema
- assertTrue(schemas.size() == 1);
- assertTrue(extElements.size() == 1);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 1);
- assertTrue(unusedPrefixes01.contains("tns02"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("tns01"));
- }
-
- public void testCleanup003()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main003.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // One inline schema
- assertTrue(schemas.size() == 1);
- assertTrue(extElements.size() == 1);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 1);
- assertTrue(unusedPrefixes01.contains("tns02"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- public void testCleanup004()
- {
- // Tests null used prefix for WSDL target namespace
-
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main004.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // One inline schema
- assertTrue(schemas.size() == 1);
- assertTrue(extElements.size() == 1);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- public void testCleanup005()
- {
- // Test null unused prefix in WSDL xmlns table
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main005.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // One inline schema
- assertTrue(schemas.size() == 1);
- assertTrue(extElements.size() == 1);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 1);
- assertTrue(unusedPrefixes01.contains("tns02"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains(null));
- }
-
- public void testCleanup006()
- {
- // Tests removal of soap xmlns entry in WSDL ns table
-
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main006.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // One inline schema
- assertTrue(schemas.size() == 1);
- assertTrue(extElements.size() == 1);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
-
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("soap"));
- }
-
- public void testCleanup007()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main007.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Five inline schemas
- assertTrue(schemas.size() == 6);
- assertTrue(extElements.size() == 6);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE3 = (XSDSchemaExtensibilityElement) extElements.get(2);
- XSDSchema inlineSchema03 = xsdEE3.getSchema();
- Set unusedPrefixes03 = (Set) map.get(inlineSchema03);
- assertTrue(unusedPrefixes03.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE4 = (XSDSchemaExtensibilityElement) extElements.get(3);
- XSDSchema inlineSchema04 = xsdEE4.getSchema();
- Set unusedPrefixes04 = (Set) map.get(inlineSchema04);
- assertTrue(unusedPrefixes04.size() == 1);
- assertTrue(unusedPrefixes04.contains(null));
-
- XSDSchemaExtensibilityElement xsdEE5 = (XSDSchemaExtensibilityElement) extElements.get(4);
- XSDSchema inlineSchema05 = xsdEE5.getSchema();
- Set unusedPrefixes05 = (Set) map.get(inlineSchema05);
- assertTrue(unusedPrefixes05.size() == 1);
- assertTrue(unusedPrefixes05.contains("unused01"));
-
- XSDSchemaExtensibilityElement xsdEE6 = (XSDSchemaExtensibilityElement) extElements.get(5);
- XSDSchema inlineSchema06 = xsdEE6.getSchema();
- Set unusedPrefixes06 = (Set) map.get(inlineSchema06);
- assertTrue(unusedPrefixes06.size() == 1);
- assertTrue(unusedPrefixes06.contains("unused01"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- public void testCleanup008()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/xmlnsCleanup/test/Main008.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Five inline schemas
- assertTrue(schemas.size() == 6);
- assertTrue(extElements.size() == 6);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE3 = (XSDSchemaExtensibilityElement) extElements.get(2);
- XSDSchema inlineSchema03 = xsdEE3.getSchema();
- Set unusedPrefixes03 = (Set) map.get(inlineSchema03);
- assertTrue(unusedPrefixes03.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE4 = (XSDSchemaExtensibilityElement) extElements.get(3);
- XSDSchema inlineSchema04 = xsdEE4.getSchema();
- Set unusedPrefixes04 = (Set) map.get(inlineSchema04);
- assertTrue(unusedPrefixes04.size() == 1);
- assertTrue(unusedPrefixes04.contains(null));
-
- XSDSchemaExtensibilityElement xsdEE5 = (XSDSchemaExtensibilityElement) extElements.get(4);
- XSDSchema inlineSchema05 = xsdEE5.getSchema();
- Set unusedPrefixes05 = (Set) map.get(inlineSchema05);
- assertTrue(unusedPrefixes05.size() == 1);
- assertTrue(unusedPrefixes05.contains("unused01"));
-
- XSDSchemaExtensibilityElement xsdEE6 = (XSDSchemaExtensibilityElement) extElements.get(5);
- XSDSchema inlineSchema06 = xsdEE6.getSchema();
- Set unusedPrefixes06 = (Set) map.get(inlineSchema06);
- assertTrue(unusedPrefixes06.size() == 1);
- assertTrue(unusedPrefixes06.contains("unused01"));
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 3);
- assertTrue(unusedWSDLPrefixes.contains(null));
- assertTrue(unusedWSDLPrefixes.contains("wsdlUsed"));
- assertTrue(unusedWSDLPrefixes.contains("used01")); // used in xsd but unused
- // in WSDL
- }
-
- // Using the test WSDLs from the Unused folder
- public void testCleanup009()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main1.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Two inline schemas
- assertTrue(schemas.size() == 2);
- assertTrue(extElements.size() == 2);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- // Using the test WSDLs from the Unused folder
- public void testCleanup010()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main5.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Two inline schemas
- assertTrue(schemas.size() == 2);
- assertTrue(extElements.size() == 2);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 0);
- }
-
- // Using the test WSDLs from the Unused folder
- public void testCleanup011()
- {
- Definition definition = getDefinition(TC_ROOT_FOLDER + "/Unused/test/Main7.wsdl");
- importManager.performRemoval(definition);
-
- List extElements = definition.getETypes().getEExtensibilityElements();
-
- Map map = (Map) importManager.getSchemaToPrefixMap();
- Set schemas = map.keySet();
- // Two inline schemas
- assertTrue(schemas.size() == 2);
- assertTrue(extElements.size() == 2);
-
- XSDSchemaExtensibilityElement xsdEE1 = (XSDSchemaExtensibilityElement) extElements.get(0);
- XSDSchema inlineSchema01 = xsdEE1.getSchema();
- Set unusedPrefixes01 = (Set) map.get(inlineSchema01);
- assertTrue(unusedPrefixes01.size() == 0);
-
- XSDSchemaExtensibilityElement xsdEE2 = (XSDSchemaExtensibilityElement) extElements.get(1);
- XSDSchema inlineSchema02 = xsdEE2.getSchema();
- Set unusedPrefixes02 = (Set) map.get(inlineSchema02);
- assertTrue(unusedPrefixes02.size() == 0);
-
- Set unusedWSDLPrefixes = importManager.getUnusedWSDLPrefixes();
- assertTrue(unusedWSDLPrefixes.size() == 1);
- assertTrue(unusedWSDLPrefixes.contains("xsd1"));
- }
-
-} \ No newline at end of file

Back to the top