Add dependencies and web container for java web projects
diff --git a/tests/org.eclipse.jst.jsp.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.jsp.core.tests/META-INF/MANIFEST.MF
index c2fe066..0723c62 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.jsp.core.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.eclipse.jst.jsp.core.tests
+Bundle-SymbolicName: org.eclipse.jst.jsp.core.tests;singleton:=true
 Bundle-Version: 1.0.800.qualifier
 Bundle-ClassPath: jspcoretests.jar
 Bundle-Activator: org.eclipse.jst.jsp.core.tests.JSPCoreTestsPlugin
@@ -23,7 +23,7 @@
  org.eclipse.jst.jsp.css.core.tests.source,
  org.eclipse.jst.jsp.css.core.tests.testfiles,
  org.eclipse.jst.jsp.css.core.tests.testfiles.results
-Require-Bundle: org.junit;bundle-version=3.8.2,
+Require-Bundle: org.junit;bundle-version="3.8.2",
  org.eclipse.wst.html.core,
  org.eclipse.wst.xml.core,
  org.eclipse.wst.sse.core,
diff --git a/tests/org.eclipse.jst.jsp.core.tests/plugin.xml b/tests/org.eclipse.jst.jsp.core.tests/plugin.xml
new file mode 100644
index 0000000..449e67e
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+   <extension
+         point="org.eclipse.jdt.core.classpathContainerInitializer">
+      <classpathContainerInitializer
+            class="org.eclipse.jst.jsp.core.tests.WebContainerInitializer"
+            id="org.eclipse.jst.jsp.core.tests.webContainerInitializer">
+      </classpathContainerInitializer>
+   </extension>
+</plugin>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/pom.xml b/tests/org.eclipse.jst.jsp.core.tests/pom.xml
index 29458f6..1d2a299 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/pom.xml
+++ b/tests/org.eclipse.jst.jsp.core.tests/pom.xml
@@ -43,6 +43,41 @@
               <artifactId>org.eclipse.wst.dtd.core</artifactId>
               <version>0.0.0</version>
             </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>org.eclipse.pde.core</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>javax.servlet</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>javax.servlet.jsp</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>org.eclipse.osgi.compatibility.state</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>org.eclipse.update.configurator</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>org.eclipse.core.runtime.compatibility</artifactId>
+              <version>0.0.0</version>
+            </dependency>
+            <dependency>
+              <type>p2-installable-unit</type>
+              <artifactId>org.eclipse.jst.j2ee.core</artifactId>
+              <version>0.0.0</version>
+            </dependency>
           </dependencies>
         </configuration>
       </plugin>
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/WebContainerInitializer.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/WebContainerInitializer.java
new file mode 100644
index 0000000..bfb6f76
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/WebContainerInitializer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.jsp.core.tests;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+public class WebContainerInitializer extends ClasspathContainerInitializer {
+
+	public WebContainerInitializer() {
+	}
+
+	public void initialize(final IPath containerPath, IJavaProject project) throws CoreException {
+		IClasspathContainer container = new IClasspathContainer() {
+			
+			public IPath getPath() {
+				return containerPath;
+			}
+			
+			public int getKind() {
+				return IClasspathContainer.K_SYSTEM;
+			}
+			
+			public String getDescription() {
+				return "JARs for the Java Web Project";
+			}
+			
+			public IClasspathEntry[] getClasspathEntries() {
+				try {
+					IClasspathEntry servlet = JavaCore.newLibraryEntry(new Path(FileLocator.getBundleFile(Platform.getBundle("javax.servlet")).getAbsolutePath()), null, null);
+					IClasspathEntry jsp = JavaCore.newLibraryEntry(new Path(FileLocator.getBundleFile(Platform.getBundle("javax.servlet.jsp")).getAbsolutePath()), null, null);
+					return new IClasspathEntry[] { servlet, jsp };
+				}
+				catch (IOException e) { }
+				return new IClasspathEntry[0];
+			}
+		};
+		JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
+	}
+
+}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java
index a510144..72726be 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/taglibindex/BundleResourceUtil.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 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
@@ -268,12 +268,28 @@
 		}
 	}
 	
+	public static void addWebContainer(IProject proj) {
+		IJavaProject jProj = JavaCore.create(proj);
+		try {
+			IClasspathEntry[] entries = jProj.getRawClasspath();
+			for (int i = 0; i < entries.length; i++) {
+				if (entries[i].getEntryKind() == IClasspathEntry.CPE_CONTAINER && "org.eclipse.jst.jsp.core.tests.webContainerInitializer".equals(entries[i].getPath().segment(0))) {
+					return;
+				}
+			}
+			List newEntries = new ArrayList();
+			newEntries.addAll(Arrays.asList(entries));
+			newEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.jst.jsp.core.tests.webContainerInitializer")));
+			jProj.setRawClasspath((IClasspathEntry[]) newEntries.toArray(new IClasspathEntry[newEntries.size()]), null);
+		}
+		catch (JavaModelException e) {
+
+		}
+	}
+
 	public static IProject createJavaWebProject(String name) throws CoreException {
 		// Create new project
-		IProject project = BundleResourceUtil.createSimpleProject(name, null, new String[]{JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature"});
-
-		project.getFolder("META-INF").create(true, true, null);
-		project.getFolder("META-INF").getFile("MANIFEST.MF").create(new ByteArrayInputStream(("Manifest-Version: 1.0\nBundle-ManifestVersion: 2\nBundle-SymbolicName: "+name+"; singleton:=true\nRequire-Bundle: javax.servlet;bundle-version=\"3.0\",\n javax.servlet.jsp;bundle-version=\"2.2\"\nBundle-ActivationPolicy: lazy\n").getBytes()), true, null);
+		IProject project = BundleResourceUtil.createSimpleProject(name, null, new String[]{JavaCore.NATURE_ID});
 
 		IJavaProject javaProject = JavaCore.create(project);
 		List buildPath = new ArrayList(Arrays.asList(javaProject.getRawClasspath()));
@@ -284,7 +300,7 @@
 				i.remove();
 			}
 		}
-		buildPath.add(JavaCore.newContainerEntry(new Path("org.eclipse.pde.core.requiredPlugins")));
+		buildPath.add(JavaCore.newContainerEntry(new Path("org.eclipse.jst.jsp.core.tests.webContainerInitializer")));
 		buildPath.add(JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6")));
 		javaProject.setRawClasspath((IClasspathEntry[]) buildPath.toArray(new IClasspathEntry[buildPath.size()]), new Path("/" + name + "/WebContent/WEB-INF/classes"), new NullProgressMonitor());
 		return project;