Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlisaacs2010-04-19 01:52:06 +0000
committerlisaacs2010-04-19 01:52:06 +0000
commit27522dc5d94441ffdec233cdf0d76ef067180d23 (patch)
tree28d5086ea27e036688b7ff627485804dc824c7dd
parentdb1ebd2c709ea9d35c394cd08fee61d9b962da4d (diff)
downloadwebtools.servertools-27522dc5d94441ffdec233cdf0d76ef067180d23.tar.gz
webtools.servertools-27522dc5d94441ffdec233cdf0d76ef067180d23.tar.xz
webtools.servertools-27522dc5d94441ffdec233cdf0d76ef067180d23.zip
[308916] Add Tomcat 7 support
-rw-r--r--tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AllTests.java14
-rw-r--r--tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70RuntimeTestCase.java23
-rw-r--r--tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70ServerTestCase.java67
-rw-r--r--tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/TomcatRuntimeTestCase.java4
4 files changed, 106 insertions, 2 deletions
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AllTests.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AllTests.java
index a7cefb0df..c694ab401 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AllTests.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AllTests.java
@@ -108,6 +108,20 @@ public class AllTests {
System.err.println("Warning: Tomcat 6.0 not found - tests skipped");
}
+ // Note that Tomcat 7.0 requires Java SE 6
+ s = System.getProperty("org.eclipse.jst.server.tomcat.70");
+ if (s != null && s.length() > 0) {
+ RuntimeLocation.runtimeLocation = s;
+ TestSuite subSuite = new TestSuite(Tomcat70RuntimeTestCase.class);
+ Tomcat70RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat70ServerTestCase.class);
+ Tomcat70ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ } else {
+ System.err.println("Warning: Tomcat 7.0 not found - tests skipped");
+ }
+
suite.addTestSuite(UtilTestCase.class);
suite.addTestSuite(XmlTestCase.class);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70RuntimeTestCase.java
new file mode 100644
index 000000000..6e17df7ff
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70RuntimeTestCase.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.server.tomcat.core.tests;
+
+import junit.framework.TestSuite;
+
+public class Tomcat70RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
+ protected String getRuntimeTypeId() {
+ return "org.eclipse.jst.server.tomcat.runtime.70";
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat70RuntimeTestCase.class, suite);
+ }
+}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70ServerTestCase.java
new file mode 100644
index 000000000..544d1de7c
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat70ServerTestCase.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.server.tomcat.core.tests;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jst.server.tomcat.core.internal.Tomcat70Configuration;
+import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
+import org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ *
+ */
+public class Tomcat70ServerTestCase extends AbstractTomcatServerTestCase {
+ protected String getServerTypeId() {
+ return "org.eclipse.jst.server.tomcat.70";
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat70ServerTestCase.class, suite);
+ }
+
+ protected void verifyPublishedModule(IPath baseDir, IModule module)
+ throws Exception {
+ Tomcat70TestConfiguration config = new Tomcat70TestConfiguration(null);
+ config.load(baseDir.append("conf"), null);
+
+ ServerInstance serverInstance = config.getServerInstance();
+ Context context = serverInstance.getContext(module.getName());
+
+ String deployDir = getTomcatServer().getDeployDirectory();
+ if ("webapps".equals(deployDir)) {
+ assertEquals(module.getName(), context.getDocBase());
+ }
+ else {
+ assertEquals(getTomcatServerBehaviour().getModuleDeployDirectory(module).toOSString(), context.getDocBase());
+ }
+ verifyPublishedModuleFiles(module);
+ }
+}
+
+class Tomcat70TestConfiguration extends Tomcat70Configuration {
+ /**
+ * @param path
+ */
+ public Tomcat70TestConfiguration(IFolder path) {
+ super(path);
+ }
+
+ /**
+ * @return server instance
+ */
+ public ServerInstance getServerInstance() {
+ return serverInstance;
+ }
+}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/TomcatRuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/TomcatRuntimeTestCase.java
index 732031d61..a17b34665 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/TomcatRuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/TomcatRuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@ public class TomcatRuntimeTestCase extends TestCase {
tomcatRuntime = (ITomcatRuntime) runtime.loadAdapter(ITomcatRuntime.class, null);
assertNotNull(tomcatRuntime);
assertNotNull(tomcatRuntime.getVMInstall());
- assertNotNull(tomcatRuntime.getRuntimeClasspath());
+ assertNotNull(tomcatRuntime.getRuntimeClasspath(null));
}
protected void modifyRuntime() throws Exception {

Back to the top