Initial checkin.
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/.classpath b/jsf/tests/org.eclipse.jst.pagedesigner.tests/.classpath
new file mode 100644
index 0000000..472ee29
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/.project b/jsf/tests/org.eclipse.jst.pagedesigner.tests/.project
new file mode 100644
index 0000000..a04c986
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.pagedesigner.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5f2d435
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.eclipse.jst.pagedesigner.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Localization: plugin
+Require-Bundle: org.junit;bundle-version="[3.8.1,4.0.0)",
+ org.eclipse.jst.jsf.test.util;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jst.jsf.core.tests;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.jst.jsf.core;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jst.jsf.common;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.wst.sse.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jst.jsp.core;bundle-version="[1.1.0,1.3.0)",
+ org.eclipse.wst.html.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.wst.xml.core;bundle-version="[1.1.0,1.2.0)",
+ org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jst.pagedesigner;bundle-version="[1.0.0,1.1.0)",
+ org.eclipse.emf.common;bundle-version="[2.2.0,2.4.0)"
+Export-Package: org.eclipse.jst.pagedesigner.tests;x-internal:=true
+Bundle-ClassPath: pagedesignertests.jar
+Bundle-Activator: org.eclipse.jst.pagedesigner.tests.PageDesignerTestsPlugin
+Eclipse-LazyStart: true
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/about.html b/jsf/tests/org.eclipse.jst.pagedesigner.tests/about.html
new file mode 100644
index 0000000..131bdcf
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/about.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>August 01, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+</body>
+</html>
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/build.properties b/jsf/tests/org.eclipse.jst.pagedesigner.tests/build.properties
new file mode 100644
index 0000000..bb32779
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2006 Oracle Corporation.
+# 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:
+# Oracle - initial API and implementation
+###############################################################################
+bin.includes = META-INF/,\
+ pagedesignertests.jar,\
+ plugin.properties,\
+ about.html,\
+ testdata/,\
+ test.xml
+source.pagedesignertests.jar = src/
+output.pagedesignertests.jar = bin/
+jars.compile.order = pagedesignertests.jar
+javacSource=1.5
+javacTarget=1.5
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/plugin.properties b/jsf/tests/org.eclipse.jst.pagedesigner.tests/plugin.properties
new file mode 100644
index 0000000..2595a80
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/plugin.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# Copyright (c) 2001, 2007 Oracle 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:
+# Oracle Corporation - initial API and implementation
+###############################################################################
+
+Bundle-Name.0=JavaServer Faces Tools - Web Page Editor Tests Plug-in
+Bundle-Vendor.0=Eclipse.org
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/AllTests.java b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/AllTests.java
new file mode 100644
index 0000000..ac9d9d7
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/AllTests.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2006 Oracle 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * All tests suite for Web Page Editor.
+ *
+ * @author Ian Trimble - Oracle
+ *
+ */
+public class AllTests {
+ /**
+ * @return the test suite
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.eclipse.jst.pagedesigner");
+ //$JUnit-BEGIN$
+
+ //tests requiring jsfRuntimeJarsDirectoryV1.1
+ addTestRequiringJSFRuntime(suite, Test_DTManager.class, "1.1");
+ addTestRequiringJSFRuntime(suite, Test_TransformOperations.class, "1.1");
+
+ //$JUnit-END$
+ return suite;
+ }
+
+ private static void addTestRequiringJSFRuntime(TestSuite suite, Class testClass, String jsfVersion) {
+ if (Utils.isJSFRuntimeJarsDirectoryValid(jsfVersion)) {
+ suite.addTestSuite(testClass);
+ } else {
+ System.err.println(Utils.getTestRequiresJSFRuntimeMessage(testClass, jsfVersion));
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/PageDesignerTestsPlugin.java b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/PageDesignerTestsPlugin.java
new file mode 100644
index 0000000..2c385d0
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/PageDesignerTestsPlugin.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation.
+ * 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:
+ * Ian Trimble - Oracle: initial API and implementation
+ *
+ ********************************************************************************/
+
+package org.eclipse.jst.pagedesigner.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class PageDesignerTestsPlugin extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.jst.pagedesigner.tests";
+
+ // The shared instance
+ private static PageDesignerTestsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public PageDesignerTestsPlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static PageDesignerTestsPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_DTManager.java b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_DTManager.java
new file mode 100644
index 0000000..c14f180
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_DTManager.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2007 Oracle 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.tests;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
+import org.eclipse.jst.jsf.core.IJSFCoreConstants;
+import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
+import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
+import org.eclipse.jst.pagedesigner.converter.IConverterFactory;
+import org.eclipse.jst.pagedesigner.converter.ITagConverter;
+import org.eclipse.jst.pagedesigner.dtmanager.DTManager;
+import org.eclipse.jst.pagedesigner.dtmanager.IDTInfo;
+import org.eclipse.jst.pagedesigner.dtmanager.dtinfo.TagConvertInfo;
+import org.eclipse.jst.pagedesigner.dtmanager.dtinfo.TagDecorateInfo;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * DTManager tests.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class Test_DTManager extends TestCase {
+
+ private WebProjectTestEnvironment webProjectTestEnv;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ JSFTestUtil.setValidationEnabled(false);
+
+ webProjectTestEnv = new WebProjectTestEnvironment("Test_DTManager_" + getName());
+ webProjectTestEnv.createProject(false);
+ assertNotNull(webProjectTestEnv);
+ assertNotNull(webProjectTestEnv.getTestProject());
+ assertTrue(webProjectTestEnv.getTestProject().isAccessible());
+
+ JSFFacetedTestEnvironment jsfFacetedTestEnv = new JSFFacetedTestEnvironment(webProjectTestEnv);
+ jsfFacetedTestEnv.initialize(IJSFCoreConstants.FACET_VERSION_1_1);
+
+ webProjectTestEnv.loadResourceInWebRoot(
+ PageDesignerTestsPlugin.getDefault().getBundle(),
+ "/testdata/Test_DTManager.jsp.data",
+ "/Test_DTManager.jsp");
+
+ assertTrue(Utils.addJSFRuntimeJarsToClasspath("1.1", jsfFacetedTestEnv));
+ }
+
+ /**
+ * Sanity check.
+ */
+ public void testSanity() {
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_DTManager.jsp", 477);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+ Node node = resolver.getNode();
+ assertTrue(node instanceof Element);
+ assertTrue(node.getPrefix().equals("h"));
+ assertTrue(node.getLocalName().equals("outputText"));
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test "getTagConverter(...)" method.
+ */
+ public void testGetTagConverter() {
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_DTManager.jsp", 477);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+
+ //get Element
+ Node node = resolver.getNode();
+ assertTrue(node instanceof Element);
+ assertTrue(node.getPrefix().equals("h"));
+ assertTrue(node.getLocalName().equals("outputText"));
+ Element element = (Element)node;
+
+ //get IDOMDocument
+ IStructuredModel model = wrapper.getModel();
+ assertTrue(model instanceof IDOMModel);
+ IDOMDocument document = ((IDOMModel)model).getDocument();
+ assertNotNull(document);
+
+ //get ITagConverter instance
+ ITagConverter tagConverter = DTManager.getInstance().getTagConverter(
+ element,
+ IConverterFactory.MODE_DESIGNER,
+ document);
+ assertNotNull(tagConverter);
+
+ //invoke ITagConverter instance
+ tagConverter.convertRefresh(null);
+
+ //test result element to ensure operations were discovered and invoked
+ Element resultElement = tagConverter.getResultElement();
+ assertNotNull(resultElement);
+ assertTrue(resultElement.getLocalName().equals("span"));
+ assertNull(resultElement.getAttributeNode("value"));
+ NodeList childNodes = resultElement.getChildNodes();
+ assertTrue(childNodes.getLength() == 1);
+ Node childNode = childNodes.item(0);
+ assertTrue(childNode instanceof Text);
+ assertTrue(((Text)childNode).getData().equals("valueValue"));
+ assertNull(resultElement.getAttributeNode("styleClass"));
+ assertNotNull(resultElement.getAttributeNode("class"));
+ assertTrue(resultElement.getAttribute("class").equals("classValue"));
+ assertNotNull(resultElement.getAttributeNode("attr1"));
+ assertTrue(resultElement.getAttribute("attr1").equals("attr1Value"));
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test "getDTInfo(...)" method.
+ */
+ public void testGetDTInfo() {
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_DTManager.jsp", 477);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+
+ //get Element
+ Node node = resolver.getNode();
+ assertTrue(node instanceof Element);
+ assertTrue(node.getPrefix().equals("h"));
+ assertTrue(node.getLocalName().equals("outputText"));
+ Element element = (Element)node;
+
+ //get IDTInfo instance
+ IDTInfo dtInfo = DTManager.getInstance().getDTInfo(element);
+ assertNotNull(dtInfo);
+
+ //test IDTInfo instance
+ TagConvertInfo tcInfo = dtInfo.getTagConvertInfo();
+ List operations = tcInfo.getOperations();
+ assertNotNull(operations);
+ assertEquals(4, operations.size());
+ List tdInfos = dtInfo.getTagDecorateInfos();
+ assertEquals(2, tdInfos.size());
+ TagDecorateInfo tdInfoDesign = dtInfo.getTagDecorateInfo("vpd-decorate-design");
+ assertNotNull(tdInfoDesign);
+ assertTrue(tdInfoDesign.isNeedBorderDecorator());
+ assertTrue(tdInfoDesign.isMultiLevel());
+ assertTrue(tdInfoDesign.isWidget());
+ assertTrue(tdInfoDesign.isSetNonVisualChildElements());
+ TagDecorateInfo tdInfoPreview = dtInfo.getTagDecorateInfo("vpd-decorate-preview");
+ assertNotNull(tdInfoPreview);
+ assertTrue(tdInfoPreview.isResolveChildText());
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+
+ }
+
+ private ContextWrapper getDocumentContext(String path, int offset) throws Exception {
+ IProject project = webProjectTestEnv.getTestProject();
+ IFile jspFile = project.getFile(new Path(path));
+ assertTrue(jspFile.exists());
+ final IModelManager modelManager =
+ StructuredModelManager.getModelManager();
+ IStructuredModel model = null;
+ model = modelManager.getModelForRead(jspFile);
+ assertTrue(model instanceof DOMModelForJSP);
+ final IStructuredDocumentContext context =
+ IStructuredDocumentContextFactory.INSTANCE.getContext(
+ model.getStructuredDocument(),
+ offset);
+ return new ContextWrapper(context, model);
+ }
+
+ private static class ContextWrapper {
+ private final IStructuredDocumentContext context;
+ private final IStructuredModel model;
+ ContextWrapper(final IStructuredDocumentContext context, final IStructuredModel model) {
+ super();
+ this.context = context;
+ this.model = model;
+ }
+ IStructuredDocumentContext getContext() {
+ return context;
+ }
+ IStructuredModel getModel() {
+ return model;
+ }
+ void dispose() {
+ model.releaseFromRead();
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_TransformOperations.java b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_TransformOperations.java
new file mode 100644
index 0000000..aecb6fa
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Test_TransformOperations.java
@@ -0,0 +1,599 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2007 Oracle 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.tests;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.IDOMContextResolver;
+import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext;
+import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory;
+import org.eclipse.jst.jsf.core.IJSFCoreConstants;
+import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+import org.eclipse.jst.jsf.test.util.WebProjectTestEnvironment;
+import org.eclipse.jst.jsp.core.internal.domdocument.DOMModelForJSP;
+import org.eclipse.jst.pagedesigner.converter.IConverterFactory;
+import org.eclipse.jst.pagedesigner.converter.ITagConverter;
+import org.eclipse.jst.pagedesigner.dtmanager.DTManager;
+import org.eclipse.jst.pagedesigner.dtmanager.converter.ITransformOperation;
+import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.TransformOperationFactory;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/**
+ * DTManager tests.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class Test_TransformOperations extends TestCase {
+
+ private WebProjectTestEnvironment webProjectTestEnv;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ JSFTestUtil.setValidationEnabled(false);
+
+ webProjectTestEnv = new WebProjectTestEnvironment("Test_TransformOperations_" + getName());
+ webProjectTestEnv.createProject(false);
+ assertNotNull(webProjectTestEnv);
+ assertNotNull(webProjectTestEnv.getTestProject());
+ assertTrue(webProjectTestEnv.getTestProject().isAccessible());
+
+ JSFFacetedTestEnvironment jsfFacetedTestEnv = new JSFFacetedTestEnvironment(webProjectTestEnv);
+ jsfFacetedTestEnv.initialize(IJSFCoreConstants.FACET_VERSION_1_1);
+
+ webProjectTestEnv.loadResourceInWebRoot(
+ PageDesignerTestsPlugin.getDefault().getBundle(),
+ "/testdata/Test_TransformOperations.jsp.data",
+ "/Test_TransformOperations.jsp");
+
+ assertTrue(Utils.addJSFRuntimeJarsToClasspath("1.1", jsfFacetedTestEnv));
+ }
+
+ /**
+ * Sanity check.
+ */
+ public void testSanity() {
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_TransformOperations.jsp", 477);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+ Node node = resolver.getNode();
+ assertTrue(node instanceof Element);
+ assertEquals("h", node.getPrefix());
+ assertEquals("selectManyListbox", node.getLocalName());
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test "AppendChildElementOperation".
+ */
+ public void testAppendChildElementOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check first child node exists and is correct node
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Element);
+ Element firstChildElement = (Element)firstChildNode;
+ assertEquals("option", firstChildElement.getLocalName());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "AppendChildTextFromXPathOperation".
+ */
+ public void testAppendChildTextFromXPathOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check first child node exists and is correct node
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Element);
+ Element firstChildElement = (Element)firstChildNode;
+ assertEquals("option", firstChildElement.getLocalName());
+
+ //check grandchild Text exists and has correct value
+ Node firstGrandChildNode = firstChildElement.getFirstChild();
+ assertTrue(firstGrandChildNode instanceof Text);
+ Text firstGrandChildText = (Text)firstGrandChildNode;
+ assertEquals("selectItem One", firstGrandChildText.getData());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "AppendChildTextOperation".
+ */
+ public void testAppendChildTextOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check second child node exists and is correct node
+ NodeList childNodes = resultElement.getChildNodes();
+ assertTrue(childNodes.getLength() > 1);
+ Node secondChildNode = childNodes.item(1);
+ assertTrue(secondChildNode instanceof Element);
+ Element secondChildElement = (Element)secondChildNode;
+ assertEquals("option", secondChildElement.getLocalName());
+
+ //check grandchild Text exists and has correct value
+ Node firstGrandChildNode = secondChildElement.getFirstChild();
+ assertTrue(firstGrandChildNode instanceof Text);
+ Text firstGrandChildText = (Text)firstGrandChildNode;
+ assertEquals("selectItem", firstGrandChildText.getData());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "ConvertAttributeToTextOperation".
+ */
+ public void testConvertAttributeToTextOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(620, "h", "commandLink");
+ assertNotNull(resultElement);
+ assertEquals("a", resultElement.getLocalName());
+
+ //check first child Text exists and has correct value
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Text);
+ Text firstChildText = (Text)firstChildNode;
+ assertEquals("commandLink value", firstChildText.getData());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "CopyAllAttributesOperation".
+ */
+ public void testCopyAllAttributesOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(620, "h", "commandLink");
+ assertNotNull(resultElement);
+ assertEquals("a", resultElement.getLocalName());
+
+ //check attributes exist and have correct values
+ String attr1Value = resultElement.getAttribute("attr1");
+ assertEquals("attr1_value", attr1Value);
+ String attr2Value = resultElement.getAttribute("attr2");
+ assertEquals("attr2_value", attr2Value);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "CopyAttributeOperation".
+ */
+ public void testCopyAttributeOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check first child node exists and is correct node
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Element);
+ Element firstChildElement = (Element)firstChildNode;
+ assertEquals("option", firstChildElement.getLocalName());
+
+ //check first child node has correct attribute with correct value
+ String valueAttrValue = firstChildElement.getAttribute("value");
+ assertEquals("selectItem_1", valueAttrValue);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "CopyChildrenOperation".
+ */
+ public void testCopyChildrenOperation() {
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_TransformOperations.jsp", 620);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+
+ //get Element
+ Node node = resolver.getNode();
+ assertTrue(node instanceof Element);
+ assertEquals("h", node.getPrefix());
+ assertEquals("commandLink", node.getLocalName());
+ Element element = (Element)node;
+
+ //get IDOMDocument
+ IStructuredModel model = wrapper.getModel();
+ assertTrue(model instanceof IDOMModel);
+ IDOMDocument document = ((IDOMModel)model).getDocument();
+ assertNotNull(document);
+
+ //get ITagConverter instance
+ ITagConverter tagConverter = DTManager.getInstance().getTagConverter(
+ element,
+ IConverterFactory.MODE_DESIGNER,
+ document);
+ assertNotNull(tagConverter);
+
+ //invoke ITagConverter instance
+ tagConverter.convertRefresh(null);
+
+ //test tag converter to ensure correct child element was copied to child node list
+ List childNodes = tagConverter.getChildModeList();
+ assertTrue(childNodes.size() > 1);
+ Node secondChildNode = (Node)childNodes.get(1);
+ assertTrue(secondChildNode instanceof Element);
+ Element secondChildElement = (Element)secondChildNode;
+ assertEquals("f", secondChildElement.getPrefix());
+ assertEquals("actionListener", secondChildElement.getLocalName());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test "CreateAttributeFromXPathOperation".
+ */
+ public void testCreateAttributeFromXPathOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check size attribute has been calculated and set
+ String sizeAttrValue = resultElement.getAttribute("size");
+ assertEquals("2", sizeAttrValue);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "CreateAttributeOperation".
+ */
+ public void testCreateAttributeOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check multiple attribute has been set
+ String multipleAttrValue = resultElement.getAttribute("multiple");
+ assertEquals("multiple", multipleAttrValue);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "CreateElementOperation".
+ */
+ public void testCreateElementOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "IfNotOperation".
+ */
+ public void testIfNotOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check size attribute has been calculated and set (only occurs if the IfNotOperation is successful)
+ String sizeAttrValue = resultElement.getAttribute("size");
+ assertEquals("2", sizeAttrValue);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "IfOperation".
+ */
+ public void testIfOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check first child node exists and is correct node
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Element);
+ Element firstChildElement = (Element)firstChildNode;
+ assertEquals("option", firstChildElement.getLocalName());
+
+ //check grandchild Text exists and has correct value (only occurs if the IfOperation is successful)
+ Node firstGrandChildNode = firstChildElement.getFirstChild();
+ assertTrue(firstGrandChildNode instanceof Text);
+ Text firstGrandChildText = (Text)firstGrandChildNode;
+ assertEquals("selectItem One", firstGrandChildText.getData());
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "IterateOverElementsOperation".
+ */
+ public void testIterateOverElementsOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check two child nodes exist and are correct nodes
+ NodeList childNodes = resultElement.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node childNode = childNodes.item(i);
+ assertTrue(childNode instanceof Element);
+ Element childElement = (Element)childNode;
+ assertEquals("option", childElement.getLocalName());
+ }
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "MakeParentElementCurrentOperation".
+ */
+ public void testMakeParentElementCurrentOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check two child nodes exist and are correct nodes (only occurs if the MakeParentElementCurrentOperation is successful)
+ NodeList childNodes = resultElement.getChildNodes();
+ assertEquals(2, childNodes.getLength());
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node childNode = childNodes.item(i);
+ assertTrue(childNode instanceof Element);
+ Element childElement = (Element)childNode;
+ assertEquals("option", childElement.getLocalName());
+ }
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "RemoveAttributeOperation".
+ */
+ public void testRemoveAttributeOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check multiple attribute has been set
+ String multipleAttrValue = resultElement.getAttribute("multiple");
+ assertEquals("multiple", multipleAttrValue);
+
+ //remove multiple attribute and assert it no longer exists
+ ITransformOperation removeAttrOp =
+ TransformOperationFactory.getInstance().getTransformOperation(
+ TransformOperationFactory.OP_RemoveAttributeOperation,
+ new String[]{"multiple"});
+ removeAttrOp.transform(null, resultElement);
+ Node multipleAttrNode = resultElement.getAttributeNode("multiple");
+ assertNull(multipleAttrNode);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * Test "RenameAttributeOperation".
+ */
+ public void testRenameAttributeOperation() {
+ try {
+ //get and test result element
+ Element resultElement = getResultElement(477, "h", "selectManyListbox");
+ assertNotNull(resultElement);
+ assertEquals("select", resultElement.getLocalName());
+
+ //check first child node exists and is correct node
+ Node firstChildNode = resultElement.getFirstChild();
+ assertTrue(firstChildNode instanceof Element);
+ Element firstChildElement = (Element)firstChildNode;
+ assertEquals("option", firstChildElement.getLocalName());
+
+ //check first child node has correct attribute with correct value
+ String valueAttrValue = firstChildElement.getAttribute("value");
+ assertEquals("selectItem_1", valueAttrValue);
+
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ fail(ex.getLocalizedMessage());
+ }
+ }
+
+ private Element getResultElement(int docOffset, String prefix, String localName) throws Exception {
+ Element resultElement = null;
+ ContextWrapper wrapper = null;
+ try {
+ wrapper = getDocumentContext("/WebContent/Test_TransformOperations.jsp", docOffset);
+ IStructuredDocumentContext context = wrapper.getContext();
+ IDOMContextResolver resolver =
+ IStructuredDocumentContextResolverFactory.INSTANCE.
+ getDOMContextResolver(context);
+
+ //get Element
+ Node node = resolver.getNode();
+ if (
+ node instanceof Element &&
+ node.getPrefix().equals(prefix) &&
+ node.getLocalName().equals(localName)) {
+
+ Element element = (Element)node;
+
+ //get IDOMDocument
+ IStructuredModel model = wrapper.getModel();
+ if (model instanceof IDOMModel) {
+ IDOMDocument document = ((IDOMModel)model).getDocument();
+ if (document != null) {
+
+ //get ITagConverter instance
+ ITagConverter tagConverter = DTManager.getInstance().getTagConverter(
+ element,
+ IConverterFactory.MODE_DESIGNER,
+ document);
+ if (tagConverter != null) {
+
+ //invoke ITagConverter instance
+ tagConverter.convertRefresh(null);
+
+ //get result element
+ resultElement = tagConverter.getResultElement();
+ }
+ }
+ }
+ }
+ } finally {
+ if (wrapper != null) {
+ wrapper.dispose();
+ }
+ }
+ return resultElement;
+ }
+
+ private ContextWrapper getDocumentContext(String path, int offset) throws Exception {
+ IProject project = webProjectTestEnv.getTestProject();
+ IFile jspFile = project.getFile(new Path(path));
+ assertTrue(jspFile.exists());
+ final IModelManager modelManager =
+ StructuredModelManager.getModelManager();
+ IStructuredModel model = null;
+ model = modelManager.getModelForRead(jspFile);
+ assertTrue(model instanceof DOMModelForJSP);
+ final IStructuredDocumentContext context =
+ IStructuredDocumentContextFactory.INSTANCE.getContext(
+ model.getStructuredDocument(),
+ offset);
+ return new ContextWrapper(context, model);
+ }
+
+ private static class ContextWrapper {
+ private final IStructuredDocumentContext context;
+ private final IStructuredModel model;
+ ContextWrapper(final IStructuredDocumentContext context, final IStructuredModel model) {
+ super();
+ this.context = context;
+ this.model = model;
+ }
+ IStructuredDocumentContext getContext() {
+ return context;
+ }
+ IStructuredModel getModel() {
+ return model;
+ }
+ void dispose() {
+ model.releaseFromRead();
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Utils.java b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Utils.java
new file mode 100644
index 0000000..2992786
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/src/org/eclipse/jst/pagedesigner/tests/Utils.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2007 Oracle 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.tests;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil;
+import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
+import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry;
+import org.eclipse.jst.jsf.core.tests.util.JSFCoreUtilHelper;
+import org.eclipse.jst.jsf.core.tests.util.JSFFacetedTestEnvironment;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+
+/**
+ * Web Page Editor test utilities.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class Utils {
+
+ public static String[] getJSFRuntimeJarNames(String jsfVersion) {
+ String[] jarNames = null;
+ String dirName = JSFTestUtil.getJSFRuntimeJarsDirectory(jsfVersion);
+ if (dirName != null) {
+ File dir = new File(dirName);
+ if (dir.exists() && dir.isDirectory()) {
+ File[] jars = dir.listFiles();
+ if (jars != null && jars.length > 0) {
+ jarNames = new String[jars.length];
+ for (int i = 0; i < jars.length; i++) {
+ jarNames[i] = jars[i].getAbsolutePath();
+ }
+ }
+ }
+ }
+ return jarNames;
+ }
+
+ public static boolean isJSFRuntimeJarsDirectoryValid(String jsfVersion) {
+ return getJSFRuntimeJarNames(jsfVersion) != null;
+ }
+
+ public static boolean addJSFRuntimeJarsToClasspath(String jsfVersion, JSFFacetedTestEnvironment jsfFacetedTestEnv) throws CoreException {
+ boolean success = false;
+ String[] jarNames = getJSFRuntimeJarNames(jsfVersion);
+ if (jarNames != null) {
+ JSFLibraryRegistry jsfLibRegistry = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry();
+ String libIDandName = "_internalJSFRuntimeLibraryV" + jsfVersion + "_";
+ JSFLibrary jsfImpl = JSFCoreUtilHelper.constructJSFLib(libIDandName, libIDandName, "", jarNames, true);
+ jsfLibRegistry.addJSFLibrary(jsfImpl);
+ jsfFacetedTestEnv.addJSFLibraryReference(jsfImpl, true);
+ success = true;
+ }
+ return success;
+ }
+
+ public static String getTestRequiresJSFRuntimeMessage(Class testClass, String jsfVersion) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Unable to run test suite \"");
+ sb.append(testClass.getName());
+ sb.append("\"; JSF runtime (v");
+ sb.append(jsfVersion);
+ sb.append(") is required but not present.\nSystem property or environment variable \"jsfRuntimeJarsDirectoryV");
+ sb.append(jsfVersion);
+ sb.append("\" must be set to point to a directory containing JSF runtime (v");
+ sb.append(jsfVersion);
+ sb.append(") JARs.");
+ return sb.toString();
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/test.xml b/jsf/tests/org.eclipse.jst.pagedesigner.tests/test.xml
new file mode 100644
index 0000000..9eae87d
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/test.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <!-- <property name="eclipse-home" value="${basedir}\..\.."/> -->
+ <echo message="basedir ${basedir}" />
+ <echo message="eclipse place ${eclipse-home}" />
+ <!-- sets the properties plugin-name, and library-file -->
+ <property name="plugin-name" value="org.eclipse.jst.pagedesigner.tests"/>
+ <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org.eclipse.jst.pagedesigner.tests.*xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+ <property name="jsf-folder" value="${eclipse-home}/jsf_folder"/>
+ <delete dir="${jsf-folder}" quiet="true"/>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jsf-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jst.pagedesigner.tests.AllTests" />
+ <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org.eclipse.jst.pagedesigner.tests.*xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+</project>
\ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_DTManager.jsp.data b/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_DTManager.jsp.data
new file mode 100644
index 0000000..272db0f
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_DTManager.jsp.data
@@ -0,0 +1,17 @@
+<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Test_DTManager</title>
+</head>
+<body>
+<f:view>
+ <h:form>
+ <h:outputText value="valueValue" styleClass="classValue" attr1="attr1Value"/>
+ </h:form>
+</f:view>
+</body>
+</html>
\ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_TransformOperations.jsp.data b/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_TransformOperations.jsp.data
new file mode 100644
index 0000000..19466bf
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.pagedesigner.tests/testdata/Test_TransformOperations.jsp.data
@@ -0,0 +1,23 @@
+<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Test_DTManager</title>
+</head>
+<body>
+<f:view>
+ <h:form>
+ <h:selectManyListbox>
+ <f:selectItem itemLabel="selectItem One" itemValue="selectItem_1"/>
+ <f:selectItem/>
+ </h:selectManyListbox>
+ <h:commandLink value="commandLink value" attr1="attr1_value" attr2="attr2_value">
+ <f:actionListener/>
+ </h:commandLink>
+ </h:form>
+</f:view>
+</body>
+</html>
\ No newline at end of file