[297975]: Need XPath 2.0 Support in XPath View
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/.classpath b/tests/org.eclipse.wst.xml.xpath.ui.tests/.classpath
new file mode 100644
index 0000000..284d84e
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**/wst/xml/**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/.project b/tests/org.eclipse.wst.xml.xpath.ui.tests/.project
new file mode 100644
index 0000000..1bba0ae
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.wst.xml.xpath.ui.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/tests/org.eclipse.wst.xml.xpath.ui.tests/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.xml.xpath.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f0e3baf
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Dec 25 13:16:14 GMT-05:00 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.xml.xpath.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9a96646
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: XPath UI Tests
+Bundle-SymbolicName: org.eclipse.wst.xml.xpath.ui.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.wst.xml.xpath.ui.tests.XPathUITestPlugin
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.wst.xml.xpath.core;bundle-version="1.1.0",
+ org.eclipse.wst.xml.xpath.ui;bundle-version="1.1.0",
+ org.eclipse.core.runtime,
+ org.junit;bundle-version="3.8.2",
+ org.eclipse.ui;bundle-version="3.5.0",
+ org.eclipse.wst.xml.xpath2;bundle-version="1.1.0",
+ org.eclipse.core.runtime.compatibility;bundle-version="3.2.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.wst.xml.xpath.ui.internal.hander.tests;x-internal:=true,
+ org.eclipse.wst.xml.xpath.ui.tests
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/build.properties b/tests/org.eclipse.wst.xml.xpath.ui.tests/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/StubXPathProcessorHandler.java b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/StubXPathProcessorHandler.java
new file mode 100644
index 0000000..be222d3
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/StubXPathProcessorHandler.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Standards for Technology in Automotive Retail 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:
+ *     David Carver - initial API based off wst.xml.ui.CustomTemplateProposal
+ *******************************************************************************/
+package org.eclipse.wst.xml.xpath.ui.internal.hander.tests;
+
+import org.eclipse.wst.xml.xpath.ui.internal.handler.XPathProcessorHandler;
+
+/**
+ * This is a stub that exposes the protected toggle state method from the
+ * supper class for testing purposes.
+ * 
+ * @author dcarver
+ *
+ */
+public class StubXPathProcessorHandler extends XPathProcessorHandler {
+
+	@Override
+	public void toggleState(String xpathState) {
+		super.toggleState(xpathState);
+	}
+	
+}
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/TestXPathProcessorHandler.java b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/TestXPathProcessorHandler.java
new file mode 100644
index 0000000..ff4eaca
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/internal/hander/tests/TestXPathProcessorHandler.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Standards for Technology in Automotive Retail 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:
+ *     David Carver - initial API based off wst.xml.ui.CustomTemplateProposal
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.xpath.ui.internal.hander.tests;
+
+import org.eclipse.wst.xml.xpath.core.XPathProcessorPreferences;
+import org.eclipse.wst.xml.xpath.core.util.XPathCoreHelper;
+import org.osgi.service.prefs.Preferences;
+
+import junit.framework.TestCase;
+
+public class TestXPathProcessorHandler extends TestCase {
+
+	Preferences prefs = null;
+	StubXPathProcessorHandler handler = null;
+	
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		prefs = XPathCoreHelper.getPreferences();
+		prefs.putBoolean(XPathProcessorPreferences.XPATH_1_0_PROCESSOR, false);
+		prefs.putBoolean(XPathProcessorPreferences.XPATH_2_0_PROCESSOR, false);
+		prefs.flush();
+		handler = new StubXPathProcessorHandler();
+	}
+	
+	@Override
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		prefs = null;
+		handler = null;
+	}
+	
+	public void testToggleStateXpath10() throws Exception {
+		handler.toggleState("xpath10");
+		prefs = XPathCoreHelper.getPreferences();
+		assertTrue("XPath 1.0 preference state not set", prefs.getBoolean(XPathProcessorPreferences.XPATH_1_0_PROCESSOR, false));
+	}
+	
+	public void testToggleStateXpath2() throws Exception {
+		handler.toggleState("xpath2");
+		prefs = XPathCoreHelper.getPreferences();
+		assertTrue("XPath 2.0 preference state not set", prefs.getBoolean(XPathProcessorPreferences.XPATH_2_0_PROCESSOR, false));
+	}	
+}
diff --git a/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/tests/XPathUITestPlugin.java b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/tests/XPathUITestPlugin.java
new file mode 100644
index 0000000..b7a5092
--- /dev/null
+++ b/tests/org.eclipse.wst.xml.xpath.ui.tests/src/org/eclipse/wst/xml/xpath/ui/tests/XPathUITestPlugin.java
@@ -0,0 +1,50 @@
+package org.eclipse.wst.xml.xpath.ui.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class XPathUITestPlugin extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.eclipse.wst.xml.xpath.ui.tests"; //$NON-NLS-1$
+
+	// The shared instance
+	private static XPathUITestPlugin plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public XPathUITestPlugin() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (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 XPathUITestPlugin getDefault() {
+		return plugin;
+	}
+
+}