diff options
Diffstat (limited to 'tests/org.eclipse.wst.html.core.tests/src')
75 files changed, 0 insertions, 5979 deletions
diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestSuite.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestSuite.java deleted file mode 100644 index 0743dce1c..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestSuite.java +++ /dev/null @@ -1,36 +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.wst.html.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.wst.html.core.tests.misc.TestPreferenceValues; - - - -public class HTMLCoreTestSuite extends TestSuite { - - /** - * to get picked up by BVT - * @return - */ - public static Test suite() { - return new HTMLCoreTestSuite(); - } - - public HTMLCoreTestSuite() { - super("HTML Core TestSuite"); - - addTest(ModelParserTests.suite()); - addTest(new TestSuite(TestPreferenceValues.class)); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestsPlugin.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestsPlugin.java deleted file mode 100644 index b37c006d3..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/HTMLCoreTestsPlugin.java +++ /dev/null @@ -1,68 +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.wst.html.core.tests; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.Plugin; - -/** - * The main plugin class to be used in the desktop. - */ -public class HTMLCoreTestsPlugin extends Plugin { - //The shared instance. - private static HTMLCoreTestsPlugin plugin; - //Resource bundle. - private ResourceBundle resourceBundle; - - /** - * The constructor. - */ - public HTMLCoreTestsPlugin() { - super(); - plugin = this; - try { - resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.html.core.tests.SSEModelHTMLTestsPluginResources"); - } - catch (MissingResourceException x) { - resourceBundle = null; - } - } - - /** - * Returns the shared instance. - */ - public static HTMLCoreTestsPlugin 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 = HTMLCoreTestsPlugin.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; - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/Logger.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/Logger.java deleted file mode 100644 index 212b6f446..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/Logger.java +++ /dev/null @@ -1,144 +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.wst.html.core.tests; - -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -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 final String PLUGIN_ID = "org.eclipse.wst.html.core.tests"; //$NON-NLS-1$ - - 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, PLUGIN_ID, severity, message, exception); - Bundle bundle = Platform.getBundle(PLUGIN_ID); - if (bundle != null) - Platform.getLog(bundle).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, PLUGIN_ID, IStatus.OK, message, exception); - Bundle bundle = Platform.getBundle(PLUGIN_ID); - if (bundle != null) - Platform.getLog(bundle).log(statusObj); - } - } - - /** - * @return true if the platform is debugging - */ - public static boolean isDebugging() { - return Platform.inDebugMode(); - } - - /** - * 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(PLUGIN_ID + 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); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/ModelParserTests.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/ModelParserTests.java deleted file mode 100644 index 166e32cd3..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/ModelParserTests.java +++ /dev/null @@ -1,135 +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.wst.html.core.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.wst.html.core.tests.parser.AttrTest; -import org.eclipse.wst.html.core.tests.parser.AttrTest2; -import org.eclipse.wst.html.core.tests.parser.CDATASectionTest; -import org.eclipse.wst.html.core.tests.parser.CDATASectionTest2; -import org.eclipse.wst.html.core.tests.parser.CDATASectionTest3; -import org.eclipse.wst.html.core.tests.parser.DocTypeTest; -import org.eclipse.wst.html.core.tests.parser.ElementTest; -import org.eclipse.wst.html.core.tests.parser.ElementTest2; -import org.eclipse.wst.html.core.tests.parser.ElementTest3; -import org.eclipse.wst.html.core.tests.parser.EmptyTextTest; -import org.eclipse.wst.html.core.tests.parser.EmptyTextTest2; -import org.eclipse.wst.html.core.tests.parser.EmptyTextTest3; -import org.eclipse.wst.html.core.tests.parser.EntityTest; -import org.eclipse.wst.html.core.tests.parser.EntityTest2; -import org.eclipse.wst.html.core.tests.parser.EntityTest3; -import org.eclipse.wst.html.core.tests.parser.EntityTest4; -import org.eclipse.wst.html.core.tests.parser.EntityTest5; -import org.eclipse.wst.html.core.tests.parser.EntityTest6; -import org.eclipse.wst.html.core.tests.parser.EntityTest7; -import org.eclipse.wst.html.core.tests.parser.EntityTest8; -import org.eclipse.wst.html.core.tests.parser.EntityTest9; -import org.eclipse.wst.html.core.tests.parser.PITest; -import org.eclipse.wst.html.core.tests.parser.ParserTest; -import org.eclipse.wst.html.core.tests.parser.ParserTest2; -import org.eclipse.wst.html.core.tests.parser.ParserTest3; -import org.eclipse.wst.html.core.tests.parser.ParserTest4; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest2; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest3; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest4; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest5; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest6; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest7; -import org.eclipse.wst.html.core.tests.parser.SplitTextTest8; -import org.eclipse.wst.html.core.tests.parser.TableTest; -import org.eclipse.wst.html.core.tests.parser.TextTest; -import org.eclipse.wst.html.core.tests.parser.TextTest2; -import org.eclipse.wst.html.core.tests.parser.TextTest3; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest10; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest11; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest12; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest13; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest14; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest2; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest3; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest4; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest5; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest6; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest7; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest8; -import org.eclipse.wst.html.core.tests.parser.UpdaterTest9; - - - -public class ModelParserTests extends TestSuite { - public static Test suite() { - return new ModelParserTests(); - } - - public ModelParserTests() { - super("ModelParserTests"); - - addTest(new TestSuite(ParserTest.class, "ParserTest")); - addTest(new TestSuite(ParserTest2.class, "ParserTest2")); - addTest(new TestSuite(ParserTest3.class, "ParserTest3")); - addTest(new TestSuite(ParserTest4.class, "ParserTest4")); - addTest(new TestSuite(UpdaterTest.class, "UpdaterTest")); - addTest(new TestSuite(UpdaterTest2.class, "UpdaterTest2")); - addTest(new TestSuite(UpdaterTest3.class, "UpdaterTest3")); - addTest(new TestSuite(UpdaterTest4.class, "UpdaterTest4")); - addTest(new TestSuite(UpdaterTest5.class, "UpdaterTest5")); - addTest(new TestSuite(UpdaterTest6.class, "UpdaterTest6")); - addTest(new TestSuite(UpdaterTest7.class, "UpdaterTest7")); - addTest(new TestSuite(UpdaterTest8.class, "UpdaterTest8")); - addTest(new TestSuite(UpdaterTest9.class, "UpdaterTest9")); - addTest(new TestSuite(UpdaterTest10.class, "UpdaterTest10")); - addTest(new TestSuite(UpdaterTest11.class, "UpdaterTest11")); - addTest(new TestSuite(UpdaterTest12.class, "UpdaterTest12")); - addTest(new TestSuite(UpdaterTest13.class, "UpdaterTest13")); - addTest(new TestSuite(UpdaterTest14.class, "UpdaterTest14")); - addTest(new TestSuite(ElementTest.class, "ElementTest")); - addTest(new TestSuite(ElementTest2.class, "ElementTest2")); - addTest(new TestSuite(ElementTest3.class, "ElementTest3")); - addTest(new TestSuite(TableTest.class, "TableTest")); - addTest(new TestSuite(TextTest.class, "TextTest")); - addTest(new TestSuite(TextTest2.class, "TextTest2")); - addTest(new TestSuite(TextTest3.class, "TextTest3")); - addTest(new TestSuite(SplitTextTest.class, "SplitTextTest")); - addTest(new TestSuite(SplitTextTest2.class, "SplitTextTest2")); - addTest(new TestSuite(SplitTextTest3.class, "SplitTextTest3")); - addTest(new TestSuite(SplitTextTest4.class, "SplitTextTest4")); - addTest(new TestSuite(SplitTextTest5.class, "SplitTextTest5")); - addTest(new TestSuite(SplitTextTest6.class, "SplitTextTest6")); - addTest(new TestSuite(SplitTextTest7.class, "SplitTextTest7")); - addTest(new TestSuite(SplitTextTest8.class, "SplitTextTest8")); - addTest(new TestSuite(EmptyTextTest.class, "EmptyTextTest")); - addTest(new TestSuite(EmptyTextTest2.class, "EmptyTextTest2")); - addTest(new TestSuite(EmptyTextTest3.class, "EmptyTextTest3")); - addTest(new TestSuite(AttrTest.class, "AttrTest")); - addTest(new TestSuite(AttrTest2.class, "AttrTest2")); - addTest(new TestSuite(EntityTest.class, "EntityTest")); - addTest(new TestSuite(EntityTest2.class, "EntityTest2")); - addTest(new TestSuite(EntityTest3.class, "EntityTest3")); - addTest(new TestSuite(EntityTest4.class, "EntityTest4")); - addTest(new TestSuite(EntityTest5.class, "EntityTest5")); - addTest(new TestSuite(EntityTest6.class, "EntityTest6")); - addTest(new TestSuite(EntityTest7.class, "EntityTest7")); - addTest(new TestSuite(EntityTest8.class, "EntityTest8")); - addTest(new TestSuite(EntityTest9.class, "EntityTest9")); - addTest(new TestSuite(DocTypeTest.class, "DocTypeTest")); - addTest(new TestSuite(CDATASectionTest.class, "CDATASectionTest")); - addTest(new TestSuite(CDATASectionTest2.class, "CDATASectionTest2")); - addTest(new TestSuite(CDATASectionTest3.class, "CDATASectionTest3")); - addTest(new TestSuite(PITest.class, "PITest")); - // the follow is fairly long running - //addTest(new TestSuite(TestExampleFiles.class, "TestExampleFiles")); - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/misc/TestPreferenceValues.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/misc/TestPreferenceValues.java deleted file mode 100644 index be60bbcf3..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/misc/TestPreferenceValues.java +++ /dev/null @@ -1,36 +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.wst.html.core.tests.misc; - -import junit.framework.TestCase; - -import org.eclipse.core.runtime.IProduct; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.html.core.HTMLFilesPreferenceNames; - - - - -public class TestPreferenceValues extends TestCase { - public static final boolean DEBUG = false; - - public void testProductName() { - IProduct product = Platform.getProduct(); - String productName = product.getName(); - - String generator = HTMLFilesPreferenceNames.GENERATOR; - if (DEBUG) { - System.out.println("GENERATOR " + productName); - } - assertTrue(productName.equals(generator)); - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AllModelParserTests.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AllModelParserTests.java deleted file mode 100644 index 0ed2256c9..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AllModelParserTests.java +++ /dev/null @@ -1,152 +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.wst.html.core.tests.parser; - - -import junit.framework.TestSuite; - - -public class AllModelParserTests { - - // public AllModelParserTests(String name) { - // //super(name); - // } - - public void holdOldTestMain() { - runTest(new ParserTest()); - runTest(new ParserTest2()); - runTest(new ParserTest3()); - runTest(new ParserTest4()); - runTest(new UpdaterTest()); - runTest(new UpdaterTest2()); - runTest(new UpdaterTest3()); - runTest(new UpdaterTest4()); - runTest(new UpdaterTest5()); - runTest(new UpdaterTest6()); - runTest(new UpdaterTest7()); - runTest(new UpdaterTest8()); - runTest(new UpdaterTest9()); - runTest(new UpdaterTest10()); - runTest(new UpdaterTest11()); - runTest(new UpdaterTest12()); - runTest(new UpdaterTest13()); - runTest(new UpdaterTest14()); - runTest(new ElementTest()); - runTest(new ElementTest2()); - runTest(new ElementTest3()); - runTest(new TableTest()); - runTest(new TextTest()); - runTest(new TextTest2()); - runTest(new TextTest3()); - runTest(new SplitTextTest()); - runTest(new SplitTextTest2()); - runTest(new SplitTextTest3()); - runTest(new SplitTextTest4()); - runTest(new SplitTextTest5()); - runTest(new SplitTextTest6()); - runTest(new SplitTextTest7()); - runTest(new SplitTextTest8()); - runTest(new EmptyTextTest()); - runTest(new EmptyTextTest2()); - runTest(new EmptyTextTest3()); - runTest(new AttrTest()); - runTest(new AttrTest2()); - runTest(new EntityTest()); - runTest(new EntityTest2()); - runTest(new EntityTest3()); - runTest(new EntityTest4()); - runTest(new EntityTest5()); - runTest(new EntityTest6()); - runTest(new EntityTest7()); - runTest(new EntityTest8()); - runTest(new EntityTest9()); - runTest(new DocTypeTest()); - runTest(new CDATASectionTest()); - runTest(new CDATASectionTest2()); - runTest(new CDATASectionTest3()); - runTest(new PITest()); - } - - public static TestSuite getAllTests() { - - - TestSuite testSuite = new TestSuite(); - - testSuite.addTestSuite(ParserTest.class); - testSuite.addTestSuite(ParserTest2.class); - testSuite.addTestSuite(ParserTest3.class); - testSuite.addTestSuite(ParserTest4.class); - testSuite.addTestSuite(UpdaterTest.class); - testSuite.addTestSuite(UpdaterTest2.class); - testSuite.addTestSuite(UpdaterTest3.class); - testSuite.addTestSuite(UpdaterTest4.class); - testSuite.addTestSuite(UpdaterTest5.class); - testSuite.addTestSuite(UpdaterTest6.class); - testSuite.addTestSuite(UpdaterTest7.class); - testSuite.addTestSuite(UpdaterTest8.class); - testSuite.addTestSuite(UpdaterTest9.class); - testSuite.addTestSuite(UpdaterTest10.class); - testSuite.addTestSuite(UpdaterTest11.class); - testSuite.addTestSuite(UpdaterTest12.class); - testSuite.addTestSuite(UpdaterTest13.class); - testSuite.addTestSuite(UpdaterTest14.class); - testSuite.addTestSuite(ElementTest.class); - testSuite.addTestSuite(ElementTest2.class); - testSuite.addTestSuite(ElementTest3.class); - testSuite.addTestSuite(TableTest.class); - testSuite.addTestSuite(TextTest.class); - testSuite.addTestSuite(TextTest2.class); - testSuite.addTestSuite(TextTest3.class); - testSuite.addTestSuite(SplitTextTest.class); - testSuite.addTestSuite(SplitTextTest2.class); - testSuite.addTestSuite(SplitTextTest3.class); - testSuite.addTestSuite(SplitTextTest4.class); - testSuite.addTestSuite(SplitTextTest5.class); - testSuite.addTestSuite(SplitTextTest6.class); - testSuite.addTestSuite(SplitTextTest7.class); - testSuite.addTestSuite(SplitTextTest8.class); - testSuite.addTestSuite(EmptyTextTest.class); - testSuite.addTestSuite(EmptyTextTest2.class); - testSuite.addTestSuite(EmptyTextTest3.class); - testSuite.addTestSuite(AttrTest.class); - testSuite.addTestSuite(AttrTest2.class); - testSuite.addTestSuite(EntityTest.class); - testSuite.addTestSuite(EntityTest2.class); - testSuite.addTestSuite(EntityTest3.class); - testSuite.addTestSuite(EntityTest4.class); - testSuite.addTestSuite(EntityTest5.class); - testSuite.addTestSuite(EntityTest6.class); - testSuite.addTestSuite(EntityTest7.class); - testSuite.addTestSuite(EntityTest8.class); - testSuite.addTestSuite(EntityTest9.class); - testSuite.addTestSuite(DocTypeTest.class); - testSuite.addTestSuite(CDATASectionTest.class); - testSuite.addTestSuite(CDATASectionTest2.class); - testSuite.addTestSuite(CDATASectionTest3.class); - testSuite.addTestSuite(PITest.class); - // the follow is fairly long running - //testSuite.addTestSuite(TestExampleFiles.class); - - return testSuite; - } - - - - private void runTest(ModelTest test) { - try { - test.testModel(); - } - catch (Exception ex) { - ModelTest.printException(ex); - } - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest.java deleted file mode 100644 index cd8879bac..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest.java +++ /dev/null @@ -1,50 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class AttrTest extends ModelTest { - /** - * Constructor for AttrTest. - * - * @param name - */ - public AttrTest(String name) { - super(name); - } - - public AttrTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new AttrTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - //Document document = model.getDocument(); - - structuredDocument.setText(this, "<a href=\"<%=c%>\">a</a>"); - - printSource(model); - printTree(model); - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest2.java deleted file mode 100644 index 4be79bc7a..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest2.java +++ /dev/null @@ -1,77 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class AttrTest2 extends ModelTest { - /** - * Constructor for AttrTest2. - * - * @param name - */ - public AttrTest2(String name) { - super(name); - } - - public AttrTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new AttrTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - a.setAttribute("b", "c"); - a.setAttribute("d", "e"); - Text t = document.createTextNode("f"); - document.appendChild(a); - a.appendChild(t); - - printSource(model); - printTree(model); - - Attr b = a.getAttributeNode("b"); - b.setPrefix("x"); - - fOutputWriter.writeln("b.name=" + b.getName()); - fOutputWriter.writeln("b.value=" + b.getValue()); - String ab = a.getAttribute("b"); - fOutputWriter.writeln("a b=" + ab); - String axb = a.getAttribute("x:b"); - fOutputWriter.writeln("a x:b=" + axb); - - printSource(model); - printTree(model); - - a.getAttributeNode("d").setPrefix("y"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest3.java deleted file mode 100644 index 87e674446..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/AttrTest3.java +++ /dev/null @@ -1,67 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class AttrTest3 extends ModelTest { - /** - * Constructor for AttrTest3. - * - * @param name - */ - public AttrTest3(String name) { - super(name); - } - - public AttrTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new AttrTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.setText(this, "<a xmlns='default-uri' xmlns:b='b-uri'><c d='d-value' b:e='e-value'/></a>"); - - printSource(model); - printTree(model); - - Element a = (Element) document.getFirstChild(); - Element c = (Element) a.getFirstChild(); - - Attr xmlns = a.getAttributeNode("xmlns"); - fOutputWriter.writeln("xmlns [" + xmlns.getNamespaceURI() + "]"); - Attr xmlns_b = a.getAttributeNode("xmlns:b"); - fOutputWriter.writeln("xmlns:b [" + xmlns_b.getNamespaceURI() + "]"); - Attr d = c.getAttributeNode("d"); - fOutputWriter.writeln("d [" + d.getNamespaceURI() + "]"); - Attr b_e = c.getAttributeNode("b:e"); - fOutputWriter.writeln("b:e [" + b_e.getNamespaceURI() + "]"); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest.java deleted file mode 100644 index b8c63855f..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest.java +++ /dev/null @@ -1,64 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -public class CDATASectionTest extends ModelTest { - /** - * Constructor for CDATASectionTest. - * - * @param name - */ - public CDATASectionTest(String name) { - super(name); - } - - public CDATASectionTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new CDATASectionTest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<a><![CDATA[contentOfCDATASection]]></a>"); - - printSource(model); - printTree(model); - - Node a = document.getFirstChild(); - for (Node child = a.getFirstChild(); child != null; child = child.getNextSibling()) { - if (child.getNodeType() != Node.CDATA_SECTION_NODE) - continue; - CDATASection cdata = (CDATASection) child; - fOutputWriter.writeln(cdata.getData()); - } - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest2.java deleted file mode 100644 index 79befa61d..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest2.java +++ /dev/null @@ -1,74 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class CDATASectionTest2 extends ModelTest { - /** - * Constructor for CDATASectionTest2. - * - * @param name - */ - public CDATASectionTest2(String name) { - super(name); - } - - public CDATASectionTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new CDATASectionTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - CDATASection cdata = document.createCDATASection("contentOfCDATASection"); - a.appendChild(cdata); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - cdata.setData("new content"); - - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - cdata.setData("new content"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest3.java deleted file mode 100644 index b0cad9ad1..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/CDATASectionTest3.java +++ /dev/null @@ -1,74 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class CDATASectionTest3 extends ModelTest { - /** - * Constructor for CDATASectionTest3. - * - * @param name - */ - public CDATASectionTest3(String name) { - super(name); - } - - public CDATASectionTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new CDATASectionTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - CDATASection cdata = document.createCDATASection("contentOfCDATASection"); - a.appendChild(cdata); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - cdata.setData("new < content"); - - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - cdata.setData("new > content"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(cdata.getData()); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/DocTypeTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/DocTypeTest.java deleted file mode 100644 index cf4d387f9..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/DocTypeTest.java +++ /dev/null @@ -1,71 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLDocument; -import org.eclipse.wst.xml.core.document.XMLDocumentType; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Element; - -public class DocTypeTest extends ModelTest { - /** - * Constructor for DocTypeTest. - * - * @param name - */ - public DocTypeTest(String name) { - super(name); - } - - public DocTypeTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new DocTypeTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - XMLDocument document = model.getDocument(); - - XMLDocumentType docType = (XMLDocumentType) document.createDoctype("HTML"); - document.appendChild(docType); - Element html = document.createElement("HTML"); - document.appendChild(html); - - printSource(model); - printTree(model); - - docType.setSystemId("sytem"); - - printSource(model); - printTree(model); - - docType.setPublicId("public"); - - printSource(model); - printTree(model); - - document.insertBefore(document.createTextNode(" "), docType); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest.java deleted file mode 100644 index 560eeb910..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest.java +++ /dev/null @@ -1,85 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -public class ElementTest extends ModelTest { - /** - * Constructor for ElementTest. - * - * @param name - */ - public ElementTest(String name) { - super(name); - } - - public ElementTest() { - super(); - } - - public Element changeTagName(Element element, String tagName) { - Document document = element.getOwnerDocument(); - Node parent = element.getParentNode(); - Element newElement = document.createElement(tagName); - NamedNodeMap attributes = element.getAttributes(); - while (attributes.getLength() > 0) { - Attr attr = (Attr) attributes.item(0); - attr = element.removeAttributeNode(attr); - newElement.setAttributeNode(attr); - } - while (element.hasChildNodes()) { - Node child = element.getFirstChild(); - child = element.removeChild(child); - newElement.appendChild(child); - } - parent.insertBefore(newElement, element); - parent.removeChild(element); - return newElement; - } - - public static void main(java.lang.String[] args) { - new ElementTest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<a><b e=\"f\" c=\"d\"><g /><h /></b></a>"); - Node a = document.getFirstChild(); - Element b = (Element) a.getFirstChild(); - - printSource(model); - printTree(model); - - //Element i = - changeTagName(b, "i"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest2.java deleted file mode 100644 index 3fb4bf0f0..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest2.java +++ /dev/null @@ -1,70 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class ElementTest2 extends ModelTest { - /** - * Constructor for ElementTest2. - * - * @param name - */ - public ElementTest2(String name) { - super(name); - } - - public ElementTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new ElementTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - Element b = document.createElement("b"); - Text t = document.createTextNode("c"); - document.appendChild(a); - a.appendChild(b); - b.appendChild(t); - - printSource(model); - printTree(model); - - a.setPrefix("x"); - - fOutputWriter.writeln("a.tagName=" + a.getTagName()); - - printSource(model); - printTree(model); - - b.setPrefix("y"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest3.java deleted file mode 100644 index 9e7f575ec..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ElementTest3.java +++ /dev/null @@ -1,78 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class ElementTest3 extends ModelTest { - /** - * Constructor for ElementTest3. - * - * @param name - */ - public ElementTest3(String name) { - super(name); - } - - public ElementTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new ElementTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("x:a"); - Element b = document.createElement("b"); - Text t = document.createTextNode("c"); - document.appendChild(a); - a.appendChild(b); - b.appendChild(t); - - printSource(model); - printTree(model); - - a.setPrefix(""); - - fOutputWriter.writeln("a.tagName=" + a.getTagName()); - - printSource(model); - printTree(model); - - a.setPrefix("y"); - - fOutputWriter.writeln("a.tagName=" + a.getTagName()); - - printSource(model); - printTree(model); - - a.setPrefix("y"); - - printSource(model); - printTree(model); - - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest.java deleted file mode 100644 index 347ef4af2..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest.java +++ /dev/null @@ -1,76 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EmptyTextTest extends ModelTest { - /** - * Constructor for EmptyTextTest. - * - * @param name - */ - public EmptyTextTest(String name) { - super(name); - } - - public EmptyTextTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new EmptyTextTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a"); - p.appendChild(text); - Element br = document.createElement("BR"); - p.appendChild(br); - Text text2 = document.createTextNode(""); - p.appendChild(text2); - - printSource(model); - printTree(model); - - Text text3 = document.createTextNode(""); - p.insertBefore(text3, text2); - - printSource(model); - printTree(model); - - text3.setData("b"); - - printSource(model); - printTree(model); - - p.removeChild(text2); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest2.java deleted file mode 100644 index d307266fb..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest2.java +++ /dev/null @@ -1,79 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EmptyTextTest2 extends ModelTest { - /** - * Constructor for EmptyTextTest2. - * - * @param name - */ - public EmptyTextTest2(String name) { - super(name); - } - - public EmptyTextTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new EmptyTextTest2().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode(""); - p.appendChild(text); - - printSource(model); - printTree(model); - - text.setData("a"); - - printSource(model); - printTree(model); - - text.setData(""); - - printSource(model); - printTree(model); - - Element b = document.createElement("B"); - p.appendChild(b); - p.removeChild(text); - b.appendChild(text); - - printSource(model); - printTree(model); - - text.setData("a"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest3.java deleted file mode 100644 index 1cff68746..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EmptyTextTest3.java +++ /dev/null @@ -1,60 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EmptyTextTest3 extends ModelTest { - /** - * Constructor for EmptyTextTest3. - * - * @param name - */ - public EmptyTextTest3(String name) { - super(name); - } - - public EmptyTextTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new EmptyTextTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Text text = document.createTextNode(""); - document.appendChild(text); - - printSource(model); - printTree(model); - - Element a = document.createElement("a"); - document.insertBefore(a, text); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest.java deleted file mode 100644 index 17f2f4779..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest.java +++ /dev/null @@ -1,60 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest extends ModelTest { - /** - * Constructor for EntityTest. - * - * @param name - */ - public EntityTest(String name) { - super(name); - } - - public EntityTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - - printSource(model); - printTree(model); - - Text text = document.createTextNode(">"); - p.appendChild(text); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest2.java deleted file mode 100644 index 7c20b4a43..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest2.java +++ /dev/null @@ -1,62 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest2 extends ModelTest { - /** - * Constructor for EntityTest2. - * - * @param name - */ - public EntityTest2(String name) { - super(name); - } - - public EntityTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest2().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a"); - p.appendChild(text); - - printSource(model); - printTree(model); - - text.setData("a>"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest3.java deleted file mode 100644 index b9aed5468..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest3.java +++ /dev/null @@ -1,82 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest3 extends ModelTest { - /** - * Constructor for EntityTest3. - * - * @param name - */ - public EntityTest3(String name) { - super(name); - } - - public EntityTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest3().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a"); - p.appendChild(text); - - printSource(model); - printTree(model); - - text.setData("ab"); - - printSource(model); - printTree(model); - - text.setData("ab&"); - - printSource(model); - printTree(model); - - text.setData("ab&c"); - - printSource(model); - printTree(model); - - text.setData("dab&c"); - - printSource(model); - printTree(model); - - text.setData("dab&ce"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest4.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest4.java deleted file mode 100644 index 2e650b9ac..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest4.java +++ /dev/null @@ -1,78 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest4 extends ModelTest { - /** - * Constructor for EntityTest4. - * - * @param name - */ - public EntityTest4(String name) { - super(name); - } - - public EntityTest4() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest4().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a&b"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = document.createTextNode(""); - p.insertBefore(text2, text); - - printSource(model); - printTree(model); - - text2.setData("c"); - - printSource(model); - printTree(model); - - text2.setData("ca&b"); - - printSource(model); - printTree(model); - - p.removeChild(text); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest5.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest5.java deleted file mode 100644 index 1ed3e6e32..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest5.java +++ /dev/null @@ -1,63 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest5 extends ModelTest { - /** - * Constructor for EntityTest5. - * - * @param name - */ - public EntityTest5(String name) { - super(name); - } - - public EntityTest5() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest5().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a&b"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = document.createTextNode("a&b"); - p.insertBefore(text2, text); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest6.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest6.java deleted file mode 100644 index 5aa0469bd..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest6.java +++ /dev/null @@ -1,63 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class EntityTest6 extends ModelTest { - /** - * Constructor for EntityTest6. - * - * @param name - */ - public EntityTest6(String name) { - super(name); - } - - public EntityTest6() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest6().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("a&"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = document.createTextNode("a&"); - p.insertBefore(text2, text); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest7.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest7.java deleted file mode 100644 index 1c3530d1a..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest7.java +++ /dev/null @@ -1,53 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class EntityTest7 extends ModelTest { - /** - * Constructor for EntityTest7. - * - * @param name - */ - public EntityTest7(String name) { - super(name); - } - - public EntityTest7() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest7().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - //Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<a>aAA&unk;&unk&unk</a>"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest8.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest8.java deleted file mode 100644 index ce9900fa5..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest8.java +++ /dev/null @@ -1,53 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class EntityTest8 extends ModelTest { - /** - * Constructor for EntityTest8. - * - * @param name - */ - public EntityTest8(String name) { - super(name); - } - - public EntityTest8() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest8().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - //Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "&ibm;&rtp;"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest9.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest9.java deleted file mode 100644 index eab9945ff..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/EntityTest9.java +++ /dev/null @@ -1,63 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class EntityTest9 extends ModelTest { - /** - * Constructor for EntityTest9. - * - * @param name - */ - public EntityTest9(String name) { - super(name); - } - - public EntityTest9() { - super(); - } - - public static void main(java.lang.String[] args) { - new EntityTest9().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - //Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(this, 4, 0, ">"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(this, 7, 0, ";"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ModelTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ModelTest.java deleted file mode 100644 index a572b7360..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ModelTest.java +++ /dev/null @@ -1,295 +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.wst.html.core.tests.parser; - -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Writer; - -import junit.framework.TestCase; - -import org.eclipse.wst.html.core.tests.utils.DateUtil; -import org.eclipse.wst.html.core.tests.utils.FileUtil; -import org.eclipse.wst.html.core.tests.utils.StringCompareUtil; -import org.eclipse.wst.html.core.tests.utils.TestWriter; -import org.eclipse.wst.sse.core.IModelManager; -import org.eclipse.wst.sse.core.IStructuredModel; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.util.StringUtils; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.internal.document.StructuredDocumentRegionChecker; -import org.w3c.dom.Node; - -public abstract class ModelTest extends TestCase { - - public final static String testResultsDirectoryPrefix = "ParserResults"; - private final static String fileExtension = ".txt"; - protected TestWriter fOutputWriter = new TestWriter(); - private int READ_BUFFER_SIZE = 4096; - - private boolean echoToSystemOut = false; - private boolean printedOnce; - private boolean printSummaryToSystemOut; - - /** - * Constructor for ModelTest. - * - * @param name - */ - public ModelTest(String name) { - super(name); - try { - printClass(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - public ModelTest() { - this("dummy"); - // try { - // printClass(); - // } catch (IOException e) { - // e.printStackTrace(); - // } - } - - public static XMLModel createHTMLModel() { - - //return new XMLModelImpl(); - - IStructuredModel model = null; - try { - IModelManager modelManager = StructuredModelManager.getInstance().getModelManager(); - //assertTrue("modelManager must not be null", modelManager != - // null); - - model = modelManager.getModelForEdit("test.html", null, null); - - // always use the same line delimiter for these tests, regardless - // of - // plaform or preference settings - model.getStructuredDocument().setLineDelimiter(TestWriter.commonEOL); - - - } - catch (Exception e) { - e.printStackTrace(); - } - //assertTrue("basic XML empty model could not be created", model != - // null); - return (XMLModel) model; - - } - - public static XMLModel createXMLModel() { - - //return new XMLModelImpl(); - - IStructuredModel model = null; - try { - IModelManager modelManager = StructuredModelManager.getInstance().getModelManager(); - //assertTrue("modelManager must not be null", modelManager != - // null); - - model = modelManager.getModelForEdit("test.xml", null, null); - - // always use the same line delimiter for these tests, regardless - // of - // plaform or preference settings - model.getStructuredDocument().setLineDelimiter(TestWriter.commonEOL); - - - } - catch (Exception e) { - e.printStackTrace(); - } - //assertTrue("basic XML empty model could not be created", model != - // null); - return (XMLModel) model; - - } - - /** - */ - private void printClass() throws IOException { - fOutputWriter.writeln(getClass().getName()); - } - - public static void printException(Exception ex) { - ex.printStackTrace(); - } - - private void printNode(Node node, int indent) { - try { - StringBuffer buffer = new StringBuffer(10); - for (int i = 0; i < indent; i++) - buffer.append("--"); - buffer.append(StringUtils.escape(node.toString())); - fOutputWriter.writeln(buffer.toString()); - indent++; - Node child = node.getFirstChild(); - while (child != null) { - printNode(child, indent); - child = child.getNextSibling(); - } - } - catch (Exception ex) { - printException(ex); - } - } - - public void printSource(XMLModel model) { - try { - fOutputWriter.writeln("Source :"); - fOutputWriter.writeln(model.getStructuredDocument().getText()); - fOutputWriter.writeln(""); - } - catch (Exception ex) { - printException(ex); - } - } - - public void printTree(XMLModel model) { - try { - printFlatModel(model.getStructuredDocument()); - new StructuredDocumentRegionChecker(fOutputWriter).checkModel(model); - fOutputWriter.writeln("Tree :"); - printNode(model.getDocument(), 0); - fOutputWriter.writeln(""); - - } - catch (Exception ex) { - printException(ex); - } - - } - - protected void saveAndCompareTestResults() { - try { - String testOutputDirectory = testResultsDirectoryPrefix + DateUtil.now(); - String currentFilename = getClass().getName() + fileExtension; - File fileout = FileUtil.makeFileFor(testOutputDirectory, currentFilename, testResultsDirectoryPrefix); - Writer fileWriter = new FileWriter(fileout); - fileWriter.write(fOutputWriter.toString()); - fileWriter.close(); - compareWithPreviousResults(fOutputWriter, currentFilename); - - if (echoToSystemOut) { - System.out.println(fOutputWriter.toString()); - } - - fOutputWriter.close(); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * Method compareWithPreviousResults. - * - * @param outputWriter - * @param currentFilename - */ - private void compareWithPreviousResults(TestWriter outputWriter, String currentFilename) throws IOException { - boolean success = false; - File previousResultsDir = FileUtil.getPreviousResultsDirectory(testResultsDirectoryPrefix); - if (previousResultsDir != null) { - String currentResults = outputWriter.toString(); - File previousResultsFile = new File(previousResultsDir, currentFilename); - FileReader previousResultsFileReader = new FileReader(previousResultsFile); - String previousResults = readString(previousResultsFileReader); - StringCompareUtil stringCompare = new StringCompareUtil(); - // trying to "force" the same linedelimter didn't work well, - // I think since the line delimiter is input on some tests, - // and CVS is likely to change anyway (for ASCII files). - // so we'll ignore in our comparisons. Note: we wouldn't - // want to ignore whitespace. There might actually be some - // tests that are not as accurate if we ignore EOL, but there - // seems to be no easy way to handle, with out a lot of trouble. - if (!stringCompare.equalsIgnoreLineSeperator(previousResults, currentResults)) { - // previousResults.equals(currentResults)) { - // fail - success = false; - - System.out.println(); - System.out.println(currentFilename + " failed comparison to previous results"); - System.out.println("Previous: "); - System.out.println(previousResults); - System.out.println(); - System.out.println("Current: "); - System.out.println(currentResults); - System.out.println(); - } - else { - success = true; - if (printSummaryToSystemOut) { - System.out.println(); - System.out.println(currentFilename + " compared ok"); - System.out.println(); - } - } - } - else { - if (!printedOnce) { - System.out.println(); - System.out.println("No Previous Directory found ... couldn't compare " + currentFilename + " with previous results"); - printedOnce = true; - System.out.println(); - } - } - assertTrue("current is not equal to reference results for " + currentFilename, success); - } - - /** - * Method readString. - * - * @param previousResultsFileReader - * @return String - */ - private String readString(FileReader fileReader) throws IOException { - return readInputStream(fileReader); - } - - private String readInputStream(InputStreamReader inputStreamReader) throws IOException { - int numRead = 0; - StringBuffer buffer = new StringBuffer(); - char tBuff[] = new char[READ_BUFFER_SIZE]; - while ((numRead = inputStreamReader.read(tBuff, 0, tBuff.length)) != -1) { - buffer.append(tBuff, 0, numRead); - } - // remember -- we didn't open stream ... so we don't close it - return buffer.toString(); - } - - public abstract void testModel(); - - protected void printFlatModel(IStructuredDocument flatModel) { - fOutputWriter.writeln(""); - fOutputWriter.writeln("StructuredDocument Regions :"); - IStructuredDocumentRegion flatnode = flatModel.getFirstStructuredDocumentRegion(); - while (flatnode != null) { - - fOutputWriter.writeln(flatnode.toString()); - flatnode = flatnode.getNext(); - - } - fOutputWriter.writeln(""); - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/NodeListTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/NodeListTest.java deleted file mode 100644 index 254431692..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/NodeListTest.java +++ /dev/null @@ -1,142 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class NodeListTest extends ModelTest { - /** - * Constructor for PITest. - * - * @param name - */ - public NodeListTest(String name) { - super(name); - } - - public NodeListTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new NodeListTest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<p></p>"); - Node parent = document.getFirstChild(); - - for (int i = 0; i < 1; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 1; i < 5; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 5; i < 10; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 10; i < 20; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 20; i < 50; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 50; i < 100; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 100; i < 200; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 200; i < 500; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 500; i < 1000; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 1000; i < 2000; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 2000; i < 5000; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - - for (int i = 5000; i < 10000; i++) { - parent.appendChild(document.createElement("c")); - } - - iterate(parent); - } - finally { - model.releaseFromEdit(); - } - - } - - private void iterate(Node parent) { - long start = System.currentTimeMillis(); - int i = 0; - int t = 0; - while (t < 1000) { - NodeList childNodes = parent.getChildNodes(); - int length = childNodes.getLength(); - for (i = 0; i < length; i++) { - childNodes.item(i); - } - // these 2 lines are required to invalidate the cache - parent.appendChild(parent.getOwnerDocument().createTextNode("")); - parent.removeChild(parent.getLastChild()); - t++; - } - float d = ((float) (System.currentTimeMillis() - start)) / t; - System.out.println(d + " ms for " + i + " child nodes"); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/PITest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/PITest.java deleted file mode 100644 index 19a711ec4..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/PITest.java +++ /dev/null @@ -1,70 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.ProcessingInstruction; - -public class PITest extends ModelTest { - /** - * Constructor for PITest. - * - * @param name - */ - public PITest(String name) { - super(name); - } - - public PITest() { - super(); - } - - public static void main(java.lang.String[] args) { - new PITest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<a><?echo $PHP_SELF?></a>"); - - printSource(model); - printTree(model); - - Node a = document.getFirstChild(); - for (Node child = a.getFirstChild(); child != null; child = child.getNextSibling()) { - if (child.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) - continue; - ProcessingInstruction pi = (ProcessingInstruction) child; - String target = pi.getTarget(); - if (target == null) - target = "null"; - String data = pi.getData(); - if (data == null) - data = "null"; - fOutputWriter.writeln("target(" + target + ") data (" + data + ")"); - } - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest.java deleted file mode 100644 index e3d0e8f15..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest.java +++ /dev/null @@ -1,102 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.document.XMLNode; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -public class ParserTest extends ModelTest { - /** - * Constructor for ParserTest. - * - * @param name - */ - public ParserTest(String name) { - super(name); - } - - public ParserTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new ParserTest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<P><B></B><B></B></P><P></P>"); - Node p = document.getFirstChild(); - Node b = p.getFirstChild(); - Node b2 = b.getNextSibling(); - Node p2 = p.getNextSibling(); - /* - * Element p = document.createElement("P"); - * document.appendChild(p); Element b = - * document.createElement("B"); p.appendChild(b); Element b2 = - * document.createElement("B"); p.appendChild(b2); Element p2 = - * document.createElement("P"); document.appendChild(p2); - */ - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 0, 0, "a"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) b).getStartOffset(), 0, "b"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) b2).getStartOffset(), 0, "c"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) b2).getEndOffset(), 0, "d"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) p2).getStartOffset(), 0, "e"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) p2).getStartOffset() + 3, 0, "f"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, ((XMLNode) p2).getEndOffset(), 0, "g"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest2.java deleted file mode 100644 index b2ee4d917..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest2.java +++ /dev/null @@ -1,93 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -public class ParserTest2 extends ModelTest { - /** - * Constructor for ParserTest2. - * - * @param name - */ - public ParserTest2(String name) { - super(name); - } - - public ParserTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new ParserTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<a b=\"\" c=\"c\">"); - - printSource(model); - printTree(model); - - Element a = (Element) document.getFirstChild(); - NamedNodeMap attributes = a.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Node attr = attributes.item(i); - String name = attr.getNodeName(); - String value = attr.getNodeValue(); - fOutputWriter.writeln(name + "=[" + value + "]"); - } - - structuredDocument.replaceText(null, 8, 0, "d"); - - printSource(model); - printTree(model); - - a = (Element) document.getFirstChild(); - attributes = a.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Node attr = attributes.item(i); - String name = attr.getNodeName(); - String value = attr.getNodeValue(); - fOutputWriter.writeln(name + "=[" + value + "]"); - } - - structuredDocument.replaceText(null, 8, 1, ""); - - printSource(model); - printTree(model); - - a = (Element) document.getFirstChild(); - attributes = a.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Node attr = attributes.item(i); - String name = attr.getNodeName(); - String value = attr.getNodeValue(); - fOutputWriter.writeln(name + "=[" + value + "]"); - } - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest3.java deleted file mode 100644 index 1a9d3c1dd..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest3.java +++ /dev/null @@ -1,89 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.events.StructuredDocumentEvent; -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -public class ParserTest3 extends ModelTest { - /** - * Constructor for ParserTest3. - * - * @param name - */ - public ParserTest3(String name) { - super(name); - } - - public ParserTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new ParserTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - //StructuredDocumentEvent event = - structuredDocument.replaceText(null, 0, 0, "<a b >"); - // dont's print instance of event, or many tests will fail when - // event class is changed (exactly what is not needed for unit - // tests!) - // fOutputWriter.writeln(event.toString()); - - printSource(model); - printTree(model); - - Element a = (Element) document.getFirstChild(); - NamedNodeMap attributes = a.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Node attr = attributes.item(i); - String name = attr.getNodeName(); - String value = attr.getNodeValue(); - fOutputWriter.writeln(name + "=[" + value + "]"); - } - - StructuredDocumentEvent event2 = structuredDocument.replaceText(null, 4, 1, ""); - // I removed this part of output, since renaming class or package - // will cause test to fail! - fOutputWriter.writeln(event2.toString()); - - printSource(model); - printTree(model); - - a = (Element) document.getFirstChild(); - attributes = a.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Node attr = attributes.item(i); - String name = attr.getNodeName(); - String value = attr.getNodeValue(); - fOutputWriter.writeln(name + "=[" + value + "]"); - } - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest4.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest4.java deleted file mode 100644 index a6a523590..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/ParserTest4.java +++ /dev/null @@ -1,84 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class ParserTest4 extends ModelTest { - /** - * Constructor for ParserTest4. - * - * @param name - */ - public ParserTest4(String name) { - super(name); - } - - public ParserTest4() { - super(); - } - - public static void main(java.lang.String[] args) { - new ParserTest4().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - - IStructuredDocument structuredDocument = model.getStructuredDocument(); - //Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<a>\n\n<% a %>\n<% b %>\n</a>"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 4, 0, "<"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 5, 0, "b"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 6, 0, "c"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 7, 0, "d"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 8, 0, "e"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 9, 0, ">"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest.java deleted file mode 100644 index 22955c1b0..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest.java +++ /dev/null @@ -1,112 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.InvalidCharacterException; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.internal.document.SourceValidator; -import org.w3c.dom.Document; -import org.w3c.dom.Text; - -public class SourceTest extends ModelTest { - /** - * Constructor for SourceTest. - * - * @param name - */ - public SourceTest(String name) { - super(name); - } - - public SourceTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new SourceTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Text t = document.createTextNode("t"); - document.appendChild(t); - SourceValidator validator = new SourceValidator(t); - - String source = null; - String result = null; - - source = "aaa<bbb>ccc"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "aaa&\"'bbb><ccc"@"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "&&&"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "&bbb&<>ccc"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "&unk;&unk"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest2.java deleted file mode 100644 index ff5382400..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest2.java +++ /dev/null @@ -1,115 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.InvalidCharacterException; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.internal.document.SourceValidator; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class SourceTest2 extends ModelTest { - /** - * Constructor for SourceTest2. - * - * @param name - */ - public SourceTest2(String name) { - super(name); - } - - public SourceTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new SourceTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - Attr b = document.createAttribute("b"); - a.setAttributeNode(b); - document.appendChild(a); - SourceValidator validator = new SourceValidator(b); - - String source = null; - String result = null; - - source = "aaa<bbb>ccc"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "aaa&bbb><ccc"@"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "&&&"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "\"aaa\""; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "\"a'a\""; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest3.java deleted file mode 100644 index dee9d1a3d..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SourceTest3.java +++ /dev/null @@ -1,93 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.InvalidCharacterException; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.internal.document.SourceValidator; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class SourceTest3 extends ModelTest { - /** - * Constructor for SourceTest3. - * - * @param name - */ - public SourceTest3(String name) { - super(name); - } - - public SourceTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new SourceTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - Attr b = document.createAttribute("b"); - a.setAttributeNode(b); - document.appendChild(a); - SourceValidator validator = new SourceValidator(b); - - String source = null; - String result = null; - - source = "<% aaa %><%= bbb %>/<%! ccc %>ddd"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = "<% aaa"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - source = ">< % aaa %>"; - fOutputWriter.writeln("source: " + source); - try { - validator.validateSource(source); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - result = validator.convertSource(source); - fOutputWriter.writeln("result: " + result); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest.java deleted file mode 100644 index 996906384..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest.java +++ /dev/null @@ -1,87 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest extends ModelTest { - /** - * Constructor for SplitTextTest. - * - * @param name - */ - public SplitTextTest(String name) { - super(name); - } - - public SplitTextTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aabbbbccc"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = text.splitText(2); - - printSource(model); - printTree(model); - - Text text3 = text2.splitText(4); - - printSource(model); - printTree(model); - - p.removeChild(text2); - - printSource(model); - printTree(model); - - text.appendData("ddddddd"); - - printSource(model); - printTree(model); - - text3.appendData("eee"); - - printSource(model); - printTree(model); - - p.insertBefore(text2, text3); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest2.java deleted file mode 100644 index a4f8c0318..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest2.java +++ /dev/null @@ -1,79 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest2 extends ModelTest { - /** - * Constructor for SplitTextTest2. - * - * @param name - */ - public SplitTextTest2(String name) { - super(name); - } - - public SplitTextTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest2().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aabbbbccc"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = text.splitText(2); - - printSource(model); - printTree(model); - - Text text3 = text2.splitText(4); - - printSource(model); - printTree(model); - - p.removeChild(text2); - - printSource(model); - printTree(model); - - Element b = document.createElement("B"); - b.appendChild(text2); - p.insertBefore(b, text3); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest3.java deleted file mode 100644 index 117890f14..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest3.java +++ /dev/null @@ -1,81 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest3 extends ModelTest { - /** - * Constructor for SplitTextTest3. - * - * @param name - */ - public SplitTextTest3(String name) { - super(name); - } - - public SplitTextTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest3().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aa"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Element b = document.createElement("B"); - Text text2 = document.createTextNode("bbbb"); - b.appendChild(text2); - p.appendChild(b); - - printSource(model); - printTree(model); - - Text text3 = document.createTextNode("ccc"); - p.appendChild(text3); - - printSource(model); - printTree(model); - - p.removeChild(b); - - printSource(model); - printTree(model); - - p.insertBefore(b, text3); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - - } - finally { - model.releaseFromEdit(); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest4.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest4.java deleted file mode 100644 index ea483d1f2..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest4.java +++ /dev/null @@ -1,79 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest4 extends ModelTest { - /** - * Constructor for SplitTextTest4. - * - * @param name - */ - public SplitTextTest4(String name) { - super(name); - } - - public SplitTextTest4() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest4().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode(""); - p.appendChild(text); - - printSource(model); - printTree(model); - - text.appendData("aaa"); - - printSource(model); - printTree(model); - - text.deleteData(0, 3); - - printSource(model); - printTree(model); - - Text text2 = document.createTextNode("cccc"); - p.insertBefore(text2, text); - - printSource(model); - printTree(model); - - text.appendData("aaa"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - - - } - finally { - model.releaseFromEdit(); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest5.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest5.java deleted file mode 100644 index 7a21f0b02..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest5.java +++ /dev/null @@ -1,94 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest5 extends ModelTest { - /** - * Constructor for SplitTextTest5. - * - * @param name - */ - public SplitTextTest5(String name) { - super(name); - } - - public SplitTextTest5() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest5().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aabbbbccc"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Text text2 = text.splitText(6); - - printSource(model); - printTree(model); - - Element br = document.createElement("BR"); - p.insertBefore(br, text2); - - printSource(model); - printTree(model); - - text2.setData("cccd"); - - printSource(model); - printTree(model); - - text2.setData("cccde"); - - printSource(model); - printTree(model); - - Text text3 = text.splitText(2); - Element b = document.createElement("B"); - b.appendChild(text3); - p.insertBefore(b, br); - - printSource(model); - printTree(model); - - Text text4 = text2.splitText(3); - Element i = document.createElement("I"); - i.appendChild(text2); - p.insertBefore(i, text4); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - - } - finally { - model.releaseFromEdit(); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest6.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest6.java deleted file mode 100644 index 907d33a8a..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest6.java +++ /dev/null @@ -1,65 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest6 extends ModelTest { - /** - * Constructor for SplitTextTest6. - * - * @param name - */ - public SplitTextTest6(String name) { - super(name); - } - - public SplitTextTest6() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest6().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aabbbbccc"); - p.appendChild(text); - Text text2 = text.splitText(2); - // ==> // Text text3 = - text2.splitText(4); - - printSource(model); - printTree(model); - - text2.setData("bbbbd"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest7.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest7.java deleted file mode 100644 index 926696a92..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest7.java +++ /dev/null @@ -1,66 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest7 extends ModelTest { - /** - * Constructor for SplitTextTest7. - * - * @param name - */ - public SplitTextTest7(String name) { - super(name); - } - - public SplitTextTest7() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest7().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aaaa"); - Text text2 = document.createTextNode("bbbb"); - p.appendChild(text); - p.appendChild(text2); - - printSource(model); - printTree(model); - - - // delete accross node boundry - model.getStructuredDocument().replaceText(this, 6, 3, ""); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest8.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest8.java deleted file mode 100644 index 905d68d7a..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/SplitTextTest8.java +++ /dev/null @@ -1,66 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class SplitTextTest8 extends ModelTest { - /** - * Constructor for SplitTextTest8. - * - * @param name - */ - public SplitTextTest8(String name) { - super(name); - } - - public SplitTextTest8() { - super(); - } - - public static void main(java.lang.String[] args) { - new SplitTextTest8().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Text text = document.createTextNode("aaaa"); - Text text2 = document.createTextNode("bbbb"); - p.appendChild(text); - p.appendChild(text2); - - printSource(model); - printTree(model); - - - // delete accross node boundry - model.getStructuredDocument().replaceText(this, 4, 6, ""); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TableTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TableTest.java deleted file mode 100644 index 6123cf105..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TableTest.java +++ /dev/null @@ -1,85 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class TableTest extends ModelTest { - /** - * Constructor for TableTest. - * @param name - */ - public TableTest(String name) { - super(name); - } - - public TableTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new TableTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element html = document.createElement("HTML"); - document.appendChild(html); - - printSource(model); - printTree(model); - - Element body = document.createElement("BODY"); - html.appendChild(body); - - printSource(model); - printTree(model); - - Element table = document.createElement("TABLE"); - table.setAttribute("border", "1"); - Element td = null; - for (int row = 0; row < 2; row++) { - Element tr = document.createElement("TR"); - table.appendChild(tr); - for (int col = 0; col < 2; col++) { - td = document.createElement("TD"); - tr.appendChild(td); - } - } - body.appendChild(table); - - printSource(model); - printTree(model); - - Element font = document.createElement("FONT"); - font.setAttribute("color", "red"); - Text text = document.createTextNode("text"); - font.appendChild(text); - td.appendChild(font); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest.java deleted file mode 100644 index 4879c68bf..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest.java +++ /dev/null @@ -1,61 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.CharacterData; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TextTest extends ModelTest { - /** - * Constructor for TextTest. - * - * @param name - */ - public TextTest(String name) { - super(name); - } - - public TextTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new TextTest().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - CharacterData text = document.createTextNode("text"); - a.appendChild(text); - - text.setData("hello <"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(text.getData()); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest2.java deleted file mode 100644 index bd8a2e8bf..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest2.java +++ /dev/null @@ -1,61 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.CharacterData; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TextTest2 extends ModelTest { - /** - * Constructor for TextTest2. - * - * @param name - */ - public TextTest2(String name) { - super(name); - } - - public TextTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new TextTest2().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - CharacterData text = document.createTextNode("text"); - a.appendChild(text); - - text.setNodeValue("hello <"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln(text.getNodeValue()); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest3.java deleted file mode 100644 index c6b3e175c..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/TextTest3.java +++ /dev/null @@ -1,106 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.InvalidCharacterException; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.document.XMLNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TextTest3 extends ModelTest { - /** - * Constructor for TextTest3. - * - * @param name - */ - public TextTest3(String name) { - super(name); - } - - public TextTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new TextTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - XMLNode text = (XMLNode) document.createTextNode("text"); - a.appendChild(text); - - try { - text.setSource("hello <"); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - - printSource(model); - printTree(model); - - try { - text.setSource("hello <"); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - - printSource(model); - printTree(model); - - try { - text.setSource("hello &unk;"); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - - printSource(model); - printTree(model); - - try { - text.setSource("hello A"); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - - printSource(model); - printTree(model); - - try { - text.setSource("hello & good-bye"); - } - catch (InvalidCharacterException ex) { - fOutputWriter.writeln(ex.getMessage()); - } - - printSource(model); - printTree(model); - - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest.java deleted file mode 100644 index 51fc7f9f2..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest.java +++ /dev/null @@ -1,105 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest extends ModelTest { - /** - * Constructor for UpdaterTest. - * - * @param name - */ - public UpdaterTest(String name) { - super(name); - } - - public UpdaterTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element html = document.createElement("HTML"); - document.appendChild(html); - - printSource(model); - printTree(model); - - Element body = document.createElement("BODY"); - html.appendChild(body); - - printSource(model); - printTree(model); - - Element p = document.createElement("P"); - body.appendChild(p); - - printSource(model); - printTree(model); - - Text text = document.createTextNode("text"); - p.appendChild(text); - - printSource(model); - printTree(model); - - Element br = document.createElement("BR"); - p.insertBefore(br, text); - - printSource(model); - printTree(model); - - Element img = document.createElement("IMG"); - p.appendChild(img); - - printSource(model); - printTree(model); - - p.removeChild(text); - - printSource(model); - printTree(model); - - p.insertBefore(text, img); - - printSource(model); - printTree(model); - - body.removeChild(p); - - printSource(model); - printTree(model); - - body.appendChild(p); - - printSource(model); - printTree(model); - - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest10.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest10.java deleted file mode 100644 index 2a62b23bc..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest10.java +++ /dev/null @@ -1,112 +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.wst.html.core.tests.parser; - -import java.util.Iterator; - -import org.eclipse.wst.sse.core.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.text.ITextRegion; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.eclipse.wst.xml.core.document.XMLNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class UpdaterTest10 extends ModelTest { - /** - * Constructor for UpdaterTest10. - * - * @param name - */ - public UpdaterTest10(String name) { - super(name); - } - - public UpdaterTest10() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest10().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - a.setAttribute("b", "c"); - Element b = document.createElement("b"); - a.appendChild(b); - - printSource(model); - printTree(model); - - fOutputWriter.writeln("IStructuredDocumentRegion:"); - XMLNode node = (XMLNode) b; - IStructuredDocumentRegion flatNode = node.getStartStructuredDocumentRegion(); - fOutputWriter.writeln(flatNode.getText()); - Iterator e = flatNode.getRegions().iterator(); - int i = 0; - while (e.hasNext()) { - ITextRegion region = (ITextRegion) e.next(); - boolean ok = true; // no longer has parent. - // //(region.getParent() == flatNode); - fOutputWriter.writeln(i + "(" + flatNode.getText(region) + ")" + ok); - } - fOutputWriter.writeln(""); - - b.setAttribute("c", "d"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln("IStructuredDocumentRegion:"); - node = (XMLNode) b; - flatNode = node.getStartStructuredDocumentRegion(); - fOutputWriter.writeln(flatNode.getText()); - e = flatNode.getRegions().iterator(); - i = 0; - while (e.hasNext()) { - ITextRegion region = (ITextRegion) e.next(); - boolean ok = true; // no longer has parent. - // (region.getParent() == flatNode); - fOutputWriter.writeln(i + "(" + flatNode.getText(region) + ")" + ok); - } - fOutputWriter.writeln(""); - - a.setAttribute("b", "cd"); - - printSource(model); - printTree(model); - - fOutputWriter.writeln("IStructuredDocumentRegion:"); - node = (XMLNode) b; - flatNode = node.getStartStructuredDocumentRegion(); - fOutputWriter.writeln(flatNode.getText()); - e = flatNode.getRegions().iterator(); - i = 0; - while (e.hasNext()) { - ITextRegion region = (ITextRegion) e.next(); - boolean ok = true; // (region.getParent() == flatNode); - fOutputWriter.writeln(i + "(" + flatNode.getText(region) + ")" + ok); - } - fOutputWriter.writeln(""); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest11.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest11.java deleted file mode 100644 index d4cbd6b4c..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest11.java +++ /dev/null @@ -1,62 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest11 extends ModelTest { - /** - * Constructor for UpdaterTest11. - * - * @param name - */ - public UpdaterTest11(String name) { - super(name); - } - - public UpdaterTest11() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest11().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - Text text = document.createTextNode("b"); - a.appendChild(text); - - printSource(model); - printTree(model); - - text.setData("b"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest12.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest12.java deleted file mode 100644 index 846115a8a..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest12.java +++ /dev/null @@ -1,64 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class UpdaterTest12 extends ModelTest { - /** - * Constructor for UpdaterTest12. - * - * @param name - */ - public UpdaterTest12(String name) { - super(name); - } - - public UpdaterTest12() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest12().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - - printSource(model); - printTree(model); - - Element a2 = document.createElement("a"); - document.insertBefore(a2, a); - - printSource(model); - printTree(model); - - document.removeChild(a2); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest13.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest13.java deleted file mode 100644 index 538b15224..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest13.java +++ /dev/null @@ -1,66 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest13 extends ModelTest { - /** - * Constructor for UpdaterTest13. - * - * @param name - */ - public UpdaterTest13(String name) { - super(name); - } - - public UpdaterTest13() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest13().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<a>\r\n<b>\r\n</a>"); - - Element a = (Element) document.getFirstChild(); - Element b = (Element) a.getLastChild(); - Text text = document.createTextNode(" "); - a.appendChild(text); - - printSource(model); - printTree(model); - - a.removeChild(b); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest14.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest14.java deleted file mode 100644 index c66d4c44b..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest14.java +++ /dev/null @@ -1,58 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class UpdaterTest14 extends ModelTest { - /** - * Constructor for UpdaterTest14. - * - * @param name - */ - public UpdaterTest14(String name) { - super(name); - } - - public UpdaterTest14() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest14().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - //Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<%= aaaa %>"); - - printSource(model); - printTree(model); - - structuredDocument.replaceText(null, 2, 0, " "); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest15.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest15.java deleted file mode 100644 index e16abde51..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest15.java +++ /dev/null @@ -1,64 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; - -public class UpdaterTest15 extends ModelTest { - /** - * Constructor for UpdaterTest15. - * - * @param name - */ - public UpdaterTest15(String name) { - super(name); - } - - public UpdaterTest15() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest15().testModel(); - } - - public void testModel() { - // XML case - XMLModel model = createXMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - //Document document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<%= aaaa %><P>"); - - printSource(model); - printTree(model); - - // HTML case - model = createHTMLModel(); - structuredDocument = model.getStructuredDocument(); - //document = model.getDocument(); - - structuredDocument.replaceText(null, 0, 0, "<%= aaaa %><P>"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest2.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest2.java deleted file mode 100644 index 0d1123821..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest2.java +++ /dev/null @@ -1,77 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest2 extends ModelTest { - /** - * Constructor for UpdaterTest2. - * - * @param name - */ - public UpdaterTest2(String name) { - super(name); - } - - public UpdaterTest2() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest2().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - IStructuredDocument structuredDocument = model.getStructuredDocument(); - Document document = model.getDocument(); - - structuredDocument.setText(this, "<HTML>\r\n<HEAD></HEAD>\r\n<BODY></BODY>\r\n</HTML>\r\n"); - Element html = (Element) document.getFirstChild(); - Element head = (Element) html.getFirstChild().getNextSibling(); - - printSource(model); - printTree(model); - - Element meta = document.createElement("META"); - meta.setAttribute("name", "GENERATOR"); - meta.setAttribute("content", "Updater Test 2"); - head.appendChild(meta); - Text text4 = document.createTextNode("\r\n"); - head.insertBefore(text4, meta); - Text text5 = document.createTextNode("\r\n"); - head.appendChild(text5); - - printSource(model); - printTree(model); - - Element title = document.createElement("TITLE"); - Text text6 = document.createTextNode(""); - title.appendChild(text6); - head.appendChild(title); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest3.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest3.java deleted file mode 100644 index 0f865d5ab..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest3.java +++ /dev/null @@ -1,69 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest3 extends ModelTest { - /** - * Constructor for UpdaterTest3. - * - * @param name - */ - public UpdaterTest3(String name) { - super(name); - } - - public UpdaterTest3() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest3().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - Element b = document.createElement("b"); - a.appendChild(b); - - printSource(model); - printTree(model); - - Text t1 = document.createTextNode("\n"); - a.insertBefore(t1, b); - - printSource(model); - printTree(model); - - Text t2 = document.createTextNode("\n"); - a.appendChild(t2); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest4.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest4.java deleted file mode 100644 index 1ac9f2fd0..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest4.java +++ /dev/null @@ -1,62 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest4 extends ModelTest { - /** - * Constructor for UpdaterTest4. - * - * @param name - */ - public UpdaterTest4(String name) { - super(name); - } - - public UpdaterTest4() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest4().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - Text t = document.createTextNode("b"); - a.appendChild(t); - - printSource(model); - printTree(model); - - t.setData("b"); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest5.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest5.java deleted file mode 100644 index 55f685e83..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest5.java +++ /dev/null @@ -1,63 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -public class UpdaterTest5 extends ModelTest { - /** - * Constructor for UpdaterTest5. - * - * @param name - */ - public UpdaterTest5(String name) { - super(name); - } - - public UpdaterTest5() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest5().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<a>'</a>"); - - printSource(model); - printTree(model); - - Node a = document.getFirstChild(); - Node t = a.getFirstChild(); - a.removeChild(t); - a.appendChild(t); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest6.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest6.java deleted file mode 100644 index 4407132ae..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest6.java +++ /dev/null @@ -1,67 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest6 extends ModelTest { - /** - * Constructor for UpdaterTest6. - * - * @param name - */ - public UpdaterTest6(String name) { - super(name); - } - - public UpdaterTest6() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest6().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element a = document.createElement("a"); - document.appendChild(a); - Text t = document.createTextNode("b"); - a.appendChild(t); - - printSource(model); - printTree(model); - - a.removeChild(t); - - printSource(model); - printTree(model); - - a.appendChild(t); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest7.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest7.java deleted file mode 100644 index dab20a09c..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest7.java +++ /dev/null @@ -1,62 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class UpdaterTest7 extends ModelTest { - /** - * Constructor for UpdaterTest7. - * - * @param name - */ - public UpdaterTest7(String name) { - super(name); - } - - public UpdaterTest7() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest7().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - Element b = document.createElement("B"); - p.appendChild(b); - - printSource(model); - printTree(model); - - Element b2 = document.createElement("B"); - p.insertBefore(b2, b); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest8.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest8.java deleted file mode 100644 index 82c5abf02..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest8.java +++ /dev/null @@ -1,60 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class UpdaterTest8 extends ModelTest { - /** - * Constructor for UpdaterTest8. - * - * @param name - */ - public UpdaterTest8(String name) { - super(name); - } - - public UpdaterTest8() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest8().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - - Element p = document.createElement("P"); - document.appendChild(p); - - printSource(model); - printTree(model); - - Element p2 = document.createElement("P"); - document.appendChild(p2); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - } - finally { - model.releaseFromEdit(); - } - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest9.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest9.java deleted file mode 100644 index f202f0e8b..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTest9.java +++ /dev/null @@ -1,61 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -public class UpdaterTest9 extends ModelTest { - /** - * Constructor for UpdaterTest9. - * - * @param name - */ - public UpdaterTest9(String name) { - super(name); - } - - public UpdaterTest9() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTest9().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); - try { - Document document = model.getDocument(); - - Element style = document.createElement("STYLE"); - document.appendChild(style); - - printSource(model); - printTree(model); - - Text text2 = document.createTextNode("p"); - style.appendChild(text2); - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTestRegionChanged.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTestRegionChanged.java deleted file mode 100644 index a80292b77..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/UpdaterTestRegionChanged.java +++ /dev/null @@ -1,73 +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.wst.html.core.tests.parser; - -import org.eclipse.wst.sse.core.events.RegionChangedEvent; -import org.eclipse.wst.sse.core.events.StructuredDocumentEvent; -import org.eclipse.wst.sse.core.text.IStructuredDocument; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -public class UpdaterTestRegionChanged extends ModelTest { - /** - * Constructor for UpdaterTestRegionChanged. - * - * @param name - */ - public UpdaterTestRegionChanged(String name) { - super(name); - } - - public UpdaterTestRegionChanged() { - super(); - } - - public static void main(java.lang.String[] args) { - new UpdaterTestRegionChanged().testModel(); - } - - public void testModel() { - XMLModel model = createXMLModel(); - try { - Document document = model.getDocument(); - IStructuredDocument structuredDocument = model.getStructuredDocument(); - - structuredDocument.setText(this, "<a b= c></a>"); - - Node before = document.getFirstChild(); - - StructuredDocumentEvent fmEvent = structuredDocument.replaceText(null, 5, 1, ""); - if (fmEvent instanceof RegionChangedEvent) { - fOutputWriter.writeln("ok: RegionChangedEvent"); - } - else { - fOutputWriter.writeln("not ok: " + fmEvent.getClass().getName()); - } - - Node after = document.getFirstChild(); - - if (before != after) { - fOutputWriter.writeln("not ok: Node replaced"); - } - else { - fOutputWriter.writeln("ok: Node not replaced"); - } - - saveAndCompareTestResults(); - } - finally { - model.releaseFromEdit(); - } - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/css/StyleTest.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/css/StyleTest.java deleted file mode 100644 index 2d4f7eb3b..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/parser/css/StyleTest.java +++ /dev/null @@ -1,75 +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.wst.html.core.tests.parser.css; - -import org.eclipse.wst.html.core.tests.parser.ModelTest; -import org.eclipse.wst.xml.core.document.XMLModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; -import org.w3c.dom.css.CSSStyleSheet; -import org.w3c.dom.stylesheets.DocumentStyle; -import org.w3c.dom.stylesheets.LinkStyle; -import org.w3c.dom.stylesheets.StyleSheetList; - -public class StyleTest extends ModelTest { - /** - * Constructor for StyleTest. - * @param name - */ - public StyleTest(String name) { - super(name); - } - - public StyleTest() { - super(); - } - - public static void main(java.lang.String[] args) { - new StyleTest().testModel(); - } - - public void testModel() { - XMLModel model = createHTMLModel(); //new HTMLModelImpl(); - Document document = model.getDocument(); - - Element style = document.createElement("STYLE"); - Text text = document.createTextNode("BODY { color : red; } P { color : green; } B { color : blue; }"); - style.appendChild(text); - document.appendChild(style); - - printSource(model); - printTree(model); - - DocumentStyle ds = (DocumentStyle) document; - StyleSheetList ssl = ds.getStyleSheets(); - if (ssl.getLength() > 0) { - CSSStyleSheet ss = (CSSStyleSheet) ssl.item(0); - ss.deleteRule(1); - } - - printSource(model); - printTree(model); - - LinkStyle ls = (LinkStyle) style; - CSSStyleSheet ss2 = (CSSStyleSheet) ls.getSheet(); - if (ss2 != null) { - ss2.deleteRule(0); - } - - printSource(model); - printTree(model); - - saveAndCompareTestResults(); - - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/CommonXML.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/CommonXML.java deleted file mode 100644 index 94e16a24e..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/CommonXML.java +++ /dev/null @@ -1,86 +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.wst.html.core.tests.utils; - - - -import java.io.IOException; -import java.io.OutputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.wst.html.core.tests.Logger; -import org.w3c.dom.Document; - -/** - */ -public class CommonXML { - - public synchronized static DocumentBuilder getDocumentBuilder() { - DocumentBuilder result = null; - try { - result = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - } - catch (ParserConfigurationException e) { - Logger.logException(e); - } - return result; - } - - public synchronized static DocumentBuilder getDocumentBuilder(boolean validating) { - DocumentBuilder result = null; - try { - DocumentBuilderFactory instance = DocumentBuilderFactory.newInstance(); - instance.setValidating(validating); - result = instance.newDocumentBuilder(); - } - catch (ParserConfigurationException e) { - Logger.logException(e); - } - return result; - } - - public static void serialize(Document document, OutputStream ostream) throws IOException { - Source domSource = new DOMSource(document); - try { - Transformer serializer = TransformerFactory.newInstance().newTransformer(); - try { - serializer.setOutputProperty(OutputKeys.INDENT, "yes"); - serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-16"); - } - catch (IllegalArgumentException e) { - // unsupported properties - } - serializer.transform(domSource, new StreamResult(ostream)); - } - catch (TransformerConfigurationException e) { - throw new IOException(e.getMessage()); - } - catch (TransformerFactoryConfigurationError e) { - throw new IOException(e.getMessage()); - } - catch (TransformerException e) { - throw new IOException(e.getMessage()); - } - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/DateUtil.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/DateUtil.java deleted file mode 100644 index 5037aa116..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/DateUtil.java +++ /dev/null @@ -1,46 +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.wst.html.core.tests.utils; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -/** - * @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 DateUtil { - - /** - * Constructor for AllTests. - * @param name - */ - private static String now = null; - - - public static String now() { - // just calculate once, so whole run as same timestamp - if (DateUtil.now == null) { - DateFormat format = new SimpleDateFormat("yyyy'-'MM'-'dd'-'kk'-'mm'-'ss"); - Calendar calendar = Calendar.getInstance(); - Date today = calendar.getTime(); - DateUtil.now = format.format(today); - } - return DateUtil.now; - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/FileUtil.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/FileUtil.java deleted file mode 100644 index d24860c31..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/FileUtil.java +++ /dev/null @@ -1,165 +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.wst.html.core.tests.utils; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.runtime.Platform; -import org.osgi.framework.Bundle; - -/** - * @author davidw - * - */ -public class FileUtil { - private static final String PLUGIN_ID = "org.eclipse.wst.html.core.tests"; - public static String fLineSeparator = System.getProperty("line.separator"); - public static String fPathSeparator = System.getProperty("path.separator"); - public static String fFileSeparator = System.getProperty("file.separator"); - - static File previousResultsDirectory = null; - static private String logSubDirectoryPath; - - private static boolean notTriedYet = true; - - public static class DirFilenameFilter implements FilenameFilter { - String startOfAcceptableNames; - - public DirFilenameFilter(String startOfDirName) { - startOfAcceptableNames = startOfDirName; - } - - /** - * @see java.io.FileFilter#accept(File) - */ - public boolean accept(File pathname, String filename) { - // we'll just assume if it starts with right key, it is a directory ... for now - return filename.startsWith(startOfAcceptableNames); - } - - } - - public static File getPreviousResultsDirectory(String directoryRootName) throws IOException { - if (previousResultsDirectory == null && notTriedYet) { - Bundle bundle = Platform.getBundle(PLUGIN_ID); - URL url = bundle.getEntry("/"); //$NON-NLS-1$ - //String installPath = url.getPath(); - // add known file so URL method below can be used - // (doesn't seem to work for directory?) - URL totalURL = new URL(url, "plugin.xml"); - URL finalurl = Platform.asLocalURL(totalURL); - String finalFile = finalurl.getFile(); - File file = new File(finalFile); - String finalPath = file.getParent(); - File pluginHomeDir = new File(finalPath); - FilenameFilter dirFilter = new DirFilenameFilter(directoryRootName); - File[] allDirs = pluginHomeDir.listFiles(dirFilter); - - // assume first in list is newest, then start looking with the - // second item ... just to avoid "null" case checking - if (allDirs.length > 0) { - File currentNewest = allDirs[0]; - for (int i = 1; i < allDirs.length; i++) { - File current = allDirs[i]; - // NOTE: we go by modified date, not by the actual time stamp in name. - // This should work for all normal cases, but may not if someone does some - // "funny" copying, or updating from repository. - if (current.lastModified() > currentNewest.lastModified()) { - currentNewest = current; - } - } - previousResultsDirectory = currentNewest; - } - notTriedYet = false; - } - return previousResultsDirectory; - } - - public static File makeFileFor(String directory, String filename, String testResultsDirectoryPrefix) throws IOException { - Bundle bundle = Platform.getBundle(PLUGIN_ID); - URL url = bundle.getEntry("/"); //$NON-NLS-1$ - URL localURL = Platform.asLocalURL(url); - String installPath = localURL.getPath(); - String totalDirectory = installPath + directory; - String totalPath = totalDirectory + "/" + filename; - URL totalURL = new URL(url, totalPath); - //URL finalurl = Platform.asLocalURL(totalURL); - String finalFile = totalURL.getFile(); - File file = new File(finalFile); - String finalPath = file.getParent(); - File dir = new File(finalPath); - if (!dir.exists()) { - // a little safety net, be sure the previous newest directory - // is initialized, just in case no one else has done so - if (testResultsDirectoryPrefix != null && testResultsDirectoryPrefix.length() > 0) { - FileUtil.getPreviousResultsDirectory(testResultsDirectoryPrefix); - } - // now its "safe" to make the new one - dir.mkdirs(); - } - return file; - } - - /** - * Just a general utility method - * @param filename - * @return String - */ - public static String getExtension(String filename) { - String extension = null; - int dotPostion = filename.lastIndexOf('.'); - if (dotPostion > -1) { - extension = filename.substring(dotPostion + 1); - } - else { - extension = new String(); - } - return extension; - } - - /** - * General purpose utility method to ensure the log - * directory exists, and returns the name. - */ - public static String getLogDirectory() { - if (logSubDirectoryPath == null) { - String mainDirectory = "/logs"; - File dir = new File(mainDirectory); - ensureExists(dir); - String subDirectory = TimestampUtil.timestamp(); - logSubDirectoryPath = mainDirectory + "/" + subDirectory; - File subdir = new File(logSubDirectoryPath); - ensureExists(subdir); - } - return logSubDirectoryPath; - } - - public static void ensureExists(File dir) { - if (!dir.exists()) { - dir.mkdirs(); - } - } - - public static String getPerformanceOutputLogName() { - String result = null; - String directoryName = FileUtil.getLogDirectory(); - String extension = ".out"; - String baseName = "sedTests"; - long now = System.currentTimeMillis(); - String nowStr = String.valueOf(now); - result = directoryName + FileUtil.fFileSeparator + baseName + nowStr + extension; - return result; - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/StringCompareUtil.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/StringCompareUtil.java deleted file mode 100644 index a33ba6a6c..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/StringCompareUtil.java +++ /dev/null @@ -1,71 +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.wst.html.core.tests.utils; - -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'); - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestRuntimeException.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestRuntimeException.java deleted file mode 100644 index d43baece8..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestRuntimeException.java +++ /dev/null @@ -1,82 +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.wst.html.core.tests.utils; - -import org.eclipse.wst.html.core.internal.HTMLCorePlugin; - - -/** - * The SourceEditingRuntimeException is often thrown by Source Editor methods when - * a service we use throws a checked exception, but we want to convert and treat - * as a runtime exception. (Such as BadLocationException is a common example). - */ -public class TestRuntimeException extends RuntimeException { - /** - * Default <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 1L; - private Throwable originalException; - - public TestRuntimeException() { - super(); - } - - public TestRuntimeException(String s) { - super(s); - } - - /** - * This form of the constructor is used to wrapper another exception. - */ - public TestRuntimeException(Throwable t) { - super(); - originalException = t; - } - - /** - * This form of the constructor is used to wrapper another exception, but still - * provide a new descriptive message. - */ - public TestRuntimeException(Throwable t, String s) { - super(s); - originalException = t; - } - - public String getMessage() { - String result = super.getMessage(); - if ((result != null) && (!result.endsWith("."))) //$NON-NLS-1$ - result = result + "."; //$NON-NLS-1$ - if (originalException != null) { - String embeddedMessage = originalException.getMessage(); - // not all exceptions (e.g. many NullPointer exception) have messages - String originalError = HTMLCorePlugin.getResourceString("Original_Error__UI_"); //$NON-NLS-1$ = "Original Error:" - if (embeddedMessage != null) - result = result + " " + originalError + " " + embeddedMessage;//$NON-NLS-2$//$NON-NLS-1$ - else - result = result + " " + originalError + " " + originalException.toString();//$NON-NLS-2$//$NON-NLS-1$ - } - return result; - } - - public Throwable getOriginalException() { - return originalException; - } - - public String toString() { - // we don't put super.toString or getClass to "hide" that it was a - // SourceEditing exception (otherwise, focus goes on that, - // instead of original exception. - String message = getMessage(); - // message should never be null ... but just in case - return (message != null) ? message : super.toString(); - - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestWriter.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestWriter.java deleted file mode 100644 index 593f562ca..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TestWriter.java +++ /dev/null @@ -1,26 +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.wst.html.core.tests.utils; - -import java.io.StringWriter; - -public class TestWriter extends StringWriter { - // we don't really want to use the system EOL, since - // we want a common once across platforms, CVS, etc. - public final static String commonEOL = "\r\n"; - - //System.getProperty("line.separator"); - - public void writeln(String line) { - write(line); - write(commonEOL); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TimestampUtil.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TimestampUtil.java deleted file mode 100644 index d9a438291..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/TimestampUtil.java +++ /dev/null @@ -1,51 +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.wst.html.core.tests.utils; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -/** - * @author davidw - * - * This class provides one timestamp per VM run. - * (Technically, per class loading.) - */ -public class TimestampUtil { - - private static Date timestamp = null; - private static DateFormat shortFormat = new SimpleDateFormat("yyyy'-'MM'-'dd"); - // private static DateFormat longFormat = new SimpleDateFormat("yyyy'-'MM'-'dd'-'kk'-'mm'-'ss"); - - private static String nowShort = null; - - public static String timestamp() { - - if (TimestampUtil.nowShort == null) { - TimestampUtil.nowShort = shortFormat.format(ensureTimestamp()); - } - return TimestampUtil.nowShort; - } - - protected static Date ensureTimestamp() { - // just calculate 'timestamp' once per class loading, - // so this 'timestamp' remains the same during - // entire run. - if (TimestampUtil.timestamp == null) { - Calendar calendar = Calendar.getInstance(); - TimestampUtil.timestamp = calendar.getTime(); - } - return TimestampUtil.timestamp; - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/WorkspaceProgressMonitor.java b/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/WorkspaceProgressMonitor.java deleted file mode 100644 index 9370ace02..000000000 --- a/tests/org.eclipse.wst.html.core.tests/src/org/eclipse/wst/html/core/tests/utils/WorkspaceProgressMonitor.java +++ /dev/null @@ -1,54 +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.wst.html.core.tests.utils; - -import org.eclipse.core.runtime.IProgressMonitor; - -class WorkspaceProgressMonitor implements IProgressMonitor { - private boolean finished = false; - - public void beginTask(String name, int totalWork) { - // we dont' care - } - - public void done() { - finished = true; - } - - public boolean isFinished() { - return finished; - } - - public void internalWorked(double work) { - // we dont' care - } - - public boolean isCanceled() { - return finished; - } - - public void setCanceled(boolean value) { - if (value == true) - finished = true; - } - - public void setTaskName(String name) { - // we don't care - } - - public void subTask(String name) { - // we don't care - } - - public void worked(int work) { - // we don't care - } -}
\ No newline at end of file |