diff options
Diffstat (limited to 'tests/org.eclipse.jst.jsp.core.tests/src/org')
107 files changed, 0 insertions, 9383 deletions
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCorePreferencesTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCorePreferencesTest.java deleted file mode 100644 index 139f20455..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCorePreferencesTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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.jst.jsp.core.tests; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jst.jsp.core.internal.JSPCorePlugin; -import org.eclipse.jst.jsp.core.internal.encoding.JSPDocumentLoader; -import org.eclipse.jst.jsp.core.internal.preferences.JSPCorePreferenceNames; -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.sse.core.internal.encoding.ContentBasedPreferenceGateway; -import org.eclipse.wst.sse.core.internal.encoding.ContentTypeEncodingPreferences; -import org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleException; -import org.osgi.service.prefs.Preferences; - -/** - * The purpose of this test is to verify the validity of the JSP Source editor - * preferences. Tests include setting/getting preferences. - * - * NOTE: This test should be preformed on a clean workspace. If performed on - * an existing workspace, this test will manipulate preferences in the - * workspace, though attempts will be made to restore original values after - * testing. - */ -public class JSPCorePreferencesTest extends TestCase { - /** - * Tests existance of preference values when getting preference values - * through Platform.getPreferencesService() - */ - public void testBundleGetPreferences() { - final String bundleName = "org.eclipse.jst.jsp.core"; - - // need to start up bundle for default values to be loaded - Bundle bundle = Platform.getBundle(bundleName); - try { - if (bundle != null) - bundle.start(); - else - fail("Get preference value failed because could not find bundle: " + bundleName); - } - catch (BundleException e) { - fail("Get preference value failed because of exception starting bundle: " + bundleName + " exception: " + e); - } - - bundleGetPreference(bundleName, JSPCorePreferenceNames.DEFAULT_EXTENSION); - } - - private void bundleGetPreference(String bundleName, String prefKey) { - String defaultValue = null; - - String value = Platform.getPreferencesService().getString(bundleName, prefKey, defaultValue, null); - assertTrue("Get preference value failed using Platform.getPreferencesService. Key: " + prefKey, defaultValue != value); - } - - /** - * Tests default values of preferences. - * - * NOTE: Expected default values are hard-coded, so if default values do - * get changed, assertions need to be updated as well - */ - public void testPluginGetDefaultPreferences() { - IEclipsePreferences node = new DefaultScope().getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName()); - - pluginGetDefaultPreference(node, JSPCorePreferenceNames.VALIDATE_FRAGMENTS, Boolean.toString(true)); - } - - private void pluginGetDefaultPreference(IEclipsePreferences node, String prefKey, String expected) { - String defaultValue = Long.toString(System.currentTimeMillis()); // random - // string - - String theDefaultValue = node.get(prefKey, defaultValue); - assertEquals("Get default preference value failed using plugin.getPreferenceStore. Key: " + prefKey, expected, theDefaultValue); - } - - /** - * Tests setting preference values by setting preference value to be a - * certain value, then getting the preference value to verify it was set. - */ - public void testPluginSetPreferences() { - IEclipsePreferences node = new InstanceScope().getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName()); - - pluginSetPreferenceBoolean(node, JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - } - - private void pluginSetPreferenceBoolean(IEclipsePreferences node, String prefKey) { - boolean originalValue = false; - boolean expectedValue = true; - - String originalString = node.get(prefKey, "bogus"); - if (!"bogus".equals(originalString)) { - originalValue = Boolean.valueOf(originalString).booleanValue(); - expectedValue = !originalValue; - } - node.putBoolean(prefKey, expectedValue); - boolean foundValue = node.getBoolean(prefKey, true); - assertEquals("Set preference value failed using plugin.getPreferenceStore. Key: " + prefKey + " expected: " + expectedValue + " found: " + foundValue, expectedValue, foundValue); - - // attempt to restore original preference value - if ("bogus".equals(originalString)) - node.remove(prefKey); - else - node.put(prefKey, originalString); - } - - /** - * Tests line delimiter preferences by making sure document created - * follows line delimiter preference. - */ - public void testDelimiterPreferences() { - // check if content type preferences match - String preferredDelimiter = ContentTypeEncodingPreferences.getPreferredNewLineDelimiter(ContentTypeIdForJSP.ContentTypeID_JSP); - Preferences prefs = ContentBasedPreferenceGateway.getPreferences(ContentTypeIdForJSP.ContentTypeID_JSP); - String gatewayDelimiter = prefs.get(CommonEncodingPreferenceNames.END_OF_LINE_CODE, null); - assertEquals("ContentTypeEncodingPreferences and ContentBasedPreferenceGateway preferences do not match", gatewayDelimiter, preferredDelimiter); - - // set a particular line delimiter - prefs.put(CommonEncodingPreferenceNames.END_OF_LINE_CODE, CommonEncodingPreferenceNames.LF); - - // create document - JSPDocumentLoader loader = new JSPDocumentLoader(); - IEncodedDocument document = loader.createNewStructuredDocument(); - String documentDelimiter = document.getPreferredLineDelimiter(); - - // verify delimiter in document matches preference - assertEquals("Delimiter in document does not match preference", CommonEncodingPreferenceNames.STRING_LF, documentDelimiter); - - // return to original preference - prefs.remove(CommonEncodingPreferenceNames.END_OF_LINE_CODE); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java deleted file mode 100644 index f7ca97044..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestSuite.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jst.jsp.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.jst.jsp.core.tests.cleanupformat.FormatTester; -import org.eclipse.jst.jsp.core.tests.contentmodels.TestFixedCMDocuments; -import org.eclipse.jst.jsp.core.tests.contentmodels.TestTaglibCMTests; -import org.eclipse.jst.jsp.core.tests.contenttypeidentifier.contentspecific.TestContentTypeHandlers; -import org.eclipse.jst.jsp.core.tests.contenttypeidentifier.contentspecific.TestModelHandlers; -import org.eclipse.jst.jsp.core.tests.dom.AttrValueTest; -import org.eclipse.jst.jsp.core.tests.dom.TestImportedNodes; -import org.eclipse.jst.jsp.core.tests.model.TestModelIncludes; -import org.eclipse.jst.jsp.core.tests.model.TestModelRelease; -import org.eclipse.jst.jsp.core.tests.model.TestModelWithNoFile; -import org.eclipse.jst.jsp.core.tests.source.JSPTokenizerTest; -import org.eclipse.jst.jsp.core.tests.translation.JSPJavaTranslatorCoreTest; -import org.eclipse.jst.jsp.core.tests.translation.JSPTranslatorPersistenceTest; -import org.eclipse.jst.jsp.core.tests.validation.JSPActionValidatorTest; -import org.eclipse.jst.jsp.core.tests.validation.JSPBatchValidatorTest; -import org.eclipse.jst.jsp.core.tests.validation.JSPDirectiveValidatorTest; -import org.eclipse.jst.jsp.core.tests.validation.JSPJavaValidatorTest; -import org.eclipse.jst.jsp.css.core.tests.source.JSPedCSSSourceParserTest; - -public class JSPCoreTestSuite extends TestSuite { - public static Test suite() { - return new JSPCoreTestSuite(); - } - - public JSPCoreTestSuite() { - super("JSP Core Test Suite"); - - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - String wtp_autotest_noninteractive = null; - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - addTest(TestCeanupFormat.suite()); - addTest(ModelCloneSuite.suite()); - addTest(new TestSuite(TestModelHandlers.class, "TestModelHandlers")); - addTest(new TestSuite(TestContentTypeHandlers.class, "TestContentTypeHandlers")); - addTest(new TestSuite(TestModelManager.class, "TestModelManager")); - addTest(new TestSuite(FormatTester.class, "FormatTester")); - addTest(new TestSuite(TestModelRelease.class, "Model Tests")); - addTest(new TestSuite(TestModelWithNoFile.class, "Model with no file Tests")); - // temporarily removed since unstable, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213754 - // addTest(new TestSuite(TestIndex.class, "TaglibIndex Tests")); - addTest(new TestSuite(JSPTokenizerTest.class, "Special Parsing Tests")); - addTest(new TestSuite(AttrValueTest.class, "JSP Attribute Tests")); - addTest(new TestSuite(JSPJavaTranslatorCoreTest.class, "Core Translator Tests")); - addTest(new TestSuite(TestModelIncludes.class, "Core Fragment Inclusion Tests")); - addTest(new TestSuite(JSPCorePreferencesTest.class, "Preference Tests")); - addTest(new TestSuite(JSPedCSSSourceParserTest.class, "Special Parsing Tests for JSP-CSS content")); - addTest(new TestSuite(JSPJavaValidatorTest.class, "Java Validator Tests")); - addTest(new TestSuite(TestImportedNodes.class, "Imported Nodes Tests")); - addTest(new TestSuite(TestFixedCMDocuments.class, "Fixed CMDocument Creation Tests")); - addTest(new TestSuite(TestTaglibCMTests.class, "Custom Tag Library Content Model Tests")); - addTest(new TestSuite(JSPActionValidatorTest.class, "Action Validator Tests")); - addTest(new TestSuite(JSPBatchValidatorTest.class, "Batch Validator Tests")); - addTest(new TestSuite(JSPDirectiveValidatorTest.class, "Directive Validator Tests")); - addTest(JSPTranslatorPersistenceTest.suite()); - - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestsPlugin.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestsPlugin.java deleted file mode 100644 index 10dda5f6c..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/JSPCoreTestsPlugin.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; - -/** - * The main plugin class to be used in the desktop. - */ -public class JSPCoreTestsPlugin extends Plugin { - //The shared instance. - private static JSPCoreTestsPlugin plugin; - //Resource bundle. - private ResourceBundle resourceBundle; - - /** - * The constructor. - */ - public JSPCoreTestsPlugin() { - super(); - plugin = this; - try { - resourceBundle = ResourceBundle.getBundle("org.eclipse.jst.jsp.core.tests.TestsPluginResources"); - } - catch (MissingResourceException x) { - resourceBundle = null; - } - } - - /** - * Returns the shared instance. - */ - public static JSPCoreTestsPlugin getDefault() { - return plugin; - } - - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. - */ - public static String getResourceString(String key) { - ResourceBundle bundle = JSPCoreTestsPlugin.getDefault().getResourceBundle(); - try { - return (bundle != null) ? bundle.getString(key) : key; - } - catch (MissingResourceException e) { - return key; - } - } - - /** - * Returns the plugin's resource bundle, - */ - public ResourceBundle getResourceBundle() { - return resourceBundle; - } - - public static URL getInstallLocation() { - URL installLocation = Platform.getBundle("org.eclipse.jst.jsp.core.tests").getEntry("/"); - URL resolvedLocation = null; - try { - resolvedLocation = FileLocator.resolve(installLocation); - } - catch (IOException e) { - // impossible - throw new Error(e); - } - return resolvedLocation; - } - - public static File getTestFile(String filepath) { - URL installURL = getInstallLocation(); - //String scheme = installURL.getProtocol(); - String path = installURL.getPath(); - String location = path + filepath; - File result = new File(location); - return result; - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/Logger.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/Logger.java deleted file mode 100644 index 58eabf640..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/Logger.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests; - -import com.ibm.icu.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.osgi.framework.Bundle; - -/** - * Small convenience class to log messages to plugin's log file and also, if desired, - * the console. This class should only be used by classes in this plugin. Other - * plugins should make their own copy, with appropriate ID. - */ -public class Logger { - private static Plugin fPlugin = JSPCoreTestsPlugin.getDefault(); - private static Bundle fBundle = fPlugin.getBundle(); - private static final String fPluginId = fBundle.getSymbolicName(); - - private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$ - - public static final int OK = IStatus.OK; // 0 - public static final int INFO = IStatus.INFO; // 1 - public static final int WARNING = IStatus.WARNING; // 2 - public static final int ERROR = IStatus.ERROR; // 4 - - public static final int OK_DEBUG = 200 + OK; - public static final int INFO_DEBUG = 200 + INFO; - public static final int WARNING_DEBUG = 200 + WARNING; - public static final int ERROR_DEBUG = 200 + ERROR; - - /** - * Adds message to log. - * @param level severity level of the message (OK, INFO, WARNING, ERROR, OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG) - * @param message text to add to the log - * @param exception exception thrown - */ - protected static void _log(int level, String message, Throwable exception) { - if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) { - if (!isDebugging()) - return; - } - - int severity = IStatus.OK; - switch (level) { - case INFO_DEBUG : - case INFO : - severity = IStatus.INFO; - break; - case WARNING_DEBUG : - case WARNING : - severity = IStatus.WARNING; - break; - case ERROR_DEBUG : - case ERROR : - severity = IStatus.ERROR; - } - message = (message != null) ? message : "null"; //$NON-NLS-1$ - Status statusObj = new Status(severity, fPluginId, severity, message, exception); - fPlugin.getLog().log(statusObj); - } - - /** - * Prints message to log if category matches /debug/tracefilter option. - * @param message text to print - * @param category category of the message, to be compared with /debug/tracefilter - */ - protected static void _trace(String category, String message, Throwable exception) { - if (isTracing(category)) { - message = (message != null) ? message : "null"; //$NON-NLS-1$ - Status statusObj = new Status(IStatus.OK, fPluginId, IStatus.OK, message, exception); - fPlugin.getLog().log(statusObj); - } - } - - /** - * @return true if the plugin for this logger is debugging - */ - public static boolean isDebugging() { - return fPlugin.isDebugging(); - } - - /** - * Determines if currently tracing a category - * @param category - * @return true if tracing category, false otherwise - */ - public static boolean isTracing(String category) { - if (!isDebugging()) - return false; - - String traceFilter = Platform.getDebugOption(fPluginId + TRACEFILTER_LOCATION); - if (traceFilter != null) { - StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreTokens()) { - String cat = tokenizer.nextToken().trim(); - if (category.equals(cat)) { - return true; - } - } - } - return false; - } - - public static void log(int level, String message) { - _log(level, message, null); - } - - public static void log(int level, String message, Throwable exception) { - _log(level, message, exception); - } - - public static void logException(String message, Throwable exception) { - _log(ERROR, message, exception); - } - - public static void logException(Throwable exception) { - _log(ERROR, exception.getMessage(), exception); - } - - public static void traceException(String category, String message, Throwable exception) { - _trace(category, message, exception); - } - - public static void traceException(String category, Throwable exception) { - _trace(category, exception.getMessage(), exception); - } - - public static void trace(String category, String message) { - _trace(category, message, null); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ManyTestIndex.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ManyTestIndex.java deleted file mode 100644 index 57f180c84..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ManyTestIndex.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.jst.jsp.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.jst.jsp.core.tests.taglibindex.TestIndex; - -public class ManyTestIndex extends TestSuite { - public static Test suite() { - return new ManyTestIndex(); - } - - public ManyTestIndex() { - super("SSE JSP Core Test Suite"); - - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - String wtp_autotest_noninteractive = null; - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - for (int i = 0; i < 25; i++) { - addTest(new TestSuite(TestIndex.class, "TaglibIndex Tests " + (i + 1))); - } - - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ModelCloneSuite.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ModelCloneSuite.java deleted file mode 100644 index 183caf93a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ModelCloneSuite.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsp.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class ModelCloneSuite extends TestSuite { - public static Test suite() { - return new ModelCloneSuite(); - } - - public ModelCloneSuite() { - super("ModelCloneSuite"); - - addTest(new TestSuite(TestStructuredDocumentClone.class, "TestStructuredDocumentClone")); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/NullInputStream.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/NullInputStream.java deleted file mode 100644 index 794f832ac..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/NullInputStream.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 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 - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.jst.jsp.core.tests; - -import java.io.IOException; -import java.io.InputStream; - - -public class NullInputStream extends InputStream { - - /* - * (non-Javadoc) - * - * @see java.io.InputStream#mark(int) - */ - public synchronized void mark(int readlimit) { - // nothing to do - } - - /* - * (non-Javadoc) - * - * @see java.io.InputStream#markSupported() - */ - public boolean markSupported() { - // we can mark nothing. - // and, we are using this Null class specifically for - // a "fake" resettable stream. - return true; - } - - /* - * (non-Javadoc) - * - * @see java.io.InputStream#read() - */ - public int read() throws IOException { - - return -1; - } - - /* - * (non-Javadoc) - * - * @see java.io.InputStream#reset() - */ - public synchronized void reset() throws IOException { - // nothing to do - } - - /* - * (non-Javadoc) - * - * @see java.io.InputStream#skip(long) - */ - public long skip(long n) throws IOException { - return 0; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ProjectUtil.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ProjectUtil.java deleted file mode 100644 index 5d96f8d65..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/ProjectUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jst.jsp.core.tests; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - -/** - * - * @see org.eclipse.wst.xml.ui.tests.ProjectUtil Similar Project Utils - * @see org.eclipse.wst.css.ui.tests.ProjectUtil Similar Project Utils - * @see org.eclipse.wst.dtd.ui.tests.ProjectUtil Similar Project Utils - */ -public class ProjectUtil { - public static IProject createProject(String name, IPath location, String[] natureIds) { - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name); - if (location != null) { - description.setLocation(location); - } - if (natureIds != null) { - description.setNatureIds(natureIds); - } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - try { - project.create(description, new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - return project; - } - - /** - * @param rootEntry - avoid trailing separators - * @param fullTargetPath - */ - public static void copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) { - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - _copyBundleEntriesIntoWorkspace(rootEntry, fullTargetPath); - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - try { - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - } - - static void _copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) throws CoreException { - Enumeration entries = JSPCoreTestsPlugin.getDefault().getBundle().getEntryPaths(rootEntry); - while (entries != null && entries.hasMoreElements()) { - String entryPath = entries.nextElement().toString(); - String targetPath = new Path(fullTargetPath + "/" + entryPath.substring(rootEntry.length())).toString(); - if (entryPath.endsWith("/")) { - IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(targetPath)); - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - _copyBundleEntriesIntoWorkspace(entryPath, targetPath); - } - else { - _copyBundleEntryIntoWorkspace(entryPath, targetPath); - } - } - } - - static IFile _copyBundleEntryIntoWorkspace(String entryname, String fullPath) throws CoreException { - IFile file = null; - URL entry = JSPCoreTestsPlugin.getDefault().getBundle().getEntry(entryname); - if (entry != null) { - try { - byte[] b = new byte[2048]; - InputStream input = entry.openStream(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - int i = -1; - while ((i = input.read(b)) > -1) { - output.write(b, 0, i); - } - file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath)); - if (file != null) { - if (!file.exists()) { - file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor()); - } - else { - file.setContents(new ByteArrayInputStream(output.toByteArray()), true, false, new NullProgressMonitor()); - } - } - } - catch (IOException e) { - e.printStackTrace(); - } - catch (CoreException e) { - e.printStackTrace(); - } - } - return file; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestCeanupFormat.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestCeanupFormat.java deleted file mode 100644 index 7a4df4182..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestCeanupFormat.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsp.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.jst.jsp.core.tests.cleanupformat.CleanupTester; -import org.eclipse.jst.jsp.core.tests.cleanupformat.FormatTester; - - -public class TestCeanupFormat extends TestSuite { - public static Test suite() { - return new TestCeanupFormat(); - } - - public TestCeanupFormat() { - super("TestCeanupFormat"); - - addTest(new TestSuite(CleanupTester.class, "CleanupTester")); - addTest(new TestSuite(FormatTester.class, "FormatTester")); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestModelManager.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestModelManager.java deleted file mode 100644 index f609b6cfe..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestModelManager.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 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.jst.jsp.core.tests; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import junit.framework.TestCase; - -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; - -/** - * This class tests basic creation of IModelManager plugin and the - * ModelManger. - * - * Appropriate for BVT. - */ -public class TestModelManager extends TestCase { - - /** - * Constructor for TestModelManager. - * - * @param name - */ - public TestModelManager(String name) { - super(name); - } - - public void testModelManager() throws IOException { - IStructuredModel model = null; - IModelManager modelManager = StructuredModelManager.getModelManager(); - assertTrue("modelManager must not be null", modelManager != null); - - try { - model = modelManager.getModelForEdit(getClass().getName() + "." + getName() + ".test.jsp", new NullInputStream(), null); - assertTrue("basic JSP empty model could not be created", model != null); - } finally { - if (model != null) { - model.releaseFromEdit(); - } - } - - } - - public void testCopyJSPModelForEdit() throws IOException { - IStructuredModel model = null; - try { - IModelManager modelManager = StructuredModelManager.getModelManager(); - model = modelManager.getModelForEdit("test.jsp", new NullInputStream(), null); - IStructuredModel modelCopy = modelManager.copyModelForEdit(model.getId(), getName()+".newId"); - assertNotNull("copied JSP model was null", modelCopy); - assertEquals("ModelHandlers differ", model.getModelHandler(), modelCopy.getModelHandler()); - assertEquals("StructuredDocument RegionParsers differ", model.getStructuredDocument().getParser().getClass(), modelCopy.getStructuredDocument().getParser().getClass()); - assertEquals("Text document contents differ", model.getStructuredDocument().get(), modelCopy.getStructuredDocument().get()); - } - catch (ResourceInUse e) { - fail("Resource in use reported for " + model.getId()); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - public void testNullArgument() throws UnsupportedEncodingException, IOException { - IStructuredModel model = null; - Exception e = null; - IModelManager modelManager = StructuredModelManager.getModelManager(); - try { - model = modelManager.getModelForEdit((String) null, null, null); - } catch (IllegalArgumentException exception) { - e = exception; - assertTrue("illegal argument failed to throw IllegalArgumentException", e instanceof IllegalArgumentException); - } finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestStructuredDocumentClone.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestStructuredDocumentClone.java deleted file mode 100644 index 6539f3f9d..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/TestStructuredDocumentClone.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests; - -import java.io.IOException; -import java.io.InputStream; - -import junit.framework.Test; -import junit.framework.TestCase; - -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * @author davidw - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class TestStructuredDocumentClone extends TestCase { - - /** - * Constructor for TestModelClone. - */ - public TestStructuredDocumentClone(String name) { - super(name); - } - - public static Test getTest() { - return new TestStructuredDocumentClone("testCloneStructuredModelJSPXML"); - } - - public void testCloneStructuredDocumentXML() throws IOException { - // First make (empty) structuredDocument - IModelManager modelManager = StructuredModelManager.getModelManager(); - IStructuredDocument structuredDocument = modelManager.createStructuredDocumentFor("dummy.xml", (InputStream) null, null); - assertTrue("structuredDocument could not be created!", structuredDocument != null); - - IStructuredDocument clonedStructuredDocument = structuredDocument.newInstance(); - // make sure the critical variables are NOT identical, but that new instances - // have been made - boolean passed = true; - if (clonedStructuredDocument.getEncodingMemento() == structuredDocument.getEncodingMemento()) - passed = false; - if (clonedStructuredDocument.getParser() == structuredDocument.getParser()) - passed = false; - if (clonedStructuredDocument.getReParser() == structuredDocument.getReParser()) - passed = false; - assertTrue("newInstance of XML structuredDocument is not correct", passed); - - } - - /** - * This test is most useful to check breakpoints and dig deep in object - * to check clones values - */ - public void testCloneStructuredDocumentJSP() throws IOException { - // First make (empty) structuredDocument - IModelManager modelManager = StructuredModelManager.getModelManager(); - IStructuredDocument structuredDocument = modelManager.createStructuredDocumentFor("dummy.jsp", (InputStream) null, null); - assertTrue("structuredDocument could not be created!", structuredDocument != null); - - IStructuredDocument clonedStructuredDocument = structuredDocument.newInstance(); - // make sure the critical variables are NOT identical, but that new instances - // have been made - boolean passed = true; - if (clonedStructuredDocument.getEncodingMemento() == structuredDocument.getEncodingMemento()) - passed = false; - if (clonedStructuredDocument.getParser() == structuredDocument.getParser()) - passed = false; - if (clonedStructuredDocument.getReParser() == structuredDocument.getReParser()) - passed = false; - assertTrue("newInstance of JSP structuredDocument is not correct", passed); - - } - - /** - * This test is most useful to check breakpoints and dig deep in object - * to check clones values - */ - public void testCloneStructuredDocumentJSPXML() throws IOException { - // First make (empty) structuredDocument - IModelManager modelManager = StructuredModelManager.getModelManager(); - String testContent = "<@! page contentType=\"text/xml\" @>"; - IStructuredDocument structuredDocument = modelManager.createStructuredDocumentFor("dummy.jsp", testContent, null); - assertTrue("structuredDocument could not be created!", structuredDocument != null); - - IStructuredDocument clonedStructuredDocument = structuredDocument.newInstance(); - // make sure the critical variables are NOT identical, but that new instances - // have been made - boolean passed = true; - if (clonedStructuredDocument.getEncodingMemento() == structuredDocument.getEncodingMemento()) - passed = false; - if (clonedStructuredDocument.getParser() == structuredDocument.getParser()) - passed = false; - if (clonedStructuredDocument.getReParser() == structuredDocument.getReParser()) - passed = false; - assertTrue("newInstance of JSPXML structuredDocument is not correct", passed); - - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/CleanupTester.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/CleanupTester.java deleted file mode 100644 index ad456c99b..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/CleanupTester.java +++ /dev/null @@ -1,360 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.jst.jsp.core.tests.cleanupformat; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.tests.util.StringCompareUtil; -import org.eclipse.wst.html.core.internal.cleanup.HTMLCleanupProcessorImpl; -import org.eclipse.wst.html.core.internal.preferences.HTMLCorePreferenceNames; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.cleanup.AbstractStructuredCleanupProcessor; -import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.cleanup.CleanupProcessorXML; - -public class CleanupTester extends TestCase { -// private static final boolean PRINT_FAILED_FORMAT_TESTS = false; - protected IModelManager fModelManager = null; - protected CleanupProcessorXML fCleanupProcessor = null; - protected HTMLCleanupProcessorImpl fHTMLCleanupProcessor = null; - private StringCompareUtil fStringCompareUtil; - - public CleanupTester(String name) { - super(name); - // get model manager - fModelManager = StructuredModelManager.getModelManager(); - - // get cleanup processor - fCleanupProcessor = new CleanupProcessorXML(); - - // get HTML cleanup processor - fHTMLCleanupProcessor = new HTMLCleanupProcessorImpl(); - } - - protected void setUp() throws Exception { - fStringCompareUtil = new StringCompareUtil(); - } - - public void testCleanupInsertTagsQuoteAttrs() throws UnsupportedEncodingException, IOException { - // get model - IStructuredModel structuredModel = getModel("invoice.xml"); - - // use for debugging - // String precleaned = structuredModel.getStructuredDocument().get(); - - // init CleanupPreferences - IStructuredCleanupPreferences cleanupPreferences = fCleanupProcessor.getCleanupPreferences(); - cleanupPreferences.setCompressEmptyElementTags(false); - cleanupPreferences.setInsertRequiredAttrs(false); - cleanupPreferences.setInsertMissingTags(true); - cleanupPreferences.setQuoteAttrValues(true); - cleanupPreferences.setFormatSource(false); - cleanupPreferences.setConvertEOLCodes(false); - - // cleanup - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = false; - fCleanupProcessor.cleanupModel(structuredModel); - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = true; - - // compare - String cleaned = structuredModel.getStructuredDocument().get(); - String expectedFileName = "invoice.afterCleanupInsertTagsQuoteAttrs.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, cleaned); - - // release model - structuredModel.releaseFromRead(); - } - - public void testCleanupInsertTags() throws IOException, IOException { - // get model - IStructuredModel structuredModel = getModel("invoice.xml"); - - // init CleanupPreferences - IStructuredCleanupPreferences cleanupPreferences = fCleanupProcessor.getCleanupPreferences(); - cleanupPreferences.setCompressEmptyElementTags(false); - cleanupPreferences.setInsertRequiredAttrs(false); - cleanupPreferences.setInsertMissingTags(true); - cleanupPreferences.setQuoteAttrValues(false); - cleanupPreferences.setFormatSource(false); - cleanupPreferences.setConvertEOLCodes(false); - - // cleanup - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = false; - fCleanupProcessor.cleanupModel(structuredModel); - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = true; - - // compare - String cleaned = structuredModel.getStructuredDocument().get(); - String expectedFileName = "invoice.afterCleanupInsertTags.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, cleaned); - - // release model - structuredModel.releaseFromRead(); - } - - public void testCleanupCompressEmptyElementTags() throws UnsupportedEncodingException, IOException { - // get model - IStructuredModel structuredModel = getModel("small2.xml"); - - // init CleanupPreferences - IStructuredCleanupPreferences cleanupPreferences = fCleanupProcessor.getCleanupPreferences(); - cleanupPreferences.setCompressEmptyElementTags(true); - cleanupPreferences.setInsertRequiredAttrs(false); - cleanupPreferences.setInsertMissingTags(false); - cleanupPreferences.setQuoteAttrValues(false); - cleanupPreferences.setFormatSource(true); - cleanupPreferences.setConvertEOLCodes(false); - - // cleanup - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = false; - fCleanupProcessor.cleanupModel(structuredModel); - ((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = true; - - // compare - String cleaned = structuredModel.getStructuredDocument().get(); - String expectedFileName = "small2.afterCompressEmptyElementTags-newfmt.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, cleaned); - - // release model - structuredModel.releaseFromRead(); - } - - public void testCleanupHTML() throws UnsupportedEncodingException, IOException { - // get model - IStructuredModel structuredModel = getModel("cleanup.html"); - - // init CleanupPreferences - IStructuredCleanupPreferences cleanupPreferences = fHTMLCleanupProcessor.getCleanupPreferences(); - cleanupPreferences.setTagNameCase(HTMLCorePreferenceNames.UPPER); - cleanupPreferences.setAttrNameCase(HTMLCorePreferenceNames.LOWER); - cleanupPreferences.setCompressEmptyElementTags(false); - cleanupPreferences.setInsertRequiredAttrs(false); - cleanupPreferences.setInsertMissingTags(true); - cleanupPreferences.setQuoteAttrValues(true); - cleanupPreferences.setFormatSource(false); - cleanupPreferences.setConvertEOLCodes(false); - - // cleanup - ((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = false; - fHTMLCleanupProcessor.cleanupModel(structuredModel); - ((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = true; - - // compare - String cleaned = structuredModel.getStructuredDocument().get(); - String expectedFileName = "cleanup.afterCleanup.html"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, cleaned); - - // release model - structuredModel.releaseFromRead(); - } - - public void testCleanupHTMLtwice() throws UnsupportedEncodingException, IOException { - // get model - IStructuredModel structuredModel = getModel("cleanup.afterCleanup.html"); - - // init CleanupPreferences - IStructuredCleanupPreferences cleanupPreferences = fHTMLCleanupProcessor.getCleanupPreferences(); - cleanupPreferences.setTagNameCase(HTMLCorePreferenceNames.UPPER); - cleanupPreferences.setAttrNameCase(HTMLCorePreferenceNames.LOWER); - cleanupPreferences.setCompressEmptyElementTags(false); - cleanupPreferences.setInsertRequiredAttrs(false); - cleanupPreferences.setInsertMissingTags(true); - cleanupPreferences.setQuoteAttrValues(true); - cleanupPreferences.setFormatSource(false); - cleanupPreferences.setConvertEOLCodes(false); - - // cleanup - ((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = false; - fHTMLCleanupProcessor.cleanupModel(structuredModel); - ((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = true; - - // compare - String cleaned = structuredModel.getStructuredDocument().get(); - String expectedFileName = "cleanup.afterCleanup.html"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, cleaned); - - // release model - structuredModel.releaseFromRead(); - } - - // public void testCleanupJSPEmptyTags1() throws - // UnsupportedEncodingException, IOException { - // // get model - // IStructuredModel structuredModel = getModel("login.jsp"); - // - // // init CleanupPreferences - // IStructuredCleanupPreferences cleanupPreferences = - // fHTMLCleanupProcessor.getCleanupPreferences(); - // cleanupPreferences.setTagNameCase(CommonModelPreferenceNames.UPPER); - // cleanupPreferences.setAttrNameCase(CommonModelPreferenceNames.LOWER); - // cleanupPreferences.setCompressEmptyElementTags(false); - // cleanupPreferences.setInsertRequiredAttrs(false); - // cleanupPreferences.setInsertMissingTags(true); - // cleanupPreferences.setQuoteAttrValues(true); - // cleanupPreferences.setFormatSource(true); - // cleanupPreferences.setConvertEOLCodes(false); - // - // // cleanup - // ((AbstractStructuredCleanupProcessor) - // fHTMLCleanupProcessor).refreshCleanupPreferences = false; - // fHTMLCleanupProcessor.cleanupModel(structuredModel); - // ((AbstractStructuredCleanupProcessor) - // fHTMLCleanupProcessor).refreshCleanupPreferences = true; - // - // // compare - // String cleaned = structuredModel.getStructuredDocument().get(); - // String expectedFileName = "login.afterCleanup.jsp"; - // String expected = getFile(expectedFileName); - // compare(expectedFileName, expected, cleaned); - // - // // release model - // structuredModel.releaseFromRead(); - // } - // - // public void testCleanupJSPEmptyTags2() throws - // UnsupportedEncodingException, IOException { - // // get model - // IStructuredModel structuredModel = getModel("subscription.jsp"); - // - // // init CleanupPreferences - // IStructuredCleanupPreferences cleanupPreferences = - // fHTMLCleanupProcessor.getCleanupPreferences(); - // cleanupPreferences.setTagNameCase(CommonModelPreferenceNames.UPPER); - // cleanupPreferences.setAttrNameCase(CommonModelPreferenceNames.LOWER); - // cleanupPreferences.setCompressEmptyElementTags(false); - // cleanupPreferences.setInsertRequiredAttrs(false); - // cleanupPreferences.setInsertMissingTags(true); - // cleanupPreferences.setQuoteAttrValues(true); - // cleanupPreferences.setFormatSource(true); - // cleanupPreferences.setConvertEOLCodes(false); - // - // // cleanup - // ((AbstractStructuredCleanupProcessor) - // fHTMLCleanupProcessor).refreshCleanupPreferences = false; - // fHTMLCleanupProcessor.cleanupModel(structuredModel); - // ((AbstractStructuredCleanupProcessor) - // fHTMLCleanupProcessor).refreshCleanupPreferences = true; - // - // // compare - // String cleaned = structuredModel.getStructuredDocument().get(); - // String expectedFileName = "subscription.afterCleanup.jsp"; - // String expected = getFile(expectedFileName); - // compare(expectedFileName, expected, cleaned); - // - // // release model - // structuredModel.releaseFromRead(); - // } - - protected String readFile(String fileName) throws IOException { - String inputString = null; - InputStream fileInputStream = null; - - try { - fileInputStream = getClass().getResourceAsStream(fileName); - - byte[] inputBuffer = new byte[2048]; - inputString = new String(); - int bytesRead = -1; - - while (true) { - bytesRead = fileInputStream.read(inputBuffer); - if (bytesRead == -1) - break; - String bufferString = new String(inputBuffer, 0, bytesRead); - // bufferString = bufferString.substring(0, bytesRead); - inputString = inputString.concat(bufferString); - } - } - finally { - if (fileInputStream != null) - fileInputStream.close(); - } - - return inputString; - } - - protected static void printException(Exception exception) { - exception.printStackTrace(); - } - - protected IStructuredModel getModel(String fileName) throws UnsupportedEncodingException, IOException { - IStructuredModel structuredModel = null; - InputStream inputStream = null; - - try { - String input = getFile(fileName); - inputStream = new ByteArrayInputStream(input.getBytes("UTF-8")); - String id = inputStream.toString().concat(fileName); - structuredModel = fModelManager.getModelForRead(id, inputStream, null); - } - // since in test code, no need to catch this - // catch (Exception exception) { - // Logger.logException(exception); - // } - finally { - try { - inputStream.close(); - } - catch (Exception exception) { - // hopeless - StringWriter s = new StringWriter(); - exception.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - return structuredModel; - } - - protected String getFile(String fileName) throws IOException { - return readFile("testfiles/".concat(fileName)); - } - - protected void compare(String testcaseName, String expected, String cleaned) { - assertTrue("Cleaned up document differs from the expected.\nExpected Contents:\n" + expected + "\nActual Contents:\n" + cleaned, fStringCompareUtil.equalsIgnoreLineSeperator(expected, cleaned)); -// if (cleaned.compareTo(expected) != 0) { -// if (PRINT_FAILED_FORMAT_TESTS) { -// System.out.println(); -// System.out.println(testcaseName + " failed"); -// System.out.println("========== expected file =========="); -// System.out.println(expected); -// System.out.println("========== cleaned file =========="); -// System.out.println(cleaned); -// System.out.println("========== expected file =========="); -// String expectedString = StringUtils.replace(expected, "\r", "\\r"); -// expectedString = StringUtils.replace(expectedString, "\n", "\\n"); -// expectedString = StringUtils.replace(expectedString, "\t", "\\t"); -// System.out.println(expectedString); -// System.out.println("========== cleaned file =========="); -// String cleanedString = StringUtils.replace(cleaned, "\r", "\\r"); -// cleanedString = StringUtils.replace(cleanedString, "\n", "\\n"); -// cleanedString = StringUtils.replace(cleanedString, "\t", "\\t"); -// System.out.println(cleanedString); -// System.out.println("======================================="); -// } -// assertTrue(false); -// } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/FormatTester.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/FormatTester.java deleted file mode 100644 index 348a3d815..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/FormatTester.java +++ /dev/null @@ -1,586 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.jst.jsp.core.tests.cleanupformat; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringWriter; - -import junit.framework.TestCase; - -import org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.format.AbstractStructuredFormatProcessor; -import org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.utils.StringUtils; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML; - -public class FormatTester extends TestCase { - private static final boolean PRINT_FAILED_FORMAT_TESTS = false; - protected IModelManager fModelManager = null; - protected FormatProcessorXML fFormatProcessor = null; - protected HTMLFormatProcessorImpl fHTMLFormatProcessor = null; - - public FormatTester(String name) { - super(name); - - // get model manager - fModelManager = StructuredModelManager.getModelManager(); - - // get format processor - fFormatProcessor = new FormatProcessorXML(); - - // get HTML format processor - fHTMLFormatProcessor = new HTMLFormatProcessorImpl(); - } - - public void testFormat261968() { - // get model - IStructuredModel structuredModel = getModel("261968.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "261968.afterDefaultFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatTagOpen() { - // get model - IStructuredModel structuredModel = getModel("tagOpen.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "tagOpen.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatTagOpenTagClose() { - // get model - IStructuredModel structuredModel = getModel("tagOpenTagClose.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "tagOpenTagClose.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatTags() { - // get model - IStructuredModel structuredModel = getModel("tags.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "tags.afterDefaultFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatEmpty() { - // get model - IStructuredModel structuredModel = getModel("empty.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "empty.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatOneSpace() { - // get model - IStructuredModel structuredModel = getModel("oneSpace.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "empty.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatOneChar() { - // get model - IStructuredModel structuredModel = getModel("oneChar.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "oneChar.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatSpaces() { - // get model - IStructuredModel structuredModel = getModel("spaces.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "empty.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatChars() { - // get model - IStructuredModel structuredModel = getModel("chars.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "chars.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatSpacesAndChars() { - // get model - IStructuredModel structuredModel = getModel("spacesAndChars.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "chars.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormat() { - // get model - IStructuredModel structuredModel = getModel("small.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "small.afterDefaultFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatSplitLinesSplitMultiAttrs() { - // get model - IStructuredModel structuredModel = getModel("small.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(true); - formatPreferences.setLineWidth(72); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "small.afterSplitLinesSplitMultiAttrsFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatSplitLines() { - // get model - IStructuredModel structuredModel = getModel("small.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(72); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "small.afterSplitLinesFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatBlockComments() { - // get model - IStructuredModel structuredModel = getModel("blockComments.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "blockComments.afterDefaultFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatInlineComments() { - // get model - IStructuredModel structuredModel = getModel("inlineComments.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(999); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "inlineComments.afterDefaultFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testFormatInlineCommentsSplitLinesSplitMultiAttrs() { - // get model - IStructuredModel structuredModel = getModel("inlineComments.xml"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(true); - formatPreferences.setLineWidth(72); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false; - fFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "inlineComments.afterSplitLinesSplitMultiAttrsFormat.xml"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - public void testHTMLFormat() { - // get model - IStructuredModel structuredModel = getModel("HitCounterIntro.html"); - - // init FormatPreferences - IStructuredFormatPreferences formatPreferences = fHTMLFormatProcessor.getFormatPreferences(); - ((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false); - formatPreferences.setLineWidth(72); - formatPreferences.setIndent("\t"); - formatPreferences.setClearAllBlankLines(false); - - // format - ((AbstractStructuredFormatProcessor) fHTMLFormatProcessor).refreshFormatPreferences = false; - fHTMLFormatProcessor.formatModel(structuredModel); - ((AbstractStructuredFormatProcessor) fHTMLFormatProcessor).refreshFormatPreferences = true; - - // compare - String formatted = structuredModel.getStructuredDocument().get(); - String expectedFileName = "HitCounterIntro.afterDefaultFormat.html"; - String expected = getFile(expectedFileName); - compare(expectedFileName, expected, formatted); - - // release model - structuredModel.releaseFromRead(); - } - - protected String readFile(String fileName) { - String inputString = null; - InputStream fileInputStream = null; - - try { - fileInputStream = getClass().getResourceAsStream(fileName); - - byte[] inputBuffer = new byte[1024]; - inputString = new String(); - int bytesRead = -1; - - while (true) { - bytesRead = fileInputStream.read(inputBuffer); - if (bytesRead == -1) - break; - String bufferString = new String(inputBuffer); - bufferString = bufferString.substring(0, bytesRead); - inputString = inputString.concat(bufferString); - } - - if (fileInputStream != null) - fileInputStream.close(); - } - catch (IOException exception) { - StringWriter s = new StringWriter(); - exception.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - - return inputString; - } - - protected static void printException(Exception exception) { - exception.printStackTrace(); - } - - protected IStructuredModel getModel(String fileName) { - IStructuredModel structuredModel = null; - InputStream inputStream = null; - - try { - String input = getFile(fileName); - inputStream = new ByteArrayInputStream(input.getBytes("UTF8")); - String id = inputStream.toString().concat(fileName); - structuredModel = fModelManager.getModelForRead(id, inputStream, null); - } - catch (Exception exception) { - StringWriter s = new StringWriter(); - exception.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - finally { - try { - inputStream.close(); - } - catch (Exception exception) { - // hopeless - StringWriter s = new StringWriter(); - exception.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - return structuredModel; - } - - protected String getFile(String fileName) { - return readFile("testfiles/".concat(fileName)); - } - - protected void compare(String testcaseName, String expected, String formatted) { - if (formatted.compareTo(expected) != 0) { - if (PRINT_FAILED_FORMAT_TESTS) { - System.out.println(); - System.out.println(testcaseName + " failed"); - System.out.println("========== expected file =========="); - System.out.println(expected); - System.out.println("========== formatted file =========="); - System.out.println(formatted); - System.out.println("========== expected file =========="); - String expectedString = StringUtils.replace(expected, "\r", "\\r"); - expectedString = StringUtils.replace(expectedString, "\n", "\\n"); - expectedString = StringUtils.replace(expectedString, "\t", "\\t"); - System.out.println(expectedString); - System.out.println("========== formatted file =========="); - String formattedString = StringUtils.replace(formatted, "\r", "\\r"); - formattedString = StringUtils.replace(formattedString, "\n", "\\n"); - formattedString = StringUtils.replace(formattedString, "\t", "\\t"); - System.out.println(formattedString); - System.out.println("======================================="); - } - assertEquals(expected, formatted); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.afterDefaultFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.afterDefaultFormat.xml deleted file mode 100644 index 048388219..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.afterDefaultFormat.xml +++ /dev/null @@ -1,43 +0,0 @@ -<tag> - <t1></t1> - <t2></t2 - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2> - /t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - t2> - </t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2 - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2> - t3> - </t3> -</tag>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.xml deleted file mode 100644 index b9981e9c0..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/261968.xml +++ /dev/null @@ -1,36 +0,0 @@ -<tag> - <t1></t1> - <t2></t2 - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2>/t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - t2></t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2> - <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2 <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2 > <t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2 ><t3></t3> -</tag> -<tag> - <t1></t1> - <t2</t2 >t3></t3> -</tag>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.afterDefaultFormat.html b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.afterDefaultFormat.html deleted file mode 100644 index c313202a6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.afterDefaultFormat.html +++ /dev/null @@ -1,148 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<HTML> -<HEAD> -<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<META http-equiv="Content-Style-Type" content="text/css"> -<META name="GENERATOR" content="IBM WebSphere Studio"> -<TITLE>Page Hit Counter Introduction</TITLE> -<LINK rel="STYLESHEET" href="../theme/Master.css" type="text/css"> -</HEAD> -<BODY> - <CENTER> - <FORM name="myForm" method="post" - action="../Controllers/SampleController"> - <TABLE border="0" cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD colspan="2"><IMG src="../images/clearPixel.gif" width="1" - height="25" alt=""> - </TD> - </TR> - <TR> - <TD rowspan="2" align="LEFT" width="220" height="300"><IMG - src="../images/hitCounter01.gif" width="200" height="300" alt=""> - </TD> - <TD align="LEFT" width="380"> - <P> - <FONT size="+1"><B>Page Hit Counter Sample</B> - </FONT> - </P></TD> - </TR> - <TR> - <TD align="LEFT" valign="TOP"> - <P> - <FONT size="-1">This sample shows you how to use a Java - servlet to count how many times a page was visited.</FONT> - </P> - <P> - <FONT size="-1">This sample requires a database to store - the counter. If you have not already installed and configured - your database for the WebSphere samples, refer to <A - href="../Configuration/DBConfig.html">Database - Configuration</A> for instructions. </FONT> - </P> - <P> - <FONT size="-1"><A - href="javascript:document.myForm.submit()" target="_self"> - <B>Run this sample</B> - </A> </FONT> - </P> <INPUT name="command" type="hidden" value="HitCounterView" /> <INPUT - name="db_region" type="hidden" value="true" /> - </TD> - </TR> - </TABLE> - </FORM> - <BR> - <TABLE border="0" cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD align="CENTER"> - <P> - <B><FONT size="-1">How this sample works:</FONT> - </TD> - </TR> - <TR> - <TD> - <TABLE border="0" width="100%"> - <TBODY> - <TR> - <TD> - <!-- ############ horizontal spacer ############ --> <IMG - src="../images/clearPixel.gif" width="15" height="1" alt=""> - <!-- ########################################### --> - </TD> - <TD> - <P> - <FONT size="-1">This sample has:</FONT> - </P> - <UL> - <LI><FONT size="-1">A Java servlet that - increments a counter every time it is invoked </FONT> - <UL> - <LI><FONT size="-1">A Java Server Page (JSP) - that invokes the servlet and displays the counter </FONT> - <LI><FONT size="-1">A .servlet file that - provides information about the servlet to the WebSphere - Application Server </FONT> - </UL> - </UL> - <P> - <FONT size="-1">The Application Server processes .jsp - files with its JSP 1.0 processor servlet. It handles the - <jsp:include ... /> tag as a server-side include, - replacing the tag with the variable data generated by the - servlet.</FONT> - </P></TD> - <TD> - <!-- ############ horizontal spacer ############ --> <IMG - src="../images/clearPixel.gif" width="15" height="1" alt=""> - <!-- ########################################### --> - </TD> - </TBODY> - </TABLE></TD> - </TR> - </TBODY> - </TABLE> - <BR> - <TABLE border="0" cellpadding="0" cellspacing="0" width="500" - border="0" cellpadding="0" cellspacing="0" width="500" border="0" - cellpadding="0" cellspacing="0" width="500" border="0" - cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD align="CENTER"> - <P> - <B><FONT size="-1"> How to use this sample on your web - page:</FONT> - </B> - </P></TD> - </TR> - <TR> - <TD> - <TABLE border="0" width="100%"> - <TBODY> - <TR> - <TD> - <!-- ############ horizontal spacer ############ --> <IMG - src="../images/clearPixel.gif" width="15" height="1" alt=""> - <!-- ########################################### --> - </TD> - <TD> - <P> - <FONT size="-1">You can add this exact tag to any HTML - page you have on your site. Rename the HTML file with a .jsp - file extension, put the Java .class and .servlet files in - the classes folder, publish.... and you're ready to go.</FONT> - </P></TD> - <TD> - <!-- ############ horizontal spacer ############ --> <IMG - src="../images/clearPixel.gif" width="15" height="1" alt=""> - <!-- ########################################### --> - </TD> - </TR> - </TBODY> - </TABLE></TD> - </TR> - </TBODY> - </TABLE> -</HTML> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.html b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.html deleted file mode 100644 index cccca180a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/HitCounterIntro.html +++ /dev/null @@ -1,95 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<HTML> - <HEAD> -<META http-equiv -= -"Content-Type" -content="text/html; charset=ISO-8859-1"> -<META http-equiv="Content-Style-Type" content="text/css"> -<META name="GENERATOR" content="IBM WebSphere Studio"> -<TITLE>Page Hit Counter Introduction</TITLE> -<LINK rel="STYLESHEET" href="../theme/Master.css" type="text/css"> -</HEAD> -<BODY> -<CENTER> -<FORM name = "myForm" method="post" action="../Controllers/SampleController"> - <TABLE border="0" cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD colspan="2"> - <IMG src="../images/clearPixel.gif" width="1" height="25" alt=""></TD> - </TR> - <TR> - <TD rowspan="2" align="LEFT" width="220" height="300"><IMG src="../images/hitCounter01.gif" width="200" height="300" alt=""></TD> - <TD align="LEFT" width="380"> - <P><FONT size="+1"><B>Page Hit Counter Sample</B></FONT></P> - </TD> - </TR> - <TR> - <TD align="LEFT" valign="TOP"> - <P><FONT size="-1">This sample shows you how to use a Java servlet to count how many times a page was visited.</FONT></P> - <P><FONT size="-1">This sample requires a database to store the counter. If you have not already installed and configured your database for the WebSphere samples, refer to <A href="../Configuration/DBConfig.html">Database Configuration</A> for instructions. </FONT></P> - <P><FONT size="-1"><A href="javascript:document.myForm.submit()" target="_self"> <B>Run this sample</B></A> </FONT></P> - <INPUT name="command" type="hidden" value="HitCounterView" /> <INPUT name="db_region" type="hidden" value="true" /></TD> - </TR> -</TABLE> -</FORM> -<BR> -<TABLE border="0" cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD align="CENTER"> - <P><B><FONT size="-1">How this sample works:</FONT> - </TD> - </TR> - <TR> - <TD> - <TABLE border="0" width="100%"> - <TBODY> - <TR> - <TD><!-- ############ horizontal spacer ############ --> <IMG src="../images/clearPixel.gif" width="15" height="1" alt=""> <!-- ########################################### --></TD> - <TD> - <P><FONT size="-1">This sample has:</FONT></P> - <UL> - <LI><FONT size="-1">A Java servlet that increments a counter every time it is invoked </FONT> -<UL> - <LI><FONT size="-1">A Java Server Page (JSP) that invokes the servlet and displays the counter </FONT> - <LI><FONT size="-1">A .servlet file that provides information about the servlet to the WebSphere Application Server </FONT> -</UL> - </UL> - <P><FONT size="-1">The Application Server processes .jsp files with its JSP 1.0 processor servlet. It handles the <jsp:include ... /> tag as a server-side include, replacing the tag with the variable data generated by the servlet.</FONT></P> - </TD> - <TD><!-- ############ horizontal spacer ############ --> <IMG src="../images/clearPixel.gif" width="15" height="1" alt=""> <!-- ########################################### --></TD> - </TBODY> - </TABLE> - </TD> - </TR> - </TBODY> -</TABLE> -<BR> -<TABLE border="0" cellpadding="0" cellspacing="0" width="500" border="0" cellpadding="0" cellspacing="0" width="500" border="0" cellpadding="0" cellspacing="0" width="500" border="0" cellpadding="0" cellspacing="0" width="500"> - <TBODY> - <TR> - <TD align="CENTER"> - <P><B><FONT size="-1"> -How to use this sample on your web page:</FONT></B></P> - </TD> - </TR> - <TR> - <TD> - <TABLE border="0" width="100%"> - <TBODY> - <TR> - <TD><!-- ############ horizontal spacer ############ --> <IMG src="../images/clearPixel.gif" width="15" height="1" alt=""> <!-- ########################################### --></TD> - <TD> - <P><FONT size="-1">You can add this exact tag to any HTML page you have on your site. Rename the HTML file with a .jsp file extension, put the Java .class and .servlet files in the classes folder, publish.... and you're ready to go.</FONT></P> - </TD> - <TD><!-- ############ horizontal spacer ############ --> <IMG src="../images/clearPixel.gif" width="15" height="1" alt=""> <!-- ########################################### --></TD> - </TR> - </TBODY> - </TABLE> - </TD> - </TR> - </TBODY> - </TABLE> -</HTML> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.afterDefaultFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.afterDefaultFormat.xml deleted file mode 100644 index d7b841349..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.afterDefaultFormat.xml +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- comment on a new line --> -<menu date="11/30/2000"><!-- inline comment after tag --> - <rname>Liam's Chowder House and Grill</rname><!-- inline comment after tag --> - <!-- block comment - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF - --> - <!-- block comment - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF - --> - <item type="appetizer"> - <desc>Warmed leek salad</desc><!-- inline comment after tag --> - <price units="usd">6.95<!-- inline comment after text --></price> - <price units="usd" units="usd">6.95<!-- inline comment after text --></price> - </item> - <!-- comment on a new line --> - <!-- comment on a new line --> - <!--comment on a new line with no space--> - <!-- - No space - --> - <!-- - OneSpace - --> - <!-- - One tab - --> - <!-- - This is a long paragraph. - - The text - in this paragraph should NOT be re-flowed.--> - <!-- - This is a long paragraph. - - The text - in this paragraph should NOT be re-flowed. - --> - <!-- - This is a long paragraph. - - - The text - in this paragraph should NOT be re-flowed. - --> - <!-- - This is a long paragraph. - - - - The text - in this paragraph should NOT be re-flowed. - --> - <!-- - - This is a long paragraph. - - The text - in this paragraph should NOT be re-flowed. - --> - <!-- - - This is a long paragraph. - - The text - in this paragraph should NOT be re-flowed. - - --> - <!-- - - - - This is a long paragraph. - - - - The text - in this paragraph should NOT be re-flowed. - - - - --> - <item type="appetizer"> - <!-- a - b--> - <!-- a - b --> - <!-- - a - b--> - <!-- - a - b --> - <!-- - a - b - --> - <!-- a - b - --> - <!-- - - - - a - - - - b - - - - --> - <desc>Prosciutto ham with melon</desc> - <!-- this block comment should line up with the sibilings - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF - --> - <price units="usd">7.95</price> - <!-- comment before missing end tag --> -</menu>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.xml deleted file mode 100644 index 296987833..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/blockComments.xml +++ /dev/null @@ -1,127 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - <!-- comment on a new line --> - <menu date="11/30/2000"><!-- inline comment after tag --> - <rname>Liam's Chowder House and Grill</rname><!-- inline comment after tag --> - <!-- block comment - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF - --> - <!-- block comment - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF ---> - <item type="appetizer"> - <desc>Warmed leek salad</desc><!-- inline comment after tag --><price units="usd">6.95<!-- inline comment after text --></price><price units="usd" units="usd">6.95<!-- inline comment after text --></price> - </item> - <!-- comment on a new line --> - <!-- comment on a new line --> - <!--comment on a new line with no space--> -<!-- -No space ---> -<!-- - OneSpace ---> -<!-- - One tab ---> -<!-- -This is a long paragraph. - -The text -in this paragraph should NOT be re-flowed.--> -<!-- -This is a long paragraph. - -The text -in this paragraph should NOT be re-flowed. ---> -<!-- -This is a long paragraph. - - -The text -in this paragraph should NOT be re-flowed. ---> -<!-- -This is a long paragraph. - - - -The text -in this paragraph should NOT be re-flowed. ---> -<!-- - -This is a long paragraph. - -The text -in this paragraph should NOT be re-flowed. ---> -<!-- - -This is a long paragraph. - -The text -in this paragraph should NOT be re-flowed. - ---> -<!-- - - - -This is a long paragraph. - - - -The text -in this paragraph should NOT be re-flowed. - - - ---> - <item type="appetizer"> -<!-- a - b--> -<!-- a - b --> -<!-- -a - b--> -<!-- -a - b --> -<!-- -a - b ---> -<!-- a - b - --> -<!-- - - - -a - - - -b - - - ---> - <desc>Prosciutto ham with melon</desc> -<!-- this block comment should line up with the sibilings - Black = #000000 - Silver= #C0C0C0 - Gray = #808080 - White = #FFFFFF ---> - <price units="usd">7.95</price> - <!-- comment before missing end tag --> -</menu>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/chars.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/chars.xml deleted file mode 100644 index f2ba8f84a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/chars.xml +++ /dev/null @@ -1 +0,0 @@ -abc
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.afterCleanup.html b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.afterCleanup.html deleted file mode 100644 index 847d8d7c6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.afterCleanup.html +++ /dev/null @@ -1,143 +0,0 @@ -<HTML> -<HEAD> - <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> - <META name="GENERATOR" content="Mozilla/4.72 [en] (Windows NT 5.0; U) [Netscape]" /> -<TITLE></TITLE> -</HEAD> - -This is a page of some of the technical stuff that I've written using various -programming languages. Click on the links to learn more about the projects or -to see the source code.<BR> -<I>Note: Feel free to copy, steal, modify, destroy what you will...</I><BR><BR> -<HR> - -<H2> Programs and Utilities </H2> -<UL> -<LI><A href="makemake.html"> <I> Automatic -Makefile Utility: </I></A> This generates a Makefile and updates it according -to the files currently in your directory. -Take a gander at the source here: <A -href="makemake.c"> <I> makemake.c - </I></A> - -<BR><BR> -</LI><LI><A href="mailsort.pl" > <I> -mail file sorter: </I> </A> -This utility parses a mail file and creates another mail file containing only -the messages specified by paramaters. For example, parse a mail archive file -(old-mail-Jan-2000) and extract all of the messages from davek@yourmom.com or -with the subject Marillion. This guy was whipped up in Perl. -<BR><BR> - -</LI><LI><A href="electronicNotes.html" > <I> -Electronic Notes: </I> </A> This is an original idea (gasp!) that I developed which is a -system for keeping little reminders to yourself during the day and having them -sent to you all in one convenient file via email at the end of the day. -<BR><BR> - -</LI><LI><A href="header.html" > <I> C/C++ Header file -to Implementation file converter: </I> </A> -This is a very useful tool written in C++ that converts .h files to empty -implementation (.C) files. -<BR><BR> -</LI><LI><A href="matrix.html" > <I> Matrix Manipulation -Package: </I></A> This is a package that does all sorts of cool manipulations -with matrices, such as Gaussian Elimination, Normal Equations, Vandermonde -Matrices, Cholesky Factorization, Error Analysis, and more stuff than you would -ever want to do with a matrix. It is written in good ol' C. - -<BR ><BR > -</LI><LI> -<A href="lisp.html" > <I>Set Operations: </I></A> <I></I> A program that performs set -operations on a list. This is written in Lisp, of all things. There's also -some examples of my own interpretations of some Lisp functions. Lisp is a good -language for AI and things of that nature. -It relies heavily on recursion, so it takes a different -mindset to program in this language. But used correctly and for its intended -purpose, Lisp is a very unique and powerful programming language. -<BR ><BR > - -</LI><LI> -<A href="loc.html" > <I> Lines Of Code Counter: -</I></A><I></I> This is is LOC counter that I wrote in Perl that calculates the number of -uncommented lines of code in a program. This works for any programming -language as you can supply the comment character on the command line. This is -an extremely useful program for use in software metrics. -<BR abc="def"><BR abc="def" > - -</LI><LI><A href="linwin.html"> <I> Simple *nix to -windows text converter </I></A> This takes files written in Linux (and in vi or - an editor with automatic line breaks after every 80 or so chars) and -formats it so it will display properly in Windows environment should you be -forced to do so. -Peruse (peruse, mind you. I don't want to see any <I>browsing</I>) the source here: <A -href="linwin.c"> <I> linwin.c - </I></A> -<BR abc = "def"><BR abc = "def"> - - -</LI><LI><B> Regression and Standard Deviation: </B> -A math class written in Java using Object Oriented design principles. The main -aspects of the program are for figuring out Standard Deviation and the -Regression, when you input a set of x and y values. Regression calculations -are often used in Software Metrics to to help in estimating length of code, and -time spent on the project.<BR> - -<A href="RegressionCalc.html" > -<I> RegressionCalc.java </I> </A> This is the main class that does the -calculations. It calculates B1, B0, and r^2, which are all parameters of -Regression. -<BR abc= "def"> -<A href="MathClass.html" > -<I> MathClass.java </I> </A> This is simply a small class which calculates the -mean and the standard deviation of a vector of numbers. This is used by the -RegressionCalc class in its calculations. -<BR abc ="def"> -<A href="Regression.html" > -<I> Regression.java </I> </A> This is basically the main routine, or where the -program starts. It puts all of the input from the command line into two -separate vectors for the x and y values.<BR><BR> - -An example of the usage of this program would be: <BR> -If you had a history of data on your estimated Lines Of Code (LOC) per class, -as well as the actual LOC per class, you could put these in the formula and -find out the Regression of the data (or how far away each point is from the -function line.) - -You would input the data for the estimated LOC, separated by a comma, and -followed by the actual LOC. The result would be the regression calculation. -<PRE> -%java Regression 130 650 99 150 , 186 699 132 272 - -X Data = [ 130.0 650.0 99.0 150.0 ] -Y Data = [ 186.0 699.0 132.0 272.0 ] -N = 4 -Beta0 = 72.6905030780361 -Beta1 = 0.9701049443030667 -rSquared = 2212.504697673689 -</PRE> - -</LI></UL> - -<HR> -<H2> Knowledge </H2> -<UL> -<LI><A href="vim.html"> <I> Espousing my love -for vim! </I></A> vim just rocks, okay. Really. If I had to choose between, -like, sex, or using vim--let's just say I'd be one masterful-editing monk. -<BR><BR> - - -</LI><LI> -<A href="MBR-LILO.txt"> -<I> Lost LILO? Recover.</I> </A> If you have Linux installed in a multi-boot -environment, and you overwrite your MBR, you can lose LILO. I reinstalled -Windows (hey, I needed to play Final Fantasy VIII!) and couldn't boot into -Linux. Here's how I recovered. -<BR><BR> - - - -</LI></UL><BODY></BODY> -</HTML><HTML> -</HTML>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.html b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.html deleted file mode 100644 index 0b97a0020..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/cleanup.html +++ /dev/null @@ -1,142 +0,0 @@ -<html> -<HEAD> - <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> - <META name="GENERATOR" content="Mozilla/4.72 [en] (Windows NT 5.0; U) [Netscape]" /> -<TITLE></TITLE> -</HEAD> - -This is a page of some of the technical stuff that I've written using various -programming languages. Click on the links to learn more about the projects or -to see the source code.<BR> -<I>Note: Feel free to copy, steal, modify, destroy what you will...</I><BR><BR> -<HR> - -<H2> Programs and Utilities </H2> -<UL> -<LI><A href="makemake.html"> <I> Automatic -Makefile Utility: </I></A> This generates a Makefile and updates it according -to the files currently in your directory. -Take a gander at the source here: <A -href="makemake.c"> <I> makemake.c - </I></A> - -<br><BR> -</LI><LI><A href="mailsort.pl" > <I> -mail file sorter: </I> </A> -This utility parses a mail file and creates another mail file containing only -the messages specified by paramaters. For example, parse a mail archive file -(old-mail-Jan-2000) and extract all of the messages from davek@yourmom.com or -with the subject Marillion. This guy was whipped up in Perl. -<BR><br> - -</LI><LI><A href="electronicNotes.html" > <I> -Electronic Notes: </I> </A> This is an original idea (gasp!) that I developed which is a -system for keeping little reminders to yourself during the day and having them -sent to you all in one convenient file via email at the end of the day. -<br><br> - -</LI><LI><A href="header.html" > <I> C/C++ Header file -to Implementation file converter: </I> </A> -This is a very useful tool written in C++ that converts .h files to empty -implementation (.C) files. -<BR><BR> -</LI><LI><A href="matrix.html" > <I> Matrix Manipulation -Package: </I></A> This is a package that does all sorts of cool manipulations -with matrices, such as Gaussian Elimination, Normal Equations, Vandermonde -Matrices, Cholesky Factorization, Error Analysis, and more stuff than you would -ever want to do with a matrix. It is written in good ol' C. - -<BR ><BR > -</LI><LI> -<A href="lisp.html" > <I>Set Operations: </I></A> <I></I> A program that performs set -operations on a list. This is written in Lisp, of all things. There's also -some examples of my own interpretations of some Lisp functions. Lisp is a good -language for AI and things of that nature. -It relies heavily on recursion, so it takes a different -mindset to program in this language. But used correctly and for its intended -purpose, Lisp is a very unique and powerful programming language. -<BR ><BR > - -</LI><LI> -<A href="loc.html" > <I> Lines Of Code Counter: -</I></A><I></I> This is is LOC counter that I wrote in Perl that calculates the number of -uncommented lines of code in a program. This works for any programming -language as you can supply the comment character on the command line. This is -an extremely useful program for use in software metrics. -<BR abc="def"><BR abc="def" > - -</LI><LI><A href="linwin.html"> <I> Simple *nix to -windows text converter </I></A> This takes files written in Linux (and in vi or - an editor with automatic line breaks after every 80 or so chars) and -formats it so it will display properly in Windows environment should you be -forced to do so. -Peruse (peruse, mind you. I don't want to see any <I>browsing</I>) the source here: <A -href="linwin.c"> <I> linwin.c - </I></A> -<BR abc = "def"><BR abc = "def"> - - -</LI><LI><B> Regression and Standard Deviation: </B> -A math class written in Java using Object Oriented design principles. The main -aspects of the program are for figuring out Standard Deviation and the -Regression, when you input a set of x and y values. Regression calculations -are often used in Software Metrics to to help in estimating length of code, and -time spent on the project.<BR> - -<A href="RegressionCalc.html" > -<I> RegressionCalc.java </I> </A> This is the main class that does the -calculations. It calculates B1, B0, and r^2, which are all parameters of -Regression. -<BR abc= "def"> -<A href="MathClass.html" > -<I> MathClass.java </I> </A> This is simply a small class which calculates the -mean and the standard deviation of a vector of numbers. This is used by the -RegressionCalc class in its calculations. -<BR abc ="def"> -<A href="Regression.html" > -<I> Regression.java </I> </A> This is basically the main routine, or where the -program starts. It puts all of the input from the command line into two -separate vectors for the x and y values.<BR><BR> - -An example of the usage of this program would be: <BR> -If you had a history of data on your estimated Lines Of Code (LOC) per class, -as well as the actual LOC per class, you could put these in the formula and -find out the Regression of the data (or how far away each point is from the -function line.) - -You would input the data for the estimated LOC, separated by a comma, and -followed by the actual LOC. The result would be the regression calculation. -<PRE> -%java Regression 130 650 99 150 , 186 699 132 272 - -X Data = [ 130.0 650.0 99.0 150.0 ] -Y Data = [ 186.0 699.0 132.0 272.0 ] -N = 4 -Beta0 = 72.6905030780361 -Beta1 = 0.9701049443030667 -rSquared = 2212.504697673689 -</PRE> - -</LI></UL> - -<HR> -<H2> Knowledge </H2> -<UL> -<LI><A href="vim.html"> <I> Espousing my love -for vim! </I></A> vim just rocks, okay. Really. If I had to choose between, -like, sex, or using vim--let's just say I'd be one masterful-editing monk. -<BR><BR> - - -</LI><LI> -<A href="MBR-LILO.txt"> -<I> Lost LILO? Recover.</I> </A> If you have Linux installed in a multi-boot -environment, and you overwrite your MBR, you can lose LILO. I reinstalled -Windows (hey, I needed to play Final Fantasy VIII!) and couldn't boot into -Linux. Here's how I recovered. -<BR><BR> - - - -</LI></UL></body> -<html> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/empty.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/empty.xml deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/empty.xml +++ /dev/null diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterDefaultFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterDefaultFormat.xml deleted file mode 100644 index 9322d4bea..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterDefaultFormat.xml +++ /dev/null @@ -1,35 +0,0 @@ -<root> - <desc>Warmed leek salad</desc><!-- inline comment after tag --> - <desc>Warmed leek salad</desc><!-- inline comment after text --> - <price units="usd">6.95<!-- inline comment after text --></price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price units="usd" units="usd">6.95<!-- inline comment after text --></price> - <price units="usd" units="usd">6.95<!-- inline comment after text and followed by text --> - dollars - </price> - <price units="usd" units="usd"> - <number /><!-- inline comment after tag --> - <unit /> - </price> - <price> - <number /><!-- inline comment after tag --> - <unit /> - </price> - <price> - <number /> - <!-- comment on a new line --> - <unit /> - </price> - <price><!-- inline comment --></price> - <th> - <b>Fahrenheit<!-- testing --></b> - </th> -</root>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterSplitLinesSplitMultiAttrsFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterSplitLinesSplitMultiAttrsFormat.xml deleted file mode 100644 index 7fddaf5e6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.afterSplitLinesSplitMultiAttrsFormat.xml +++ /dev/null @@ -1,44 +0,0 @@ -<root> - <desc>Warmed leek salad</desc><!-- inline comment after tag --> - <desc>Warmed leek salad</desc><!-- inline comment after text --> - <price units="usd">6.95<!-- inline comment after text --></price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price units="usd"> - <number /><!-- inline comment after tag --> - </price> - <price - units="usd" - units="usd"> - 6.95<!-- inline comment after text --> - </price> - <price - units="usd" - units="usd"> - 6.95<!-- inline comment after text and followed by text --> - dollars - </price> - <price - units="usd" - units="usd"> - <number /><!-- inline comment after tag --> - <unit /> - </price> - <price> - <number /><!-- inline comment after tag --> - <unit /> - </price> - <price> - <number /> - <!-- comment on a new line --> - <unit /> - </price> - <price><!-- inline comment --></price> - <th> - <b>Fahrenheit<!-- testing --></b> - </th> -</root>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.xml deleted file mode 100644 index 71a11bcf4..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/inlineComments.xml +++ /dev/null @@ -1,15 +0,0 @@ -<root><desc>Warmed leek salad</desc><!-- inline comment after tag --> -<desc>Warmed leek salad</desc> <!-- inline comment after text --> -<price units="usd">6.95<!-- inline comment after text --></price> -<price units="usd"><number/><!-- inline comment after tag --></price> -<price units="usd"><number/> <!-- inline comment after tag --></price> -<price units="usd"> <number/><!-- inline comment after tag --></price> -<price units="usd" units="usd">6.95<!-- inline comment after text --></price> -<price units="usd" units="usd">6.95<!-- inline comment after text and followed by text -->dollars</price> -<price units="usd" units="usd"><number/><!-- inline comment after tag --><unit/></price> -<price><number/><!-- inline comment after tag --><unit/></price> -<price><number/> -<!-- comment on a new line --><unit/></price> -<price><!-- inline comment --></price> -<th><b>Fahrenheit <!-- testing --></b></th> -</root>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTags.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTags.xml deleted file mode 100644 index 012c982d9..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTags.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE Invoice PUBLIC "InvoiceId" "Invoice.dtd" > -<Invoice> - <Header invoiceNumber=12345> - <Date> - <Month>July</Month> - <Day>15</Day> - <Year>2001 - </Year></Date> - <BillTo custNumber=/> - <BillTo custNumber= /> - <BillTo custNumber =/> - <BillTo custNumber = /> - <BillTo custNumber name=Craig phone = 416-448-4414 /> - <BillTo custNumber = X5739 name phone = 416-448-4414 /> - <BillTo custNumber = X5739 name = Craig phone/> - <BillTo custNumber name phone/> - <BillTo custNumber = X5739 name="Craig Salter" phone=416-448-4414> - <Address> - <street1>IBM</street1> - <street2>1150 Eglinton Ave East</street2> - <city>Toronto</city> - <state>Ontario</state> - <zip>M3C 1H7</zip> - <country>Canada - </country></Address></BillTo></Header> - <Item discount=promotion price=57> - <description>A wedding ring</description></Item></Invoice>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTagsQuoteAttrs.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTagsQuoteAttrs.xml deleted file mode 100644 index 557812da0..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.afterCleanupInsertTagsQuoteAttrs.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE Invoice PUBLIC "InvoiceId" "Invoice.dtd" > -<Invoice> - <Header invoiceNumber="12345"> - <Date> - <Month>July</Month> - <Day>15</Day> - <Year>2001 - </Year></Date> - <BillTo custNumber="custNumber"/> - <BillTo custNumber= "custNumber"/> - <BillTo custNumber ="custNumber"/> - <BillTo custNumber = "custNumber"/> - <BillTo custNumber="custNumber" name="Craig" phone = "416-448-4414" /> - <BillTo custNumber = "X5739" name="name" phone = "416-448-4414" /> - <BillTo custNumber = "X5739" name = "Craig" phone="phone"/> - <BillTo custNumber="custNumber" name="name" phone="phone"/> - <BillTo custNumber = "X5739" name="Craig Salter" phone="416-448-4414"> - <Address> - <street1>IBM</street1> - <street2>1150 Eglinton Ave East</street2> - <city>Toronto</city> - <state>Ontario</state> - <zip>M3C 1H7</zip> - <country>Canada - </country></Address></BillTo></Header> - <Item discount="promotion" price="57"> - <description>A wedding ring</description></Item></Invoice>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.xml deleted file mode 100644 index 88a26b59f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/invoice.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE Invoice PUBLIC "InvoiceId" "Invoice.dtd" > -<Invoice> - <Header invoiceNumber=12345> - <Date> - <Month>July</Month> - <Day>15</Day> - <Year>2001 - </Date> - <BillTo custNumber=/> - <BillTo custNumber= /> - <BillTo custNumber =/> - <BillTo custNumber = /> - <BillTo custNumber name=Craig phone = 416-448-4414 /> - <BillTo custNumber = X5739 name phone = 416-448-4414 /> - <BillTo custNumber = X5739 name = Craig phone/> - <BillTo custNumber name phone/> - <BillTo custNumber = X5739 name="Craig Salter" phone=416-448-4414> - <Address> - <street1>IBM</street1> - <street2>1150 Eglinton Ave East</street2> - <city>Toronto</city> - <state>Ontario</state> - <zip>M3C 1H7</zip> - <country>Canada - </Header> - <Item discount=promotion price=57> - <description>A wedding ring
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.afterCleanup.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.afterCleanup.jsp deleted file mode 100644 index 7e906c976..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.afterCleanup.jsp +++ /dev/null @@ -1,54 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<HTML>
-<HEAD>
-<TITLE>Login</TITLE>
-<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
-</HEAD>
-<BODY bgcolor="#ffffcc">
-<SCRIPT>
- function submitForm(dest){
- document.myForm.action = dest
- document.myForm.submit()
- }
- </SCRIPT>
-<CENTER>
-<H1>Database Connectivity</H1>
-<HR>
-</CENTER>
-<P>Enter the username & password to connect to the database.<BR>
-This username & password should be the one used while creating the
-database.</P>
-<% if(session.getAttribute("error_message") != null) { %>
-<P>* Incorrect Login or Password</P>
-<% session.removeAttribute("error_message");
- } %>
-<FORM name="myForm" method="POST" action="../Login/LogonServlet"><INPUT
- type="hidden" name="command"
- value='<%=session.getAttribute("final_page") %>'> <INPUT type="hidden"
- name="previous_page" value="Login/Login.jsp"> <A
- href="javascript:submitForm('../Login/LogonServlet')">OK</A>
-<TABLE border="0">
- <TBODY>
- <TR>
- <TD><FONT color="#993333"> username: </FONT></TD>
- <TD><INPUT name="userID" type="text" size="30" maxlength="40"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> password: </FONT></TD>
- <TD><INPUT name="password" type="password" size="30" maxlength="40"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> drivername: </FONT></TD>
- <TD><INPUT name="driver" type="text" size="30" maxlength="40"
- value="COM.ibm.db2.jdbc.app.DB2Driver"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> url: </FONT></TD>
- <TD><INPUT name="url" type="text" size="30" maxlength="40"
- value="jdbc:db2:WSSAMPLE"></TD>
- </TR>
- </TBODY>
-</TABLE>
-</FORM>
-</BODY>
-</HTML>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.jsp deleted file mode 100644 index 439a67bd8..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/login.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<HTML>
-<HEAD>
-<TITLE>Login</TITLE>
-<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
-</HEAD>
-<BODY bgcolor="#ffffcc">
-<SCRIPT>
- function submitForm(dest){
- document.myForm.action = dest
- document.myForm.submit()
- }
- </SCRIPT>
-<CENTER>
-<H1>Database Connectivity</H1>
-<HR>
-</CENTER>
-<P>Enter the username & password to connect to the database.<BR>
-This username & password should be the one used while creating the database.</P>
-<% if(session.getAttribute("error_message") != null) { %>
-<P>* Incorrect Login or Password</P>
-<% session.removeAttribute("error_message");
- } %>
-<FORM name="myForm" method="POST" action="../Login/LogonServlet"><INPUT type="hidden" name="command" value='<%=session.getAttribute("final_page") %>'> <INPUT type="hidden" name="previous_page" value="Login/Login.jsp"> <A href="javascript:submitForm('../Login/LogonServlet')">OK</A>
-<TABLE border="0">
- <TBODY>
- <TR>
- <TD><FONT color="#993333"> username: </FONT></TD>
- <TD><INPUT name="userID" type="text" size="30" maxlength="40"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> password: </FONT></TD>
- <TD><INPUT name="password" type="password" size="30" maxlength="40"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> drivername: </FONT></TD>
- <TD><INPUT name="driver" type="text" size="30" maxlength="40" value="COM.ibm.db2.jdbc.app.DB2Driver"></TD>
- </TR>
- <TR>
- <TD><FONT color="#993333"> url: </FONT></TD>
- <TD><INPUT name="url" type="text" size="30" maxlength="40" value="jdbc:db2:WSSAMPLE"></TD>
- </TR>
- </TBODY>
-</TABLE>
-</FORM>
-</BODY>
-</HTML>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneChar.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneChar.xml deleted file mode 100644 index 2e65efe2a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneChar.xml +++ /dev/null @@ -1 +0,0 @@ -a
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneSpace.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneSpace.xml deleted file mode 100644 index 0519ecba6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/oneSpace.xml +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterCompressEmptyElementTags.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterCompressEmptyElementTags.xml deleted file mode 100644 index bba9c7fd6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterCompressEmptyElementTags.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion /> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion /> - </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1" /> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1" /> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.metamodel xmi.name="UML" xmi.version="1.1" /> - </XMI.header> - - <XMI.content> - <Model_Management.Package xmi.id="_1" xmi.uuid="Name:ejb"> - <Foundation.Core.ModelElement.name> - ejb - </Foundation.Core.ModelElement.name> - <Foundation.Core.ModelElement.visibility xmi.value="public" /> - <XMI.extension xmi.extender="IXT" xmi.extenderID=""> - <ixts s="IDL"> - <ixttv t="uuid" - v="DCE:d8a25660-8826-11e1-0000-005d9e6adec4:1" /> - </ixts> - <ixts s="Rose"> - <ixttv t="quid" v="3780E272032D" /> - <ixttv t="is_unit" v="TRUE" /> - <ixttv t="file_name" - v=""$ECLIPSE_RESOURCES\\eTools EJB libraries\\ejbschema.cat"" /> - <ixttv t="is_loaded" v="TRUE" /> - </ixts> - <ixts s="RosePetal"> - <ixttv t="charSet" v="0" /> - <ixttv t="version" v="43" /> - <ixttv t="_written" v=""Rose 6.5.9232.10"" /> - </ixts> - </XMI.extension> - </Model_Management.Package> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterDefaultFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterDefaultFormat.xml deleted file mode 100644 index 4d66ba3c0..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterDefaultFormat.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1">1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1">1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.metamodel xmi.name="UML" xmi.version="1.1" /> - </XMI.header> - - <XMI.content> - <Model_Management.Package xmi.id="_1" xmi.uuid="Name:ejb"> - <Foundation.Core.ModelElement.name>ejb</Foundation.Core.ModelElement.name> - <Foundation.Core.ModelElement.visibility xmi.value="public" /> - <XMI.extension xmi.extender="IXT" xmi.extenderID=""> - <ixts s="IDL"> - <ixttv t="uuid" v="DCE:d8a25660-8826-11e1-0000-005d9e6adec4:1" /> - </ixts> - <ixts s="Rose"> - <ixttv t="quid" v="3780E272032D" /> - <ixttv t="is_unit" v="TRUE" /> - <ixttv t="file_name" v=""$ECLIPSE_RESOURCES\\eTools EJB libraries\\ejbschema.cat"" /> - <ixttv t="is_loaded" v="TRUE" /> - </ixts> - <ixts s="RosePetal"> - <ixttv t="charSet" v="0" /> - <ixttv t="version" v="43" /> - <ixttv t="_written" v=""Rose 6.5.9232.10"" /> - </ixts> - </XMI.extension> - </Model_Management.Package> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesFormat.xml deleted file mode 100644 index a708f6e15..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesFormat.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.metamodel xmi.name="UML" xmi.version="1.1" /> - </XMI.header> - - <XMI.content> - <Model_Management.Package xmi.id="_1" xmi.uuid="Name:ejb"> - <Foundation.Core.ModelElement.name> - ejb - </Foundation.Core.ModelElement.name> - <Foundation.Core.ModelElement.visibility xmi.value="public" /> - <XMI.extension xmi.extender="IXT" xmi.extenderID=""> - <ixts s="IDL"> - <ixttv t="uuid" - v="DCE:d8a25660-8826-11e1-0000-005d9e6adec4:1" /> - </ixts> - <ixts s="Rose"> - <ixttv t="quid" v="3780E272032D" /> - <ixttv t="is_unit" v="TRUE" /> - <ixttv t="file_name" - v=""$ECLIPSE_RESOURCES\\eTools EJB libraries\\ejbschema.cat"" /> - <ixttv t="is_loaded" v="TRUE" /> - </ixts> - <ixts s="RosePetal"> - <ixttv t="charSet" v="0" /> - <ixttv t="version" v="43" /> - <ixttv t="_written" v=""Rose 6.5.9232.10"" /> - </ixts> - </XMI.extension> - </Model_Management.Package> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesSplitMultiAttrsFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesSplitMultiAttrsFormat.xml deleted file mode 100644 index ee5bbf2cc..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.afterSplitLinesSplitMultiAttrsFormat.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI - xmi.version="1.0" - timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion - xmi.name="UML" - xmi.version="1.1"> - </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion - xmi.name="UML" - xmi.version="1.1"> - </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion - xmi.name="UML" - xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion - xmi.name="UML" - xmi.version="1.1"> - 1.05 - </XMI.exporterVersion> - </XMI.documentation> - <XMI.metamodel - xmi.name="UML" - xmi.version="1.1" /> - </XMI.header> - - <XMI.content> - <Model_Management.Package - xmi.id="_1" - xmi.uuid="Name:ejb"> - <Foundation.Core.ModelElement.name> - ejb - </Foundation.Core.ModelElement.name> - <Foundation.Core.ModelElement.visibility xmi.value="public" /> - <XMI.extension - xmi.extender="IXT" - xmi.extenderID=""> - <ixts s="IDL"> - <ixttv - t="uuid" - v="DCE:d8a25660-8826-11e1-0000-005d9e6adec4:1" /> - </ixts> - <ixts s="Rose"> - <ixttv - t="quid" - v="3780E272032D" /> - <ixttv - t="is_unit" - v="TRUE" /> - <ixttv - t="file_name" - v=""$ECLIPSE_RESOURCES\\eTools EJB libraries\\ejbschema.cat"" /> - <ixttv - t="is_loaded" - v="TRUE" /> - </ixts> - <ixts s="RosePetal"> - <ixttv - t="charSet" - v="0" /> - <ixttv - t="version" - v="43" /> - <ixttv - t="_written" - v=""Rose 6.5.9232.10"" /> - </ixts> - </XMI.extension> - </Model_Management.Package> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.xml deleted file mode 100644 index 6295d5cc0..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter> - XMI Toolkit - </XMI.exporter> - - <XMI.exporterVersion> 1.05 </XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion> 1.05 </XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion> 1.05 </XMI.exporterVersion> </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"></XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"></XMI.exporterVersion> </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"> 1.05 </XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"> 1.05 </XMI.exporterVersion> </XMI.documentation> - <XMI.metamodel xmi.name = "UML" xmi.version - = - "1.1" /> - </XMI.header> - - <XMI.content> - <Model_Management.Package - xmi.id="_1" xmi.uuid="Name:ejb"> - <Foundation.Core.ModelElement.name>ejb </Foundation.Core.ModelElement.name> - <Foundation.Core.ModelElement.visibility xmi.value="public"/> - <XMI.extension xmi.extender="IXT" xmi.extenderID=""> - <ixts s="IDL"> - <ixttv t="uuid" v="DCE:d8a25660-8826-11e1-0000-005d9e6adec4:1" - /> - </ixts> - <ixts s="Rose"> - <ixttv - t="quid" - v="3780E272032D" - /> - <ixttv - t="is_unit" - v="TRUE" - /> - <ixttv t="file_name" - v=""$ECLIPSE_RESOURCES\\eTools EJB libraries\\ejbschema.cat"" - /> - <ixttv t="is_loaded" v="TRUE" /> - </ixts> - <ixts s="RosePetal"> - <ixttv t="charSet" v="0" /> - <ixttv t="version" v="43" /> - <ixttv t="_written" v=""Rose 6.5.9232.10"" /></ixts></XMI.extension> - </Model_Management.Package> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.afterCompressEmptyElementTags-newfmt.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.afterCompressEmptyElementTags-newfmt.xml deleted file mode 100644 index 8a49f9e88..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.afterCompressEmptyElementTags-newfmt.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion /> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion /> - </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1" /> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name="UML" xmi.version="1.1" /> - </XMI.documentation> - <XMI.metamodel xmi.name="UML" xmi.version="1.1" /> - </XMI.header> - <XMI.content /> -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.xml deleted file mode 100644 index 7b9be5a14..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/small2.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<XMI xmi.version="1.0" timestamp="Tue Nov 28 08:19:21 EST 2000"> - - <XMI.header> - <XMI.documentation> - <XMI.exporter>XMI Toolkit</XMI.exporter> - - <XMI.exporterVersion>1.05</XMI.exporterVersion> - </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion></XMI.exporterVersion> </XMI.documentation> - <XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion>1.05</XMI.exporterVersion> </XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"></XMI.exporterVersion></XMI.documentation> - <XMI.documentation> - <XMI.exporterVersion xmi.name = "UML" xmi.version = "1.1"></XMI.exporterVersion> </XMI.documentation> - <XMI.metamodel xmi.name = "UML" xmi.version - = - "1.1" /> - </XMI.header> - - <XMI.content> - </XMI.content> - -</XMI>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spaces.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spaces.xml deleted file mode 100644 index 01ad2f9a6..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spaces.xml +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spacesAndChars.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spacesAndChars.xml deleted file mode 100644 index 9c04eb569..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/spacesAndChars.xml +++ /dev/null @@ -1 +0,0 @@ - abc
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.afterCleanup.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.afterCleanup.jsp deleted file mode 100644 index 8c57fd0f8..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.afterCleanup.jsp +++ /dev/null @@ -1,112 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java"%>
-<%@ taglib uri="/WEB-INF/app.tld" prefix="app"%>
-<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
-<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
-<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
-<app:checkLogon />
-
-<%-- In real life, these would be loaded from a database --%>
-<%
- java.util.ArrayList list = new java.util.ArrayList();
- list.add(new org.apache.struts.util.LabelValueBean("IMAP Protocol", "imap"));
- list.add(new org.apache.struts.util.LabelValueBean("POP3 Protocol", "pop3"));
- pageContext.setAttribute("serverTypes", list);
-%>
-
-<html:html>
-<HEAD>
-<logic:equal name="subscriptionForm" property="action" scope="request"
- value="Create">
- <TITLE><bean:message key="subscription.title.create" /></TITLE>
-</logic:equal>
-<logic:equal name="subscriptionForm" property="action" scope="request"
- value="Delete">
- <TITLE><bean:message key="subscription.title.delete" /></TITLE>
-</logic:equal>
-<logic:equal name="subscriptionForm" property="action" scope="request"
- value="Edit">
- <TITLE><bean:message key="subscription.title.edit" /></TITLE>
-</logic:equal>
-<html:base />
-</HEAD>
-<BODY bgcolor="white">
-
-<html:errors />
-
-<html:form action="/saveSubscription" focus="host">
- <html:hidden property="action" />
- <TABLE border="0" width="100%">
-
- <TR>
- <TH align="right"><bean:message key="prompt.username" />:</TH>
- <TD align="left"><bean:write name="user" property="username"
- filter="true" /></TD>
- </TR>
-
- <TR>
- <TH align="right"><bean:message key="prompt.mailHostname" />:</TH>
- <TD align="left"><logic:equal name="subscriptionForm"
- property="action" scope="request" value="Create">
- <html:text property="host" size="50" />
- </logic:equal> <logic:notEqual name="subscriptionForm"
- property="action" scope="request" value="Create">
- <html:hidden property="host" write="true" />
- </logic:notEqual></TD>
- </TR>
-
- <TR>
- <TH align="right"><bean:message key="prompt.mailUsername" />:</TH>
- <TD align="left"><html:text property="username" size="50" /></TD>
- </TR>
-
- <TR>
- <TH align="right"><bean:message key="prompt.mailPassword" />:</TH>
- <TD align="left"><html:password property="password" size="50" /></TD>
- </TR>
-
- <TR>
- <TH align="right"><bean:message key="prompt.mailServerType" />:</TH>
- <TD align="left"><html:select property="type">
- <html:options collection="serverTypes" property="value"
- labelProperty="label" />
- </html:select></TD>
- </TR>
-
- <TR>
- <TH align="right"><bean:message key="prompt.autoConnect" />:</TH>
- <TD align="left"><html:checkbox property="autoConnect" /></TD>
- </TR>
-
- <TR>
- <TD align="right"><logic:equal name="subscriptionForm"
- property="action" scope="request" value="Create">
- <html:submit>
- <bean:message key="button.save" />
- </html:submit>
- </logic:equal> <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Delete">
- <html:submit>
- <bean:message key="button.confirm" />
- </html:submit>
- </logic:equal> <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Edit">
- <html:submit>
- <bean:message key="button.save" />
- </html:submit>
- </logic:equal></TD>
- <TD align="left"><logic:notEqual name="subscriptionForm"
- property="action" scope="request" value="Delete">
- <html:reset>
- <bean:message key="button.reset" />
- </html:reset>
- </logic:notEqual> <html:cancel>
- <bean:message key="button.cancel" />
- </html:cancel></TD>
- </TR>
-
- </TABLE>
-
-</html:form>
-
-</BODY>
-</html:html>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.jsp deleted file mode 100644 index 20bf3ea48..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/subscription.jsp +++ /dev/null @@ -1,144 +0,0 @@ -<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %>
-<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
-<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
-<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
-<app:checkLogon/>
-
-<%-- In real life, these would be loaded from a database --%>
-<%
- java.util.ArrayList list = new java.util.ArrayList();
- list.add(new org.apache.struts.util.LabelValueBean("IMAP Protocol", "imap"));
- list.add(new org.apache.struts.util.LabelValueBean("POP3 Protocol", "pop3"));
- pageContext.setAttribute("serverTypes", list);
-%>
-
-<html:html>
-<head>
-<logic:equal name="subscriptionForm" property="action"
- scope="request" value="Create">
- <title><bean:message key="subscription.title.create"/></title>
-</logic:equal>
-<logic:equal name="subscriptionForm" property="action"
- scope="request" value="Delete">
- <title><bean:message key="subscription.title.delete"/></title>
-</logic:equal>
-<logic:equal name="subscriptionForm" property="action"
- scope="request" value="Edit">
- <title><bean:message key="subscription.title.edit"/></title>
-</logic:equal>
-<html:base/>
-</head>
-<body bgcolor="white">
-
-<html:errors/>
-
-<html:form action="/saveSubscription" focus="host">
-<html:hidden property="action"/>
-<table border="0" width="100%">
-
- <tr>
- <th align="right">
- <bean:message key="prompt.username"/>:
- </th>
- <td align="left">
- <bean:write name="user" property="username" filter="true"/>
- </td>
- </tr>
-
- <tr>
- <th align="right">
- <bean:message key="prompt.mailHostname"/>:
- </th>
- <td align="left">
- <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Create">
- <html:text property="host" size="50"/>
- </logic:equal>
- <logic:notEqual name="subscriptionForm" property="action"
- scope="request" value="Create">
- <html:hidden property="host" write="true"/>
- </logic:notEqual>
- </td>
- </tr>
-
- <tr>
- <th align="right">
- <bean:message key="prompt.mailUsername"/>:
- </th>
- <td align="left">
- <html:text property="username" size="50"/>
- </td>
- </tr>
-
- <tr>
- <th align="right">
- <bean:message key="prompt.mailPassword"/>:
- </th>
- <td align="left">
- <html:password property="password" size="50"/>
- </td>
- </tr>
-
- <tr>
- <th align="right">
- <bean:message key="prompt.mailServerType"/>:
- </th>
- <td align="left">
- <html:select property="type">
- <html:options collection="serverTypes" property="value"
- labelProperty="label"/>
- </html:select>
- </td>
- </tr>
-
- <tr>
- <th align="right">
- <bean:message key="prompt.autoConnect"/>:
- </th>
- <td align="left">
- <html:checkbox property="autoConnect"/>
- </td>
- </tr>
-
- <tr>
- <td align="right">
- <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Create">
- <html:submit>
- <bean:message key="button.save"/>
- </html:submit>
- </logic:equal>
- <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Delete">
- <html:submit>
- <bean:message key="button.confirm"/>
- </html:submit>
- </logic:equal>
- <logic:equal name="subscriptionForm" property="action"
- scope="request" value="Edit">
- <html:submit>
- <bean:message key="button.save"/>
- </html:submit>
- </logic:equal>
- </td>
- <td align="left">
- <logic:notEqual name="subscriptionForm" property="action"
- scope="request" value="Delete">
- <html:reset>
- <bean:message key="button.reset"/>
- </html:reset>
- </logic:notEqual>
-
- <html:cancel>
- <bean:message key="button.cancel"/>
- </html:cancel>
- </td>
- </tr>
-
-</table>
-
-</html:form>
-
-</body>
-</html:html>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpen.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpen.xml deleted file mode 100644 index c5fa78456..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpen.xml +++ /dev/null @@ -1 +0,0 @@ -<
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpenTagClose.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpenTagClose.xml deleted file mode 100644 index 6787e487a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tagOpenTagClose.xml +++ /dev/null @@ -1 +0,0 @@ -<>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.afterDefaultFormat.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.afterDefaultFormat.xml deleted file mode 100644 index 069235dfa..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.afterDefaultFormat.xml +++ /dev/null @@ -1,10 +0,0 @@ -<tag> - <tag></tag> - <tag></tag> - <tag></tag> - <tag></tag> - <tag> - <tag></tag> - <tag></tag> - <tag></tag> - <tag></tag>
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.xml b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.xml deleted file mode 100644 index 2fa949bb5..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/cleanupformat/testfiles/tags.xml +++ /dev/null @@ -1,10 +0,0 @@ -<tag> -<tag></tag> -<tag></tag > -<tag> </tag> -<tag> </tag > -<tag > -<tag ></tag> -<tag ></tag > -<tag > </tag> -<tag > </tag >
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java deleted file mode 100644 index 1f679b9c2..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 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.jst.jsp.core.tests.contentmodels; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.internal.contentmodel.JSPCMDocumentFactory; -import org.eclipse.wst.html.core.internal.contentmodel.JSP11Namespace; -import org.eclipse.wst.html.core.internal.contentmodel.JSP20Namespace; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType; - -public class TestFixedCMDocuments extends TestCase { - - public TestFixedCMDocuments(String name) { - super(name); - } - - /** - * @param cm_doc_type - * @param elementName - * @param attrNameImport - */ - private void checkAttrNames(String documentKey, String elementName, String[] attrNames) { - CMDocument document = JSPCMDocumentFactory.getCMDocument(documentKey); - CMNode elementDeclaration = document.getElements().getNamedItem(elementName); - assertEquals("not an element declaration:" + elementDeclaration, CMNode.ELEMENT_DECLARATION, elementDeclaration.getNodeType()); - assertNotNull("missing element declaration:" + elementName, elementDeclaration); - - CMNamedNodeMap attributes = ((CMElementDeclaration) elementDeclaration).getAttributes(); - - for (int i = 0; i < attrNames.length; i++) { - assertNotNull("missing attribute declaration:" + attrNames[i], attributes.getNamedItem(attrNames[i])); - } - assertEquals("Attributes defined in content model that are not expected by the test", attributes.getLength(), attrNames.length); - } - - private void checkDocument(Object documentKey) { - CMDocument document = JSPCMDocumentFactory.getCMDocument(documentKey.toString()); - assertNotNull("missing doc:" + documentKey.toString(), document); - CMNamedNodeMap elements = document.getElements(); - for (int i = 0; i < elements.getLength(); i++) { - CMNode item = elements.item(i); - verifyElementDeclarationHasName(item); - } - } - - public void testAttributesOnJSP11Forward() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.FORWARD, new String[]{JSP11Namespace.ATTR_NAME_PAGE}); - } - - public void testAttributesOnJSP11GetProperty() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.GETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY}); - } - - public void testAttributesOnJSP11Include() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_PAGE, JSP11Namespace.ATTR_NAME_FLUSH}); - } - - public void testAttributesOnJSP11IncludeDirective() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_FILE}); - } - - public void testAttributesOnJSP11PageDirective() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_PAGE, new String[]{JSP11Namespace.ATTR_NAME_LANGUAGE, JSP11Namespace.ATTR_NAME_EXTENDS, JSP11Namespace.ATTR_NAME_IMPORT, JSP11Namespace.ATTR_NAME_SESSION, JSP11Namespace.ATTR_NAME_BUFFER, JSP11Namespace.ATTR_NAME_AUTOFLUSH, JSP11Namespace.ATTR_NAME_IS_THREAD_SAFE, JSP11Namespace.ATTR_NAME_INFO, JSP11Namespace.ATTR_NAME_ERROR_PAGE, JSP11Namespace.ATTR_NAME_IS_ERROR_PAGE, JSP11Namespace.ATTR_NAME_CONTENT_TYPE, JSP11Namespace.ATTR_NAME_PAGE_ENCODING}); - } - - public void testAttributesOnJSP11Param() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.PARAM, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnJSP11Plugin() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.PLUGIN, new String[]{JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_CODE, JSP11Namespace.ATTR_NAME_CODEBASE, JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_ARCHIVE, JSP11Namespace.ATTR_NAME_ALIGN, JSP11Namespace.ATTR_NAME_HEIGHT, JSP11Namespace.ATTR_NAME_WIDTH, JSP11Namespace.ATTR_NAME_HSPACE, JSP11Namespace.ATTR_NAME_VSPACE, JSP11Namespace.ATTR_NAME_JREVERSION, JSP11Namespace.ATTR_NAME_NSPLUGINURL, JSP11Namespace.ATTR_NAME_IEPLUGINURL}); - } - - public void testAttributesOnJSP11Root() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.ROOT, new String[]{JSP11Namespace.ATTR_NAME_XMLNS_JSP, JSP11Namespace.ATTR_NAME_VERSION}); - } - -// public void testAttributesOnJSP21PageDirective() { -// checkAttrNames(CMDocType.JSP21_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_PAGE, new String[]{JSP11Namespace.ATTR_NAME_LANGUAGE, JSP11Namespace.ATTR_NAME_EXTENDS, JSP11Namespace.ATTR_NAME_IMPORT, JSP11Namespace.ATTR_NAME_SESSION, JSP11Namespace.ATTR_NAME_BUFFER, JSP11Namespace.ATTR_NAME_AUTOFLUSH, JSP11Namespace.ATTR_NAME_IS_THREAD_SAFE, JSP11Namespace.ATTR_NAME_INFO, JSP11Namespace.ATTR_NAME_ERROR_PAGE, JSP11Namespace.ATTR_NAME_IS_ERROR_PAGE, JSP11Namespace.ATTR_NAME_CONTENT_TYPE, JSP11Namespace.ATTR_NAME_PAGE_ENCODING, JSP20Namespace.ATTR_NAME_DEFERRED_SYNTAX_ALLOWED_AS_LITERAL, JSP20Namespace.ATTR_NAME_TRIM_DIRECTIVE_WHITESPACES, JSP20Namespace.ATTR_NAME_ISELIGNORED}); -// } - - public void testAttributesOnJSP11SetProperty() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.SETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY, JSP11Namespace.ATTR_NAME_PARAM, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnJSP11TaglibDirective() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_TAGLIB, new String[]{JSP11Namespace.ATTR_NAME_URI, JSP11Namespace.ATTR_NAME_PREFIX}); - } - - public void testAttributesOnJSP11UseBean() { - checkAttrNames(CMDocType.JSP11_DOC_TYPE, JSP11Namespace.ElementName.USEBEAN, new String[]{JSP11Namespace.ATTR_NAME_ID, JSP11Namespace.ATTR_NAME_SCOPE, JSP11Namespace.ATTR_NAME_CLASS, JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_BEAN_NAME}); - } - - public void testAttributesOnJSP20Attribute() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP20Namespace.ElementName.ATTRIBUTE, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP20Namespace.ATTR_NAME_TRIM}); - } - - public void testAttributesOnJSP20Element() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP20Namespace.ElementName.ELEMENT, new String[]{JSP11Namespace.ATTR_NAME_NAME}); - } - - - public void testAttributesOnJSP20Forward() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.FORWARD, new String[]{JSP11Namespace.ATTR_NAME_PAGE}); - } - - public void testAttributesOnJSP20GetProperty() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.GETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY}); - } - - // JSP 2.1 attributes on tag directives -// public void testAttributesOnTAG21TagDirective() { -// checkAttrNames(CMDocType.TAG21_DOC_TYPE, JSP20Namespace.ElementName.DIRECTIVE_TAG, new String[]{JSP20Namespace.ATTR_NAME_DISPLAY_NAME, JSP20Namespace.ATTR_NAME_BODY_CONTENT, JSP20Namespace.ATTR_NAME_DYNAMIC_ATTRIBUTES, JSP20Namespace.ATTR_NAME_SMALL_ICON, JSP20Namespace.ATTR_NAME_LARGE_ICON, JSP20Namespace.ATTR_NAME_DESCRIPTION, JSP20Namespace.ATTR_NAME_EXAMPLE, JSP20Namespace.ATTR_NAME_LANGUAGE, JSP11Namespace.ATTR_NAME_IMPORT, JSP11Namespace.ATTR_NAME_PAGE_ENCODING, JSP20Namespace.ATTR_NAME_ISELIGNORED, JSP20Namespace.ATTR_NAME_DEFERRED_SYNTAX_ALLOWED_AS_LITERAL, JSP20Namespace.ATTR_NAME_TRIM_DIRECTIVE_WHITESPACES}); -// } - - public void testAttributesOnJSP20Include() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_PAGE, JSP11Namespace.ATTR_NAME_FLUSH}); - } - - public void testAttributesOnJSP20IncludeDirective() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_FILE}); - } - - public void testAttributesOnJSP20Output() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP20Namespace.ElementName.OUTPUT, new String[]{JSP20Namespace.ATTR_NAME_OMIT_XML_DECL, JSP20Namespace.ATTR_NAME_DOCTYPE_PUBLIC, JSP20Namespace.ATTR_NAME_DOCTYPE_ROOT_ELEMENT, JSP20Namespace.ATTR_NAME_DOCTYPE_SYSTEM}); - } - - public void testAttributesOnJSP20PageDirective() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_PAGE, new String[]{JSP11Namespace.ATTR_NAME_LANGUAGE, JSP11Namespace.ATTR_NAME_EXTENDS, JSP11Namespace.ATTR_NAME_IMPORT, JSP11Namespace.ATTR_NAME_SESSION, JSP11Namespace.ATTR_NAME_BUFFER, JSP11Namespace.ATTR_NAME_AUTOFLUSH, JSP11Namespace.ATTR_NAME_IS_THREAD_SAFE, JSP11Namespace.ATTR_NAME_INFO, JSP11Namespace.ATTR_NAME_ERROR_PAGE, JSP11Namespace.ATTR_NAME_IS_ERROR_PAGE, JSP11Namespace.ATTR_NAME_CONTENT_TYPE, JSP11Namespace.ATTR_NAME_PAGE_ENCODING, JSP20Namespace.ATTR_NAME_ISELIGNORED}); - } - - public void testAttributesOnJSP20Param() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.PARAM, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnJSP20Plugin() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.PLUGIN, new String[]{JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_CODE, JSP11Namespace.ATTR_NAME_CODEBASE, JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_ARCHIVE, JSP11Namespace.ATTR_NAME_ALIGN, JSP11Namespace.ATTR_NAME_HEIGHT, JSP11Namespace.ATTR_NAME_WIDTH, JSP11Namespace.ATTR_NAME_HSPACE, JSP11Namespace.ATTR_NAME_VSPACE, JSP11Namespace.ATTR_NAME_JREVERSION, JSP11Namespace.ATTR_NAME_NSPLUGINURL, JSP11Namespace.ATTR_NAME_IEPLUGINURL, JSP20Namespace.ATTR_NAME_MAYSCRIPT}); - } - - public void testAttributesOnJSP20Root() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.ROOT, new String[]{JSP11Namespace.ATTR_NAME_XMLNS_JSP, JSP11Namespace.ATTR_NAME_VERSION}); - } - - public void testAttributesOnJSP20SetProperty() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.SETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY, JSP11Namespace.ATTR_NAME_PARAM, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnJSP20TaglibDirective() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_TAGLIB, new String[]{JSP11Namespace.ATTR_NAME_URI, JSP11Namespace.ATTR_NAME_PREFIX, JSP20Namespace.ATTR_NAME_TAGDIR}); - } - - public void testAttributesOnJSP20UseBean() { - checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.USEBEAN, new String[]{JSP11Namespace.ATTR_NAME_ID, JSP11Namespace.ATTR_NAME_SCOPE, JSP11Namespace.ATTR_NAME_CLASS, JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_BEAN_NAME}); - } - - public void testAttributesOnTAG20Attribute() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.ATTRIBUTE, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP20Namespace.ATTR_NAME_TRIM}); - } - - public void testAttributesOnTAG20AttributeDirective() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.DIRECTIVE_ATTRIBUTE, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP20Namespace.ATTR_NAME_REQUIRED, JSP20Namespace.ATTR_NAME_FRAGMENT, JSP20Namespace.ATTR_NAME_RTEXPRVALUE, JSP20Namespace.ATTR_NAME_TYPE, JSP20Namespace.ATTR_NAME_DESCRIPTION}); - } - - public void testAttributesOnTAG20DoBody() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.DOBODY, new String[]{JSP20Namespace.ATTR_NAME_VAR, JSP20Namespace.ATTR_NAME_VARREADER, JSP11Namespace.ATTR_NAME_SCOPE}); - } - - public void testAttributesOnTAG20Element() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.ELEMENT, new String[]{JSP11Namespace.ATTR_NAME_NAME}); - } - - public void testAttributesOnTAG20Forward() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.FORWARD, new String[]{JSP11Namespace.ATTR_NAME_PAGE}); - } - - public void testAttributesOnTAG20GetProperty() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.GETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY}); - } - - public void testAttributesOnTAG20Include() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_PAGE, JSP11Namespace.ATTR_NAME_FLUSH}); - } - - public void testAttributesOnTAG20IncludeDirective() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_INCLUDE, new String[]{JSP11Namespace.ATTR_NAME_FILE}); - } - - public void testAttributesOnTAG20Invoke() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.INVOKE, new String[]{JSP20Namespace.ATTR_NAME_FRAGMENT, JSP20Namespace.ATTR_NAME_VAR, JSP20Namespace.ATTR_NAME_VARREADER, JSP11Namespace.ATTR_NAME_SCOPE}); - } - - public void testAttributesOnTAG20Output() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.OUTPUT, new String[]{JSP20Namespace.ATTR_NAME_OMIT_XML_DECL, JSP20Namespace.ATTR_NAME_DOCTYPE_PUBLIC, JSP20Namespace.ATTR_NAME_DOCTYPE_ROOT_ELEMENT, JSP20Namespace.ATTR_NAME_DOCTYPE_SYSTEM}); - } - - public void testAttributesOnTAG20Param() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.PARAM, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnTAG20Plugin() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.PLUGIN, new String[]{JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_CODE, JSP11Namespace.ATTR_NAME_CODEBASE, JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_ARCHIVE, JSP11Namespace.ATTR_NAME_ALIGN, JSP11Namespace.ATTR_NAME_HEIGHT, JSP11Namespace.ATTR_NAME_WIDTH, JSP11Namespace.ATTR_NAME_HSPACE, JSP11Namespace.ATTR_NAME_VSPACE, JSP11Namespace.ATTR_NAME_JREVERSION, JSP11Namespace.ATTR_NAME_NSPLUGINURL, JSP11Namespace.ATTR_NAME_IEPLUGINURL, JSP20Namespace.ATTR_NAME_MAYSCRIPT}); - } - - public void testAttributesOnTAG20Root() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.ROOT, new String[]{JSP11Namespace.ATTR_NAME_XMLNS_JSP, JSP11Namespace.ATTR_NAME_VERSION}); - } - - public void testAttributesOnTAG20SetProperty() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.SETPROPERTY, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP11Namespace.ATTR_NAME_PROPERTY, JSP11Namespace.ATTR_NAME_PARAM, JSP11Namespace.ATTR_NAME_VALUE}); - } - - public void testAttributesOnTAG20TagDirective() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.DIRECTIVE_TAG, new String[]{JSP20Namespace.ATTR_NAME_DISPLAY_NAME, JSP20Namespace.ATTR_NAME_BODY_CONTENT, JSP20Namespace.ATTR_NAME_DYNAMIC_ATTRIBUTES, JSP20Namespace.ATTR_NAME_SMALL_ICON, JSP20Namespace.ATTR_NAME_LARGE_ICON, JSP20Namespace.ATTR_NAME_DESCRIPTION, JSP20Namespace.ATTR_NAME_EXAMPLE, JSP20Namespace.ATTR_NAME_LANGUAGE, JSP11Namespace.ATTR_NAME_IMPORT, JSP11Namespace.ATTR_NAME_PAGE_ENCODING, JSP20Namespace.ATTR_NAME_ISELIGNORED}); - } - - public void testAttributesOnTAG20TaglibDirective() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.DIRECTIVE_TAGLIB, new String[]{JSP11Namespace.ATTR_NAME_URI, JSP11Namespace.ATTR_NAME_PREFIX, JSP20Namespace.ATTR_NAME_TAGDIR}); - } - - public void testAttributesOnTAG20UseBean() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP11Namespace.ElementName.USEBEAN, new String[]{JSP11Namespace.ATTR_NAME_ID, JSP11Namespace.ATTR_NAME_SCOPE, JSP11Namespace.ATTR_NAME_CLASS, JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_BEAN_NAME}); - } - - public void testAttributesOnTAG20VariableDirective() { - checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.DIRECTIVE_VARIABLE, new String[]{JSP20Namespace.ATTR_NAME_NAME_GIVEN, JSP20Namespace.ATTR_NAME_NAME_FROM_ATTRIBUTE, JSP20Namespace.ATTR_NAME_ALIAS, JSP20Namespace.ATTR_NAME_VARIABLE_CLASS, JSP20Namespace.ATTR_NAME_DECLARE, JSP11Namespace.ATTR_NAME_SCOPE, JSP20Namespace.ATTR_NAME_DESCRIPTION}); - } - - public void testCHTMLdocument() { - checkDocument(CMDocType.CHTML_DOC_TYPE); - } - - public void testHTML4document() { - checkDocument(CMDocType.HTML_DOC_TYPE); - } - - public void testJSP11document() { - checkDocument(CMDocType.JSP11_DOC_TYPE); - - } - - public void testJSP12document() { - checkDocument(CMDocType.JSP12_DOC_TYPE); - - } - - public void testJSP20document() { - checkDocument(CMDocType.JSP20_DOC_TYPE); - } - - public void testTag20document() { - checkDocument(CMDocType.TAG20_DOC_TYPE); - } - - private void verifyAttributeDeclaration(CMElementDeclaration elemDecl, CMNode attr) { - assertTrue(attr.getNodeType() == CMNode.ATTRIBUTE_DECLARATION); - assertNotNull("no name on an attribute declaration", attr.getNodeName()); - CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) attr; - assertNotNull("no attribute 'type' on an attribute declaration " + elemDecl.getNodeName() + "/" + attr.getNodeName(), attrDecl.getAttrType()); - } - - private void verifyElementDeclarationHasName(CMNode item) { - assertTrue(item.getNodeType() == CMNode.ELEMENT_DECLARATION); - assertNotNull("no name on an element declaration", item.getNodeName()); - CMNamedNodeMap attrs = ((CMElementDeclaration) item).getAttributes(); - for (int i = 0; i < attrs.getLength(); i++) { - CMNode attr = attrs.item(i); - verifyAttributeDeclaration(((CMElementDeclaration) item), attr); - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestTaglibCMTests.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestTaglibCMTests.java deleted file mode 100644 index 429e7a02c..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestTaglibCMTests.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.jst.jsp.core.tests.contentmodels; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -import junit.framework.Test; -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMElementDeclarationImpl; -import org.eclipse.jst.jsp.core.internal.provisional.JSP20Namespace; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -public class TestTaglibCMTests extends TestCase { - private static final String TESTFILES_PATHSTRING = "/testfiles/"; - private static final String PROJECT_NAME = "testLoadTaglibs"; - private static final String TAG_NAME = "logic:empty"; - - public TestTaglibCMTests(String name) { - super(name); - } - - public TestTaglibCMTests() { - super(); - } - - public static Test suite() { - return new TestTaglibCMTests(); - } - - protected void setUp() throws Exception { - super.setUp(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME); - if (!project.exists()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace(TESTFILES_PATHSTRING + PROJECT_NAME, Path.ROOT.append(PROJECT_NAME).toString()); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/struts.jar", Path.ROOT.append(PROJECT_NAME).append("web stuff/WEB-INF/lib/struts.jar").toString()); - project.refreshLocal(IResource.DEPTH_INFINITE, null); - project.build(IncrementalProjectBuilder.FULL_BUILD, null); - } - assertTrue(project.isAccessible()); - } - - public void testLoadCustomTagsThroughJSPSyntax() throws IOException, CoreException { - IFile jspFile = ResourcesPlugin.getWorkspace().getRoot().getFile(Path.ROOT.append(PROJECT_NAME).append("web stuff/test1.jsp")); - assertTrue("test file " + jspFile.getFullPath() + " does not exist", jspFile.exists()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(jspFile); - NodeList presents = model.getDocument().getElementsByTagName(TAG_NAME); - assertNotNull(TAG_NAME + " was missing from document", presents.item(0)); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) presents.item(0)).getAdapterFor(ModelQueryAdapter.class); - CMElementDeclaration declaration = modelQueryAdapter.getModelQuery().getCMElementDeclaration((Element) presents.item(0)); - assertNotNull("no CMElementDelcaration for " + TAG_NAME, declaration); - assertEquals("qualified name from element declaration was different", TAG_NAME, declaration.getNodeName()); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } - - public void testLoadCustomTagsThroughXMLSyntax() throws IOException, CoreException { - IFile jspFile = ResourcesPlugin.getWorkspace().getRoot().getFile(Path.ROOT.append(PROJECT_NAME).append("web stuff/testX.jsp")); - assertTrue("test file " + jspFile.getFullPath() + " does not exist", jspFile.exists()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(jspFile); - NodeList presents = model.getDocument().getElementsByTagName(TAG_NAME); - assertNotNull(TAG_NAME + " was missing from document", presents.item(0)); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) presents.item(0)).getAdapterFor(ModelQueryAdapter.class); - CMElementDeclaration declaration = modelQueryAdapter.getModelQuery().getCMElementDeclaration((Element) presents.item(0)); - assertNotNull("no CMElementDeclaration for " + TAG_NAME, declaration); - assertEquals("qualified name from element declaration was different", TAG_NAME, declaration.getNodeName()); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } - - public void testTagFileReferencedInTLD() throws IOException, CoreException { - String DPROJECT_NAME = "DynamicWebProject"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(DPROJECT_NAME); - if (!project.exists()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(DPROJECT_NAME, null, null); - BundleResourceUtil.copyBundleZippedEntriesIntoWorkspace("/testfiles/jspErrorProject.zip", Path.ROOT); - } - project.refreshLocal(IResource.DEPTH_INFINITE, null); - - IFile jspFile = ResourcesPlugin.getWorkspace().getRoot().getFile(Path.ROOT.append("DynamicWebProject/WebContent/index.jsp")); - assertTrue("test file " + jspFile.getFullPath() + " does not exist", jspFile.exists()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(jspFile); - String DTAGNAME = "date:returndate"; - NodeList returnDates = model.getDocument().getElementsByTagName(DTAGNAME); - assertNotNull("date:returndate was missing from document", returnDates.item(0)); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) returnDates.item(0)).getAdapterFor(ModelQueryAdapter.class); - CMElementDeclaration declaration = modelQueryAdapter.getModelQuery().getCMElementDeclaration((Element) returnDates.item(0)); - assertNotNull("no CMElementDeclaration for date:returndate", declaration); - assertEquals("qualified name from element declaration was different", DTAGNAME, declaration.getNodeName()); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } - - public void testTagFileHasHTMLContentModel() throws IOException, CoreException { - String DPROJECT_NAME = getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(DPROJECT_NAME); - if (!project.exists()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(DPROJECT_NAME, null, null); - } - project.refreshLocal(IResource.DEPTH_INFINITE, null); - - IFile tagFile = project.getFile("test1.tag"); - tagFile.create(new ByteArrayInputStream(new byte[0]), IResource.FORCE, null); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(tagFile); - model.getStructuredDocument().set("<b/>"); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) model.getDocument().getDocumentElement()).getAdapterFor(ModelQueryAdapter.class); - CMElementDeclaration declaration = modelQueryAdapter.getModelQuery().getCMElementDeclaration(model.getDocument().getDocumentElement()); - assertNotNull("no CMElementDeclaration for 'b'", declaration); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - project.delete(true, null); - } - public void testTagFileHasTagContentModel() throws IOException, CoreException { - String DPROJECT_NAME = getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(DPROJECT_NAME); - if (!project.exists()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(DPROJECT_NAME, null, null); - } - project.refreshLocal(IResource.DEPTH_INFINITE, null); - - IFile tagFile = project.getFile("test1.tag"); - tagFile.create(new ByteArrayInputStream(new byte[0]), IResource.FORCE, null); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(tagFile); - model.getStructuredDocument().set("<"+JSP20Namespace.ElementName.DOBODY+"/>"); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) model.getDocument().getDocumentElement()).getAdapterFor(ModelQueryAdapter.class); - CMElementDeclaration declaration = modelQueryAdapter.getModelQuery().getCMElementDeclaration(model.getDocument().getDocumentElement()); - assertNotNull("no CMElementDeclaration for '"+JSP20Namespace.ElementName.DOBODY+"'", declaration); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - project.delete(true, null); - } - - public void testDynamicAttributes() throws Exception { - final String testName = "testDynamicAttributes"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - if (!project.exists()) { - project = BundleResourceUtil.createSimpleProject(testName, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace(TESTFILES_PATHSTRING + "testDynamicAttributes", "/testDynamicAttributes"); - } - project.refreshLocal(IResource.DEPTH_INFINITE, null); - - CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD(); - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/"+ testName + "/")); - assertEquals("There should only be one taglib record", 1, records.length); - CMDocument document = factory.createCMDocument(records[0]); - CMNamedNodeMap elements = document.getElements(); - assertNotNull("No elements for the CM Document", elements); - CMNode node = elements.getNamedItem("bar"); - assertTrue("Node must be a CMElementDeclarationImpl", node instanceof CMElementDeclarationImpl); - assertEquals("Dynamic attributes must be set to 'true'", "true", ((CMElementDeclarationImpl) node).getDynamicAttributes()); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/NullStream.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/NullStream.java deleted file mode 100644 index ac16f838f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/NullStream.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.jst.jsp.core.tests.contenttypeidentifier.contentspecific; - -import java.io.IOException; -import java.io.InputStream; - - -public class NullStream extends InputStream { - - /* (non-Javadoc) - * @see java.io.InputStream#read() - */ - public int read() throws IOException { - return -1; - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestContentTypeHandlers.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestContentTypeHandlers.java deleted file mode 100644 index ff92ba27f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestContentTypeHandlers.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 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 Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.jsp.core.tests.contenttypeidentifier.contentspecific; - -import java.io.IOException; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS; -import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML; -import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML; - -/** - * This class is to test very basics of content type handlers. - * - * It tests that - * - * BVT: content registry can be / is created 5 expected contentTypeIdentifiers - * can be created/found based on id. there is one and only one default content - * type handler. - * - * - * - * - */ -public class TestContentTypeHandlers extends TestCase { - private static final boolean DEBUG = false; - - public TestContentTypeHandlers(String name) { - super(name); - } - - private static IContentTypeManager getContentTypeRegistry() { - IContentTypeManager registry = Platform.getContentTypeManager(); - return registry; - } - - public void testCreation() { - IContentTypeManager registry = getContentTypeRegistry(); - assertTrue("content type identifer registry must exist", registry != null); - if (DEBUG) { - IContentType[] allTypes = registry.getAllContentTypes(); - for (int i = 0; i < allTypes.length; i++) { - System.out.println(allTypes[i]); - - } - } - } - - public void testXMLExists() { - String id = ContentTypeIdForXML.ContentTypeID_SSEXML; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getContentType(id); - assertTrue("content type identifier " + id + " does not have custom XML type ", identifier != null); - } - - public void testHTMLExists() { - String id = ContentTypeIdForHTML.ContentTypeID_HTML; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getContentType(id); - assertTrue("content type identifier " + id + " does not have HTML type ", identifier != null); - } - - public void testJSPExists() { - String id = ContentTypeIdForJSP.ContentTypeID_JSP; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getContentType(id); - assertTrue("content type identifier " + id + " does not have JSP type ", identifier != null); - } - - public void testCSSExists() { - String id = ContentTypeIdForCSS.ContentTypeID_CSS; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getContentType(id); - assertTrue("content type identifier " + id + " does not have CSS type ", identifier != null); - } - - public void testDTDExists() { - String id = "org.eclipse.wst.dtd.core.dtdsource"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getContentType(id); - assertTrue("content type identifier " + id + " does not have DTD type ", identifier != null); - } - - public void testXMLExistsByFileExtension() throws IOException { - String filename = "test.xml"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("content type identifier for " + filename + " does not have XML type ", identifier != null); - } - - public void testHTMLExistsByFileExtension() throws IOException { - String filename = "test.html"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("content type identifier for " + filename + " does not have HTML type ", identifier != null); - } - - public void testJSPExistsByFileExtension() throws IOException { - String filename = "test.jsp"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("content type identifier for " + filename + " does not have JSP type ", identifier != null); - } - - public void testCSSExistsByFileExtension() throws IOException { - String filename = "test.css"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("content type identifier for " + filename + " does not have CSS type ", identifier != null); - } - - public void testDTDExistsByFileExtension() throws IOException { - String filename = "test.dtd"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("content type identifier for " + filename + " does not have DTD type ", identifier != null); - } - - public void testMultipleDefinitions() throws IOException { - String id = ContentTypeIdForCSS.ContentTypeID_CSS; - String filename = "test.css"; - IContentTypeManager registry = getContentTypeRegistry(); - IContentType identifier1 = registry.getContentType(id); - IContentType identifier2 = registry.getDescriptionFor(new NullStream(), filename, IContentDescription.ALL).getContentType(); - assertTrue("mulitple content type identifiers need to be equal (but not same instance) ", identifier1.equals(identifier2)); - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestModelHandlers.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestModelHandlers.java deleted file mode 100644 index 3e6c937e1..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contenttypeidentifier/contentspecific/TestModelHandlers.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 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.jst.jsp.core.tests.contenttypeidentifier.contentspecific; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.jst.jsp.core.internal.document.PageDirectiveAdapter; -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS; -import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler; -import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler; -import org.eclipse.wst.sse.core.internal.modelhandler.ModelHandlerRegistry; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Document; - -public class TestModelHandlers extends TestCase { - private static ModelHandlerRegistry getModelHandlerRegistry() { - ModelHandlerRegistry registry = ModelHandlerRegistry.getInstance(); - return registry; - } - - public TestModelHandlers() { - super(); - } - - public void testCreation() { - ModelHandlerRegistry registry = getModelHandlerRegistry(); - assertTrue("model handler registry must exist", registry != null); - } - - public void testCSSExists() { - String id = ContentTypeIdForCSS.ContentTypeID_CSS; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerForContentTypeId(id); - assertTrue("model handler registry does not have CSS type ", handler != null && handler.getAssociatedContentTypeId().equals(id)); - } - - public void testCSSExistsFromFilename() throws IOException { - String filename = "test.css"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerFor(filename, null); - assertTrue("model handler registry does not have CSS type ", handler != null && handler.getAssociatedContentTypeId().equals(ContentTypeIdForCSS.ContentTypeID_CSS)); - } - - public void testDTDExists() { - String id = "org.eclipse.wst.dtd.core.dtdsource"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerForContentTypeId(id); - assertTrue("model handler registry does not have DTD type ", handler != null && handler.getAssociatedContentTypeId().equals(id)); - } - - public void testDTDExistsFromFilename() throws IOException { - String filename = "test.dtd"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerFor(filename, null); - assertTrue("model handler registry does not have DTD type ", handler != null && handler.getAssociatedContentTypeId().equals("org.eclipse.wst.dtd.core.dtdsource")); - } - - public void testHTMLExists() { - String id = ContentTypeIdForHTML.ContentTypeID_HTML; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerForContentTypeId(id); - assertTrue("model handler registry does not have HTML type ", handler != null && handler.getAssociatedContentTypeId().equals(id)); - } - - public void testHTMLExistsFromFilename() throws IOException { - String filename = "test.html"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerFor(filename, null); - assertTrue("model handler registry does not have HTML type ", handler != null && handler.getAssociatedContentTypeId().equals(ContentTypeIdForHTML.ContentTypeID_HTML)); - } - - public void testJSPExists() { - String id = ContentTypeIdForJSP.ContentTypeID_JSP; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerForContentTypeId(id); - assertTrue("model handler registry does not have JSP type ", handler != null && handler.getAssociatedContentTypeId().equals(id)); - } - - public void testJSPExistsFromFilename() throws IOException { - String filename = "test.jsp"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerFor(filename, null); - assertTrue("model handler registry does not have JSP type ", handler != null && handler.getAssociatedContentTypeId().equals(ContentTypeIdForJSP.ContentTypeID_JSP)); - } - - public void testXMLExists() { - String id = ContentTypeIdForXML.ContentTypeID_XML; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerForContentTypeId(id); - assertEquals("model handler registry does not have XML type ", id, handler.getAssociatedContentTypeId()); - } - - public void testXMLExistsFromFilename() throws IOException { - String filename = "test.xml"; - ModelHandlerRegistry registry = getModelHandlerRegistry(); - IModelHandler handler = registry.getHandlerFor(filename, null); - assertEquals("model handler registry does not have XML type ", ContentTypeIdForXML.ContentTypeID_XML, handler.getAssociatedContentTypeId()); - } - - public void testDirtyStateForEmbeddedContentTypeTextHTML() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("html.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } - - public void testDirtyStateForEmbeddedContentTypeTextCSS() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("css.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } - - public void testDirtyStateForEmbeddedContentTypeTextXML() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("xml.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } - - public void testDirtyStateForMisspelledEmbeddedCharset() throws Exception { - String projectName = "TestModelHandlers." + getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(projectName, null, null); - } - IFile testFile = project.getFile("charaset.jsp"); - String contents = "<%@ page language=\"java\" contentType=\"text/xml; charaset=UTF-8\" pageEncoding=\"UTF-8\"%>\n" + - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<Contents>\n" + - "<Error state=\"fatal\" code=\"\">\n" + - "</Error>\n" + - "</Contents>"; - if (!testFile.exists()) { - testFile.create(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - else { - testFile.setContents(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - IStructuredModel model = null; - try { - model = StructuredModelManager.getModelManager().getModelForRead(testFile); - - Document doc = ((IDOMModel) model).getDocument(); - PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) ((INodeNotifier) doc).getAdapterFor(PageDirectiveAdapter.class); - EmbeddedTypeHandler embeddedHandler = pageDirectiveAdapter.getEmbeddedType(); - - assertFalse("newly opened model was dirty, embedded handler changed? current family:" + embeddedHandler.getFamilyId(), model.isDirty()); - } - finally { - if (model != null) - model.releaseFromRead(); - } - project.delete(true, null); - } - - public void testDirtyStateForEmbeddedCharsetWithoutContentType() throws Exception { - String projectName = "TestModelHandlers." + getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(projectName, null, null); - } - IFile testFile = project.getFile("charaset.jsp"); - String contents = "<%@ page language=\"java\" contentType=\"charset=UTF-8\" pageEncoding=\"UTF-8\"%>\n" + - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<Contents>\n" + - "<Error state=\"fatal\" code=\"\">\n" + - "</Error>\n" + - "</Contents>"; - if (!testFile.exists()) { - testFile.create(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - else { - testFile.setContents(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - IStructuredModel model = null; - try { - model = StructuredModelManager.getModelManager().getModelForRead(testFile); - - Document doc = ((IDOMModel) model).getDocument(); - PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) ((INodeNotifier) doc).getAdapterFor(PageDirectiveAdapter.class); - EmbeddedTypeHandler embeddedHandler = pageDirectiveAdapter.getEmbeddedType(); - - assertFalse("newly opened model was dirty, embedded handler changed? current family:" + embeddedHandler.getFamilyId(), model.isDirty()); - } - finally { - if (model != null) - model.releaseFromRead(); - } - project.delete(true, null); - } - - public void testDirtyStateForUnsupportedEmbeddedContentType() throws Exception { - String projectName = "TestModelHandlers." + getName(); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(projectName, null, null); - } - IFile testFile = project.getFile("unsupported.jsp"); - String contents = "<%@ page language=\"java\" contentType=\"image/gif\"%>\n" + - "out.write(\"GIF89a\""; - if (!testFile.exists()) { - testFile.create(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - else { - testFile.setContents(new ByteArrayInputStream(contents.getBytes("utf8")), IResource.FORCE, null); - } - IStructuredModel model = null; - try { - model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - } - finally { - if (model != null) - model.releaseFromRead(); - } - project.delete(true, null); - } - - public void testDirtyStateForEmbeddedContentTypeSubXML() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("rdf.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } - - public void testDirtyStateForDefaultEmbeddedContentType() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("default.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } - - public void testDirtyStateWithNoPageDirective() throws Exception { - String name = "bug243243"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - if (!project.isAccessible()) { - project = BundleResourceUtil.createSimpleProject(name, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug243243", "/bug243243"); - } - IFile testFile = project.getFile("nodirective.jsp"); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(testFile); - assertFalse("newly opened model was dirty " + testFile.getName(), model.isDirty()); - model.releaseFromRead(); - project.delete(true, null); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/AttrValueTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/AttrValueTest.java deleted file mode 100644 index f19cf5e21..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/AttrValueTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jst.jsp.core.tests.dom; - -import junit.framework.TestCase; - -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.xml.core.internal.parser.ContextRegionContainer; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class AttrValueTest extends TestCase { - - private static final String[] VALUES = {"<<Previous", "<page>", "Next>>"}; - - public void testAttributeValue() { - IDOMModel model = (IDOMModel) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor("org.eclipse.jst.jsp.core.jspsource"); - - assertNotNull(model); - IStructuredDocument document = model.getStructuredDocument(); - assertNotNull(document); - - document.setText(this, "<button value=\""+ VALUES[0] +"\"></button><button value=\"" + VALUES[1] + "\"></button><button value=\"" + VALUES[2] + "\"></button>"); - - IDOMDocument dom = model.getDocument(); - NodeList nodes = dom.getElementsByTagName("button"); - assertTrue("Must be 3 button elements in the document.", nodes.getLength() == 3); - - for (int i = 0; i < nodes.getLength(); i++) { - Node node = nodes.item(i); - Node attr = node.getAttributes().getNamedItem("value"); - assertTrue("Attribute 'value' not present.", attr != null && attr.getNodeValue().length() > 0); - assertEquals("Attribute values are not equal", VALUES[i], attr.getNodeValue()); - } - } - - public void testEmbeddedTagValue() { - IDOMModel model = (IDOMModel) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor("org.eclipse.jst.jsp.core.jspsource"); - - assertNotNull(model); - IStructuredDocument document = model.getStructuredDocument(); - assertNotNull(document); - - document.setText(this, "<a href=\"<c:out value='test.html'></c:out>\">Test</a>"); - - IDOMDocument dom = model.getDocument(); - NodeList nodes = dom.getElementsByTagName("a"); - assertTrue("Must be 1 anchor element in the document.", nodes.getLength() == 1); - IStructuredDocumentRegion region = document.getFirstStructuredDocumentRegion(); - ITextRegion embeddedRegion = region.getRegionAtCharacterOffset(9); - assertTrue("The attribute is not a ContextRegionContainer", embeddedRegion instanceof ContextRegionContainer); - Node node = nodes.item(0); - Node attr = node.getAttributes().getNamedItem("href"); - assertEquals("Attribute values are not equal", "<c:out value='test.html'></c:out>", attr.getNodeValue()); - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestImportedNodes.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestImportedNodes.java deleted file mode 100644 index 74e69ee44..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestImportedNodes.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests.dom; - -import junit.framework.TestCase; - -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Node; - -public class TestImportedNodes extends TestCase { - - - public void testImportedComments() { - IDOMModel orgModel = (IDOMModel) StructuredModelManager.getModelManager(). - - createUnManagedStructuredModelFor("org.eclipse.jst.jsp.core.jspsource"); - IDOMModel foreignModel = (IDOMModel) StructuredModelManager.getModelManager(). - - createUnManagedStructuredModelFor("org.eclipse.jst.jsp.core.jspsource"); - foreignModel.getStructuredDocument().set("<%-- abc --%>"); - Node child = foreignModel.getDocument().getLastChild(); - // import comment node - child = orgModel.getDocument().importNode(child, true); - orgModel.getDocument().appendChild(child); - // create text node and insert it after comment node - child = orgModel.getDocument().createTextNode("abc"); - orgModel.getDocument().appendChild(child); - String text = orgModel.getStructuredDocument().get(); - assertEquals("document text was not expected", "<%-- abc --%>abc", text); - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestOrphan.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestOrphan.java deleted file mode 100644 index 71105b591..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/dom/TestOrphan.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests.dom; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.jst.jsp.core.tests.Logger; -import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.xml.core.internal.document.AttrImpl; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * This test will cause a "region management error" to be thrown in DOM parser - * (and its subsequent 'handleRefresh' to be called). This is "normal" in this - * error case, of appending an jsp element to an html document. This - * error/exception is not normally printed out, but is if 'debug' is turned on. - */ - -public class TestOrphan extends TestCase { - - private static final String fCategory = "unittests"; - - public TestOrphan(String name) { - - super(name); - } - - private Document getJSPDoc() { - IDOMModel structuredModel = (IDOMModel) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP); - Document doc = structuredModel.getDocument(); - return doc; - } - - private Document getHTMLDoc() { - - IDOMModel structuredModel = (IDOMModel) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForHTML.ContentTypeID_HTML); - Document doc = structuredModel.getDocument(); - return doc; - } - - private Element makeElement(Document document) { - - Element element = document.createElement("IMG"); - element.setAttribute("src", "<bean:message />"); - return element; - } - - public void testNonOrphanInHTMLDoc() { - - Logger.trace(fCategory, "testNonOrphanInHTMLDoc"); - Document doc = getHTMLDoc(); - Element element = makeElement(doc); - AttrImpl attr = (AttrImpl) element.getAttributeNode("src"); - String attrValue = attr.getValue(); - Logger.trace(fCategory, "attrValue: " + attrValue); - doc.appendChild(element); - boolean isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertFalse(isJspValue); - } - - public void testNonOrphanInJSPDoc() { - - Logger.trace(fCategory, "testNonOrphanInJSPDoc"); - Document doc = getJSPDoc(); - Element element = makeElement(doc); - AttrImpl attr = (AttrImpl) element.getAttributeNode("src"); - String attrValue = attr.getValue(); - Logger.trace(fCategory, "attrValue: " + attrValue); - doc.appendChild(element); - boolean isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertTrue(isJspValue); - } - - public void testNonOrphanInBoth() { - - Logger.trace(fCategory, "testNonOrphanInBoth"); - Document jspDoc = getJSPDoc(); - Element commonElement = makeElement(jspDoc); - AttrImpl attr = (AttrImpl) commonElement.getAttributeNode("src"); - String attrValue = attr.getValue(); - Logger.trace(fCategory, "attrValue: " + attrValue); - jspDoc.appendChild(commonElement); - boolean isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertTrue(isJspValue); - Document htmlDoc = getHTMLDoc(); - // this test will cause a "region management error" to be - // thrown in parser (and its subsequent 'handleRefresh'). - // this is "normal" in this error case, of appending an jsp - // element to an html document. This error/exception is not - // normally printed out, but is if 'debug' is turned on. - htmlDoc.appendChild(commonElement); - isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertFalse(isJspValue); - } - - public void testNonOrphanInBothReversedOrder() { - - Logger.trace(fCategory, "testNonOrphanInBothReversedOrder"); - Document htmlDoc = getHTMLDoc(); - Element commonElement = makeElement(htmlDoc); - AttrImpl attr = (AttrImpl) commonElement.getAttributeNode("src"); - String attrValue = attr.getValue(); - Logger.trace(fCategory, "attrValue: " + attrValue); - htmlDoc.appendChild(commonElement); - boolean isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertFalse(isJspValue); - Document jspDoc = getJSPDoc(); - // this little test shows its important to - // actually create the element with the right kind of - // document, not just append. - // (and, append is needed too, as can be seen by - // commenting out one or the other of the following - // two lines. - commonElement = makeElement(jspDoc); - jspDoc.appendChild(commonElement); - // - attr = (AttrImpl) commonElement.getAttributeNode("src"); - attrValue = attr.getValue(); - Logger.trace(fCategory, "attrValue: " + attrValue); - isJspValue = attr.hasNestedValue(); - Logger.trace(fCategory, "isJspValue: " + isJspValue); - assertTrue(isJspValue); - } - - public void doBothTests() { - - testNonOrphanInHTMLDoc(); - testNonOrphanInJSPDoc(); - testNonOrphanInBoth(); - testNonOrphanInBothReversedOrder(); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelAdapters.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelAdapters.java deleted file mode 100644 index 037739258..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelAdapters.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jst.jsp.core.tests.model; - -import java.io.IOException; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter; - -/** - * @deprecated - we don't have INodeAdapters directly on our models and this - * is not part of the usual test suite (test.xml) - */ -public class TestModelAdapters extends TestCase { - - - - public void testJSPModel() throws IOException { - IModelManager modelManager = getModelManager(); - IDOMModel structuredModel = (IDOMModel) modelManager.createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP); - try { - boolean test = structuredModel.getId().equals(IModelManager.UNMANAGED_MODEL); - assertTrue(test); - ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) structuredModel.getAdapter(ModelQueryAdapter.class); - assertNotNull("initial modelQueryAdapter should not be null", modelQueryAdapter); - IStructuredModel newModel = structuredModel.newInstance(); - // IDOMDocument newDocument = ((IDOMModel) - // newModel).getDocument(); - // INodeNotifier notifier = newDocument; - ModelQueryAdapter result = (ModelQueryAdapter) newModel.getAdapter(ModelQueryAdapter.class); - assertNotNull("newInstance modelQueryAdapter should not be null", result); - - } - finally { - // even though model is unmanaged, release still required, since - // adapter factories, etc., may be depending on it. - structuredModel.releaseFromEdit(); - // if above complete's normally (with no exceptions) - // consider passed. - assertTrue(true); - } - } - - private IModelManager getModelManager() { - IModelManager modelManager = StructuredModelManager.getModelManager(); - return modelManager; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelIncludes.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelIncludes.java deleted file mode 100644 index 587e27d79..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelIncludes.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2010 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.jst.jsp.core.tests.model; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter; -import org.eclipse.jst.jsp.core.internal.modelhandler.ModelHandlerForJSP; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMNodeWrapper; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Element; - -/** - * Tests for JSP include directives - */ -public class TestModelIncludes extends TestCase { - String wtp_autotest_noninteractive = null; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } - - /** - * Tests the custom tag content model when single line fragments are used - * without trailing white space - * - * @throws Exception - */ - public void testContentModelSingleLineIncludedFileWithNoSpacesButWithTaglibInInclude() throws Exception { - String projectName = "prj119576_a"; - - BundleResourceUtil.createSimpleProject(projectName, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()); - - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/prj119576_a/WebContent/body2.jsp")); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(file); - assertTrue("model has no content", model.getStructuredDocument().getLength() > 0); - - Element element = (Element) model.getIndexedRegion(75); - CMElementDeclaration ed = ModelQueryUtil.getModelQuery(model).getCMElementDeclaration(element); - assertNotNull("no (TLD) element declaration found for " + element.getNodeName(), ed); - assertTrue("not a wrapping content model element declaration: " + ed.getNodeName(), ed instanceof CMNodeWrapper); - assertTrue("not a taglib content model element declaration: " + ed.getNodeName(), ((CMNodeWrapper) ed).getOriginNode() instanceof TLDElementDeclaration); - String tagClassName = ((TLDElementDeclaration) ((CMNodeWrapper) ed).getOriginNode()).getTagclass(); - assertNotNull("no tag class name found", tagClassName); - } - finally { - if (model != null) - model.releaseFromRead(); - } - } - - /** - * Verify included files are translated properly when they contain a - * multiple lines - * - * @throws Exception - */ - public void testTranslateMultiLineIncludedFileWithSpacesAndScriptletInInclude() throws Exception { - String projectName = "prj119576_c"; - - BundleResourceUtil.createSimpleProject(projectName, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()); - - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/" + projectName + "/WebContent/body3.jsp")); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(file); - assertTrue("model has no content", model.getStructuredDocument().getLength() > 0); - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter adapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - String source = adapter.getJSPTranslation().getJavaText(); - assertTrue("scriptlet with variable declaration not found\n" + source, source.indexOf("java.util.Date headerDate") > -1); - } - finally { - if (model != null) - model.releaseFromRead(); - } - } - - /** - * Verify included files are translated properly when they contain a - * single line and document region and no trailing white space. - * - * @throws Exception - */ - public void testTranslateSingleLineIncludedFileWithNoSpacesButScriptletInInclude() throws Exception { - String projectName = "prj119576_b"; - - BundleResourceUtil.createSimpleProject(projectName, null, null); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()); - - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/" + projectName + "/WebContent/body3.jsp")); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(file); - assertTrue("model has no content", model.getStructuredDocument().getLength() > 0); - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter adapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - String source = adapter.getJSPTranslation().getJavaText(); - assertTrue("scriptlet with variable declaration not found", source.indexOf("java.util.Date headerDate") > -1); - } - finally { - if (model != null) - model.releaseFromRead(); - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelRelease.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelRelease.java deleted file mode 100644 index 76f539c53..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelRelease.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 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.jst.jsp.core.tests.model; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; - -public class TestModelRelease extends TestCase { - - - - public void testJSPModel() { - IModelManager modelManager = getModelManager(); - IDOMModel structuredModel = (IDOMModel) modelManager.createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP); - boolean test = structuredModel.getId().equals(IModelManager.UNMANAGED_MODEL); - assertTrue(test); - // even though model is unmanaged, release still required, since - // adapter factories, etc., may be depending on it. - structuredModel.releaseFromEdit(); - // if above complete's normally (with no exceptions) - // consider passed. - assertTrue(true); - } - - private IModelManager getModelManager() { - IModelManager modelManager = StructuredModelManager.getModelManager(); - return modelManager; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelWithNoFile.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelWithNoFile.java deleted file mode 100644 index cca9267dc..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/model/TestModelWithNoFile.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 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.jst.jsp.core.tests.model; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.net.URL; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.jst.jsp.core.tests.JSPCoreTestsPlugin; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; - -public class TestModelWithNoFile extends TestCase { - - public void testJSPModel() { - IDOMModel structuredModel = (IDOMModel) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForJSP.ContentTypeID_JSP); - boolean test = structuredModel.getId().equals(IModelManager.UNMANAGED_MODEL); - assertTrue(test); - structuredModel.releaseFromEdit(); - assertTrue(true); - } - - public void testBug116066_1() { - IModelManager modelManager = StructuredModelManager.getModelManager(); - IStructuredModel model = null; - - // Create new project - IProject project = createSimpleProject("bug116066_1", null, null); - - IFile testFile = project.getFile("nonExistant.jsp"); - assertFalse("nonExistant.jsp test file already exists (not a clean workspace)?", testFile.exists()); - - // Get the model and set a reference to that tag library into it - try { - model = modelManager.getNewModelForEdit(testFile, false); - assertNotNull("couldn't get new model for " + testFile.getFullPath(), model); - model.getStructuredDocument().set("<%@taglib prefix=\"tagdependent\" uri=\"tagdependent\">\n<tagdependent:code> <<< </tagdependent:code>"); - } - catch (Exception e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } - - public void testBug116066_2() { - IModelManager modelManager = StructuredModelManager.getModelManager(); - IStructuredModel model = null; - - // Create new project - IProject project = createSimpleProject("bug116066_2", null, null); - // Copy a TLD into the project - IFile tld = copyBundleEntryIntoWorkspace("/testfiles/116066/tagdep.tld", "/bug116066_2/tagdep.tld"); - assertNotNull("TLD entry was not copied properly", tld); - assertTrue("TLD IFile does not exist", tld.exists()); - - IFile testFile = project.getFile("nonExistant.jsp"); - assertFalse("nonExistant.jsp test file already exists (not a clean workspace)?", testFile.exists()); - - // Get the model and set a reference to that tag library into it - try { - model = modelManager.getNewModelForEdit(testFile, false); - assertNotNull("couldn't get new model for " + testFile.getFullPath(), model); - model.getStructuredDocument().set("<%@taglib prefix=\"tagdependent\" uri=\"tagdependent\">\n<tagdependent:code> <<< </tagdependent:code>"); - } - catch (Exception e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - finally { - if (model != null) { - model.releaseFromEdit(); - } - } - } - - private IFile copyBundleEntryIntoWorkspace(String entryname, String fullPath) { - IFile file = null; - URL entry = JSPCoreTestsPlugin.getDefault().getBundle().getEntry(entryname); - if (entry != null) { - try { - byte[] b = new byte[2048]; - InputStream input = entry.openStream(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - int i = -1; - while ((i = input.read(b)) > -1) { - output.write(b, 0, i); - } - file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullPath)); - if (file != null) { - file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor()); - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - catch (CoreException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - return file; - } - - private IProject createSimpleProject(String name, IPath location, String[] natureIds) { - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name); - if (location != null) { - description.setLocation(location); - } - if (natureIds != null) { - description.setNatureIds(natureIds); - } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - try { - project.create(description, new NullProgressMonitor()); - assertTrue(project.exists()); - project.open(new NullProgressMonitor()); - } - catch (CoreException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - return project; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/JSPTokenizerTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/JSPTokenizerTest.java deleted file mode 100644 index fb22dd90f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/JSPTokenizerTest.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 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.jst.jsp.core.tests.source; - - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; - -import junit.framework.TestCase; - -import org.eclipse.jst.jsp.core.internal.parser.internal.JSPTokenizer; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; - -public class JSPTokenizerTest extends TestCase { - private JSPTokenizer tokenizer = null; - - private void reset(Reader in) { - tokenizer.reset(in); - } - - private void reset(String filename) { - Reader fileReader = null; - try { - fileReader = new InputStreamReader(getClass().getResourceAsStream(filename), "utf8"); - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - BufferedReader reader = new BufferedReader(fileReader); - reset(reader); - } - - protected void setUp() throws Exception { - super.setUp(); - tokenizer = new JSPTokenizer(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - tokenizer = null; - } - - public void test144807_AttrName() { - String input = ""; - for (int i = 0; i < 400; i++) { - input = input += "<a "; - } - try { - reset(new StringReader(input)); - assertTrue("empty input", tokenizer.getNextToken() != null); - while (tokenizer.getNextToken() != null) { - // really, we just want to loop - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - public void test144807_AttrValue() { - String input = "<a b="; - for (int i = 0; i < 400; i++) { - input = input += "<a "; - } - try { - reset(new StringReader(input)); - assertTrue("empty input", tokenizer.getNextToken() != null); - while (tokenizer.getNextToken() != null) { - // really, we just want to loop - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - public void test144807_Equals() { - String input = "<a b"; - for (int i = 0; i < 400; i++) { - input = input += "<a "; - } - try { - reset(new StringReader(input)); - assertTrue("empty input", tokenizer.getNextToken() != null); - while (tokenizer.getNextToken() != null) { - // really, we just want to loop - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - public void testInsertComment() { - reset("jspcomment01.jsp"); - try { - assertTrue("empty input", tokenizer.getNextToken() != null); - while (tokenizer.getNextToken() != null) { - // really, we just want to loop - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - catch (StackOverflowError e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - - // success if StackOverFlowError does not occur with tokenizer. - assertTrue(true); - } - // [260004] - public void test26004() { - String input = "<c:set var=\"foo\" value=\"${foo} bar #\" /> <div id=\"container\" >Test</div>"; - try { - reset(new StringReader(input)); - ITextRegion region = tokenizer.getNextToken(); - assertTrue("empty input", region != null); - while (region != null) { - if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) { - region = tokenizer.getNextToken(); - assertNotNull("document consumed by trailing $ or #", region); - } - else - region = tokenizer.getNextToken(); - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - // [150794] - public void test150794() { - String input = "<a href=\"<jsp:getProperty/>\">"; - try { - reset(new StringReader(input)); - ITextRegion region = tokenizer.getNextToken(); - assertTrue("empty input", region != null); - while (region != null) { - if (region.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) { - region = tokenizer.getNextToken(); - assertNotNull("document consumed by embedded JSP tag", region); - } - else - region = tokenizer.getNextToken(); - } - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - /** - * <p>This test is to protect against regression of 299146 where   was being - * broken up into & #1 60 and then when a ; was typed could not be recognized - * as a Unicode character reference. It should be detected as & #160 which is - * what is tested for here.</p> - */ - public void test299146() { - String input = "<root> </root>"; - try { - reset(new StringReader(input)); - ITextRegion region = null; - for(int i = 0; i < 5; ++i) { - region = tokenizer.getNextToken(); - } - assertNotNull("This region should exist", region); - assertEquals("The region did not have the expected start location", 7, region.getStart()); - assertEquals("The region did not have the expected length", 4, region.getLength()); - } - catch (IOException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - } - - // Need to simulate typing characters into the document to cause the stack overflow. - // Test is irrelevant due to changes in [280496] - /*public void test265380() throws Exception { - String projectName = "bug_265380"; - int oldDepth = BooleanStack.maxDepth; - // Make the maxDepth equivalent to that we'd see in a normal editor - BooleanStack.maxDepth = 100; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(projectName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - IFile file = project.getFile("test265380.jsp"); - assertTrue(file.exists()); - - IStructuredModel model = StructuredModelManager.getModelManager().getModelForEdit(file); - - try { - IStructuredDocument jspDocument = model.getStructuredDocument(); - - // offset in the document to begin inserting text - int offset = 414; - // String to insert character-by-character - String cif = "<c:out value=\"lorem ipsum\"></c:out>\n"; - // It takes several tags to be inserted before the stack was overflowed - for (int i = 0; i < 10; i++) { - for (int j = 0; j < cif.length(); j++) - jspDocument.replace(offset++, 0, String.valueOf(cif.charAt(j))); - } - } - catch (StackOverflowError e) { - fail("Stack overflow encountered while editing document."); - } - finally { - if (model != null) - model.releaseFromEdit(); - BooleanStack.maxDepth = oldDepth; - } - }*/ -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/jspcomment01.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/jspcomment01.jsp deleted file mode 100644 index 71a8c053e..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/source/jspcomment01.jsp +++ /dev/null @@ -1,222 +0,0 @@ -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> -<%-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --%> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java deleted file mode 100644 index c3f557376..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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.jst.jsp.core.tests.taglibindex; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jst.jsp.core.tests.JSPCoreTestsPlugin; - -public class BundleResourceUtil { - - public static void _copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) throws Exception { - Enumeration entries = JSPCoreTestsPlugin.getDefault().getBundle().getEntryPaths(rootEntry); - while (entries != null && entries.hasMoreElements()) { - String entryPath = entries.nextElement().toString(); - String targetPath = new Path(fullTargetPath + "/" + entryPath.substring(rootEntry.length())).toString(); - if (entryPath.endsWith("/")) { - IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(targetPath)); - if (!folder.exists()) { - folder.create(true, true, new NullProgressMonitor()); - } - _copyBundleEntriesIntoWorkspace(entryPath, targetPath); - } - else { - _copyBundleEntryIntoWorkspace(entryPath, targetPath); - } - // System.out.println(entryPath + " -> " + targetPath); - } - } - - public static IFile _copyBundleEntryIntoWorkspace(String entryname, String fullPath) throws Exception { - IFile file = null; - URL entry = JSPCoreTestsPlugin.getDefault().getBundle().getEntry(entryname); - if (entry != null) { - IPath path = new Path(fullPath); - // for (int j = 1; j <= path.segmentCount() - 2; j++) { - // IPath folderPath = path.removeLastSegments(path.segmentCount() - // - j); - // IFolder folder = - // ResourcesPlugin.getWorkspace().getRoot().getFolder(folderPath); - // if (!folder.exists()) { - // folder.create(true, true, null); - // } - // } - byte[] b = new byte[2048]; - InputStream input = entry.openStream(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - int i = -1; - while ((i = input.read(b)) > -1) { - output.write(b, 0, i); - } - file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (file != null) { - if (!file.exists()) { - file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor()); - } - else { - file.setContents(new ByteArrayInputStream(output.toByteArray()), true, false, new NullProgressMonitor()); - } - } - } - else { - System.err.println("can't find " + entryname); - } - return file; - } - - public static void copyBundleEntriesIntoWorkspace(final String rootEntry, final String fullTargetPath) throws Exception { - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - try { - _copyBundleEntriesIntoWorkspace(rootEntry, fullTargetPath); - } - catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR, JSPCoreTestsPlugin.getDefault().getBundle().getSymbolicName(), 0, null, e)); - } - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - - public static IFile copyBundleEntryIntoWorkspace(final String entryname, final String fullPath) throws Exception { - final IFile file[] = new IFile[1]; - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - try { - file[0] = _copyBundleEntryIntoWorkspace(entryname, fullPath); - } - catch (Exception e) { - throw new CoreException(new Status(IStatus.ERROR, JSPCoreTestsPlugin.getDefault().getBundle().getSymbolicName(), 0, null, e)); - } - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - return file[0]; - } - - public static void copyBundleZippedEntriesIntoWorkspace(final String zipFileEntry, final IPath fullTargetPath) throws CoreException { - IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - IFile file = null; - URL entry = JSPCoreTestsPlugin.getDefault().getBundle().getEntry(zipFileEntry); - if (entry != null) { - try { - byte[] b = new byte[2048]; - ZipInputStream input = new ZipInputStream(entry.openStream()); - - ZipEntry nextEntry = input.getNextEntry(); - while (nextEntry != null) { - IPath path = fullTargetPath.append(nextEntry.getName()); - - if (nextEntry.isDirectory()) { - IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path); - if (!folder.exists()) { - folder.create(true, true, null); - } - } - else { - IPath folderPath = path.removeLastSegments(1); - for (int i = folderPath.segmentCount(); i > 0; i--) { - IPath parentFolderPath = path.removeLastSegments(i); - if (parentFolderPath.segmentCount() > 1) { - IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(parentFolderPath); - if (!folder.exists()) { - folder.create(true, true, null); - } - } - } - file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - int i = -1; - while ((i = input.read(b)) > -1) { - output.write(b, 0, i); - } - if (!file.exists()) { - file.create(new ByteArrayInputStream(output.toByteArray()), true, new NullProgressMonitor()); - } - else { - file.setContents(new ByteArrayInputStream(output.toByteArray()), true, false, new NullProgressMonitor()); - } - } - ResourcesPlugin.getWorkspace().checkpoint(true); - nextEntry = input.getNextEntry(); - } - } - catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - else { - System.err.println("can't find " + zipFileEntry); - } - ResourcesPlugin.getWorkspace().checkpoint(true); - } - }; - ResourcesPlugin.getWorkspace().run(runnable, new NullProgressMonitor()); - } - - /** - * Creates a simple project. - * - * @param name - - * the name of the project - * @param location - - * the location of the project, or null if the default of - * "/name" within the workspace is to be used - * @param natureIds - - * an array of natures IDs to set on the project, null if none - * should be set - * @return - */ - public static IProject createSimpleProject(String name, IPath location, String[] natureIds) { - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(name); - if (location != null) { - description.setLocation(location); - } - if (natureIds != null) { - description.setNatureIds(natureIds); - } - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name); - try { - project.create(description, new NullProgressMonitor()); - project.open(new NullProgressMonitor()); - } - catch (CoreException e) { - e.printStackTrace(); - } - return project; - } - - public static final String JAVA_NATURE_ID = "org.eclipse.jdt.core.javanature"; - - /** - * Add a library entry (like a jar) to the classpath of a project. The jar - * must be in your poject. You can copy the jar into your workspace using - * copyBundleEntryIntoWorkspace(String entryname, String fullPath) - * - * @param proj - * assumed it has java nature - * @param pathToJar - * project relative, no leading slash - */ - public static void addLibraryEntry(IProject proj, String pathToJar) { - - IPath projLocation = proj.getLocation(); - IPath absJarPath = projLocation.append(pathToJar); - - IJavaProject jProj = JavaCore.create(proj); - - IClasspathEntry strutsJarEntry = JavaCore.newLibraryEntry(absJarPath, null, null); - try { - IClasspathEntry[] currentEntries = jProj.getRawClasspath(); - - List l = new ArrayList(); - l.addAll(Arrays.asList(currentEntries)); - l.add(strutsJarEntry); - - IClasspathEntry[] newEntries = (IClasspathEntry[]) l.toArray(new IClasspathEntry[l.size()]); - jProj.setRawClasspath(newEntries, new NullProgressMonitor()); - } - catch (JavaModelException e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/TestIndex.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/TestIndex.java deleted file mode 100644 index ddde55557..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/TestIndex.java +++ /dev/null @@ -1,484 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 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.jst.jsp.core.tests.taglibindex; - -import java.net.URL; - -import junit.framework.TestCase; - -import org.eclipse.core.internal.resources.ResourceException; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.internal.core.ClasspathEntry; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument; -import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration; -import org.eclipse.jst.jsp.core.taglib.IJarRecord; -import org.eclipse.jst.jsp.core.taglib.ITaglibRecord; -import org.eclipse.jst.jsp.core.taglib.IURLRecord; -import org.eclipse.jst.jsp.core.taglib.TaglibIndex; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; -import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMNodeWrapper; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -/** - * Tests for the TaglibIndex. - */ -public class TestIndex extends TestCase { - String wtp_autotest_noninteractive = null; - int MAX_RETRYS = 5; - int PAUSE_TIME = 1; - boolean DEBUG = true; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - removeAllProjects(); - } - - public void testAvailableAfterAddingJARToBuildPath() throws Exception { - String url = "http://example.com/sample2_for_118251-e"; - - // Create new project - IProject project = BundleResourceUtil.createSimpleProject("bug_118251-e", null, null); - assertTrue(project.exists()); - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-e")); - assertEquals("wrong number of taglib records found before unpacking", 0, records.length); - - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_118251-e", "/bug_118251-e"); - // bug_118251-e/WebContent/WEB-INF/web.xml - // bug_118251-e/WebContent/WEB-INF/tld/sample2_for_118251-e.tld - // bug_118251-e/WebContent/META-INF/MANIFEST.MF - // bug_118251-e/WebContent/test1.jsp - // bug_118251-e/.classpath - // bug_118251-e/.project - ITaglibRecord taglibRecord = TaglibIndex.resolve("/bug_118251-e/WebContent/test1.jsp", url, false); - assertNull("unexpected record found for " + url, taglibRecord); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-e/WebContent/")); - assertEquals("wrong number of taglib records found after unpacking but before copying", 2, records.length); - - /* - * increase by <b>one</b> for the URL to the TLD in the jar (one - * implicit for the TLD in the jar as a resource and another implicit - * overwriting it with the same URL to the TLD in the jar on the - * classpath) - */ - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/bug_118251-e/WebContent/WEB-INF/sample_tld.jar"); - - url = "http://example.com/sample-taglib"; - taglibRecord = TaglibIndex.resolve("/bug_118251-e/WebContent/test1.jsp", url, false); - assertNotNull("expected record missing for " + url, taglibRecord); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-e/WebContent/")); - assertEquals("wrong number of taglib records found after copying", 3, records.length); - } - - public void testAvailableAfterCopyingJARIntoProject() throws Exception { - // Create new project - IProject project = BundleResourceUtil.createSimpleProject("bug_118251-f", null, null); - assertTrue(project.exists()); - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f")); - assertEquals("wrong number of taglib records found before unpacking", 0, records.length); - - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_118251-f", "/bug_118251-f"); - // bug_118251-f/WebContent/WEB-INF/web.xml - // bug_118251-f/WebContent/WEB-INF/tld/sample2_for_118251-e.tld - // bug_118251-f/WebContent/META-INF/MANIFEST.MF - // bug_118251-f/WebContent/test1.jsp - // bug_118251-f/.classpath - // bug_118251-f/.project - String url = "http://example.com/sample-taglib"; - ITaglibRecord taglibRecord = TaglibIndex.resolve("/bug_118251-f/WebContent/test1.jsp", url, false); - assertNull("unexpected record found for " + url, taglibRecord); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f/WebContent/")); - assertEquals("wrong number of taglib records found after unpacking but before copying", 3, records.length); - - /* - * increase by <b>one</b> for the URL to the TLD in the jar (one - * implicit for the TLD in the jar as a resource and another implicit - * overwriting it with the same URL to the TLD in the jar on the - * classpath) - */ - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/bug_118251-f/WebContent/WEB-INF/lib/sample_tld.jar"); - - taglibRecord = TaglibIndex.resolve("/bug_118251-f/WebContent/test1.jsp", url, false); - assertNotNull("no record found for " + url, taglibRecord); - assertTrue("record found was wrong type", taglibRecord instanceof IURLRecord); - assertNotNull("record has no base location", ((IURLRecord) taglibRecord).getBaseLocation()); - assertEquals("record has wrong short name", "sample", ((IURLRecord) taglibRecord).getShortName()); - assertEquals("record has wrong URI", url, ((IURLRecord) taglibRecord).getDescriptor().getURI()); - URL recordURL = ((IURLRecord) taglibRecord).getURL(); - assertNotNull("record has no URL", recordURL); - assertTrue("record has wrong URL", recordURL.toString().length() > 4); - assertEquals("record has wrong URL protocol", "jar:", recordURL.toString().substring(0, 4)); - assertEquals("record has wrong URL", "/bug_118251-f/WebContent/WEB-INF/lib/sample_tld.jar!/folder/sample_for_118251.tld", recordURL.toString().substring(recordURL.toString().length() - 81)); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f/WebContent/")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f/WebContent")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f/WebContent/WEB-INF")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-f/WebContent/WEB-INF/web.xml")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - } - - public void testAvailableAfterCopyingJARIntoProject2() throws Exception { - // Create new project - IProject project = BundleResourceUtil.createSimpleProject("bug_118251-g", null, null); - assertTrue(project.exists()); - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g")); - assertEquals("wrong number of taglib records found before unpacking", 0, records.length); - - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_118251-g", "/bug_118251-g"); - // bug_118251-g/Web Content/WEB-INF/web.xml - // bug_118251-g/Web Content/WEB-INF/tld/sample2_for_118251-e.tld - // bug_118251-g/Web Content/META-INF/MANIFEST.MF - // bug_118251-g/Web Content/test1.jsp - // bug_118251-g/.classpath - // bug_118251-g/.project - String url = "http://example.com/sample-taglib"; - ITaglibRecord taglibRecord = TaglibIndex.resolve("/bug_118251-g/Web Content/test1.jsp", url, false); - assertNull("unexpected record found for " + url, taglibRecord); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g/Web Content/")); - assertEquals("wrong number of taglib records found after unpacking but before copying", 3, records.length); - - /* - * increase by <b>one</b> for the URL to the TLD in the jar (one - * implicit for the TLD in the jar as a resource and another implicit - * overwriting it with the same URL to the TLD in the jar on the - * classpath) - */ - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/bug_118251-g/Web Content/WEB-INF/lib/sample_tld.jar"); - - taglibRecord = TaglibIndex.resolve("/bug_118251-g/Web Content/test1.jsp", url, false); - assertNotNull("no record found for " + url, taglibRecord); - assertTrue("record found was wrong type", taglibRecord instanceof IURLRecord); - assertNotNull("record has no base location", ((IURLRecord) taglibRecord).getBaseLocation()); - assertEquals("record has wrong short name", "sample", ((IURLRecord) taglibRecord).getShortName()); - assertEquals("record has wrong URI", url, ((IURLRecord) taglibRecord).getDescriptor().getURI()); - URL recordURL = ((IURLRecord) taglibRecord).getURL(); - assertNotNull("record has no URL", recordURL); - assertTrue("record has wrong URL", recordURL.toString().length() > 4); - assertEquals("record has wrong URL protocol", "jar:", recordURL.toString().substring(0, 4)); - assertEquals("record has wrong URL", "/bug_118251-g/Web Content/WEB-INF/lib/sample_tld.jar!/folder/sample_for_118251.tld", recordURL.toString().substring(recordURL.toString().length() - 82)); - - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g/Web Content/")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g/Web Content")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g/Web Content/WEB-INF")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_118251-g/Web Content/WEB-INF/web.xml")); - assertEquals("wrong number of taglib records found after copying", 4, records.length); - } - - public void testUtilityProjectSupport() throws Exception { - // Create project 1 - IProject project = BundleResourceUtil.createSimpleProject("test-jar", null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug183756/test-jar", "/test-jar"); - - // Create project 2 - IProject project2 = BundleResourceUtil.createSimpleProject("test-war", null, null); - assertTrue(project2.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug183756/test-war", "/test-war"); - - IFile testFile = project2.getFile(new Path("src/main/webapp/test.jsp")); - assertTrue("missing test JSP file!", testFile.isAccessible()); - - IDOMModel jspModel = null; - try { - jspModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(testFile); - NodeList tests = jspModel.getDocument().getElementsByTagName("test:test"); - assertTrue("test:test element not found", tests.getLength() > 0); - CMElementDeclaration elementDecl = ModelQueryUtil.getModelQuery(jspModel).getCMElementDeclaration(((Element) tests.item(0))); - assertNotNull("No element declaration was found for test:test at runtime", elementDecl); - assertTrue("element declaration was not the expected kind", elementDecl instanceof CMNodeWrapper); - CMNode originNode = ((CMNodeWrapper) elementDecl).getOriginNode(); - assertTrue("element declaration was not from a tag library", originNode instanceof TLDElementDeclaration); - assertEquals("element declaration was not from expected tag library", "http://foo.com/testtags", ((TLDDocument) ((TLDElementDeclaration) originNode).getOwnerDocument()).getUri()); - } - finally { - if (jspModel != null) { - jspModel.releaseFromRead(); - } - } - } - - public void testWebXMLTaglibMappingsToJARs() throws Exception { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("bug_148717"); - if (!project.exists()) { - // Create new project - project = BundleResourceUtil.createSimpleProject("bug_148717", null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/bug_148717", "/bug_148717"); - } - - IFile file = project.getFile("/WebContent/WEB-INF/lib/internal.jar"); - assertTrue(file.exists()); - - String uri = "http://example.com/external-uri"; - ITaglibRecord taglibRecord = TaglibIndex.resolve("/bug_148717/WebContent/", uri, false); - assertNotNull("record not found for " + uri, taglibRecord); - assertEquals(ITaglibRecord.JAR, taglibRecord.getRecordType()); - assertEquals(uri, ((IJarRecord) taglibRecord).getDescriptor().getURI()); - - ITaglibRecord taglibRecord2 = null; - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/bug_148717/WebContent/")); - for (int i = 0; i < records.length; i++) { - int type = records[i].getRecordType(); - switch (type) { - case ITaglibRecord.JAR : { - taglibRecord2 = records[i]; - } - break; - } - } - assertNotNull("record not returned for " + uri, taglibRecord2); - assertEquals(ITaglibRecord.JAR, taglibRecord2.getRecordType()); - assertEquals(uri, ((IJarRecord) taglibRecord2).getDescriptor().getURI()); - } - - /** - * test caching from session-to-session - */ - public void testRecordCacheCountBetweenSessions() throws Exception { - TaglibIndex.shutdown(); - // Create new project - IProject project = BundleResourceUtil.createSimpleProject("testcache1", null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/testcache1", "/testcache1"); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/testcache1/WebContent/WEB-INF/lib/sample_tld.jar"); - TaglibIndex.startup(); - - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match", 5, records.length); - - TaglibIndex.shutdown(); - TaglibIndex.startup(); - ITaglibRecord[] records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (1st restart)", records.length, records2.length); - TaglibIndex.shutdown(); - TaglibIndex.startup(); - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (2nd restart)", records.length, records2.length); - TaglibIndex.shutdown(); - TaglibIndex.startup(); - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (3rd restart)", records.length, records2.length); - } - - /** - * test caching from session-to-session with an addition in one session - */ - public void testCachingWithAddingLibrary() throws Exception { - // Create new project - IProject project = BundleResourceUtil.createSimpleProject("testcache2", null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/testcache2", "/testcache2"); - - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache2/WebContent")); - TaglibIndex.shutdown(); - - TaglibIndex.startup(); - ITaglibRecord[] records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (1st restart)", records.length, records2.length); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/testcache2/WebContent/WEB-INF/lib/sample_tld.jar"); - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (1st restart, added jar file)", records.length + 1, records2.length); - TaglibIndex.shutdown(); - - TaglibIndex.startup(); - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (2nd restart)", records.length + 1, records2.length); - BundleResourceUtil.addLibraryEntry(project, "WebContent/WEB-INF/lib/sample_tld.jar"); - TaglibIndex.shutdown(); - - TaglibIndex.startup(); - assertEquals("total ITaglibRecord count doesn't match (3nd restart)", records.length + 1, records2.length); - TaglibIndex.shutdown(); - - TaglibIndex.startup(); - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testcache2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match changed value (4th restart, add jar to build path)", records.length + 2, records2.length); - } - - public void testAvailableFromExportedOnBuildpathFromAnotherProject() throws Exception { - TaglibIndex.shutdown(); - - // Create project 1 - IProject project = BundleResourceUtil.createSimpleProject("testavailable1", null, null); - assertTrue(project.isAccessible()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/testavailable1", "/testavailable1"); - - // Create project 2 - IProject project2 = BundleResourceUtil.createSimpleProject("testavailable2", null, null); - assertTrue(project2.isAccessible()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/testavailable2", "/testavailable2"); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/bug_118251-sample/sample_tld.jar", "/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar"); - - TaglibIndex.startup(); - - // make sure project 1 sees no taglibs - ITaglibRecord[] records = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable1/WebContent")); - assertEquals("ITaglibRecords were found", 0, records.length); - // make sure project 2 sees two taglibs - ITaglibRecord[] records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable2/WebContent")); - if (records2.length != 2) { - for (int i = 0; i < records2.length; i++) { - System.err.println(records2[i]); - } - } - assertEquals("total ITaglibRecord count doesn't match", 2, records2.length); - - TaglibIndex.shutdown(); - TaglibIndex.startup(); - - - records2 = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match after restart", 2, records2.length); - - IJavaProject created = JavaCore.create(project2); - assertTrue("/availabletest2 not a Java project", created.exists()); - - // export the jar from project 2 - IClasspathEntry[] entries = created.getRawClasspath(); - boolean found = false; - for (int i = 0; i < entries.length; i++) { - IClasspathEntry entry = entries[i]; - if (entry.getPath().equals(new Path("/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar"))) { - found = true; - assertFalse("was exported", entry.isExported()); - ((ClasspathEntry) entry).isExported = true; - } - } - assertTrue("/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar was not found in build path", found); - IClasspathEntry[] entries2 = new IClasspathEntry[entries.length]; - System.arraycopy(entries, 1, entries2, 0, entries.length - 1); - entries2[entries.length - 1] = entries[0]; - created.setRawClasspath(entries2, new NullProgressMonitor()); - - entries = created.getRawClasspath(); - found = false; - for (int i = 0; i < entries.length; i++) { - IClasspathEntry entry = entries[i]; - if (entry.getPath().equals(new Path("/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar"))) { - found = true; - assertTrue("/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar was not exported", ((ClasspathEntry) entry).isExported); - } - } - assertTrue("/testavailable2/WebContent/WEB-INF/lib/sample_tld.jar was not found (and exported) in build path", found); - - // project 2 should still have just two taglibs - records = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (after exporting jar)", 2, records.length); - - // now one taglib should be visible from project 1 - records = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (after exporting jar), classpath provider problem?", 1, records.length); - - TaglibIndex.shutdown(); - TaglibIndex.startup(); - - // project 2 should still have just two taglibs - records = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable2/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (after exporting jar and restarting)", 2, records.length); - - // and one taglib should still be visible from project 1 - records = TaglibIndex.getAvailableTaglibRecords(new Path("/testavailable1/WebContent")); - assertEquals("total ITaglibRecord count doesn't match (after exporting jar and restarting)", 1, records.length); - } - - private void removeAllProjects() throws CoreException, InterruptedException { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IProject[] projects = workspace.getRoot().getProjects(); - IProject project = null; - for (int i = 0; i < projects.length; i++) { - project = projects[i]; - deleteProject(project); - } - } - - /** - * It's not easy to delete projects. If any of it's files are open by another thread, - * the operation will fail. So, this method will make several attempts before giving up. - * @param project - * @throws CoreException - * @throws InterruptedException - */ - private void deleteProject(IProject project) throws CoreException, InterruptedException { - int nTrys = 0; - while (project != null && project.exists() && nTrys < MAX_RETRYS) { - try { - nTrys++; - project.delete(true, true, null); - } - catch (ResourceException e) { - if (DEBUG) { - System.out.println(); - System.out.println("Could not delete project on attempt number: "+ nTrys); - IStatus eStatus = e.getStatus(); - // should always be MultiStatus, but we'll check - if (eStatus instanceof MultiStatus) { - MultiStatus mStatus = (MultiStatus) eStatus; - IStatus[] iStatus = mStatus.getChildren(); - for (int j = 0; j < iStatus.length; j++) { - System.out.println("Status: " + j + " " + iStatus[j]); - } - } - else { - System.out.println("Status: " + eStatus); - } - } - /* - * If we could not delete the first time, wait a bit and - * re-try. If we could not delete, it is likely because - * another thread has a file open, or similar (such as the - * validation thread). - */ - Thread.sleep(PAUSE_TIME); - } - } - - if (project != null && project.exists()) { - fail("Error in test infrastructure. Could not delete project " + project + " after " + MAX_RETRYS + "attempts."); - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java deleted file mode 100644 index f94a6fa0d..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java +++ /dev/null @@ -1,691 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 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.jst.jsp.core.tests.translation; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.compiler.IProblem; -import org.eclipse.jst.jsp.core.internal.JSPCorePlugin; -import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslation; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslationExtension; -import org.eclipse.jst.jsp.core.internal.modelhandler.ModelHandlerForJSP; -import org.eclipse.jst.jsp.core.internal.preferences.JSPCorePreferenceNames; -import org.eclipse.jst.jsp.core.internal.taglib.CustomTag; -import org.eclipse.jst.jsp.core.internal.taglib.TaglibHelper; -import org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPValidator; -import org.eclipse.jst.jsp.core.tests.JSPCoreTestsPlugin; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.jst.jsp.core.tests.validation.ReporterForTest; -import org.eclipse.jst.jsp.core.tests.validation.ValidationContextForTest; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.validation.ValidationFramework; -import org.eclipse.wst.validation.ValidationResult; -import org.eclipse.wst.validation.ValidationState; -import org.eclipse.wst.validation.internal.operations.ValidatorManager; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; - -public class JSPJavaTranslatorCoreTest extends TestCase { - - static final String WTP_AUTOTEST_NONINTERACTIVE = "wtp.autotest.noninteractive"; - private static byte[] creationLock = new byte[0]; - - public JSPJavaTranslatorCoreTest() { - } - - public JSPJavaTranslatorCoreTest(String name) { - super(name); - } - - String wtp_autotest_noninteractive = null; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty(WTP_AUTOTEST_NONINTERACTIVE); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, "true"); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, wtp_autotest_noninteractive); - } - - public void test_107338() throws Exception { - String projectName = "bug_107338"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(projectName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - IFile file = project.getFile("WebContent/test107338.jsp"); - assertTrue(file.exists()); - - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(file); - IDOMModel jspModel = (IDOMModel) model; - - String jspSource = model.getStructuredDocument().get(); - - assertTrue("line delimiters have been converted to Windows [CRLF]", jspSource.indexOf("\r\n") < 0); - assertTrue("line delimiters have been converted to Mac [CR]", jspSource.indexOf("\r") < 0); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - IDOMDocument xmlDoc = jspModel.getDocument(); - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class); - JSPTranslation translation = translationAdapter.getJSPTranslation(); - // System.err.print(translation.getJavaText()); - - assertTrue("new-line beginning scriptlet missing from translation", translation.getJavaText().indexOf("int i = 0;") >= 0); - - model.releaseFromRead(); - } - - /** - * Tests jsp translation when jsp is within html comments. See - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=126377 - * - * @throws Exception - */ - public void test_126377() throws Exception { - String projectName = "bug_126377"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(projectName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); - IFile file = project.getFile("WebContent/test126377_noerror.jsp"); - assertTrue(file.exists()); - - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - helper.setURI(file.getFullPath().toOSString()); - validator.validate(helper, reporter); - - assertTrue("found jsp java error within html comments when there are none", reporter.getMessages().isEmpty()); - - file = project.getFile("WebContent/test126377_error.jsp"); - assertTrue(file.exists()); - helper.setURI(file.getFullPath().toOSString()); - validator.validate(helper, reporter); - - int errors = reporter.getMessages().size(); - assertTrue("found "+errors+" jsp java errors within html comments when there should be 3", (errors == 3)); - } - - // public void testMangling() { - // assertEquals("simple_tag", JSP2ServletNameUtil.mangle("simple.tag")); - // assertEquals("simple_jspf", JSP2ServletNameUtil.mangle("simple.jspf")); - // assertEquals("sim_005f_005fple_tagx", - // JSP2ServletNameUtil.mangle("sim__ple.tagx")); - // assertEquals(new Path("Project.folder.simple_tag"), - // JSP2ServletNameUtil.mangle(new Path("/Project/folder/simple.tag"))); - // assertEquals(new Path("Project.fold_005fer.simple_jspx"), - // JSP2ServletNameUtil.mangle(new Path("/Project/fold_er/simple.jspx"))); - // } - // - // public void testUnmangling() { - // assertEquals("simple.tag", JSP2ServletNameUtil.unmangle("simple_tag")); - // assertEquals("simple.jspf", - // JSP2ServletNameUtil.unmangle("simple_jspf")); - // assertEquals("sim__ple.tagx", - // JSP2ServletNameUtil.unmangle("sim_005f_005fple_tagx")); - // assertEquals(new Path("/Project/folder/simple.tag"), - // JSP2ServletNameUtil.unmangle(new Path("Project.folder.simple_tag"))); - // assertEquals(new Path("/Project/fold_er/simple.jspx"), - // JSP2ServletNameUtil.unmangle(new - // Path("Project.fold_005fer.simple_jspx"))); - // } - public void test_174042() throws Exception { - boolean doValidateSegments = JSPCorePlugin.getDefault().getPluginPreferences().getBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - String testName = "bug_174042"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/struts.jar", "/" + testName + "/struts.jar"); - waitForBuildAndValidation(project); - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, doValidateSegments); - IFile main = project.getFile("main.jsp"); - IMarker[] markers = main.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO); - StringBuffer s = new StringBuffer(); - for (int i = 0; i < markers.length; i++) { - s.append("\nproblem marker on line " + markers[i].getAttribute(IMarker.LINE_NUMBER) + ": \"" + markers[i].getAttribute(IMarker.MESSAGE) + "\" "); - } - assertEquals("problem markers found, " + s.toString(), 0, markers.length); - } - - private void waitForBuildAndValidation() throws CoreException { - IWorkspaceRoot root = null; - try { - ResourcesPlugin.getWorkspace().checkpoint(true); - Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor()); - Job.getJobManager().join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new NullProgressMonitor()); - Job.getJobManager().join(ValidatorManager.VALIDATOR_JOB_FAMILY, new NullProgressMonitor()); - Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor()); - Thread.sleep(200); - Job.getJobManager().beginRule(root = ResourcesPlugin.getWorkspace().getRoot(), null); - } - catch (InterruptedException e) { - // woken up from sleep? -// StringWriter s = new StringWriter(); -// e.printStackTrace(new PrintWriter(s)); -// fail(s.toString()); - } - catch (IllegalArgumentException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - catch (OperationCanceledException e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - finally { - if (root != null) { - Job.getJobManager().endRule(root); - } - } - } - - private void waitForBuildAndValidation(IProject project) throws CoreException { - project.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor()); - waitForBuildAndValidation(); - project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); - waitForBuildAndValidation(); - } - - public void test_178443() throws Exception { - boolean doValidateSegments = JSPCorePlugin.getDefault().getPluginPreferences().getBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - String testName = "bug_178443"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testName, Platform.getStateLocation(JSPCoreTestsPlugin.getDefault().getBundle()).append(testName), null); - assertTrue(project.exists()); - /* - * Should be set to false. A referenced class in an included segment - * does not exist. - */ - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, false); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/struts.jar", "/" + testName + "/struts.jar"); - - waitForBuildAndValidation(project); - - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, doValidateSegments); - IFile main = project.getFile("main.jsp"); - IMarker[] markers = main.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO); - - StringBuffer s = new StringBuffer(); - for (int i = 0; i < markers.length; i++) { - s.append("\nproblem on line " + markers[i].getAttribute(IMarker.LINE_NUMBER) + ": " + markers[i].getAttribute(IMarker.MESSAGE)); - } - assertEquals("problem markers found" + s.toString(), 0, markers.length); - } - - public void test_109721() throws Exception { - boolean doValidateSegments = JSPCorePlugin.getDefault().getPluginPreferences().getBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - String testName = "bug_109721"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testName, Platform.getStateLocation(JSPCoreTestsPlugin.getDefault().getBundle()).append(testName), null); - assertTrue(project.exists()); - /* - * Should be set to false. A referenced class in an included segment - * does not exist. - */ - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, false); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/struts.jar", "/" + testName + "/WebContent/WEB-INF/lib/struts.jar"); - - waitForBuildAndValidation(project); - - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, doValidateSegments); - IFile main = project.getFile("WebContent/main.jsp"); - ValidationResult result = new JSPJavaValidator().validate(main, IResourceDelta.ADDED, new ValidationState(), new NullProgressMonitor()); - List messages = result.getReporter(null).getMessages(); - - StringBuffer s = new StringBuffer(); - for (int i = 0; i < messages.size(); i++) { - s.append("\nproblem on line " + ((IMessage)messages.get(i)).getAttribute(IMarker.LINE_NUMBER) + ": " + ((IMessage)messages.get(i)).getText()); - } - assertEquals("problem markers found" + s.toString(), 0, messages.size()); - } - - public void test_181057a() throws Exception { - boolean doValidateSegments = JSPCorePlugin.getDefault().getPluginPreferences().getBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - String testName = "bug_181057"; - // Create new project - IProject j = BundleResourceUtil.createSimpleProject("j", null, null); - assertTrue(j.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/j", "/j"); - IProject k = BundleResourceUtil.createSimpleProject("k", null, null); - assertTrue(k.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/k", "/k"); - - IProject project = BundleResourceUtil.createSimpleProject(testName, Platform.getStateLocation(JSPCoreTestsPlugin.getDefault().getBundle()).append(testName), null); - assertTrue(project.exists()); - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - BundleResourceUtil.copyBundleEntryIntoWorkspace("/testfiles/struts.jar", "/" + testName + "/struts.jar"); - - waitForBuildAndValidation(project); - - JSPCorePlugin.getDefault().getPluginPreferences().setValue(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, doValidateSegments); - /* - * main.jsp contains numerous references to tags in struts.jar, which - * is at the end of the build path - */ - IFile main = project.getFile("main.jsp"); - IMarker[] markers = main.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO); - StringBuffer s = new StringBuffer(); - for (int i = 0; i < markers.length; i++) { - s.append("\n" + markers[i].getAttribute(IMarker.LINE_NUMBER) + ":" + markers[i].getAttribute(IMarker.MESSAGE)); - } - assertEquals("problem markers found" + s.toString(), 0, markers.length); - } - - public void test_219761a() throws Exception { - /** - * Broken behavior has a Java syntax error on line 19, which only - * contains an include directive to a fragment that doesn't exist. - * - * All syntax errors should be on lines 25 or 28 and after offset 373 - * (single character line delimiter!). - */ - String testName = "testTranslatorMessagesWithIncludes"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - - waitForBuildAndValidation(project); - ValidationFramework.getDefault().validate(new IProject[]{project}, true, true, new NullProgressMonitor()); - - IFile main = project.getFile("/WebContent/sample.jsp"); - assertTrue("sample test file does not exist", main.isAccessible()); - IMarker[] markers = main.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO); - StringBuffer markerText = new StringBuffer(); - for (int i = 0; i < markers.length; i++) { - // line/start-end - markerText.append("\nL" + markers[i].getAttribute(IMarker.LINE_NUMBER) + "/o" + markers[i].getAttribute(IMarker.CHAR_START) + "-" + markers[i].getAttribute(IMarker.CHAR_END) + ":" + markers[i].getAttribute(IMarker.MESSAGE)); - } -// int numberOfSyntaxErrors = 0; - for (int i = 0; i < markers.length; i++) { - Object message = markers[i].getAttribute(IMarker.MESSAGE); - assertNotNull("Marker message was null!", message); - if (message.toString().startsWith("Syntax error")) { -// numberOfSyntaxErrors++; - assertTrue("Syntax error reported before line 25" + markerText, ((Integer) markers[i].getAttribute(IMarker.LINE_NUMBER)).intValue() >= 25); -// assertTrue("Syntax error reported before offset 371" + markerText, ((Integer) markers[i].getAttribute(IMarker.CHAR_START)).intValue() >= 370); -// assertTrue("Syntax error reported after 456" + markerText, ((Integer) markers[i].getAttribute(IMarker.CHAR_START)).intValue() < 456); - } - } -// assertEquals("wrong number of syntax errors reported\n" + markerText, 3, numberOfSyntaxErrors); - - // clean up if we got to the end - project.delete(true, true, null); - } - - public void test_150794() throws Exception { - String testName = "bug_150794"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - - IFile main = project.getFile("/WebContent/escapedQuotes.jsp"); - assertTrue("sample test file does not exist", main.isAccessible()); - - JSPJavaValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - helper.setURI(main.getFullPath().toOSString()); - validator.validate(helper, reporter); - - assertTrue("Unexpected problems found", reporter.getMessages().size() == 0); - - // clean up if we got to the end - project.delete(true, true, null); - } - - public void test_preludes() throws Exception { - String testName = "testPreludeAndCodas"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - synchronized (creationLock) { - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - } - - IFile main = project.getFile("/web stuff/prelude-user/test.jsp"); - assertTrue("sample test file not accessible", main.isAccessible()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(main); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - IJSPTranslation translation = translationAdapter.getJSPTranslation(); - assertNotNull("no Java translation found", translation); - assertTrue("prelude0 contents not included", translation.getJavaText().indexOf("int prelude0") > 0); - assertTrue("prelude1 contents not included", translation.getJavaText().indexOf("int prelude1") > 0); - - assertTrue("import statement not found", translation.getJavaText().indexOf("import java.lang.ref.Reference") > 0); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - public void test_codas() throws Exception { - String testName = "testPreludeAndCodas"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - synchronized (creationLock) { - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - } - - IFile main = project.getFile("/web stuff/coda-user/test.jsp"); - assertTrue("sample test file not accessible", main.isAccessible()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(main); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - IJSPTranslation translation = translationAdapter.getJSPTranslation(); - assertNotNull("no Java translation found", translation); - assertTrue("coda0 contents not included", translation.getJavaText().indexOf("int coda0") > 0); - assertTrue("coda1 contents not included", translation.getJavaText().indexOf("int coda1") > 0); - - assertTrue("import statement not found", translation.getJavaText().indexOf("import java.lang.ref.Reference") > 0); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - public void test_prelude_and_coda() throws Exception { - String testName = "testPreludeAndCodas"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - synchronized (creationLock) { - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - } - - IFile main = project.getFile("/web stuff/both/test.jsp"); - assertTrue("sample test file not accessible", main.isAccessible()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(main); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - IJSPTranslation translation = translationAdapter.getJSPTranslation(); - assertNotNull("no Java translation found", translation); - assertTrue("prelude0 contents not included", translation.getJavaText().indexOf("int prelude0") > 0); - assertTrue("prelude1 contents included", translation.getJavaText().indexOf("int prelude1") < 0); - assertTrue("coda0 contents not included", translation.getJavaText().indexOf("int coda0") > 0); - assertTrue("coda1 contents included", translation.getJavaText().indexOf("int coda1") < 0); - - assertTrue("import statement not found", translation.getJavaText().indexOf("import java.lang.ref.Reference") > 0); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - public void testVariablesFromIncludedFragments() throws Exception { - String testName = "testVariablesFromIncludedFragments"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - synchronized (creationLock) { - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - } - - IFile main = project.getFile("/WebContent/main.jsp"); - assertTrue("sample test file not accessible", main.isAccessible()); - - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(main); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - IJSPTranslation translation = translationAdapter.getJSPTranslation(); - assertNotNull("no Java translation found", translation); - assertTrue("String variableFromHeader1 not found", translation.getJavaText().indexOf("String variableFromHeader1") > 0); - assertTrue("header1 contents not included", translation.getJavaText().indexOf("String variableFromHeader1 = \"initialized in header 1\";") > 0); - assertTrue("header2 contents not included", translation.getJavaText().indexOf("variableFromHeader1 = \"reassigned in header 2\";") > 0); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - public void testIterationTags() throws Exception { - String testName = "testIterationTags"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - waitForBuildAndValidation(project); - IFile testFile = project.getFile("/WebContent/test.jsp"); - assertTrue("test.jsp is not accessible", testFile.isAccessible()); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(testFile); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - JSPTranslationExtension translation = translationAdapter.getJSPTranslation(); - translation.setProblemCollectingActive(true); - assertNotNull("No Java translation found", translation); - translation.reconcileCompilationUnit(); - translation.setProblemCollectingActive(false); - List problems = translation.getProblems(); - assertNotNull("Translation had a null problems list.", problems); - Iterator it = problems.iterator(); - String javaText = translation.getJavaText(); - int startOffset = javaText.indexOf("<plain:simple>"); - assertTrue("<plan:simple> scope not found.", startOffset > 0); - int endOffset = javaText.indexOf("</plain:simple>", startOffset); - assertTrue("</plan:simple> scope not found.", endOffset > 0); - // Finds all errors caused by "continue cannot be used outside of a loop" - should only occur between <plain:simple></plain:simple> - while (it.hasNext()) { - IProblem problem = (IProblem) it.next(); - if (problem.isError()) { - if ("continue cannot be used outside of a loop".equals(problem.getMessage())) { - assertTrue("'continue cannot be used outside of a loop' outside of iteration tag: ", problem.getSourceStart() > startOffset && problem.getSourceEnd() < endOffset); - } - - } - } - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - /** - * Tests that an iteration tag will generate - * @throws Exception - */ - public void testIterationTagsIncomplete() throws Exception { - String testName = "testIterationTags"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - waitForBuildAndValidation(project); - IFile testFile = project.getFile("/WebContent/test_missing_end_tag.jsp"); - assertTrue("test_missing_end_tag.jsp is not accessible", testFile.isAccessible()); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForEdit(testFile); - - ModelHandlerForJSP.ensureTranslationAdapterFactory(model); - - JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) model.getDocument().getAdapterFor(IJSPTranslation.class); - JSPTranslationExtension translation = translationAdapter.getJSPTranslation(); - String javaText = translation.getJavaText(); - int startOffset = javaText.indexOf("} // [</plain:loop>]"); - assertTrue("Missing end tag was not accounted for.", startOffset != -1); - } - finally { - if (model != null) - model.releaseFromEdit(); - } - } - - public void testTaglibHelperWrongHierarchy() throws Exception { - String testName = "testIterationTags"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - waitForBuildAndValidation(project); - TaglibHelper helper = new TaglibHelper(project); - IFile testFile = project.getFile("/WebContent/iterationTester.jsp"); - assertTrue("iterationTester.jsp is not accessible", testFile.isAccessible()); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(testFile); - IStructuredDocument doc = model.getStructuredDocument(); - CustomTag tag = helper.getCustomTag("plain:list", doc, null, new ArrayList()); - assertFalse("plain:list should not be an IterationTag", tag.isIterationTag()); - } - finally { - if (model != null) - model.releaseFromRead(); - } - } - - public void testTaglibHelperUnresolvedSupertype() throws Exception { - String testName = "testIterationTags"; - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testName); - if (!project.isAccessible()) { - // Create new project - project = BundleResourceUtil.createSimpleProject(testName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testName, "/" + testName); - } - waitForBuildAndValidation(project); - TaglibHelper helper = new TaglibHelper(project); - IFile testFile = project.getFile("/WebContent/iterationTester.jsp"); - assertTrue("iterationTester.jsp is not accessible", testFile.isAccessible()); - IDOMModel model = null; - try { - model = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(testFile); - IStructuredDocument doc = model.getStructuredDocument(); - CustomTag tag = helper.getCustomTag("plain:uberloop", doc, null, new ArrayList()); - assertTrue("plain:uberloop should be an IterationTag", tag.isIterationTag()); - } - finally { - if (model != null) - model.releaseFromRead(); - } - } - - public void test_javaVariableIncludes() throws Exception { - String testFolderName = "jspx_javaVariable_includes"; - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(testFolderName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + testFolderName, "/" + testFolderName); - - waitForBuildAndValidation(project); - - ValidationFramework.getDefault().validate(new IProject[]{project}, true, false, new NullProgressMonitor()); - - assertNoProblemMarkers(project.getFile("/WebContent/test1.jsp")); - assertNoProblemMarkers(project.getFile("/WebContent/index.jspx")); - - // clean up if we got to the end - project.delete(true, true, null); - } - - private void assertNoProblemMarkers(IFile file) throws CoreException { - assertTrue("sample test file does not exist", file.isAccessible()); - IMarker[] markers = file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO); - StringBuffer markerText = new StringBuffer(); - for (int i = 0; i < markers.length; i++) { - // line/start-end - markerText.append("\nL" + markers[i].getAttribute(IMarker.LINE_NUMBER) + "/o" + markers[i].getAttribute(IMarker.CHAR_START) + "-" + markers[i].getAttribute(IMarker.CHAR_END) + ":" + markers[i].getAttribute(IMarker.MESSAGE)); - } - assertEquals("Problem markers reported found \n" + markerText, 0, markers.length); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCustomTagTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCustomTagTest.java deleted file mode 100644 index d317ee4c9..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCustomTagTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 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.jst.jsp.core.tests.translation; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPValidator; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.jst.jsp.core.tests.validation.ReporterForTest; -import org.eclipse.jst.jsp.core.tests.validation.ValidationContextForTest; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JSPJavaTranslatorCustomTagTest extends TestCase { - - static final String WTP_AUTOTEST_NONINTERACTIVE = "wtp.autotest.noninteractive";//$NON-NLS-1$ -// private static byte[] creationLock = new byte[0]; - - public JSPJavaTranslatorCustomTagTest() { - } - - public JSPJavaTranslatorCustomTagTest(String name) { - super(name); - } - - String wtp_autotest_noninteractive = null; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty(WTP_AUTOTEST_NONINTERACTIVE); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, "true");//$NON-NLS-1$ - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, wtp_autotest_noninteractive); - } - - /** - * Tests jsp translation when custom tag used - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=310085 - * - * @throws Exception - */ - public void test_310085() throws Exception { - String projectName = "bug_310085"; //$NON-NLS-1$ - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(projectName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName);//$NON-NLS-1$ //$NON-NLS-2$ - IFile file = project.getFile("WebContent/test310085.jsp");//$NON-NLS-1$ - assertTrue(file.exists()); - - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - helper.setURI(file.getFullPath().toString()); - validator.validate(helper, reporter); - - assertTrue("Found JSP Java problem for custom tag "+reporter.getMessages().size(), reporter.getMessages().isEmpty());//$NON-NLS-1$ - - } - - /** - * Tests jsp translation when custom tag used - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=326193 - * - * @throws Exception - */ - public void test_326193() throws Exception { - String projectName = "bug_326193"; //$NON-NLS-1$ - // Create new project - IProject project = BundleResourceUtil.createSimpleProject(projectName, null, null); - assertTrue(project.exists()); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + projectName, "/" + projectName); //$NON-NLS-1$ //$NON-NLS-2$ - IFile file = project.getFile("WebContent/test326193.jsp"); //$NON-NLS-1$ - assertTrue(file.exists()); - - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - helper.setURI(file.getFullPath().toOSString()); - validator.validate(helper, reporter); - - assertTrue("found jsp java error for empty end tag in xml comment in script", reporter.getMessages().isEmpty());//$NON-NLS-1$ - - } - } diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPTranslatorPersistenceTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPTranslatorPersistenceTest.java deleted file mode 100644 index 7b0f8fc45..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPTranslatorPersistenceTest.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 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.jst.jsp.core.tests.translation; - -import java.io.Externalizable; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslationExtension; -import org.eclipse.jst.jsp.core.internal.java.JSPTranslator; -import org.eclipse.jst.jsp.core.tests.ProjectUtil; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; - -/** - * - */ -public class JSPTranslatorPersistenceTest extends TestCase { - /** The name of the project that all of these tests will use */ - private static final String PROJECT_NAME = "JSPTranslatorPersistenceTest"; - - /** The location of the testing files */ - private static final String PROJECT_FILES = "/testfiles/JSPTranslatorPersistenceTest"; - - /** The project that all of the tests use */ - private static IProject fProject; - - /** - * <p>Default constructor<p> - * <p>Use {@link #suite()}</p> - * - * @see #suite() - */ - public JSPTranslatorPersistenceTest() { - super("JSPTranslator Externalization Test"); - } - - /** - * <p>Constructor that takes a test name.</p> - * <p>Use {@link #suite()}</p> - * - * @param name The name this test run should have. - * - * @see #suite() - */ - public JSPTranslatorPersistenceTest(String name) { - super(name); - } - - /** - * <p>Use this method to add these tests to a larger test suite so set up - * and tear down can be performed</p> - * - * @return a {@link TestSetup} that will run all of the tests in this class - * with set up and tear down. - */ - public static Test suite() { - TestSuite ts = new TestSuite(JSPTranslatorPersistenceTest.class, "JSPTranslator Externalization Test"); - return new JSPTranslatorExternalizationTestSetup(ts); - } - - public void testTranslationTextComparison() throws Exception { - String outFileName = "testTranslationTextComparison.obj"; - - JSPTranslator originalTranslator = writeTranslator("Test1.jsp", outFileName); - StringBuffer originalTranslation = originalTranslator.getTranslation(); - - JSPTranslator externalizedTranslator = (JSPTranslator)readObject(outFileName); - StringBuffer externalizedTranslation = externalizedTranslator.getTranslation(); - - assertEquals("The original translation should be the same as the restored externalized translation", - originalTranslation.toString(), externalizedTranslation.toString()); - } - - public void testTranslationsDeepEqual() throws Exception { - String outFileName = "testTranslationTextComparison.obj"; - - JSPTranslator originalTranslator = writeTranslator("Test1.jsp", outFileName); - JSPTranslator externalizedTranslator = (JSPTranslator)readObject(outFileName); - - assertEquals("The original translation should be deeply equal to the restored externalized translation", - originalTranslator, externalizedTranslator); - } - - /** - * <p>This test case follows the general pattern of how a translation is created, then can be - * externalized when the workspace is closed, then reloaded when its opened again.</p> - * - * @throws Exception - */ - public void testCreateTranslationAdapter() throws Exception { - String outFileName = "testCreateTranslationAdapter.obj"; - - IStructuredModel structModel = getModelForRead("Test1.jsp"); - - //verify there is not already an existing translation adapter - IDOMDocument domDoc = ((IDOMModel)structModel).getDocument(); - INodeAdapter existingAdapter = domDoc.getAdapterFor(IJSPTranslation.class); - assertNull("There should be no existing adapter for IJSPTranslation", existingAdapter); - - //create a translator and externalize it, then load the externalized translator - JSPTranslator originalTranslator = writeTranslator(structModel, outFileName); - JSPTranslator externalizedTranslator = (JSPTranslator)readObject(outFileName); - - //create an adaptr from the loaded externalized translator and add it to the doc - JSPTranslationAdapter restoredAdapter = new JSPTranslationAdapter((IDOMModel)structModel, externalizedTranslator); - domDoc.addAdapter(restoredAdapter); - - //verify we can retrieve the adapter we just set - existingAdapter = domDoc.getAdapterFor(IJSPTranslation.class); - assertNotNull("There should now be an existing adapter for IJSPTranslation", existingAdapter); - assertTrue("Expected " + existingAdapter + " to be an instance of JSPTranslationAdapter", - existingAdapter instanceof JSPTranslationAdapter); - JSPTranslationAdapter retrievedAdapter = (JSPTranslationAdapter)existingAdapter; - JSPTranslationExtension jspTranslationExtension = retrievedAdapter.getJSPTranslation(); - - /* verify that the original translation is equal to that of the - * retrieved adapter created from the previously externalized translator - */ - assertEquals("The original translation should be the same as the restored externalized translation", - originalTranslator.getTranslation().toString(), jspTranslationExtension.getJavaText()); - - - } - - private static JSPTranslator writeTranslator(String jspFileName, String externalizedFileName) throws IOException, CoreException { - JSPTranslator translator = new JSPTranslator(); - IStructuredModel model = null; - try { - model = getModelForRead(jspFileName); - translator = writeTranslator(model, externalizedFileName); - } finally { - if(model != null) { - model.releaseFromRead(); - } - } - - return translator; - } - - private static IStructuredModel getModelForRead(String fileName) throws IOException, CoreException { - IFile jspFile = fProject.getFile(fileName); - assertTrue(jspFile.exists()); - IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead(jspFile); - assertNotNull(model); - - return model; - } - - private static JSPTranslator writeTranslator(IStructuredModel jspModel, String externalizedFileName) throws IOException, CoreException { - JSPTranslator translator = new JSPTranslator(); - translator.reset((IDOMNode)jspModel.getIndexedRegion(0), new NullProgressMonitor()); - translator.translate(); - writeObject(externalizedFileName, translator); - - return translator; - } - - /** - * <p>Write an {@link Externalizable} object to a file</p> - * - * @param fileName - * @param obj - * @throws IOException - */ - private static void writeObject(String fileName, Object obj) throws IOException { - FileOutputStream fos = new FileOutputStream(fileName); - ObjectOutputStream out = new ObjectOutputStream(fos); - out.writeObject(obj); - out.close(); - } - - /** - * <p>Read an {@link Externalizable} object from a file</p> - * - * @param fileName - * @return - * @throws IOException - * @throws ClassNotFoundException - */ - private static Object readObject(String fileName) throws IOException, ClassNotFoundException { - Object obj = null; - - FileInputStream fis = new FileInputStream(fileName); - ObjectInputStream in = new ObjectInputStream(fis); - obj = in.readObject(); - in.close(); - - return obj; - } - - /** - * <p>This inner class is used to do set up and tear down before and - * after (respectively) all tests in the inclosing class have run.</p> - */ - private static class JSPTranslatorExternalizationTestSetup extends TestSetup { - private static final String WTP_AUTOTEST_NONINTERACTIVE = "wtp.autotest.noninteractive"; - private static String previousWTPAutoTestNonInteractivePropValue = null; - - /** - * Default constructor - * - * @param test do setup for the given test - */ - public JSPTranslatorExternalizationTestSetup(Test test) { - super(test); - } - - /** - * <p>This is run once before all of the tests</p> - * - * @see junit.extensions.TestSetup#setUp() - */ - public void setUp() throws Exception { - fProject = ProjectUtil.createProject(PROJECT_NAME, null, null); - ProjectUtil.copyBundleEntriesIntoWorkspace(PROJECT_FILES, PROJECT_NAME); - - String noninteractive = System.getProperty(WTP_AUTOTEST_NONINTERACTIVE); - - if (noninteractive != null) { - previousWTPAutoTestNonInteractivePropValue = noninteractive; - } else { - previousWTPAutoTestNonInteractivePropValue = "false"; - } - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, "true"); - } - - /** - * <p>This is run once after all of the tests have been run</p> - * - * @see junit.extensions.TestSetup#tearDown() - */ - public void tearDown() throws Exception { - if (previousWTPAutoTestNonInteractivePropValue != null) { - System.setProperty(WTP_AUTOTEST_NONINTERACTIVE, previousWTPAutoTestNonInteractivePropValue); - } - - fProject.delete(true, new NullProgressMonitor()); - } - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/StringCompareUtil.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/StringCompareUtil.java deleted file mode 100644 index d289dec9f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/util/StringCompareUtil.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.jst.jsp.core.tests.util; - -import java.io.IOException; -import java.io.StringReader; - -public class StringCompareUtil { - - public boolean equalsIgnoreLineSeperator(String string1, String string2) { - - if (string1 == null) - return false; - if (string2 == null) - return false; - - StringReader s1Reader = new StringReader(string1); - StringReader s2Reader = new StringReader(string2); - - // assume true unless find evidence to the contrary - boolean result = true; - int s1Char = -1; - int s2Char = -1; - do { - - s1Char = getNextChar(s1Reader); - - s2Char = getNextChar(s2Reader); - - if (s1Char != s2Char) { - result = false; - break; - } - } - while (s1Char != -1 && s2Char != -1); - - return result; - } - - /** - * Method getNextChar. - * @param s1Reader - * @return char - */ - private int getNextChar(StringReader reader) { - int nextChar = -1; - try { - nextChar = reader.read(); - while (isEOL(nextChar)) { - nextChar = reader.read(); - } - } - catch (IOException e) { - e.printStackTrace(); - } - return nextChar; - } - - private boolean isEOL(int aChar) { - return (aChar == '\n' || aChar == '\r'); - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPActionValidatorTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPActionValidatorTest.java deleted file mode 100644 index e22c507a1..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPActionValidatorTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 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.jst.jsp.core.tests.validation; - -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsp.core.internal.JSPCoreMessages; -import org.eclipse.jst.jsp.core.internal.validation.JSPActionValidator; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class JSPActionValidatorTest extends TestCase { - String wtp_autotest_noninteractive = null; - private static final String PROJECT_NAME = "testvalidatejspactions"; - private static final String UNDEFINED_ATTR_IDONT = "idont"; - private static final String REQUIRED_ATTR_NAME = "name"; - private static final String NONEMPTY_INLINE_TAG_NAME = "libtags:emptybodycontent"; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - if (!ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()) { - BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME); - } - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } - - /** - * Tests if unknown attributes are detected - * - * @throws Exception - */ - public void testUknownAttribute() throws Exception { - JSPActionValidator validator = new JSPActionValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/undefinedattribute.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - helper.setURI(filePath); - validator.validate(helper, reporter); - - boolean foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 4); - if (foundError1) - foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 12); - if (foundError1) - foundError1 = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_6, UNDEFINED_ATTR_IDONT), 13); - - assertTrue("jsp action validator did not detect undefined attributes", foundError1); - } - - /** - * Tests if missing required attributes are detected - * - * @throws Exception - */ - public void testMissingRequiredAttribute() throws Exception { - JSPActionValidator validator = new JSPActionValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/norequiredattribute.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - - helper.setURI(filePath); - validator.validate(helper, reporter); - - boolean foundError = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_5, REQUIRED_ATTR_NAME), 11); - if (foundError) - foundError = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPDirectiveValidator_5, REQUIRED_ATTR_NAME), 12); - - assertTrue("jsp action validator did not detect missing required attributes", foundError); - } - - private boolean errorMessageFound(IReporter reporter, String errorMessage, int errorLineNumber) { - boolean foundError = false; - List messages = reporter.getMessages(); - Iterator iter = messages.iterator(); - while (iter.hasNext() && !foundError) { - IMessage message = (IMessage) iter.next(); - int lineNumber = message.getLineNumber(); - String messageText = message.getText(); - - if (lineNumber == errorLineNumber && messageText.startsWith(errorMessage)) - foundError = true; - } - return foundError; - } - - /** - * Tests if missing required attributes are detected - * - * @throws Exception - */ - public void testAttributesCorrect() throws Exception { - JSPActionValidator validator = new JSPActionValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/worksfine.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - - helper.setURI(filePath); - validator.validate(helper, reporter); - - StringBuffer error = new StringBuffer("jsp action validator found errors when it should not have"); - List messages = reporter.getMessages(); - for (int i = 0; i < messages.size(); i++) { - error.append('\n'); - error.append(((IMessage) messages.get(i)).getText()); - } - - assertTrue(error.toString(), reporter.getMessages().isEmpty()); - } - - /** - * Tests if non-empty inline tags are flagged as warnings - * - * @throws Exception - */ - public void testNonEmptyInlineTag() throws Exception { - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=203254 - JSPActionValidator validator = new JSPActionValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/nonemptyinlinetag.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - - helper.setURI(filePath); - validator.validate(helper, reporter); - - boolean foundError = errorMessageFound(reporter, NLS.bind(JSPCoreMessages.JSPActionValidator_0, NONEMPTY_INLINE_TAG_NAME), 10); - - assertTrue("jsp action validator had problems detecting an error with content in an inline tag", foundError); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPBatchValidatorTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPBatchValidatorTest.java deleted file mode 100644 index 52d171d41..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPBatchValidatorTest.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.jst.jsp.core.tests.validation; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsp.core.internal.JSPCorePlugin; -import org.eclipse.jst.jsp.core.internal.contentproperties.JSPFContentProperties; -import org.eclipse.jst.jsp.core.internal.preferences.JSPCorePreferenceNames; -import org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPValidator; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.wst.validation.ReporterHelper; -import org.eclipse.wst.validation.ValidationFramework; -import org.eclipse.wst.validation.ValidationResult; -import org.eclipse.wst.validation.ValidationState; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Tests JSP Batch Validator - */ -public class JSPBatchValidatorTest extends TestCase { - String wtp_autotest_noninteractive = null; - private static final String PROJECT_NAME = "batchvalidation"; - Object originalWorkspaceValue = null; - IEclipsePreferences workspaceScope = null; - IEclipsePreferences projectScope = null; - Object[] validatorIds = new String[]{"org.eclipse.jst.jsp.core.JSPContentValidator", "org.eclipse.jst.jsp.core.JSPBatchValidator"}; - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - - protected void setUp() throws Exception { - super.setUp(); - - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - if (!getProject().exists()) { - BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME); - } - assertTrue("project could not be created", getProject().exists()); - - String filePath = "/" + PROJECT_NAME + "/WebContent/header.jspf"; - IFile fragment = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)); - - String qualifier = JSPCorePlugin.getDefault().getBundle().getSymbolicName(); - workspaceScope = new InstanceScope().getNode(qualifier); - projectScope = new ProjectScope(fragment.getProject()).getNode(qualifier); - originalWorkspaceValue = workspaceScope.get(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, null); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - projectScope.remove(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - projectScope.remove(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS); - if (originalWorkspaceValue != null) - workspaceScope.put(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, originalWorkspaceValue.toString()); - else - workspaceScope.remove(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - } - - /** - * Tests validating 2 jsp files. See - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=214441 - * - * @throws Exception - */ - public void testValidating2Files() throws Exception { - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath1 = "/" + PROJECT_NAME + "/WebContent/ihaveerrors.jsp"; - IFile file1 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath1)); - assertTrue(file1.exists()); - - String filePath2 = "/" + PROJECT_NAME + "/WebContent/ihaveerrors2.jsp"; - IFile file2 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath1)); - assertTrue(file2.exists()); - - helper.setURIs(new String[]{filePath1, filePath2}); - - validator.validate(helper, reporter); - assertTrue("expected jsp errors were not found in both files: " + reporter.getMessages().size(), reporter.getMessages().size() >= 2); - } - - public void testFragmentValidationPreferenceOnProject() throws Exception { - JSPBatchValidator validator1 = new JSPBatchValidator(); - JSPContentValidator validator2 = new JSPContentValidator(); - String filePath = "/" + PROJECT_NAME + "/WebContent/header.jspf"; - ValidationResult result = null; - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)); - - // enable workspace-wide but disable in project, no problem markers - // expected - workspaceScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); - projectScope.putBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, true); - projectScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, false); - - result = validator1.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor()); - result.mergeResults(validator2.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor())); - - assertEquals("Problems found while fragment validation was disabled in project but enabled on workspace", 0, (((ReporterHelper)result.getReporter(null)).getMessages().size())); - - /* - * disable workspace-wide but enable in project, some problem markers - * expected - */ - workspaceScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, false); - projectScope.putBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, true); - projectScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); - JSPFContentProperties.setProperty(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, file, Boolean.toString(true)); - - result = validator1.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor()); - result.mergeResults(validator2.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor())); - - assertTrue("Problems not found while fragment validation was enabled for project but disabled on workspace", 0 < (((ReporterHelper)result.getReporter(null)).getMessages().size())); - } - - public void testFragmentValidationPreferenceOnWorkspace() throws Exception { - JSPBatchValidator validator1 = new JSPBatchValidator(); - JSPContentValidator validator2 = new JSPContentValidator(); - String filePath = "/" + PROJECT_NAME + "/WebContent/header.jspf"; - - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)); - ValidationResult result = null; - - // disable workspace-wide, no problem markers expected - workspaceScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, false); - - result = validator1.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor()); - result.mergeResults(validator2.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor())); - - assertEquals("Problem markers found while fragment validation was disabled", 0, (((ReporterHelper)result.getReporter(null)).getMessages().size())); - - // enable workspace-wide, some problem markers expected - workspaceScope.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); - ValidationFramework.getDefault().validate(new IProject[]{getProject()}, true, false, new NullProgressMonitor()); - ValidationFramework.getDefault().join(new NullProgressMonitor()); - - result = validator1.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor()); - result.mergeResults(validator2.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor())); - - assertTrue("Problem markers not found while fragment validation was enabled on workspace", (((ReporterHelper)result.getReporter(null)).getMessages().size()) != 0); - - // check default value is true - workspaceScope.remove(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - projectScope.remove(JSPCorePreferenceNames.VALIDATE_FRAGMENTS); - projectScope.remove(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS); - - result = validator1.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor()); - result.mergeResults(validator2.validate(file, IResourceDelta.CHANGED, new ValidationState(), new NullProgressMonitor())); - - assertTrue("Problem markers not found while fragment validation was preferences were default", (((ReporterHelper)result.getReporter(null)).getMessages().size()) != 0); - } - - public void testELConditional() throws Exception { - if (!ResourcesPlugin.getWorkspace().getRoot().getProject("testIterationTags").exists()) { - BundleResourceUtil.createSimpleProject("testIterationTags", null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME); - } - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject("testIterationTags").exists()); - - - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath1 = "/testIterationTags/WebContent/default.jspx"; - IFile file1 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath1)); - assertTrue(file1.exists()); - - helper.setURIs(new String[]{filePath1}); - - validator.validate(helper, reporter); - assertTrue("expected jsp errors were not found in both files: " + reporter.getMessages().size(), reporter.getMessages().size() == 0); - } - - /** - * @return - */ - private IProject getProject() { - return ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java deleted file mode 100644 index 6caba40bc..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPDirectiveValidatorTest.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.jst.jsp.core.tests.validation; - -import java.io.ByteArrayInputStream; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsp.core.internal.JSPCoreMessages; -import org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPDirectiveValidator; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.sse.core.internal.util.Sorter; -import org.eclipse.wst.validation.AbstractValidator; -import org.eclipse.wst.validation.ValidationResult; -import org.eclipse.wst.validation.ValidationState; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage; - -public class JSPDirectiveValidatorTest extends TestCase { - - private String wtp_autotest_noninteractive = null; - private static final String PROJECT_NAME = "testvalidatejspdirectives"; - private static final String FRAGMENT_NAME = "fragmentThatDoesntExist.jspf"; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - if (!ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()) { - BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME); - } - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } - - public void testBug265710Expression() throws Exception { - JSPDirectiveValidator validator = new JSPDirectiveValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/bug265710expression.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - helper.setURI(filePath); - validator.validate(helper, reporter); - - if (reporter.getMessages().size() > 0) { - Iterator it = reporter.getMessages().iterator(); - while (it.hasNext()) { - IMessage message = (IMessage) it.next(); - if (message.getLineNumber() == 14 && message.getSeverity() == IMessage.HIGH_SEVERITY) { - fail("JSP Directive Validator flagged a JSP expression in the import directive"); - } - } - } - } - - public void testBug265710El() throws Exception { - JSPDirectiveValidator validator = new JSPDirectiveValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/bug265710el.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - helper.setURI(filePath); - validator.validate(helper, reporter); - - if (reporter.getMessages().size() > 0) { - Iterator it = reporter.getMessages().iterator(); - while (it.hasNext()) { - IMessage message = (IMessage) it.next(); - if (message.getLineNumber() == 11 && message.getSeverity() == IMessage.HIGH_SEVERITY) { - fail("JSP Directive Validator flagged JSP EL in the import directive"); - } - } - } - } - - public void testIncludeDirective() throws Exception { - JSPDirectiveValidator validator = new JSPDirectiveValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/testinclude.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - helper.setURI(filePath); - validator.validate(helper, reporter); - - boolean foundMissingInclude = false; - boolean foundIncludeWithError = false; - if (reporter.getMessages().size() > 0) { - Iterator it = reporter.getMessages().iterator(); - boolean foundError = false; - while (it.hasNext() && !foundError) { - IMessage message = (IMessage) it.next(); - if (message.getLineNumber() == 11) - foundIncludeWithError = true; - else if (message.getLineNumber() == 12) { - String expectedMsg = NLS.bind(JSPCoreMessages.JSPDirectiveValidator_4, new String[] { FRAGMENT_NAME, "/" + PROJECT_NAME + "/WebContent/" + FRAGMENT_NAME }); - if (!expectedMsg.equals(message.getText())) - fail("Error found on line 12, but was not a missing fragment error."); - foundMissingInclude = true; - break; - } - } - } - - assertFalse("JSP Directive Validator reported an error for a fragment that should be locatable.", foundIncludeWithError); - assertTrue("JSP Directive Validator did not report the missing fragment.", foundMissingInclude); - } - - public void testIncludeDirectiveXML() throws Exception { - String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"+ - "<jsp:root xmlns:jsp=\"http://java.sun.com/JSP/Page\" version=\"2.0\">\n"+ - "<jsp:directive.include file=\"missing.jspf\"/>\n"; - runNegativeTest("/"+ getName() + "/test.jsp", contents, new JSPBatchValidator(), "Fragment \"missing.jspf\" was not found at expected path /testIncludeDirectiveXML/missing.jspf"); - } - - public void testIncludeDirective2() throws Exception { - String contents = "<%@include file=\"missing.jspf\"%>\n"; - runNegativeTest("/"+ getName() + "/test.jsp", contents, new JSPBatchValidator(), "Fragment \"missing.jspf\" was not found at expected path /testIncludeDirective2/missing.jspf"); - } - - public void testIncludeAction() throws Exception { - String contents = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"+ - "<jsp:root xmlns:jsp=\"http://java.sun.com/JSP/Page\" version=\"2.0\">\n"+ - "<jsp:include page=\"missing.jspf\"/>\n"; - runNegativeTest("/"+ getName() + "/test.jsp", contents, new JSPBatchValidator(), "Fragment \"missing.jspf\" was not found at expected path /testIncludeAction/missing.jspf"); - } - - public void testIncludeMappedURL() throws Exception { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("delos"); - if (!project.exists()) { - BundleResourceUtil.createSimpleProject("delos", null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/delos", "/delos"); - } - assertTrue("project could not be created", project.exists()); - - JSPDirectiveValidator validator = new JSPDirectiveValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/delos/WebContent/1.jsp"; - assertTrue("unable to find file: " + filePath, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)).exists()); - helper.setURI(filePath); - validator.validate(helper, reporter); - assertTrue("problems were found in JSP file", reporter.getMessages().isEmpty()); - - try { - project.delete(true, null); - } - catch (CoreException e) { - // failure to clean up shouldn't fail the test - } - } - - /** - * The purpose of a validator is to generate messages. Let us make sure the expected messages are generated. - * @param filePath - * @param content - * @param validator - * @param expectedProblemMessages - * @throws Exception - */ - protected void runNegativeTest(String filePath, String content, AbstractValidator validator, String expectedProblemMessages) throws Exception { - IPath path = new Path (filePath); - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0)); - if (!project.exists()) { - BundleResourceUtil.createSimpleProject(path.segment(0), null, new String[]{JavaCore.NATURE_ID}); - } - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - file.create(new ByteArrayInputStream(content.getBytes("utf8")), true, null); - ValidationResult result = validator.validate(file, IResourceDelta.ADDED, new ValidationState(), new NullProgressMonitor()); - assertEquals(expectedProblemMessages, sortMessages(result.getReporter(new NullProgressMonitor()).getMessages())); - } - - static class ValidatorMessageSorter extends Sorter { - /* (non-Javadoc) - * @see org.eclipse.wst.sse.core.internal.util.Sorter#compare(java.lang.Object, java.lang.Object) - */ - public boolean compare(Object elementOne, Object elementTwo) { - if (elementOne instanceof ValidationMessage) - return ((ValidationMessage) elementTwo).getMessage().compareTo(((ValidationMessage) elementOne).getMessage()) > 0; - return ((IMessage) elementTwo).getOffset() > ((IMessage) elementOne).getOffset(); - } - } - - /** - * @param messages - * @return - */ - private String sortMessages(List messages) { - Object[] sorted = new ValidatorMessageSorter().sort(messages.toArray()); - StringBuffer s = new StringBuffer(); - for (int i = 0; i < sorted.length; i++) { - if (sorted[i] instanceof ValidationMessage) - s.append(((ValidationMessage) sorted[i]).getMessage()); - else - s.append(((IMessage) sorted[i]).getText()); - } - return s.toString(); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPJavaValidatorTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPJavaValidatorTest.java deleted file mode 100644 index 622071df3..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/JSPJavaValidatorTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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.jst.jsp.core.tests.validation; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jst.jsp.core.internal.contentproperties.JSPFContentProperties; -import org.eclipse.jst.jsp.core.internal.validation.JSPJavaValidator; -import org.eclipse.jst.jsp.core.internal.validation.JSPValidator; -import org.eclipse.jst.jsp.core.tests.taglibindex.BundleResourceUtil; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Tests JSP Java Validator - */ -public class JSPJavaValidatorTest extends TestCase { - String wtp_autotest_noninteractive = null; - private static final String PROJECT_NAME = "bug_87351"; - - protected void setUp() throws Exception { - super.setUp(); - String noninteractive = System.getProperty("wtp.autotest.noninteractive"); - if (noninteractive != null) - wtp_autotest_noninteractive = noninteractive; - System.setProperty("wtp.autotest.noninteractive", "true"); - - if (!ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()) { - BundleResourceUtil.createSimpleProject(PROJECT_NAME, null, new String[]{JavaCore.NATURE_ID}); - BundleResourceUtil.copyBundleEntriesIntoWorkspace("/testfiles/" + PROJECT_NAME, "/" + PROJECT_NAME); - } - assertTrue("project could not be created", ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME).exists()); - } - - protected void tearDown() throws Exception { - super.tearDown(); - if (wtp_autotest_noninteractive != null) - System.setProperty("wtp.autotest.noninteractive", wtp_autotest_noninteractive); - } - - /** - * Tests if jsp fragments are validated when preference is set to true - * - * @throws Exception - */ - public void testValidatingFragments() throws Exception { - JSPValidator validator = new JSPJavaValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/WebContent/ihaveerrors.jspf"; - helper.setURI(filePath); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)); - - String validate = JSPFContentProperties.getProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, false); - JSPFContentProperties.setProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, Boolean.toString(true)); - validator.validate(helper, reporter); - - if (validate != null) { - JSPFContentProperties.setProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, validate); - } - assertTrue("jspf was not validated when it should have been", !reporter.getMessages().isEmpty()); - } - - /** - * Tests if jsp fragments are not validated when preference is set to - * false - * - * @throws Exception - */ - public void testNoValidatingFragments() throws Exception { - JSPValidator validator = new JSPValidator(); - IReporter reporter = new ReporterForTest(); - ValidationContextForTest helper = new ValidationContextForTest(); - String filePath = "/" + PROJECT_NAME + "/ihaveerrors.jspf"; - helper.setURI(filePath); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath)); - - String validate = JSPFContentProperties.getProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, false); - JSPFContentProperties.setProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, Boolean.toString(false)); - validator.validate(helper, reporter); - - if (validate != null) { - JSPFContentProperties.setProperty(JSPFContentProperties.VALIDATE_FRAGMENTS, file, validate); - } - assertTrue("jspf was validated when it should not have been", reporter.getMessages().isEmpty()); - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ReporterForTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ReporterForTest.java deleted file mode 100644 index ab7667d1b..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ReporterForTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 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.jst.jsp.core.tests.validation; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.validation.internal.core.IMessageAccess; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; - -public class ReporterForTest implements IReporter { - List list = new ArrayList(); - - public ReporterForTest() { - super(); - } - - public void addMessage(IValidator origin, IMessage message) { - list.add(message); - } - - public void displaySubtask(IValidator validator, IMessage message) { - /* do not need to implement */ - } - - public IMessageAccess getMessageAccess() { - return null; - } - - public boolean isCancelled() { - return false; - } - - public void removeAllMessages(IValidator origin, Object object) { // do - /* do not need to implement */ - } - - public void removeAllMessages(IValidator origin) { - /* do not need to implement */ - } - - public void removeMessageSubset(IValidator validator, Object obj, String groupName) {// do - /* do not need to implement */ - } - - public List getMessages() { - return list; - } -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ValidationContextForTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ValidationContextForTest.java deleted file mode 100644 index 81d7453fc..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/validation/ValidationContextForTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 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.jst.jsp.core.tests.validation; - -import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; - -public class ValidationContextForTest implements IValidationContext { - private String[] fURIs = null; - - public void setURI(String uri) { - String[] uris = null; - if (uri != null) - uris = new String[]{uri}; - - setURIs(uris); - } - - public void setURIs(String[] uris) { - fURIs = uris; - } - - public String[] getURIs() { - if (fURIs != null) - return fURIs; - return new String[0]; - } - - public Object loadModel(String symbolicName) { - return null; - } - - public Object loadModel(String symbolicName, Object[] parms) { - return null; - } - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/source/JSPedCSSSourceParserTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/source/JSPedCSSSourceParserTest.java deleted file mode 100644 index 1d474107e..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/source/JSPedCSSSourceParserTest.java +++ /dev/null @@ -1,422 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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.jst.jsp.css.core.tests.source; - - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringWriter; -import java.net.URL; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jst.jsp.core.tests.NullInputStream; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; -import org.osgi.framework.Bundle; - -/** - * - */ -public class JSPedCSSSourceParserTest extends TestCase { - private static final String FILES_DIR = "src/org/eclipse/jst/jsp/css/core/tests/testfiles"; //$NON-NLS-1$ - private static final String RESULTS_DIR = "src/org/eclipse/jst/jsp/css/core/tests/testfiles/results"; //$NON-NLS-1$ - private static final String MODE_OPEN = "MODE_OPEN"; //$NON-NLS-1$ - private static final String MODE_APPEND = "MODE_APPEND"; //$NON-NLS-1$ - private static final String MODE_INSERT = "MODE_INSERT"; //$NON-NLS-1$ - private static final String commonEOL = "\r\n";//$NON-NLS-1$ - - public void testSourceOpen1() throws IOException { - sourceParserTest("sample01.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend1() throws IOException { - sourceParserTest("sample01.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert1() throws IOException { - sourceParserTest("sample01.jsp", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceOpen2() throws IOException { - sourceParserTest("sample02.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend2() throws IOException { - sourceParserTest("sample02.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen3() throws IOException { - sourceParserTest("sample03.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend3() throws IOException { - sourceParserTest("sample03.jsp", MODE_APPEND); //$NON-NLS-1$ - } - /* - * The following test case fails with WTP 1.5 RC2, but, ignore this release. - * - public void testSourceInsert2() throws IOException { - sourceParserTest("sample02.jsp", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceInsert3() throws IOException { - sourceParserTest("sample03.jsp", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceInsert6() throws IOException { - sourceParserTest("sample06.jsp", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceInsert8() throws IOException { - sourceParserTest("sample02.jspf", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceInsert9() throws IOException { - sourceParserTest("sample03.jspf", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceInsert12() throws IOException { - sourceParserTest("sample06.jspf", MODE_INSERT); //$NON-NLS-1$ - } - * - */ - public void testSourceOpen4() throws IOException { - sourceParserTest("sample04.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend4() throws IOException { - sourceParserTest("sample04.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert4() throws IOException { - sourceParserTest("sample04.jsp", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceOpen5() throws IOException { - sourceParserTest("sample05.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend5() throws IOException { - sourceParserTest("sample05.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert5() throws IOException { - sourceParserTest("sample05.jsp", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceOpen6() throws IOException { - sourceParserTest("sample06.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend6() throws IOException { - sourceParserTest("sample06.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen7() throws IOException { - sourceParserTest("sample01.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend7() throws IOException { - sourceParserTest("sample01.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert7() throws IOException { - sourceParserTest("sample01.jspf", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceOpen8() throws IOException { - sourceParserTest("sample02.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend8() throws IOException { - sourceParserTest("sample02.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen9() throws IOException { - sourceParserTest("sample03.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend9() throws IOException { - sourceParserTest("sample03.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen10() throws IOException { - sourceParserTest("sample04.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend10() throws IOException { - sourceParserTest("sample04.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert10() throws IOException { - sourceParserTest("sample04.jspf", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceOpen11() throws IOException { - sourceParserTest("sample05.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend11() throws IOException { - sourceParserTest("sample05.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert11() throws IOException { - sourceParserTest("sample05.jspf", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceOpen12() throws IOException { - sourceParserTest("sample06.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend12() throws IOException { - sourceParserTest("sample06.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen13() throws IOException { - sourceParserTest("sample07.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend13() throws IOException { - sourceParserTest("sample07.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert13() throws IOException { - sourceParserTest("sample07.jspf", MODE_INSERT); //$NON-NLS-1$ - } - public void testSourceOpen14() throws IOException { - sourceParserTest("sample07.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceAppend14() throws IOException { - sourceParserTest("sample07.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceInsert14() throws IOException { - sourceParserTest("sample07.jsp", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceOpen15() throws IOException { - sourceParserTest("sample08.jsp", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceInsert15() throws IOException { - sourceParserTest("sample08.jsp", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceAppend15() throws IOException { - sourceParserTest("sample08.jsp", MODE_APPEND); //$NON-NLS-1$ - } - - public void testSourceOpen16() throws IOException { - sourceParserTest("sample08.jspf", MODE_OPEN); //$NON-NLS-1$ - } - - public void testSourceInsert16() throws IOException { - sourceParserTest("sample08.jspf", MODE_INSERT); //$NON-NLS-1$ - } - - public void testSourceAppend16() throws IOException { - sourceParserTest("sample08.jspf", MODE_APPEND); //$NON-NLS-1$ - } - - protected void setUp() throws Exception { - // set cssjsptestX.jsp(f) file as css jsp. - IContentType ct = Platform.getContentTypeManager().getContentType("org.eclipse.jst.jsp.core.cssjspsource"); - ct.addFileSpec("cssjsptest0.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest1.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest2.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest3.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest4.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest5.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest6.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest7.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest8.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest9.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest10.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest11.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest12.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest13.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest14.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest15.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest16.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest17.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest18.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest19.jsp", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest20.jsp", IContentType.FILE_NAME_SPEC); - ct = Platform.getContentTypeManager().getContentType("org.eclipse.jst.jsp.core.cssjspfragmentsource"); - ct.addFileSpec("cssjsptest0.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest1.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest2.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest3.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest4.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest5.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest6.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest7.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest8.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest9.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest10.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest11.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest12.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest13.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest14.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest15.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest16.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest17.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest18.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest19.jspf", IContentType.FILE_NAME_SPEC); - ct.addFileSpec("cssjsptest20.jspf", IContentType.FILE_NAME_SPEC); - } - - static int index_jsp = 0; - static int index_jspf = 0; - private ICSSModel createModel(boolean isFragment) { - IStructuredModel model = null; - try { - IModelManager modelManager = StructuredModelManager.getModelManager(); - model = !isFragment ? modelManager.getModelForEdit("cssjsptest" + index_jsp++ + ".jsp", new NullInputStream(), null) : //$NON-NLS-1$ - modelManager.getModelForEdit("cssjsptest" + index_jspf++ + ".jspf", new NullInputStream(), null); //$NON-NLS-1$ - model.getStructuredDocument().setLineDelimiter(commonEOL);//$NON-NLS-1$ - } - catch (Exception e) { - StringWriter s = new StringWriter(); - e.printStackTrace(new PrintWriter(s)); - fail(s.toString()); - } - return (ICSSModel) model; - - } - private File createFile(String directory, String filename) throws IOException { - Bundle bundle = Platform.getBundle("org.eclipse.jst.jsp.core.tests"); //$NON-NLS-1$ - URL url = bundle.getEntry("/"); //$NON-NLS-1$ - URL localURL = FileLocator.toFileURL(url); - String installPath = localURL.getPath(); - String totalDirectory = installPath + directory; - String totalPath = totalDirectory + "/" + filename; //$NON-NLS-1$ - URL totalURL = new URL(url, totalPath); - String finalFile = totalURL.getFile(); - File file = new File(finalFile); - return file; - } - - private String createString(String directory, String filename) throws FileNotFoundException, IOException { - StringBuffer buf = new StringBuffer(); - Reader fileReader = new FileReader(createFile(directory, filename)); - BufferedReader reader = new BufferedReader(fileReader); - String line; - while ((line = reader.readLine()) != null) { - buf.append(line); - buf.append(commonEOL); - } - return buf.toString(); - } - - private void sourceParserTest(String filename, String mode) throws IOException { - ICSSModel model = null; - if (mode.equals(MODE_OPEN)) { - model = readModelOpen(filename); - } - else if (mode.equals(MODE_APPEND)) { - model = readModelAppend(filename); - } - else if (mode.equals(MODE_INSERT)) { - model = readModelInsert(filename); - } - String result = dumpRegions(model.getStructuredDocument()); - compareResult(result, "JSPedCSSSourceParserTest-" + filename); //$NON-NLS-1$ - closeModel(model); - } - - private ICSSModel readModelOpen(String filename) throws IOException { - String source = createString(FILES_DIR, filename); - ICSSModel model = createModel(filename.endsWith("jspf"));//$NON-NLS-1$ - IStructuredDocument document = model.getStructuredDocument(); - document.replaceText(null, 0, 0, source); - - return model; - } - - private ICSSModel readModelAppend(String filename) throws IOException { - String source = createString(FILES_DIR, filename); - ICSSModel model = createModel(filename.endsWith("jspf"));//$NON-NLS-1$ - IStructuredDocument document = model.getStructuredDocument(); - for (int i = 0; i < source.length(); i++) { - document.replaceText(null, i, 0, source.substring(i, i + 1)); - } - - return model; - } - - private ICSSModel readModelInsert(String filename) throws IOException { - String source = createString(FILES_DIR, filename); - ICSSModel model = createModel(filename.endsWith("jspf"));//$NON-NLS-1$ - IStructuredDocument document = model.getStructuredDocument(); - for (int i = 0; i < source.length(); i++) { - int textIndex = source.length() - i - 1; - document.replaceText(null, 0, 0, source.substring(textIndex, textIndex + 1)); - } - - return model; - } - - private void closeModel(ICSSModel model) { - model.releaseFromEdit(); - } - - private String dumpRegions(IStructuredDocument document) { - StringBuffer buf = new StringBuffer(); - buf.append(dumpRegions(document.getFirstStructuredDocumentRegion())); - return buf.toString(); - } - - private String dumpRegions(IStructuredDocumentRegion region) { - StringBuffer buf = new StringBuffer(); - while (region != null){ - buf.append(dumpOneRegion(region)); - region = region.getNext(); - } - - buf.append(commonEOL + "-------" + commonEOL); //$NON-NLS-1$ - - return buf.toString(); - } - - private String dumpOneRegion(IStructuredDocumentRegion documentRegion) { - StringBuffer buf = new StringBuffer(); - - buf.append(documentRegion.toString()); - buf.append(commonEOL + " "); //$NON-NLS-1$ - - ITextRegionList regionList = documentRegion.getRegions(); - Iterator i = regionList.iterator(); - while (i.hasNext()) { - ITextRegion textRegion = (ITextRegion) i.next(); - buf.append(textRegion.toString()); - buf.append(", "); //$NON-NLS-1$ - } - buf.append(commonEOL); //$NON-NLS-1$ - return buf.toString(); - } - - private void compareResult(String actual, String filename) throws IOException { - String result = createString(RESULTS_DIR, filename); - assertEquals(result, actual); - } - - -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jsp deleted file mode 100644 index 1c4b700d8..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jsp +++ /dev/null @@ -1,13 +0,0 @@ -[0, 73] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/73,
-[73, 143] (<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-66/70,
-[143, 188] (<%@ include file="./cssjspfragment.jspf" %>
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-43/45,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jspf deleted file mode 100644 index 49ab4db96..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample01.jspf +++ /dev/null @@ -1,9 +0,0 @@ -[0, 70] (<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %> - -) - ContextRegion--> CSS_JSP_DIRECTIVE: 0-66/70, -[70, 115] (<%@ include file="./cssjspfragment.jspf" %> -) - ContextRegion--> CSS_JSP_DIRECTIVE: 0-43/45, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jsp deleted file mode 100644 index 06f5e7c8b..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jsp +++ /dev/null @@ -1,32 +0,0 @@ -[0, 73] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/73,
-[73, 79] (.hoge )
- ContextRegion--> SELECTOR_CLASS: 0-5/6,
-[79, 83] ({
- )
- ContextRegion--> LBRACE: 0-1/4,
-[83, 97] (float : ${XXX})
- ContextRegion--> DECLARATION_PROPERTY: 0-5/6, ContextRegion--> DECLARATION_SEPARATOR: 6-7/8, ContextRegion--> FOREIGN_ELEMENT: 8-14,
-[97, 98] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[98, 101] (
- )
- ContextRegion--> S: 0-3,
-[101, 120] (border-${XXX}-color)
- ContextRegion--> DECLARATION_PROPERTY: 0-7, ContextRegion--> FOREIGN_ELEMENT: 7-13, ContextRegion--> UNKNOWN: 13-19,
-[120, 126] ( : red)
- ContextRegion--> S: 0-1, ContextRegion--> DECLARATION_SEPARATOR: 1-2/3, ContextRegion--> DECLARATION_VALUE_IDENT: 3-6,
-[126, 127] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[127, 129] (
-)
- ContextRegion--> S: 0-2,
-[129, 130] (})
- ContextRegion--> RBRACE: 0-1,
-[130, 132] (
-)
- ContextRegion--> S: 0-2,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jspf deleted file mode 100644 index 6e4a6ec3a..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample02.jspf +++ /dev/null @@ -1,32 +0,0 @@ -[0, 4] ( - -) - ContextRegion--> S: 0-4, -[4, 10] (.hoge ) - ContextRegion--> SELECTOR_CLASS: 0-5/6, -[10, 14] ({ - ) - ContextRegion--> LBRACE: 0-1/4, -[14, 28] (float : ${XXX}) - ContextRegion--> DECLARATION_PROPERTY: 0-5/6, ContextRegion--> DECLARATION_SEPARATOR: 6-7/8, ContextRegion--> FOREIGN_ELEMENT: 8-14, -[28, 29] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[29, 32] ( - ) - ContextRegion--> S: 0-3, -[32, 51] (border-${XXX}-color) - ContextRegion--> DECLARATION_PROPERTY: 0-7, ContextRegion--> FOREIGN_ELEMENT: 7-13, ContextRegion--> UNKNOWN: 13-19, -[51, 57] ( : red) - ContextRegion--> S: 0-1, ContextRegion--> DECLARATION_SEPARATOR: 1-2/3, ContextRegion--> DECLARATION_VALUE_IDENT: 3-6, -[57, 58] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[58, 60] ( -) - ContextRegion--> S: 0-2, -[60, 61] (}) - ContextRegion--> RBRACE: 0-1, -[61, 63] ( -) - ContextRegion--> S: 0-2, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jsp deleted file mode 100644 index f36aaa355..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jsp +++ /dev/null @@ -1,30 +0,0 @@ -[0, 73] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/73,
-[73, 79] (.hoge )
- ContextRegion--> SELECTOR_CLASS: 0-5/6,
-[79, 83] ({
- )
- ContextRegion--> LBRACE: 0-1/4,
-[83, 97] (color : ${XXX})
- ContextRegion--> DECLARATION_PROPERTY: 0-5/6, ContextRegion--> DECLARATION_SEPARATOR: 6-7/8, ContextRegion--> FOREIGN_ELEMENT: 8-14,
-[97, 98] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[98, 101] (
- )
- ContextRegion--> S: 0-3,
-[101, 126] (border-color : <%= YYY %>)
- ContextRegion--> DECLARATION_PROPERTY: 0-12/13, ContextRegion--> DECLARATION_SEPARATOR: 13-14/15, ContextRegion--> CSS_JSP_EXP: 15-25,
-[126, 127] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[127, 129] (
-)
- ContextRegion--> S: 0-2,
-[129, 130] (})
- ContextRegion--> RBRACE: 0-1,
-[130, 132] (
-)
- ContextRegion--> S: 0-2,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jspf deleted file mode 100644 index 29b6482c3..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample03.jspf +++ /dev/null @@ -1,30 +0,0 @@ -[0, 4] ( - -) - ContextRegion--> S: 0-4, -[4, 10] (.hoge ) - ContextRegion--> SELECTOR_CLASS: 0-5/6, -[10, 14] ({ - ) - ContextRegion--> LBRACE: 0-1/4, -[14, 28] (color : ${XXX}) - ContextRegion--> DECLARATION_PROPERTY: 0-5/6, ContextRegion--> DECLARATION_SEPARATOR: 6-7/8, ContextRegion--> FOREIGN_ELEMENT: 8-14, -[28, 29] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[29, 32] ( - ) - ContextRegion--> S: 0-3, -[32, 57] (border-color : <%= YYY %>) - ContextRegion--> DECLARATION_PROPERTY: 0-12/13, ContextRegion--> DECLARATION_SEPARATOR: 13-14/15, ContextRegion--> CSS_JSP_EXP: 15-25, -[57, 58] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[58, 60] ( -) - ContextRegion--> S: 0-2, -[60, 61] (}) - ContextRegion--> RBRACE: 0-1, -[61, 63] ( -) - ContextRegion--> S: 0-2, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jsp deleted file mode 100644 index cf760e600..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jsp +++ /dev/null @@ -1,30 +0,0 @@ -[0, 73] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/73,
-[73, 79] (.puge )
- ContextRegion--> SELECTOR_CLASS: 0-5/6,
-[79, 83] ({
- )
- ContextRegion--> LBRACE: 0-1/4,
-[83, 89] (${XXX})
- ContextRegion--> FOREIGN_ELEMENT: 0-6,
-[89, 90] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[90, 93] (
- )
- ContextRegion--> S: 0-3,
-[93, 111] (border-color : red)
- ContextRegion--> DECLARATION_PROPERTY: 0-12/13, ContextRegion--> DECLARATION_SEPARATOR: 13-14/15, ContextRegion--> DECLARATION_VALUE_IDENT: 15-18,
-[111, 112] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[112, 114] (
-)
- ContextRegion--> S: 0-2,
-[114, 115] (})
- ContextRegion--> RBRACE: 0-1,
-[115, 117] (
-)
- ContextRegion--> S: 0-2,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jspf deleted file mode 100644 index 1d40579d3..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample04.jspf +++ /dev/null @@ -1,26 +0,0 @@ -[0, 6] (.puge ) - ContextRegion--> SELECTOR_CLASS: 0-5/6, -[6, 10] ({ - ) - ContextRegion--> LBRACE: 0-1/4, -[10, 16] (${XXX}) - ContextRegion--> FOREIGN_ELEMENT: 0-6, -[16, 17] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[17, 20] ( - ) - ContextRegion--> S: 0-3, -[20, 38] (border-color : red) - ContextRegion--> DECLARATION_PROPERTY: 0-12/13, ContextRegion--> DECLARATION_SEPARATOR: 13-14/15, ContextRegion--> DECLARATION_VALUE_IDENT: 15-18, -[38, 39] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[39, 41] ( -) - ContextRegion--> S: 0-2, -[41, 42] (}) - ContextRegion--> RBRACE: 0-1, -[42, 44] ( -) - ContextRegion--> S: 0-2, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jsp deleted file mode 100644 index ddd99933b..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jsp +++ /dev/null @@ -1,28 +0,0 @@ -[0, 71] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/71,
-[71, 100] (<%--
-jsp
-comment
---%>
-)
- ContextRegion--> COMMENT: 0-27/29,
-[100, 103] (H1 )
- ContextRegion--> SELECTOR_ELEMENT_NAME: 0-2/3,
-[103, 107] ({
- )
- ContextRegion--> LBRACE: 0-1/4,
-[107, 130] (background-color : blue)
- ContextRegion--> DECLARATION_PROPERTY: 0-16/17, ContextRegion--> DECLARATION_SEPARATOR: 17-18/19, ContextRegion--> DECLARATION_VALUE_IDENT: 19-23,
-[130, 131] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[131, 133] (
-)
- ContextRegion--> S: 0-2,
-[133, 134] (})
- ContextRegion--> RBRACE: 0-1,
-[134, 136] (
-)
- ContextRegion--> S: 0-2,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jspf deleted file mode 100644 index 83fff303b..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample05.jspf +++ /dev/null @@ -1,26 +0,0 @@ -[0, 31] ( -<%-- -jsp -comment ---%> -) - ContextRegion--> S: 0-2, ContextRegion--> COMMENT: 2-29/31, -[31, 34] (H1 ) - ContextRegion--> SELECTOR_ELEMENT_NAME: 0-2/3, -[34, 38] ({ - ) - ContextRegion--> LBRACE: 0-1/4, -[38, 61] (background-color : blue) - ContextRegion--> DECLARATION_PROPERTY: 0-16/17, ContextRegion--> DECLARATION_SEPARATOR: 17-18/19, ContextRegion--> DECLARATION_VALUE_IDENT: 19-23, -[61, 62] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[62, 64] ( -) - ContextRegion--> S: 0-2, -[64, 65] (}) - ContextRegion--> RBRACE: 0-1, -[65, 67] ( -) - ContextRegion--> S: 0-2, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jsp deleted file mode 100644 index 23ac7c0e1..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jsp +++ /dev/null @@ -1,23 +0,0 @@ -[0, 73] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-)
- ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/73,
-[73, 76] (H1 )
- ContextRegion--> SELECTOR_ELEMENT_NAME: 0-2/3,
-[76, 80] ({
- )
- ContextRegion--> LBRACE: 0-1/4,
-[80, 111] (border-${XXX} : 0px, solid, red)
- ContextRegion--> DECLARATION_PROPERTY: 0-7, ContextRegion--> FOREIGN_ELEMENT: 7-13/14, ContextRegion--> DECLARATION_SEPARATOR: 14-15/16, ContextRegion--> DECLARATION_VALUE_DIMENSION: 16-19, ContextRegion--> DECLARATION_VALUE_OPERATOR: 19-20/21, ContextRegion--> DECLARATION_VALUE_IDENT: 21-26, ContextRegion--> DECLARATION_VALUE_OPERATOR: 26-27/28, ContextRegion--> DECLARATION_VALUE_IDENT: 28-31,
-[111, 112] (;)
- ContextRegion--> DECLARATION_DELIMITER: 0-1,
-[112, 114] (
-)
- ContextRegion--> S: 0-2,
-[114, 115] (})
- ContextRegion--> RBRACE: 0-1,
-[115, 117] (
-)
- ContextRegion--> S: 0-2,
-
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jspf deleted file mode 100644 index 671d71d32..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample06.jspf +++ /dev/null @@ -1,23 +0,0 @@ -[0, 4] ( - -) - ContextRegion--> S: 0-4, -[4, 7] (H1 ) - ContextRegion--> SELECTOR_ELEMENT_NAME: 0-2/3, -[7, 11] ({ - ) - ContextRegion--> LBRACE: 0-1/4, -[11, 42] (border-${XXX} : 0px, solid, red) - ContextRegion--> DECLARATION_PROPERTY: 0-7, ContextRegion--> FOREIGN_ELEMENT: 7-13/14, ContextRegion--> DECLARATION_SEPARATOR: 14-15/16, ContextRegion--> DECLARATION_VALUE_DIMENSION: 16-19, ContextRegion--> DECLARATION_VALUE_OPERATOR: 19-20/21, ContextRegion--> DECLARATION_VALUE_IDENT: 21-26, ContextRegion--> DECLARATION_VALUE_OPERATOR: 26-27/28, ContextRegion--> DECLARATION_VALUE_IDENT: 28-31, -[42, 43] (;) - ContextRegion--> DECLARATION_DELIMITER: 0-1, -[43, 45] ( -) - ContextRegion--> S: 0-2, -[45, 46] (}) - ContextRegion--> RBRACE: 0-1, -[46, 48] ( -) - ContextRegion--> S: 0-2, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jsp deleted file mode 100644 index c2678fb63..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jsp +++ /dev/null @@ -1,2 +0,0 @@ -
--------
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jspf deleted file mode 100644 index de5f2acbb..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample07.jspf +++ /dev/null @@ -1,2 +0,0 @@ - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jsp deleted file mode 100644 index 709b113fa..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jsp +++ /dev/null @@ -1,11 +0,0 @@ -[0, 71] (<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %> -) - ContextRegion--> CSS_JSP_DIRECTIVE: 0-69/71, -[71, 134] (<% pageContext.getRequest().setCharacterEncoding("UTF-8"); %> -) - ContextRegion--> CSS_JSP_SCRIPTLET: 0-61/63, -[134, 171] (<%@ include file="./styles.jspf" %> -) - ContextRegion--> CSS_JSP_DIRECTIVE: 0-35/37, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jspf deleted file mode 100644 index bdb584bcc..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/results/JSPedCSSSourceParserTest-sample08.jspf +++ /dev/null @@ -1,8 +0,0 @@ -[0, 63] (<% pageContext.getRequest().setCharacterEncoding("UTF-8"); %> -) - ContextRegion--> CSS_JSP_SCRIPTLET: 0-61/63, -[63, 100] (<%@ include file="./styles.jspf" %> -) - ContextRegion--> CSS_JSP_DIRECTIVE: 0-35/37, - -------- diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jsp deleted file mode 100644 index 19723c594..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
-
-<%@ include file="./cssjspfragment.jspf" %>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jspf deleted file mode 100644 index a86aee580..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample01.jspf +++ /dev/null @@ -1,3 +0,0 @@ -<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %> - -<%@ include file="./cssjspfragment.jspf" %> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jsp deleted file mode 100644 index b00d5b45e..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-.hoge {
- float : ${XXX};
- border-${XXX}-color : red;
-}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jspf deleted file mode 100644 index 238ad9ee1..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample02.jspf +++ /dev/null @@ -1,6 +0,0 @@ - - -.hoge { - float : ${XXX}; - border-${XXX}-color : red; -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jsp deleted file mode 100644 index 38ddb8cad..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-.hoge {
- color : ${XXX};
- border-color : <%= YYY %>;
-}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jspf deleted file mode 100644 index 5e638360e..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample03.jspf +++ /dev/null @@ -1,6 +0,0 @@ - - -.hoge { - color : ${XXX}; - border-color : <%= YYY %>; -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jsp deleted file mode 100644 index 18709a8b0..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jsp +++ /dev/null @@ -1,6 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-.puge {
- ${XXX};
- border-color : red;
-}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jspf deleted file mode 100644 index 4f03d5a57..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample04.jspf +++ /dev/null @@ -1,4 +0,0 @@ -.puge { - ${XXX}; - border-color : red; -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jsp deleted file mode 100644 index 2e39e577e..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jsp +++ /dev/null @@ -1,8 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-<%--
-jsp
-comment
---%>
-H1 {
- background-color : blue;
-}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jspf deleted file mode 100644 index e98a25199..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample05.jspf +++ /dev/null @@ -1,8 +0,0 @@ - -<%-- -jsp -comment ---%> -H1 { - background-color : blue; -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jsp deleted file mode 100644 index 01b344e6f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %>
-
-H1 {
- border-${XXX} : 0px, solid, red;
-}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jspf deleted file mode 100644 index 0216ce5fb..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample06.jspf +++ /dev/null @@ -1,5 +0,0 @@ - - -H1 { - border-${XXX} : 0px, solid, red; -} diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jsp deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jsp +++ /dev/null diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jspf deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample07.jspf +++ /dev/null diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jsp b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jsp deleted file mode 100644 index bfaf6295f..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<%@ page session="false" contentType="text/css;charset=ISO-8859-1" %> -<% pageContext.getRequest().setCharacterEncoding("UTF-8"); %> -<%@ include file="./styles.jspf" %> diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jspf b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jspf deleted file mode 100644 index 8abadc747..000000000 --- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/css/core/tests/testfiles/sample08.jspf +++ /dev/null @@ -1,2 +0,0 @@ -<% pageContext.getRequest().setCharacterEncoding("UTF-8"); %> -<%@ include file="./styles.jspf" %> |