Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal')
-rw-r--r--tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/resolver/URIResolverTest.java203
-rw-r--r--tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTask.java29
-rw-r--r--tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTest.java143
-rw-r--r--tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogTest.java53
4 files changed, 0 insertions, 428 deletions
diff --git a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/resolver/URIResolverTest.java b/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/resolver/URIResolverTest.java
deleted file mode 100644
index 31dcb9325..000000000
--- a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/resolver/URIResolverTest.java
+++ /dev/null
@@ -1,203 +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.wsdl.validation.internal.resolver;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * URIResolver tests.
- */
-public class URIResolverTest extends TestCase
-{
- private URIResolver uriResolver = null;
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(URIResolverTest.class);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- uriResolver = new URIResolver();
- }
-
- public void testNormalizeAbsoluteFile()
- {
- // System id is absolute and should not be modified.
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "file:/c:/somepath/myfile.txt";
- assertEquals("systemId is absolute and should not be modified.", systemId, uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
-
- }
-
- public void testNormalizeRelativeFile()
- {
- // System id is relative
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("systemId is simple relative and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileStartsWithDotDot()
- {
- // System id is relative with ../
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "../myfile.txt";
- assertEquals("systemId is relative with ../ and is not modified correctly.", "file:/c:/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileStartsWithDotDotTwice()
- {
- // System id is relative with ../../
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "../../myfile.txt";
- assertEquals("systemId is relative with ../../ and is not modified correctly.", "file:/c:/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileStartsWithDot()
- {
- // System id is relative with ./
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "./myfile.txt";
- assertEquals("systemId is relative with ./ and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileStartsWithDotTwice()
- {
- // System id is relative with ././
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "././myfile.txt";
- assertEquals("systemId is relative with ././ and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileStartsWithSlash()
- {
- // System id is relative beginning with /
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "/myfile.txt";
- assertEquals("systemId is relative beginning with / and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileDotDotInMiddle()
- {
- // System id contains ../ in the middle
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "somepath/../myfile.txt";
- assertEquals("systemId is relative and contains ../ in the middle and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileFotInMiddle()
- {
- // System id contains ./ in the middle
- String baseLocation = "file:/c:/somepath/somepath/file.txt";
- String systemId = "somepath/./myfile.txt";
- assertEquals("systemId is relative and contains ./ in the middle and is not modified correctly.", "file:/c:/somepath/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormlizeRelativeFileDotDotInMiddleOfBase()
- {
- // Base location contains ../ in the middle
- String baseLocation = "file:/c:/somepath/../somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation contains ../ in the middle and is not modified correctly.", "file:/c:/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileDotInMiddleOfBase()
- {
- // Base location contains ./ in the middle
- String baseLocation = "file:/c:/somepath/./somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation contains ./ in the middle and is not modified correctly.", "file:/c:/somepath/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileBaseStartsWithSlashDotDot()
- {
- // Base location starts with /../
- String baseLocation = "file:/../somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation starts with ../ and is not modified correctly.", "file:/../somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileBaseStartsWithSlashDot()
- {
- // Base location starts with /./
- String baseLocation = "file:/./somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation starts with ./ and is not modified correctly.", "file:/somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileBaseStartsWithDotDot()
- {
- // Base location starts with ../
- String baseLocation = "file:../somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation starts with ../ and is not modified correctly.", "file:../somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileBaseStartsWithDot()
- {
- // Base location starts with ./
- String baseLocation = "file:./somepath/file.txt";
- String systemId = "myfile.txt";
- assertEquals("baseLocation starts with ./ and is not modified correctly.", "file:somepath/myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileSomedirDotDot()
- {
- // System id contains somedir../ in the middle
- String baseLocation = "file:/somepath/file.txt";
- String systemId = "somedir../myfile.txt";
- assertEquals("systemId has somedir../ and is not modified correctly.", "file:/somepath/somedir../myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeRelativeFileSomedirDot()
- {
- // System id contains somedir./ in the middle
- String baseLocation = "file:/somepath/file.txt";
- String systemId = "somedir./myfile.txt";
- assertEquals("systemId has somedir./ and is not modified correctly.", "file:/somepath/somedir./myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeNullSystemId()
- {
- // System id is null
- String baseLocation = "file:/somepath/file.txt";
- String systemId = null;
- assertEquals("systemId is null.", null, uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeNullBaseLocation()
- {
- // Base location is null
- String baseLocation = null;
- String systemId = "somedir./myfile.txt";
- assertEquals("systemId is null.", null, uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
- public void testNormalizeSystemIdAbsoluteNullBaseLocation()
- {
- // Base location is null
- String baseLocation = "null";
- String systemId = "file:/somedir./myfile.txt";
- assertEquals("systemId is null.", "file:/somedir./myfile.txt", uriResolver.resolve(baseLocation, null, systemId).getLogicalLocation());
- }
-
-
-}
diff --git a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTask.java b/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTask.java
deleted file mode 100644
index 907875d96..000000000
--- a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTask.java
+++ /dev/null
@@ -1,29 +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.wsdl.validation.internal.ui.ant;
-
-import java.util.List;
-
-/**
- * This class is used to expose functionality from the WSDLValidate class for testing.
- */
-public class WSDLValidateTask extends WSDLValidate
-{
-
- /**
- * @see org.eclipse.wst.wsdl.validation.internal.ui.ant.WSDLValidate#getFileList()
- */
- public List getFileList()
- {
- return super.getFileList();
- }
-
-}
diff --git a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTest.java b/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTest.java
deleted file mode 100644
index 92ca201f3..000000000
--- a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/ui/ant/WSDLValidateTest.java
+++ /dev/null
@@ -1,143 +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.wsdl.validation.internal.ui.ant;
-
-import java.io.File;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.types.selectors.FilenameSelector;
-import org.eclipse.wst.wsdl.validation.tests.internal.BaseTestCase;
-
-/**
- * WSDLValidate ant task tests.
- */
-public class WSDLValidateTest extends BaseTestCase
-{
- private String BASE_DIR;;
- private Project project;
-
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(WSDLValidateTest.class);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp()
- {
- super.setUp();
- try
- {
- BASE_DIR = PLUGIN_ABSOLUTE_PATH;
- BASE_DIR = BASE_DIR.replace('/', File.separatorChar);
- if(BASE_DIR.startsWith("\\"))
- {
- BASE_DIR = BASE_DIR.substring(1);
- }
- }
- catch(Exception e)
- {
-
- }
- project = new Project();
- project.setBaseDir(new File(BASE_DIR));
- }
-
- /**
- * Test that a single file with a relative location is resolved properly.
- */
- public void testRelativeSingleFileLocation()
- {
- String fileLoc = "file.wsdl";
- String resolvedLocation = ("file:///" + BASE_DIR + fileLoc).replace('\\','/');
- WSDLValidateTask wsdlValidateTask = new WSDLValidateTask();
- wsdlValidateTask.setProject(project);
- wsdlValidateTask.setFile(fileLoc);
- List fileList = wsdlValidateTask.getFileList();
- assertEquals("The file list does not contain only one file.", 1, fileList.size());
- // The file locations are converted to lower case to avoid drive letter case differences on windows. ie. C vs c.
- assertEquals("The file location '" + fileList.get(0) + "' is not correctly resolved to the base location.", resolvedLocation.toLowerCase(), ((String)fileList.get(0)).toLowerCase());
-
- }
-
- /**
- * Test that a single file with an absolute location is resolved properly.
- */
- public void testAbsoluteSingleFileLocation()
- {
- String fileLoc = BASE_DIR + "file.wsdl";
- String resolvedLocation = (FILE_PROTOCOL + fileLoc).replace('\\','/');
- WSDLValidateTask wsdlValidateTask = new WSDLValidateTask();
- wsdlValidateTask.setProject(project);
- wsdlValidateTask.setFile(fileLoc);
- List fileList = wsdlValidateTask.getFileList();
- assertEquals("The file list does not contain only one file.", 1, fileList.size());
- assertEquals("The file location '" + fileLoc + "' is modified.", resolvedLocation.toLowerCase(), ((String)fileList.get(0)).toLowerCase());
-
- }
-
- /**
- * Test that a single file with an absolute, remote location is resolved properly.
- */
- public void testAbsoluteSingleFileRemoteLocation()
- {
- String resolvedLocation = "http://www.ws-i.org/SampleApplications/SupplyChainManagement/2003-07/Catalog.wsdl";
- String fileLoc = "http://www.ws-i.org/SampleApplications/SupplyChainManagement/2003-07/Catalog.wsdl";
- WSDLValidateTask wsdlValidateTask = new WSDLValidateTask();
- wsdlValidateTask.setProject(project);
- wsdlValidateTask.setFile(fileLoc);
- List fileList = wsdlValidateTask.getFileList();
- assertEquals("The file list does not contain only one file.", 1, fileList.size());
- assertEquals("The file location '" + fileLoc + "' is modified.", resolvedLocation.toLowerCase(), ((String)fileList.get(0)).toLowerCase());
-
- }
-
-/**
- * Test that a single file in a fileset with a relative location is resolved properly
- * when no directory is specified.
- */
- public void testRelativeSingleFileInFilesetNoDirSpecified()
- {
- String fileLoc = "Empty.wsdl";
- String base_dir = BASE_DIR + SAMPLES_DIR + "WSDL" + File.separator + "SelfContained";
- String resolvedLocation = ("file:///" + base_dir + "/" + fileLoc).replace('\\','/');
- base_dir = base_dir.replace('/', File.separatorChar);
-
- WSDLValidateTask wsdlValidateTask = new WSDLValidateTask();
- wsdlValidateTask.setProject(project);
-
- FileSet fileset = wsdlValidateTask.createFileset();
- fileset.setProject(project);
- fileset.setDir(new File(base_dir));
-
- FilenameSelector filenameSelector = new FilenameSelector();
- filenameSelector.setName(fileLoc);
- fileset.addFilename(filenameSelector);
- //fileset.setFile(new File(fileLoc));
-
- List fileList = wsdlValidateTask.getFileList();
- assertEquals("The file list does not contain only one file.", 1, fileList.size());
- // The file locations are converted to lower case to avoid drive letter case differences on windows. ie. C vs c.
- assertEquals("The file location '" + fileList.get(0) + "' is not correctly resolved to the base location.", resolvedLocation.toLowerCase(), ((String)fileList.get(0)).toLowerCase());
-
- }
-}
diff --git a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogTest.java b/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogTest.java
deleted file mode 100644
index 941135e77..000000000
--- a/tests/org.eclipse.wst.wsdl.validation.tests/src/org/eclipse/wst/wsdl/validation/internal/xml/XMLCatalogTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.wst.wsdl.validation.internal.xml;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.wsdl.validation.tests.internal.BaseTestCase;
-
-/**
- * Tests for the WSDL validator's internal XML catalog.
- */
-public class XMLCatalogTest extends BaseTestCase
-{
- private String CATALOG_DIR = "testresources/samples/XSD/CatalogSchemas/";
-
- /**
- * Create a tests suite from this test class.
- *
- * @return A test suite containing this test class.
- */
- public static Test suite()
- {
- return new TestSuite(XMLCatalogTest.class);
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp()
- {
- super.setUp();
- XMLCatalog.reset();
- }
-
-
-
-public void testSchemaDir()
- {
- XMLCatalog.addSchemaDir(PLUGIN_ABSOLUTE_PATH + CATALOG_DIR);
- String catalogLocation = PLUGIN_ABSOLUTE_PATH + CATALOG_DIR;
- catalogLocation = catalogLocation.replace('\\','/');
- while(catalogLocation.startsWith("/"))
- {
- catalogLocation = catalogLocation.substring(1);
- }
- catalogLocation = FILE_PROTOCOL + catalogLocation;
- IXMLCatalog catalog = XMLCatalog.getInstance();
- String resolvedLocation = catalog.resolveEntityLocation("http://www.example.org/schema1", "");
- assertEquals("The resolved location is not equal to the expected location.", catalogLocation + "schema1.xsd", resolvedLocation);
- resolvedLocation = catalog.resolveEntityLocation("http://www.example.org/schema2", "");
- assertEquals("The second resolved location is not equal to the resolved location.", catalogLocation + "schema2.xsd", resolvedLocation);
-
- }
-}

Back to the top