[296854] Update for JUnit 4 Test Framework. Bumped minor version since OrderedTestSuite is being removed and tests are run unordered.
diff --git a/tests/org.eclipse.jst.server.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.server.core.tests/META-INF/MANIFEST.MF
index 1498acb..75085a3 100644
--- a/tests/org.eclipse.jst.server.core.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.server.core.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jst.server.core.tests
Bundle-SymbolicName: org.eclipse.jst.server.core.tests
-Bundle-Version: 1.0.402.qualifier
+Bundle-Version: 1.1.000.qualifier
Bundle-ClassPath: tests.jar
Bundle-Activator: org.eclipse.jst.server.core.tests.TestsPlugin
Bundle-Vendor: Eclipse.org
@@ -11,7 +11,7 @@
org.eclipse.jst.server.core.tests.j2ee
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.junit;bundle-version="[3.8.0,4.0.0)",
+ org.junit;bundle-version="3.8.0",
org.eclipse.jdt.core,
org.eclipse.jdt.launching,
org.eclipse.wst.server.core,
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/AllTests.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/AllTests.java
index 40a2371..12d9a3b 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/AllTests.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/AllTests.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
@@ -28,30 +28,32 @@
System.setProperty("wtp.autotest.noninteractive", "true");
suite.addTestSuite(ExistenceTest.class);
- suite.addTest(new OrderedTestSuite(GenericRuntimeTestCase.class));
+ TestSuite subSuite = new TestSuite(GenericRuntimeTestCase.class);
+ GenericRuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
- suite.addTest(new OrderedTestSuite(J2EEModuleTestCase.class));
- suite.addTest(new OrderedTestSuite(ApplicationClientTestCase.class));
- suite.addTest(new OrderedTestSuite(ConnectorModuleTestCase.class));
- suite.addTest(new OrderedTestSuite(EJBModuleTestCase.class));
- suite.addTest(new OrderedTestSuite(WebModuleTestCase.class));
- suite.addTest(new OrderedTestSuite(EnterpriseApplicationTestCase.class));
+ suite.addTestSuite(J2EEModuleTestCase.class);
+ suite.addTestSuite(ApplicationClientTestCase.class);
+ suite.addTestSuite(ConnectorModuleTestCase.class);
+ suite.addTestSuite(EJBModuleTestCase.class);
+ suite.addTestSuite(WebModuleTestCase.class);
+ suite.addTestSuite(EnterpriseApplicationTestCase.class);
- suite.addTest(new OrderedTestSuite(EJBBeanTestCase.class));
- suite.addTest(new OrderedTestSuite(ServletTestCase.class));
- suite.addTest(new OrderedTestSuite(JndiObjectTestCase.class));
- suite.addTest(new OrderedTestSuite(JndiLaunchableTestCase.class));
+ suite.addTestSuite(EJBBeanTestCase.class);
+ suite.addTestSuite(ServletTestCase.class);
+ suite.addTestSuite(JndiObjectTestCase.class);
+ suite.addTestSuite(JndiLaunchableTestCase.class);
- suite.addTest(new OrderedTestSuite(RuntimeClasspathProviderDelegateTestCase.class));
+ suite.addTestSuite(RuntimeClasspathProviderDelegateTestCase.class);
- String s = System.getProperty("org.eclipse.jst.server.tomcat.32");
+ String s = System.getProperty("org.eclipse.jst.server.tomcat.60");
//s = "D:\\Tools\\tomcat\\jakarta-tomcat-3.2.4";
if (s != null && s.length() > 0) {
if (!s.endsWith(File.separator))
s += File.separator;
runtimeLocation = new Path(s + "lib");
}
- //s = System.getProperty("org.eclipse.jst.server.tomcat.40");
+ //s = System.getProperty("org.eclipse.jst.server.tomcat.55");
if (s != null && s.length() > 0) {
if (!s.endsWith(File.separator))
s += File.separator;
@@ -60,11 +62,18 @@
// bug 160848
- if (runtimeLocation != null)
- suite.addTest(new OrderedTestSuite(ModuleTestCase.class));
+ if (runtimeLocation != null) {
+ subSuite = new TestSuite(ModuleTestCase.class);
+ ModuleTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ }
- suite.addTest(new OrderedTestSuite(NoSourceTestCase.class));
- suite.addTest(new OrderedTestSuite(BinaryTestCase.class));
+ subSuite = new TestSuite(NoSourceTestCase.class);
+ NoSourceTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(BinaryTestCase.class);
+ BinaryTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
//$JUnit-END$
return suite;
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ConnectorModuleTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ConnectorModuleTestCase.java
index 6e39415..660347a 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ConnectorModuleTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ConnectorModuleTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,11 +17,18 @@
public class ConnectorModuleTestCase extends TestCase {
protected static IConnectorModule module;
- public void test00Create() {
- module = new TestConnectorModule();
+ protected IConnectorModule getConnectorModule() {
+ if (module == null) {
+ module = new TestConnectorModule();
+ }
+ return module;
}
- public void test04Classpath() {
- module.getClasspath();
+ public void testCreate() {
+ getConnectorModule();
+ }
+
+ public void testClasspath() {
+ getConnectorModule().getClasspath();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EJBBeanTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EJBBeanTestCase.java
index 274e991..88302bf 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EJBBeanTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EJBBeanTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,23 +16,30 @@
public class EJBBeanTestCase extends TestCase {
protected static EJBBean bean;
- public void test00Create() {
- bean = new EJBBean(null, "test", false, true);
- }
-
- public void test01GetModule() {
- assertNull(bean.getModule());
- }
-
- public void test02GetJNDIName() {
- assertEquals(bean.getJndiName(), "test");
+ protected EJBBean getEJBBean() {
+ if (bean == null) {
+ bean = new EJBBean(null, "test", false, true);
+ }
+ return bean;
}
- public void test03Local() {
- assertTrue(bean.hasLocalInterface());
+ public void testCreate() {
+ getEJBBean();
}
- public void test04Remote() {
- assertFalse(bean.hasRemoteInterface());
+ public void testGetModule() {
+ assertNull(getEJBBean().getModule());
+ }
+
+ public void testGetJNDIName() {
+ assertEquals(getEJBBean().getJndiName(), "test");
+ }
+
+ public void testLocal() {
+ assertTrue(getEJBBean().hasLocalInterface());
+ }
+
+ public void testRemote() {
+ assertFalse(getEJBBean().hasRemoteInterface());
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EnterpriseApplicationTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EnterpriseApplicationTestCase.java
index 90fe44e..8e19e54 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EnterpriseApplicationTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/EnterpriseApplicationTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,15 +18,22 @@
public class EnterpriseApplicationTestCase extends TestCase {
protected static IEnterpriseApplication app;
- public void test00Create() {
- app = new TestEnterpriseApplication();
+ protected IEnterpriseApplication getEnterpriseApplication() {
+ if (app == null) {
+ app = new TestEnterpriseApplication();
+ }
+ return app;
}
- public void test03Modules() {
- app.getModules();
+ public void testCreate() {
+ getEnterpriseApplication();
}
- public void test04URI() {
- app.getURI(null);
+ public void testModules() {
+ getEnterpriseApplication().getModules();
+ }
+
+ public void testURI() {
+ getEnterpriseApplication().getURI(null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/GenericRuntimeTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/GenericRuntimeTestCase.java
index 63023cc..d61733d 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/GenericRuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/GenericRuntimeTestCase.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
@@ -18,67 +18,84 @@
import org.eclipse.wst.server.core.*;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/* Note: These tests may be executed in any order. Because null is used as most
+ * arguments, the order doesn't currently matter. If non-null arguments are used,
+ * it may be necessary to rewrite the tests to make them truly order independent.
+ */
public class GenericRuntimeTestCase extends TestCase {
private static final String RUNTIME_TYPE_ID = "org.eclipse.jst.server.core.runtimeType";
protected static IRuntime runtime;
- protected static IRuntime runtimeWC;
- protected static IGenericRuntime genericRuntime;
- protected static IGenericRuntimeWorkingCopy genericRuntimeWC;
- public void test00CreateRuntime() throws Exception {
- IRuntimeType rt = ServerCore.findRuntimeType(RUNTIME_TYPE_ID);
- IRuntimeWorkingCopy wc = rt.createRuntime("a", null);
- wc.setLocation(new Path("c://test"));
- runtime = wc.save(false, null);
-
- assertTrue(!runtime.isWorkingCopy());
+ protected IRuntime getRuntime() throws Exception {
+ if (runtime == null) {
+ IRuntimeType rt = ServerCore.findRuntimeType(RUNTIME_TYPE_ID);
+ IRuntimeWorkingCopy wc = rt.createRuntime("a", null);
+ wc.setLocation(new Path("c://test"));
+ runtime = wc.save(false, null);
+ }
+ return runtime;
}
- public void test01ValidateRuntime() throws Exception {
- IStatus status = runtime.validate(null);
+ protected IGenericRuntime getGenericRuntime() throws Exception {
+ return (IGenericRuntime)getRuntime().getAdapter(IGenericRuntime.class);
+ }
+
+ protected IRuntime getRuntimeWC() throws Exception {
+ return getRuntime().createWorkingCopy();
+ }
+
+ protected IGenericRuntimeWorkingCopy getGenericRuntimeWC() throws Exception {
+ return (IGenericRuntimeWorkingCopy)getRuntimeWC().loadAdapter(IGenericRuntimeWorkingCopy.class, null);
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ suite.addTest(TestSuite.createTest(GenericRuntimeTestCase.class, "deleteRuntime"));
+ }
+
+ public void testCreateRuntime() throws Exception {
+ assertTrue(!getRuntime().isWorkingCopy());
+ }
+
+ public void testValidateRuntime() throws Exception {
+ IStatus status = getRuntime().validate(null);
assertTrue(!status.isOK());
}
- public void test02Util() throws Exception {
- assertTrue(GenericRuntimeUtil.isGenericJ2EERuntime(runtime));
+ public void testUtil() throws Exception {
+ assertTrue(GenericRuntimeUtil.isGenericJ2EERuntime(getRuntime()));
}
- public void test03Adapt() throws Exception {
- genericRuntime = (IGenericRuntime) runtime.getAdapter(IGenericRuntime.class);
- assertNotNull(genericRuntime);
+ public void testAdapt() throws Exception {
+ assertNotNull(getGenericRuntime());
}
- public void test04Adapt() throws Exception {
- assertNotNull(runtime.getAdapter(IGenericRuntimeWorkingCopy.class));
+ public void testAdaptWorkingCopy() throws Exception {
+ assertNotNull(getRuntime().getAdapter(IGenericRuntimeWorkingCopy.class));
}
- public void test05GetJVM() throws Exception {
- assertNotNull(genericRuntime.getVMInstall());
+ public void testGetJVM() throws Exception {
+ assertNotNull(getGenericRuntime().getVMInstall());
}
- public void test06Adapt() throws Exception {
- runtimeWC = runtime.createWorkingCopy();
- genericRuntimeWC = (IGenericRuntimeWorkingCopy) runtimeWC.loadAdapter(IGenericRuntimeWorkingCopy.class, null);
- assertNotNull(genericRuntimeWC);
+ public void testAdapt2() throws Exception {
+ assertNotNull(getGenericRuntimeWC());
}
- public void test07Adapt() throws Exception {
- assertNotNull(runtimeWC.loadAdapter(IGenericRuntime.class, null));
+ public void testAdapt3() throws Exception {
+ assertNotNull(getRuntimeWC().loadAdapter(IGenericRuntime.class, null));
}
- public void test08SetJVM() throws Exception {
- assertNotNull(genericRuntimeWC.getVMInstall());
- genericRuntimeWC.setVMInstall(null);
- assertNotNull(genericRuntimeWC.getVMInstall());
+ public void testSetJVM() throws Exception {
+ assertNotNull(getGenericRuntimeWC().getVMInstall());
+ assertNotNull(getGenericRuntimeWC().getVMInstall());
}
- public void test09DeleteRuntime() throws Exception {
- runtime.delete();
+ public void deleteRuntime() throws Exception {
+ getRuntime().delete();
runtime = null;
- runtimeWC = null;
- genericRuntime = null;
- genericRuntimeWC = null;
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiLaunchableTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiLaunchableTestCase.java
index 306785f..49a2432 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiLaunchableTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiLaunchableTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,15 +16,22 @@
public class JndiLaunchableTestCase extends TestCase {
protected static JndiLaunchable launch;
- public void test00Create() {
- launch = new JndiLaunchable(null, "test");
+ protected JndiLaunchable getJndiLaunchable() {
+ if (launch == null) {
+ launch = new JndiLaunchable(null, "test");
+ }
+ return launch;
+ }
+
+ public void testCreate() {
+ getJndiLaunchable();
}
- public void test01GetProperties() {
- assertNull(launch.getProperties());
+ public void testGetProperties() {
+ assertNull(getJndiLaunchable().getProperties());
}
- public void test02GetJNDIName() {
- assertEquals(launch.getJNDIName(), "test");
+ public void testGetJNDIName() {
+ assertEquals(getJndiLaunchable().getJNDIName(), "test");
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiObjectTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiObjectTestCase.java
index db020d9..a0b13a4 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiObjectTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/JndiObjectTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,15 +16,22 @@
public class JndiObjectTestCase extends TestCase {
protected static JndiObject obj;
- public void test00Create() {
- obj = new JndiObject(null, "test");
+ protected JndiObject getJndiObject() {
+ if (obj == null) {
+ obj = new JndiObject(null, "test");
+ }
+ return obj;
+ }
+
+ public void testCreate() {
+ getJndiObject();
}
- public void test01GetModule() {
- assertNull(obj.getModule());
+ public void testGetModule() {
+ assertNull(getJndiObject().getModule());
}
- public void test02GetJNDIName() {
- assertEquals(obj.getJndiName(), "test");
+ public void testGetJNDIName() {
+ assertEquals(getJndiObject().getJndiName(), "test");
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/OrderedTestSuite.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/OrderedTestSuite.java
deleted file mode 100644
index 78a2b58..0000000
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/OrderedTestSuite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 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.core.tests;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class OrderedTestSuite extends TestSuite {
- public OrderedTestSuite(Class theClass) {
- super(theClass);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration tests() {
- Enumeration<TestCase> enum2 = super.tests();
-
- Vector<TestCase> list = new Vector<TestCase>();
- while (enum2.hasMoreElements()) {
- list.add(enum2.nextElement());
- }
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- TestCase t1 = list.get(i);
- TestCase t2 = list.get(j);
- if (t1.getName().compareTo(t2.getName()) > 0) {
- TestCase obj = list.get(i);
- list.set(i, list.get(j));
- list.set(j, obj);
- }
- }
- }
-
- return list.elements();
- }
-}
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/RuntimeClasspathProviderDelegateTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/RuntimeClasspathProviderDelegateTestCase.java
index 7ecde84..37582e3 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/RuntimeClasspathProviderDelegateTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/RuntimeClasspathProviderDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,35 +17,42 @@
public class RuntimeClasspathProviderDelegateTestCase extends TestCase {
protected static RuntimeClasspathProviderDelegate handler;
- public void test00Create() {
- handler = new TestRuntimeClasspathProviderDelegate();
+ protected RuntimeClasspathProviderDelegate getHander() {
+ if (handler == null) {
+ handler = new TestRuntimeClasspathProviderDelegate();
+ }
+ return handler;
}
- public void test01ResolveClasspathContainer() {
- handler.resolveClasspathContainer(null);
+ public void testCreate() {
+ getHander();
}
- public void test02ResolveClasspathContainer() {
- handler.resolveClasspathContainer(null, null);
+ public void testResolveClasspathContainer() {
+ getHander().resolveClasspathContainer(null);
}
- public void test03ResolveClasspathContainerImpl() {
- handler.resolveClasspathContainerImpl(null);
+ public void testResolveClasspathContainer2() {
+ getHander().resolveClasspathContainer(null, null);
}
- public void test04ResolveClasspathContainerImpl() {
- handler.resolveClasspathContainerImpl(null, null);
+ public void testResolveClasspathContainerImpl() {
+ getHander().resolveClasspathContainerImpl(null);
}
- public void test05TestAddMethods() {
- ((TestRuntimeClasspathProviderDelegate) handler).testAddMethods();
+ public void testResolveClasspathContainerImpl2() {
+ getHander().resolveClasspathContainerImpl(null, null);
}
- public void test06RequestClasspathContainerUpdate() {
- handler.requestClasspathContainerUpdate(null, null);
+ public void testTestAddMethods() {
+ ((TestRuntimeClasspathProviderDelegate) getHander()).testAddMethods();
}
- public void test07HasRuntimeClasspathChanged() {
- handler.hasRuntimeClasspathChanged(null);
+ public void testRequestClasspathContainerUpdate() {
+ getHander().requestClasspathContainerUpdate(null, null);
+ }
+
+ public void testHasRuntimeClasspathChanged() {
+ getHander().hasRuntimeClasspathChanged(null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ServletTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ServletTestCase.java
index 02d49c5..ed820dc 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ServletTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/ServletTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,23 +16,30 @@
public class ServletTestCase extends TestCase {
protected static Servlet servlet;
- public void test00Create() {
- servlet = new Servlet(null, "class", "alias");
- }
-
- public void test01GetModule() {
- assertNull(servlet.getModule());
- }
-
- public void test02GetClassName() {
- assertEquals(servlet.getServletClassName(), "class");
+ protected Servlet getServlet() {
+ if (servlet == null) {
+ servlet = new Servlet(null, "class", "alias");
+ }
+ return servlet;
}
- public void test02GetAlias() {
- assertEquals(servlet.getAlias(), "alias");
+ public void testCreate() {
+ getServlet();
}
- public void test03ToString() {
- servlet.toString();
+ public void testGetModule() {
+ assertNull(getServlet().getModule());
+ }
+
+ public void testGetClassName() {
+ assertEquals(getServlet().getServletClassName(), "class");
+ }
+
+ public void testGetAlias() {
+ assertEquals(getServlet().getAlias(), "alias");
+ }
+
+ public void testToString() {
+ getServlet().toString();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/WebModuleTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/WebModuleTestCase.java
index e955ae0..a93b2a2 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/WebModuleTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/WebModuleTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,11 +17,18 @@
public class WebModuleTestCase extends TestCase {
protected static IWebModule module;
- public void test00Create() {
- module = new TestWebModule();
+ protected IWebModule getWebModule() {
+ if (module == null) {
+ module = new TestWebModule();
+ }
+ return module;
}
- public void test06ContextRoot() {
- module.getContextRoot();
+ public void testCreate() {
+ getWebModule();
+ }
+
+ public void testContextRoot() {
+ getWebModule().getContextRoot();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/BinaryTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/BinaryTestCase.java
index 3521bfa..2911ff8 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/BinaryTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/BinaryTestCase.java
@@ -19,6 +19,7 @@
import org.eclipse.wst.server.core.*;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
public class BinaryTestCase extends TestCase {
private static final String[] PROJECT_NAMES = new String[] {
@@ -26,90 +27,134 @@
"PublishTestWeb", "PublishTestWeb2", "PublishTestConnector", "PublishTestClient"
};
- protected static IRuntime runtime;
- protected static IModule module;
- protected static IEnterpriseApplication ent;
- protected static IWebModule webModule;
- protected static IJ2EEModule j2eeModule;
+ private static final String EJB_PATH = "lib/PublishTestEAR/EarContent/PublishTestEJB.jar";
+ private static final String CONN_PATH = "lib/PublishTestEAR/EarContent/PublishTestConnector.rar";
+ private static final String CLIENT_PATH = "lib/PublishTestEAR/EarContent/PublishTestClient.jar";
+ private static final String WEBAPP_PATH = "lib/PublishTestEAR/EarContent/PublishTestWeb.war";
+ private static final String WEBAPP2_PATH = "lib/PublishTestEAR/EarContent/PublishTestWeb2.war";
- public void test001ImportModules() throws Exception {
- ModuleHelper.importProject("PublishTestBinary.zip", new String[] { PROJECT_NAMES[0] } );
+ private static boolean projectsCreated;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (!projectsCreated) {
+ ModuleHelper.importProject("PublishTestBinary.zip", new String[] { PROJECT_NAMES[0] } );
+ ModuleHelper.buildIncremental();
+ projectsCreated = true;
+ }
}
- public void test002IncrementalBuild() throws Exception {
- ModuleHelper.buildIncremental();
+ protected IModule getEARModule(String project) throws Exception {
+ return ModuleHelper.getModule("jst.ear", project);
}
- public void test003NumModules() throws Exception {
+ protected IEnterpriseApplication getEnterpriseApp(String project) throws Exception {
+ return (IEnterpriseApplication) getEARModule(project).loadAdapter(IEnterpriseApplication.class, null);
+ }
+
+ protected IModule getEJBModule(String ejb) throws Exception {
+ return ModuleHelper.getModule("jst.ejb", ejb);
+ }
+
+ protected IJ2EEModule getJ2EEEJBModule(String ejb) throws Exception {
+ return (IJ2EEModule) getEJBModule(ejb).loadAdapter(IJ2EEModule.class, null);
+ }
+
+ protected IModule getConnectorModule(String conn) throws Exception {
+ return ModuleHelper.getModule("jst.connector", conn);
+ }
+
+ protected IJ2EEModule getJ2EEConnectorModule(String conn) throws Exception {
+ return (IJ2EEModule) getConnectorModule(conn).loadAdapter(IJ2EEModule.class, null);
+ }
+
+ protected IModule getAppClientModule(String client) throws Exception {
+ return ModuleHelper.getModule("jst.appclient", client);
+ }
+
+ protected IJ2EEModule getJ2EEAppClientModule(String client) throws Exception {
+ return (IJ2EEModule) getAppClientModule(client).loadAdapter(IJ2EEModule.class, null);
+ }
+
+ protected IModule getWebModule(String webapp) throws Exception {
+ return ModuleHelper.getModule("jst.web", webapp);
+ }
+
+ protected IWebModule getJ2EEWebModule(String webapp) throws Exception {
+ return (IWebModule) getWebModule(webapp).loadAdapter(IWebModule.class, null);
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ suite.addTest(TestSuite.createTest(BinaryTestCase.class, "deleteProjects"));
+ }
+
+ public void testNumEarModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ear").length, 1);
}
- public void test004NumModules() throws Exception {
+ public void testNumWebModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.web").length, 2);
}
- public void test005NumModules() throws Exception {
+ public void testNumEjbModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ejb").length, 1);
}
- public void test006NumModules() throws Exception {
+ public void testNumUtilityModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.utility").length, 0);
}
- public void test007NumModules() throws Exception {
+ public void testNumClientModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.appclient").length, 1);
}
- public void test008NumModules() throws Exception {
+ public void testNumConnectorModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.connector").length, 1);
}
// ---------- EAR tests ----------
- public void test020EAR() throws Exception {
- //module = ModuleHelper.getModuleFromProject("PublishTestEAR");
- module = ModuleHelper.getModule("jst.ear", "PublishTestEAR");
- assertNotNull(module);
+ public void testEARModule() throws Exception {
+ assertNotNull(getEARModule("PublishTestEAR"));
}
- public void test021EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/application.xml"))
+ public void testEARFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getEARModule("PublishTestEAR"), "META-INF/application.xml"))
fail();
}
- public void test022EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestUtil2.jar"))
+ public void test0EARJarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getEARModule("PublishTestEAR"), "PublishTestUtil2.jar"))
fail();
}
- public void test023EAR() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 4);
+ public void testEARFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getEARModule("PublishTestEAR")), 4);
}
- public void test024EAR() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 1);
+ public void testEARFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getEARModule("PublishTestEAR")), 1);
}
- public void test025EAR() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ear");
+ public void testEARModuleType() throws Exception {
+ assertEquals(getEARModule("PublishTestEAR").getModuleType().getId(), "jst.ear");
}
- public void test026EAR() throws Exception {
- ent = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, null);
- assertNotNull(ent);
+ public void testEARGetApp() throws Exception {
+ assertNotNull(getEnterpriseApp("PublishTestEAR"));
}
- public void test027EAR() throws Exception {
- assertEquals(ent.getResourceFolders().length, 1);
+ public void testEARResourceFolderCount() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getResourceFolders().length, 1);
}
- public void test028EAR() throws Exception {
- assertEquals(ent.getModules().length, 5);
+ public void testEARModuleCount() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getModules().length, 5);
}
- public void test029EAR() throws Exception {
- IModule[] modules = ent.getModules();
+ public void testEARModuleNames() throws Exception {
+ IModule[] modules = getEnterpriseApp("PublishTestEAR").getModules();
int size = modules.length;
List<String> list = new ArrayList<String>(size);
for (IModule m : modules)
@@ -131,235 +176,222 @@
// ---------- EJB tests ----------
- public void test080EJB() throws Exception {
- module = ModuleHelper.getModule("jst.ejb", "lib/PublishTestEAR/EarContent/PublishTestEJB.jar");
- assertNotNull(module);
+ public void testEJBModule() throws Exception {
+ assertNotNull(getEJBModule(EJB_PATH));
}
- public void test081EJB() throws Exception {
+ public void testEJBFileExists() throws Exception {
/* PublishTestEJB should be exposed as a child module, NOT as a resource
if (!ModuleHelper.fileExists(module, "PublishTestEJB.jar"))
fail();
*/
}
- public void test084EJB() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 1);
+ public void testEJBFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getEJBModule(EJB_PATH)), 1);
}
public void test085EJB() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 0);
+ assertEquals(ModuleHelper.countFolders(getEJBModule(EJB_PATH)), 0);
}
- public void test086EJB() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ejb");
+ public void testEJBModuleType() throws Exception {
+ assertEquals(getEJBModule(EJB_PATH).getModuleType().getId(), "jst.ejb");
}
- public void test087EJB() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testEJBJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEEJBModule(EJB_PATH));
}
- public void test088EJB() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testEJBResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEEJBModule(EJB_PATH).getResourceFolders().length, 1);
}
- public void test089EJB() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 0);
+ public void testEJBJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEEJBModule(EJB_PATH).getJavaOutputFolders().length, 0);
}
- public void test090EJB() throws Exception {
- assertTrue(j2eeModule.isBinary());
+ public void testEJBIsBinary() throws Exception {
+ assertTrue(getJ2EEEJBModule(EJB_PATH).isBinary());
}
// ---------- Connector tests ----------
- public void test100Connector() throws Exception {
- module = ModuleHelper.getModule("jst.connector", "lib/PublishTestEAR/EarContent/PublishTestConnector.rar");
- assertNotNull(module);
+ public void testConnectorModule() throws Exception {
+ assertNotNull(getConnectorModule(CONN_PATH));
}
- public void test101Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestConnector.rar"))
+ public void testConnectorFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getConnectorModule(CONN_PATH), "PublishTestConnector.rar"))
fail();
}
- public void test104Connector() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 1);
+ public void testConnectorFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getConnectorModule(CONN_PATH)), 1);
}
- public void test105Connector() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 0);
+ public void testConnectorFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getConnectorModule(CONN_PATH)), 0);
}
- public void test106Connector() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.connector");
+ public void testConnectorModuleType() throws Exception {
+ assertEquals(getConnectorModule(CONN_PATH).getModuleType().getId(), "jst.connector");
}
- public void test107Connector() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testConnectorJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEConnectorModule(CONN_PATH));
}
- public void test108Connector() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testConnectorResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEConnectorModule(CONN_PATH).getResourceFolders().length, 1);
}
- public void test109Connector() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 0);
+ public void testConnectorJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEConnectorModule(CONN_PATH).getJavaOutputFolders().length, 0);
}
- public void test110Connector() throws Exception {
- assertTrue(j2eeModule.isBinary());
+ public void testConnectorIsBinary() throws Exception {
+ assertTrue(getJ2EEConnectorModule(CONN_PATH).isBinary());
}
// ---------- Client tests ----------
- public void test120Client() throws Exception {
- module = ModuleHelper.getModule("jst.appclient", "lib/PublishTestEAR/EarContent/PublishTestClient.jar");
- assertNotNull(module);
+ public void testClientModule() throws Exception {
+ assertNotNull(getAppClientModule(CLIENT_PATH));
}
- public void test121Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestClient.jar"))
+ public void testClientFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getAppClientModule(CLIENT_PATH), "PublishTestClient.jar"))
fail();
}
- public void test125Client() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 1);
+ public void testClientFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getAppClientModule(CLIENT_PATH)), 1);
}
- public void test126Client() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 0);
+ public void testClientFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getAppClientModule(CLIENT_PATH)), 0);
}
- public void test127Client() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.appclient");
+ public void testClientModuleTime() throws Exception {
+ assertEquals(getAppClientModule(CLIENT_PATH).getModuleType().getId(), "jst.appclient");
}
- public void test128Client() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testClientJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEAppClientModule(CLIENT_PATH));
}
- public void test129Client() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testClientResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEAppClientModule(CLIENT_PATH).getResourceFolders().length, 1);
}
- public void test130Client() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 0);
+ public void testClientJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEAppClientModule(CLIENT_PATH).getJavaOutputFolders().length, 0);
}
- public void test131Client() throws Exception {
- assertTrue(j2eeModule.isBinary());
+ public void testClientIsBinary() throws Exception {
+ assertTrue(getJ2EEAppClientModule(CLIENT_PATH).isBinary());
}
// ---------- Web 1 tests ----------
- public void test140Web() throws Exception {
- module = ModuleHelper.getModule("jst.web", "lib/PublishTestEAR/EarContent/PublishTestWeb.war");
- assertNotNull(module);
+ public void testWebModule() throws Exception {
+ assertNotNull(getWebModule(WEBAPP_PATH));
}
- public void test141Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestWeb.war"))
+ public void testWebFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getWebModule(WEBAPP_PATH), "PublishTestWeb.war"))
fail();
}
- public void test147Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 1);
+ public void testWebFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getWebModule(WEBAPP_PATH)), 1);
}
- public void test148Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 0);
+ public void testWebFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getWebModule(WEBAPP_PATH)), 0);
}
- public void test149Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWebModuleType() throws Exception {
+ assertEquals(getWebModule(WEBAPP_PATH).getModuleType().getId(), "jst.web");
}
- public void test150Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ public void testWebJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEWebModule(WEBAPP_PATH));
}
- public void test151Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWebResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP_PATH).getResourceFolders().length, 1);
}
- public void test152Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 0);
+ public void testWebJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP_PATH).getJavaOutputFolders().length, 0);
}
- public void test153Web() throws Exception {
- assertEquals(webModule.getModules().length, 0);
+ public void testWebModuleCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP_PATH).getModules().length, 0);
}
- public void _test154Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb");
+ public void _testWebContextRoot() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP_PATH).getContextRoot(), "PublishTestWeb");
}
- public void test155Web() throws Exception {
- assertTrue(webModule.isBinary());
+ public void testWebIsBinaary() throws Exception {
+ assertTrue(getJ2EEWebModule(WEBAPP_PATH).isBinary());
}
// ---------- Web 2 tests ----------
- public void test160Web() throws Exception {
- module = ModuleHelper.getModule("jst.web", "lib/PublishTestEAR/EarContent/PublishTestWeb2.war");
- assertNotNull(module);
+ public void testWeb2Module() throws Exception {
+ assertNotNull(getWebModule(WEBAPP2_PATH));
}
- public void test161Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestWeb2.war"))
+ public void testWeb2FileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getWebModule(WEBAPP2_PATH), "PublishTestWeb2.war"))
fail();
}
- public void test166Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 1);
+ public void testWeb2FileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getWebModule(WEBAPP2_PATH)), 1);
}
- public void test167Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 0);
+ public void testWeb2FolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getWebModule(WEBAPP2_PATH)), 0);
}
- public void test168Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWeb2ModuleType() throws Exception {
+ assertEquals(getWebModule(WEBAPP2_PATH).getModuleType().getId(), "jst.web");
}
- public void test169Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ public void testWeb2J2EEModule() throws Exception {
+ assertNotNull(getJ2EEWebModule(WEBAPP2_PATH));
}
- public void test170Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWeb2ResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP2_PATH).getResourceFolders().length, 1);
}
- public void test171Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 0);
+ public void testWeb2JavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP2_PATH).getJavaOutputFolders().length, 0);
}
- public void test172Web() throws Exception {
- assertEquals(webModule.getModules().length, 0);
+ public void testWeb2ModuleCount() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP2_PATH).getModules().length, 0);
}
- public void _test173Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb2");
+ public void _testWeb2ContextRoot() throws Exception {
+ assertEquals(getJ2EEWebModule(WEBAPP2_PATH).getContextRoot(), "PublishTestWeb2");
}
- public void test174Client() throws Exception {
- assertTrue(webModule.isBinary());
+ public void testWeb2IsBinary() throws Exception {
+ assertTrue(getJ2EEWebModule(WEBAPP2_PATH).isBinary());
}
-
- public void test199Cleanup() throws Exception {
+ public void deleteProjects() throws Exception {
ModuleHelper.deleteProject(PROJECT_NAMES[0]);
}
}
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/ModuleTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/ModuleTestCase.java
index 8fd911f..c4a55f6 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/ModuleTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/ModuleTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -20,6 +20,7 @@
import org.eclipse.wst.server.core.*;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
/**
* TODO Tests left to do:
* migrated modules
@@ -36,103 +37,131 @@
};
protected static IRuntime runtime;
- protected static IModule module;
- protected static IEnterpriseApplication ent;
- protected static IWebModule webModule;
- protected static IJ2EEModule j2eeModule;
- public void test000CreateRuntime() throws Exception {
- IRuntimeType rt = ServerCore.findRuntimeType(RUNTIME_TYPE_ID);
- IRuntimeWorkingCopy wc = rt.createRuntime("RuntimeLibraries", null);
- wc.setLocation(AllTests.runtimeLocation);
- wc.setName("RuntimeLibraries");
- runtime = wc.save(false, null);
-
- assertTrue(!runtime.isWorkingCopy());
+ private static boolean projectsCreated;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (!projectsCreated) {
+ ModuleHelper.importProject("PublishEAR.zip", PROJECT_NAMES);
+ ModuleHelper.buildIncremental();
+ projectsCreated = true;
+ }
}
- public void test001ImportModules() throws Exception {
- ModuleHelper.importProject("PublishEAR.zip", PROJECT_NAMES);
+ protected IRuntime getRuntime() throws Exception {
+ if (runtime == null) {
+ IRuntimeType rt = ServerCore.findRuntimeType(RUNTIME_TYPE_ID);
+ IRuntimeWorkingCopy wc = rt.createRuntime("RuntimeLibraries", null);
+ wc.setLocation(AllTests.runtimeLocation);
+ wc.setName("RuntimeLibraries");
+ runtime = wc.save(false, null);
+ }
+ return runtime;
}
- public void test002IncrementalBuild() throws Exception {
- ModuleHelper.buildIncremental();
+ protected IModule getModule(String project) throws Exception {
+ return ModuleHelper.getModuleFromProject(project);
}
- public void test003NumModules() throws Exception {
+ protected IEnterpriseApplication getEnterpriseApp(String project) throws Exception {
+ return (IEnterpriseApplication) getModule(project).loadAdapter(IEnterpriseApplication.class, null);
+ }
+
+ protected IJ2EEModule getJ2EEModule(String project) throws Exception {
+ return (IJ2EEModule) getModule(project).loadAdapter(IJ2EEModule.class, null);
+ }
+
+ protected IWebModule getWebModule(String project) throws Exception {
+ return (IWebModule) getModule(project).loadAdapter(IWebModule.class, null);
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ suite.addTest(TestSuite.createTest(ModuleTestCase.class, "deleteProjects"));
+ }
+
+ public void testCreateRuntime() throws Exception {
+ assertTrue(!getRuntime().isWorkingCopy());
+ }
+
+ public void testNumEARModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ear").length, 1);
}
- public void test004NumModules() throws Exception {
+ public void testNumWebModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.web").length, 2);
}
- public void test005NumModules() throws Exception {
+ public void testNumEJBModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ejb").length, 1);
}
- public void test006NumModules() throws Exception {
+ public void testNumUtilityModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.utility").length, 2);
}
- public void test007NumModules() throws Exception {
+ public void testNumClientModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.appclient").length, 1);
}
- public void test008NumModules() throws Exception {
+ public void testNumConnectorModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.connector").length, 1);
}
// ---------- EAR tests ----------
- public void test020EAR() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestEAR");
- assertNotNull(module);
+ public void testEARModule() throws Exception {
+ assertNotNull(getModule("PublishTestEAR"));
}
- public void test021EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/application.xml"))
+ public void testEARFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEAR"), "META-INF/application.xml"))
fail();
}
- public void test022EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.jar"))
+ public void testEARJarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEAR"), "test.jar"))
fail();
}
- public void test023EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "jarfolder/test3.jar"))
+ public void testEARJarExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEAR"), "jarfolder/test3.jar"))
fail();
}
- public void test024EAR() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 3);
+ /*
+ * This count is incremented because, at this moment
+ * I don't know which should take precedence:
+ * the file inside the Ear project, or the reference.
+ * For now we include both.
+ */
+ public void testEARFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestEAR")), 4);
}
- public void test025EAR() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testEARFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestEAR")), 2);
}
- public void test026EAR() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ear");
+ public void testEARModuleType() throws Exception {
+ assertEquals(getModule("PublishTestEAR").getModuleType().getId(), "jst.ear");
}
- public void test027EAR() throws Exception {
- ent = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, null);
- assertNotNull(ent);
+ public void testEARGetApp() throws Exception {
+ assertNotNull(getEnterpriseApp("PublishTestEAR"));
}
- public void test028EAR() throws Exception {
- assertEquals(ent.getResourceFolders().length, 1);
+ public void testEARResourceFolderCount() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getResourceFolders().length, 1);
}
- public void test029EAR() throws Exception {
- assertEquals(ent.getModules().length, 6);
+ public void testEARModuleCount() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getModules().length, 6);
}
- public void _test030EAR() throws Exception {
- IModule[] modules = ent.getModules();
+ public void _testEARModuleNames() throws Exception {
+ IModule[] modules = getEnterpriseApp("PublishTestEAR").getModules();
List<String> list = new ArrayList<String>(modules.length);
for (IModule m : modules) {
System.out.println(m.getName());
@@ -153,414 +182,398 @@
// ---------- Utility 1 tests ----------
- public void test040Util() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestUtil");
- assertNotNull(module);
+ public void testUtilModule() throws Exception {
+ assertNotNull(getModule("PublishTestUtil"));
}
- public void test041Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testUtilFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test042Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.properties"))
+ public void testUtilFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil"), "test.properties"))
fail();
}
- public void test043Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "publish/TestUtil.class"))
+ public void testUtilClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil"), "publish/TestUtil.class"))
fail();
}
- public void test044Util() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 3);
+ public void testUtilFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestUtil")), 3);
}
- public void test045Util() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testUtilFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestUtil")), 2);
}
- public void test046Util() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.utility");
+ public void testUtilModuleType() throws Exception {
+ assertEquals(getModule("PublishTestUtil").getModuleType().getId(), "jst.utility");
}
- public void test047Util() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testUtilJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestUtil"));
}
- public void test048Util() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testUtilResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestUtil").getResourceFolders().length, 1);
}
- public void test049Util() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testUtilJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestUtil").getJavaOutputFolders().length, 1);
}
- public void test050Util() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testUtilIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestUtil").isBinary());
}
// ---------- Utility 2 tests ----------
- public void test060Util() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestUtil2");
- assertNotNull(module);
+ public void testUtil2Module() throws Exception {
+ assertNotNull(getModule("PublishTestUtil2"));
}
- public void test061Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testUtil2FileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil2"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test062Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "temp/test.properties"))
+ public void testUtil2FileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil2"), "temp/test.properties"))
fail();
}
- public void test063Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "publish/TestUtil2.class"))
+ public void testUtil2ClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestUtil2"), "publish/TestUtil2.class"))
fail();
}
- public void test064Util() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 3);
+ public void testUtil2FileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestUtil2")), 3);
}
- public void test065Util() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 3);
+ public void testUtil2FolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestUtil2")), 3);
}
- public void test066Util() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.utility");
+ public void testUtil2ModuleType() throws Exception {
+ assertEquals(getModule("PublishTestUtil2").getModuleType().getId(), "jst.utility");
}
- public void test067Util() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testUtil2J2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestUtil2"));
}
- public void test068Util() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testUtil2ResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestUtil2").getResourceFolders().length, 1);
}
- public void test069Util() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testUtil2JavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestUtil2").getJavaOutputFolders().length, 1);
}
- public void test070Util() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testUtil2IsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestUtil2").isBinary());
}
// ---------- EJB tests ----------
- public void test080EJB() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestEJB");
- assertNotNull(module);
+ public void testEJBModule() throws Exception {
+ assertNotNull(getModule("PublishTestEJB"));
}
- public void test081EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testEJBFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test082EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/ejb-jar.xml"))
+ public void testEJBFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "META-INF/ejb-jar.xml"))
fail();
}
- public void test083EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "ejbs/MyBeanLocalHome.class"))
+ public void testEJBClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "ejbs/MyBeanLocalHome.class"))
fail();
}
- public void test084EJB() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 7);
+ public void testEJBFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestEJB")), 7);
}
- public void test085EJB() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testEJBFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestEJB")), 2);
}
- public void test086EJB() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ejb");
+ public void testEJBModuleType() throws Exception {
+ assertEquals(getModule("PublishTestEJB").getModuleType().getId(), "jst.ejb");
}
- public void test087EJB() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testEJBJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestEJB"));
}
- public void test088EJB() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testEJBResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestEJB").getResourceFolders().length, 1);
}
- public void test089EJB() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testEJBJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestEJB").getJavaOutputFolders().length, 1);
}
- public void test090EJB() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testEJBIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestEJB").isBinary());
}
// ---------- Connector tests ----------
- public void test100Connector() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestConnector");
- assertNotNull(module);
+ public void testConnectorModule() throws Exception {
+ assertNotNull(getModule("PublishTestConnector"));
}
- public void test101Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testConnectorFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test102Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/ra.xml"))
+ public void testConnectorFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "META-INF/ra.xml"))
fail();
}
- public void test103Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "test/MyOtherConnectorClass.class"))
+ public void testConnectorClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "test/MyOtherConnectorClass.class"))
fail();
}
- public void test104Connector() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 5);
+ public void testConnectorFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestConnector")), 5);
}
- public void test105Connector() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 3);
+ public void testConnectorFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestConnector")), 3);
}
- public void test106Connector() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.connector");
+ public void testConnectorModuleType() throws Exception {
+ assertEquals(getModule("PublishTestConnector").getModuleType().getId(), "jst.connector");
}
- public void test107Connector() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testConnectorJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestConnector"));
}
- public void test108Connector() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testConnectorResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestConnector").getResourceFolders().length, 1);
}
- public void test109Connector() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testConnectorJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestConnector").getJavaOutputFolders().length, 1);
}
- public void test110Connector() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testConnectorIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestConnector").isBinary());
}
// ---------- Client tests ----------
- public void test120Client() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestClient");
- assertNotNull(module);
+ public void testClientModule() throws Exception {
+ assertNotNull(getModule("PublishTestClient"));
}
- public void test121Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testClientFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test122Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/application-client.xml"))
+ public void testClientFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "META-INF/application-client.xml"))
fail();
}
- public void test123Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "Main.class"))
+ public void testClientClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "Main.class"))
fail();
}
- public void test124Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "Main2.class"))
+ public void testClientClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "Main2.class"))
fail();
}
- public void test125Client() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 4);
+ public void testClientFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestClient")), 4);
}
- public void test126Client() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 1);
+ public void testClientFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestClient")), 1);
}
- public void test127Client() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.appclient");
+ public void testClientModuleType() throws Exception {
+ assertEquals(getModule("PublishTestClient").getModuleType().getId(), "jst.appclient");
}
- public void test128Client() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testClientJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestClient"));
}
- public void test129Client() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testClientResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestClient").getResourceFolders().length, 1);
}
- public void test130Client() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testClientJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestClient").getJavaOutputFolders().length, 1);
}
- public void test131Client() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testClientIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestClient").isBinary());
}
// ---------- Web 1 tests ----------
- public void test140Web() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestWeb");
- assertNotNull(module);
+ public void testWebModule() throws Exception {
+ assertNotNull(getModule("PublishTestWeb"));
}
- public void test141Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testWebFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test142Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/web.xml"))
+ public void testWebWebXmlExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/web.xml"))
fail();
}
- public void test143Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.jsp"))
+ public void testWebJSPExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "test.jsp"))
fail();
}
- public void test144Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/servtest/TestServlet2.class"))
+ public void testWebClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/classes/servtest/TestServlet2.class"))
fail();
}
- public void test145Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/servtest/TestServlet.class"))
+ public void testWebClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/classes/servtest/TestServlet.class"))
fail();
}
- public void test146Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 5);
+ public void testWebFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestWeb")), 5);
}
- public void test147Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 5);
+ public void testWebFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestWeb")), 5);
}
- public void test148Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWebModuleType() throws Exception {
+ assertEquals(getModule("PublishTestWeb").getModuleType().getId(), "jst.web");
}
public void test149Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ assertNotNull(getWebModule("PublishTestWeb"));
}
- public void test150Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWebResourceFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getResourceFolders().length, 1);
}
- public void test151Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testWebJavaOutputFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getJavaOutputFolders().length, 1);
}
- public void test152Web() throws Exception {
- assertEquals(webModule.getModules().length, 1);
+ public void testWebModuleCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getModules().length, 1);
}
- public void test153Web() throws Exception {
- assertEquals(webModule.getModules()[0].getName(), "PublishTestUtil");
+ public void testWebModuleName() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getModules()[0].getName(), "PublishTestUtil");
}
- public void test154Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb");
+ public void testWebContextRoot() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getContextRoot(), "PublishTestWeb");
}
- public void test155Web() throws Exception {
- assertFalse(webModule.isBinary());
+ public void testWebIsBinary() throws Exception {
+ assertFalse(getWebModule("PublishTestWeb").isBinary());
}
// ---------- Web 2 tests ----------
- public void test160Web() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestWeb2");
- assertNotNull(module);
+ public void testWeb2Module() throws Exception {
+ assertNotNull(getModule("PublishTestWeb2"));
}
- public void test161Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testWeb2FileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test162Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/web.xml"))
+ public void testWeb2WebXmlExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/web.xml"))
fail();
}
- public void test163Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/lib/test.jar"))
+ public void testWeb2JarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/lib/test.jar"))
fail();
}
- public void test164Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/serv/AServlet.class"))
+ public void testWeb2ClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/classes/serv/AServlet.class"))
fail();
}
- public void test165Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/serv/BServlet.class"))
+ public void testWeb2ClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/classes/serv/BServlet.class"))
fail();
}
- public void test166Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 5);
+ public void testWeb2FileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestWeb2")), 5);
}
- public void test167Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 5);
+ public void testWeb2FolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestWeb2")), 5);
}
- public void test168Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWeb2ModuleType() throws Exception {
+ assertEquals(getModule("PublishTestWeb2").getModuleType().getId(), "jst.web");
}
- public void test169Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ public void testWeb2J2EEModule() throws Exception {
+ assertNotNull(getWebModule("PublishTestWeb2"));
}
- public void test170Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWeb2ResourceFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getResourceFolders().length, 1);
}
- public void test171Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testWeb2JavaOutputFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getJavaOutputFolders().length, 1);
}
- public void test172Web() throws Exception {
- assertEquals(webModule.getModules().length, 0);
+ public void testWeb2ModuleCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getModules().length, 0);
}
- public void test173Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb2");
+ public void testWeb2ContextRoot() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getContextRoot(), "PublishTestWeb2");
}
- public void test174Web() throws Exception {
- assertFalse(webModule.isBinary());
+ public void testWeb2IsBinary() throws Exception {
+ assertFalse(getWebModule("PublishTestWeb2").isBinary());
}
- public void test199Cleanup() throws Exception {
+ public void deleteProjects() throws Exception {
for (String projectName : PROJECT_NAMES) {
ModuleHelper.deleteProject(projectName);
}
diff --git a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/NoSourceTestCase.java b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/NoSourceTestCase.java
index a944ded..ff56ed0 100644
--- a/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/NoSourceTestCase.java
+++ b/tests/org.eclipse.jst.server.core.tests/src/org/eclipse/jst/server/core/tests/j2ee/NoSourceTestCase.java
@@ -17,6 +17,7 @@
import org.eclipse.wst.server.core.*;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
public class NoSourceTestCase extends TestCase {
private static final String[] PROJECT_NAMES = new String[] {
@@ -24,59 +25,75 @@
"PublishTestWeb", "PublishTestWeb2", "PublishTestConnector", "PublishTestClient"
};
- protected static IRuntime runtime;
- protected static IModule module;
- protected static IEnterpriseApplication ent;
- protected static IWebModule webModule;
- protected static IJ2EEModule j2eeModule;
+ private static boolean projectsCreated;
- public void test001ImportModules() throws Exception {
- ModuleHelper.importProject("PublishEARNoSource.zip", PROJECT_NAMES);
+ @Override
+ protected void setUp() throws Exception {
+ if (!projectsCreated) {
+ ModuleHelper.importProject("PublishEARNoSource.zip", PROJECT_NAMES);
+ ModuleHelper.buildIncremental();
+ projectsCreated = true;
+ }
}
- public void test002IncrementalBuild() throws Exception {
- ModuleHelper.buildIncremental();
+ protected IModule getModule(String project) throws Exception {
+ return ModuleHelper.getModuleFromProject(project);
}
- public void test003NumModules() throws Exception {
+ protected IEnterpriseApplication getEnterpriseApp(String project) throws Exception {
+ return (IEnterpriseApplication) getModule(project).loadAdapter(IEnterpriseApplication.class, null);
+ }
+
+ protected IJ2EEModule getJ2EEModule(String project) throws Exception {
+ return (IJ2EEModule) getModule(project).loadAdapter(IJ2EEModule.class, null);
+ }
+
+ protected IWebModule getWebModule(String project) throws Exception {
+ return (IWebModule) getModule(project).loadAdapter(IWebModule.class, null);
+ }
+
+ public static void addOrderedTests(TestSuite suite) {
+ suite.addTest(TestSuite.createTest(NoSourceTestCase.class, "deleteProjects"));
+ }
+
+ public void testNumJstEarModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ear").length, 1);
}
- public void test004NumModules() throws Exception {
+ public void testNumJstWebModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.web").length, 2);
}
- public void test005NumModules() throws Exception {
+ public void testNumJstEjbModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.ejb").length, 1);
}
- public void test006NumModules() throws Exception {
+ public void testNumJstUtilModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.utility").length, 2);
}
- public void test007NumModules() throws Exception {
+ public void testNumJstAppModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.appclient").length, 1);
}
- public void test008NumModules() throws Exception {
+ public void testNumJstConnModules() throws Exception {
assertEquals(ServerUtil.getModules("jst.connector").length, 1);
}
// ---------- EAR tests ----------
- public void test020EAR() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestEAR");
- assertNotNull(module);
+ public void testEARGetModule() throws Exception {
+ assertNotNull(getModule("PublishTestEAR"));
}
- public void test021EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/application.xml"))
+ public void testEARFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEAR"), "META-INF/application.xml"))
fail();
}
- public void test022EAR() throws Exception {
- if (!ModuleHelper.fileExists(module, "PublishTestUtil2.jar"))
+ public void testEARJarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEAR"), "PublishTestUtil2.jar"))
fail();
}
@@ -86,33 +103,32 @@
* the file inside the Ear project, or the reference.
* For now we include both.
*/
- public void test023EAR() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 4);
+ public void testEARFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestEAR")), 4);
}
- public void test024EAR() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 1);
+ public void testEARFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestEAR")), 1);
}
- public void test025EAR() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ear");
+ public void testEARModuleType() throws Exception {
+ assertEquals(getModule("PublishTestEAR").getModuleType().getId(), "jst.ear");
}
- public void test026EAR() throws Exception {
- ent = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, null);
- assertNotNull(ent);
+ public void testEARGetApp() throws Exception {
+ assertNotNull(getEnterpriseApp("PublishTestEAR"));
}
- public void test027EAR() throws Exception {
- assertEquals(ent.getResourceFolders().length, 1);
+ public void testEARResourceFolderCount() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getResourceFolders().length, 1);
}
- public void test028EAR() throws Exception {
- assertEquals(ent.getModules().length, 6);
+ public void testEARModules() throws Exception {
+ assertEquals(getEnterpriseApp("PublishTestEAR").getModules().length, 6);
}
- public void test029EAR() throws Exception {
- IModule[] modules = ent.getModules();
+ public void testEARAModuleNames() throws Exception {
+ IModule[] modules = getEnterpriseApp("PublishTestEAR").getModules();
List<String> list = new ArrayList<String>(modules.length);
for (IModule m : modules)
list.add(m.getName());
@@ -132,401 +148,385 @@
// ---------- Utility 1 tests ----------
- public void test040Util() throws Exception {
- module = ModuleHelper.getModuleFromProject("test");
- assertNotNull(module);
+ public void testUtilGetModule() throws Exception {
+ assertNotNull(getModule("test"));
}
- public void test041Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testUtilFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test042Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.properties"))
+ public void testUtilFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test"), "test.properties"))
fail();
}
- public void test043Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "publish/TestUtil.class"))
+ public void testUtilClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test"), "publish/TestUtil.class"))
fail();
}
- public void test044Util() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 3);
+ public void testUtilFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("test")), 3);
}
- public void test045Util() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testUtilFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("test")), 2);
}
- public void test046Util() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.utility");
+ public void testUtilModuleType() throws Exception {
+ assertEquals(getModule("test").getModuleType().getId(), "jst.utility");
}
- public void test047Util() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testUtilJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("test"));
}
- public void test048Util() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 2);
+ public void testUtilResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("test").getResourceFolders().length, 2);
}
- public void test049Util() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testUtilJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("test").getJavaOutputFolders().length, 1);
}
- public void test050Util() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testUtilIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("test").isBinary());
}
// ---------- Utility 2 tests ----------
- public void test060Util() throws Exception {
- module = ModuleHelper.getModuleFromProject("test2");
- assertNotNull(module);
+ public void testUtil2Module() throws Exception {
+ assertNotNull(getModule("test2"));
}
- public void test061Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testUtil2FileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test2"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test062Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.properties"))
+ public void testUtil2FileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test2"), "test.properties"))
fail();
}
- public void test063Util() throws Exception {
- if (!ModuleHelper.fileExists(module, "publish/TestUtil.class"))
+ public void testUtil2ClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("test2"), "publish/TestUtil.class"))
fail();
}
- public void test064Util() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 3);
+ public void testUtil2FileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("test2")), 3);
}
- public void test065Util() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testUtil2FolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("test2")), 2);
}
- public void test066Util() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.utility");
+ public void testUtil2ModuleType() throws Exception {
+ assertEquals(getModule("test2").getModuleType().getId(), "jst.utility");
}
- public void test067Util() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testUtil2J2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("test2"));
}
- public void test068Util() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 2);
+ public void testUtil2ResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("test2").getResourceFolders().length, 2);
}
- public void test069Util() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testUtil2JavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("test2").getJavaOutputFolders().length, 1);
}
- public void test070Util() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testUtil2IsBinary() throws Exception {
+ assertFalse(getJ2EEModule("test2").isBinary());
}
// ---------- EJB tests ----------
- public void test080EJB() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestEJB");
- assertNotNull(module);
+ public void testEJBModule() throws Exception {
+ assertNotNull(getModule("PublishTestEJB"));
}
- public void test081EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testEJBFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test082EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/ejb-jar.xml"))
+ public void testEJBFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "META-INF/ejb-jar.xml"))
fail();
}
- public void test083EJB() throws Exception {
- if (!ModuleHelper.fileExists(module, "ejbs/MyBeanLocalHome.class"))
+ public void testEJBClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestEJB"), "ejbs/MyBeanLocalHome.class"))
fail();
}
- public void test084EJB() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 7);
+ public void testEJBFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestEJB")), 7);
}
- public void test085EJB() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 2);
+ public void testEJBFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestEJB")), 2);
}
- public void test086EJB() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.ejb");
+ public void testEJBModuleType() throws Exception {
+ assertEquals(getModule("PublishTestEJB").getModuleType().getId(), "jst.ejb");
}
- public void test087EJB() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testEJBJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestEJB"));
}
- public void test088EJB() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 2);
+ public void testEJBResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestEJB").getResourceFolders().length, 2);
}
- public void test089EJB() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testEJBJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestEJB").getJavaOutputFolders().length, 1);
}
- public void test090EJB() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testEJBIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestEJB").isBinary());
}
// ---------- Connector tests ----------
- public void test100Connector() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestConnector");
- assertNotNull(module);
+ public void testConnector() throws Exception {
+ assertNotNull(getModule("PublishTestConnector"));
}
- public void test101Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testConnectorFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test102Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/ra.xml"))
+ public void testConnectorFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "META-INF/ra.xml"))
fail();
}
- public void _test103Connector() throws Exception {
- if (!ModuleHelper.fileExists(module, "test/MyOtherConnectorClass.class"))
+ public void _testConnectorClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestConnector"), "test/MyOtherConnectorClass.class"))
fail();
}
- public void _test104Connector() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 5);
+ public void _testConnectorFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestConnector")), 5);
}
- public void _test105Connector() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 3);
+ public void _testConnectorFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestConnector")), 3);
}
- public void test106Connector() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.connector");
+ public void testConnectorModuleType() throws Exception {
+ assertEquals(getModule("PublishTestConnector").getModuleType().getId(), "jst.connector");
}
- public void test107Connector() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testConnectorJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestConnector"));
}
- public void test108Connector() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testConnectorResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestConnector").getResourceFolders().length, 1);
}
- public void test109Connector() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testConnectorJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestConnector").getJavaOutputFolders().length, 1);
}
- public void test110Connector() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testConnectorIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestConnector").isBinary());
}
// ---------- Client tests ----------
- public void test120Client() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestClient");
- assertNotNull(module);
+ public void testClientModule() throws Exception {
+ assertNotNull(getModule("PublishTestClient"));
}
- public void test121Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testClientFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test122Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/application-client.xml"))
+ public void testClientFileExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "META-INF/application-client.xml"))
fail();
}
- public void test123Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "Main.class"))
+ public void testClientClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "Main.class"))
fail();
}
- public void test124Client() throws Exception {
- if (!ModuleHelper.fileExists(module, "Main2.class"))
+ public void testClientClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestClient"), "Main2.class"))
fail();
}
- public void _test125Client() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 4);
+ public void _testClientFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestClient")), 4);
}
- public void test126Client() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 1);
+ public void testClientFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestClient")), 1);
}
- public void test127Client() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.appclient");
+ public void testClientModuleType() throws Exception {
+ assertEquals(getModule("PublishTestClient").getModuleType().getId(), "jst.appclient");
}
- public void test128Client() throws Exception {
- j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
- assertNotNull(j2eeModule);
+ public void testClientJ2EEModule() throws Exception {
+ assertNotNull(getJ2EEModule("PublishTestClient"));
}
- public void test129Client() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 2);
+ public void testClientResourceFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestClient").getResourceFolders().length, 2);
}
- public void test130Client() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testClientJavaOutputFolderCount() throws Exception {
+ assertEquals(getJ2EEModule("PublishTestClient").getJavaOutputFolders().length, 1);
}
- public void test131Client() throws Exception {
- assertFalse(j2eeModule.isBinary());
+ public void testClientIsBinary() throws Exception {
+ assertFalse(getJ2EEModule("PublishTestClient").isBinary());
}
// ---------- Web 1 tests ----------
- public void test140Web() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestWeb");
- assertNotNull(module);
+ public void testWebModule() throws Exception {
+ assertNotNull(getModule("PublishTestWeb"));
}
- public void test141Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testWebFileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test142Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/web.xml"))
+ public void testWebWebXmlExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/web.xml"))
fail();
}
- public void test143Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "test.jsp"))
+ public void testWebJSPExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "test.jsp"))
fail();
}
- public void test144Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/servtest/TestServlet2.class"))
+ public void testWebClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/classes/servtest/TestServlet2.class"))
fail();
}
- public void test145Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/servtest/TestServlet.class"))
+ public void testWebClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/classes/servtest/TestServlet.class"))
fail();
}
- public void test146Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/lib/PublishTestUtil.jar"))
+ public void testWebJarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb"), "WEB-INF/lib/PublishTestUtil.jar"))
fail();
}
- public void _test147Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 6);
+ public void _testWebFileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestWeb")), 6);
}
- public void _test148Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 5);
+ public void _testWebFolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestWeb")), 5);
}
- public void test149Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWebModuleType() throws Exception {
+ assertEquals(getModule("PublishTestWeb").getModuleType().getId(), "jst.web");
}
- public void test150Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ public void testWebJ2EEModule() throws Exception {
+ assertNotNull(getWebModule("PublishTestWeb"));
}
- public void test151Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWebResourceFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getResourceFolders().length, 1);
}
- public void test152Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testWebJavaOutputFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getJavaOutputFolders().length, 1);
}
- public void test153Web() throws Exception {
- assertEquals(webModule.getModules().length, 0);
+ public void testWebGetModules() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getModules().length, 0);
}
- public void test154Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb");
+ public void testWebGetContextRoot() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb").getContextRoot(), "PublishTestWeb");
}
- public void test155Web() throws Exception {
- assertFalse(webModule.isBinary());
+ public void testWebIsBinary() throws Exception {
+ assertFalse(getWebModule("PublishTestWeb").isBinary());
}
// ---------- Web 2 tests ----------
- public void test160Web() throws Exception {
- module = ModuleHelper.getModuleFromProject("PublishTestWeb2");
- assertNotNull(module);
+ public void testWeb2Module() throws Exception {
+ assertNotNull(getModule("PublishTestWeb2"));
}
- public void test161Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "META-INF/MANIFEST.MF"))
+ public void testWeb2FileExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "META-INF/MANIFEST.MF"))
fail();
}
- public void test162Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/web.xml"))
+ public void testWeb2WebXmlExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/web.xml"))
fail();
}
- public void test163Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/lib/test.jar"))
+ public void testWeb2JarExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/lib/test.jar"))
fail();
}
- public void test164Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/serv/AServlet.class"))
+ public void testWeb2ClassExists() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/classes/serv/AServlet.class"))
fail();
}
- public void test165Web() throws Exception {
- if (!ModuleHelper.fileExists(module, "WEB-INF/classes/serv/BServlet.class"))
+ public void testWeb2ClassExists2() throws Exception {
+ if (!ModuleHelper.fileExists(getModule("PublishTestWeb2"), "WEB-INF/classes/serv/BServlet.class"))
fail();
}
- public void test166Web() throws Exception {
- assertEquals(ModuleHelper.countFiles(module), 5);
+ public void testWeb2FileCount() throws Exception {
+ assertEquals(ModuleHelper.countFiles(getModule("PublishTestWeb2")), 5);
}
- public void test167Web() throws Exception {
- assertEquals(ModuleHelper.countFolders(module), 5);
+ public void testWeb2FolderCount() throws Exception {
+ assertEquals(ModuleHelper.countFolders(getModule("PublishTestWeb2")), 5);
}
- public void test168Web() throws Exception {
- assertEquals(module.getModuleType().getId(), "jst.web");
+ public void testWeb2ModuleType() throws Exception {
+ assertEquals(getModule("PublishTestWeb2").getModuleType().getId(), "jst.web");
}
- public void test169Web() throws Exception {
- webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
- j2eeModule = webModule;
- assertNotNull(j2eeModule);
+ public void testWeb2J2EEModule() throws Exception {
+ assertNotNull(getWebModule("PublishTestWeb2"));
}
- public void test170Web() throws Exception {
- assertEquals(j2eeModule.getResourceFolders().length, 1);
+ public void testWeb2ResourceFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getResourceFolders().length, 1);
}
- public void test171Web() throws Exception {
- assertEquals(j2eeModule.getJavaOutputFolders().length, 1);
+ public void testWeb2JavaOutputFolderCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getJavaOutputFolders().length, 1);
}
/*
@@ -534,25 +534,24 @@
* but also references a utility project named test.
* Which should prevail?
*/
- public void test172Web() throws Exception {
- assertEquals(webModule.getModules().length, 1);
+ public void testWeb2ModuleCount() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getModules().length, 1);
}
- public void test173Web() throws Exception {
- assertEquals(webModule.getModules()[0].getName(), "test");
+ public void testWeb2GetModules() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getModules()[0].getName(), "test");
}
- public void test174Web() throws Exception {
- assertEquals(webModule.getContextRoot(), "PublishTestWeb2");
+ public void testWeb2GetContextRoot() throws Exception {
+ assertEquals(getWebModule("PublishTestWeb2").getContextRoot(), "PublishTestWeb2");
}
- public void test175Web() throws Exception {
- assertFalse(webModule.isBinary());
+ public void testWeb2IsBinary() throws Exception {
+ assertFalse(getWebModule("PublishTestWeb2").isBinary());
}
- public void test199Cleanup() throws Exception {
+ public void deleteProjects() throws Exception {
for (String projectName : PROJECT_NAMES) {
- // don't delete the ear - leave for binary tests
ModuleHelper.deleteProject(projectName);
}
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jst.server.tomcat.core.tests/META-INF/MANIFEST.MF
index 5a0ad0e..e47c2c0 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jst.server.tomcat.core.tests
Bundle-SymbolicName: org.eclipse.jst.server.tomcat.core.tests
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.1.000.qualifier
Bundle-ClassPath: tests.jar
Bundle-Activator: org.eclipse.jst.server.tomcat.core.tests.TestsPlugin
Bundle-Vendor: Eclipse.org
@@ -11,7 +11,7 @@
org.eclipse.jst.server.tomcat.core.tests.module
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.commands,
- org.junit;bundle-version="[3.8.0,4.0.0)",
+ org.junit;bundle-version="3.8.0",
org.eclipse.wst.server.core,
org.eclipse.jst.server.tomcat.core,
org.eclipse.wst.server.core.tests,
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatRuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatRuntimeTestCase.java
index 18cc750..8d007c0 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatRuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatRuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.tests.ext.AbstractRuntimeTestCase;
@@ -37,4 +39,9 @@
wc.setLocation(new Path(RuntimeLocation.runtimeLocation));
return wc;
}
+
+ public static void addOrderedTests(Class testClass,TestSuite suite) {
+ AbstractRuntimeTestCase.addOrderedTests(testClass, suite);
+ AbstractRuntimeTestCase.addFinalTests(testClass, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatServerTestCase.java
index fddc122..addea57 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/AbstractTomcatServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -13,6 +13,8 @@
import java.io.File;
import java.util.List;
+import junit.framework.TestSuite;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -21,7 +23,14 @@
import org.eclipse.jst.server.tomcat.core.internal.TomcatServer;
import org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour;
import org.eclipse.jst.server.tomcat.core.tests.module.ModuleTestCase;
-import org.eclipse.wst.server.core.*;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerPort;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
@@ -75,15 +84,32 @@
return (TomcatServerBehaviour)getServer().loadAdapter(TomcatServerBehaviour.class, null);
}
- public void test0100CanAddModule() {
+ public static void addOrderedTests(Class testClass,TestSuite suite) {
+ AbstractServerTestCase.addOrderedTests(testClass, suite);
+ suite.addTest(TestSuite.createTest(testClass, "canAddModule"));
+ suite.addTest(TestSuite.createTest(testClass, "hasModule"));
+ suite.addTest(TestSuite.createTest(testClass, "addModule"));
+ suite.addTest(TestSuite.createTest(testClass, "hasModule2"));
+ suite.addTest(TestSuite.createTest(testClass, "removeModule"));
+ suite.addTest(TestSuite.createTest(testClass, "hasModule3"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyDefaultDeployConfig"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyDefaultAddPublish"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyDefaultRemovePublish"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyLegacyDeployConfig"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyLegacyAddPublish"));
+ suite.addTest(TestSuite.createTest(testClass, "verifyLegacyRemovePublish"));
+ AbstractServerTestCase.addFinalTests(testClass, suite);
+ }
+
+ public void canAddModule() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IStatus status = server.canModifyModules(new IModule[] { webModule }, null, null);
+ IStatus status = getServer().canModifyModules(new IModule[] { webModule }, null, null);
assertTrue(status.isOK());
}
- public void test0101HasModule() {
+ public void hasModule() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IModule[] modules = server.getModules();
+ IModule[] modules = getServer().getModules();
int size = modules.length;
boolean found = false;
for (int i = 0; i < size; i++) {
@@ -94,16 +120,16 @@
assertTrue(false);
}
- public void test0102AddModule() throws Exception {
+ public void addModule() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IServerWorkingCopy wc = server.createWorkingCopy();
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
wc.modifyModules(new IModule[] { webModule }, null, null);
wc.save(true, null);
}
- public void test0103HasModule() {
+ public void hasModule2() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IModule[] modules = server.getModules();
+ IModule[] modules = getServer().getModules();
int size = modules.length;
boolean found = false;
for (int i = 0; i < size; i++) {
@@ -114,16 +140,16 @@
assertTrue(false);
}
- public void test0104RemoveModule() throws Exception {
+ public void removeModule() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IServerWorkingCopy wc = server.createWorkingCopy();
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
wc.modifyModules(null, new IModule[] { webModule }, null);
wc.save(true, null);
}
- public void test0105HasModule() {
+ public void hasModule3() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IModule[] modules = server.getModules();
+ IModule[] modules = getServer().getModules();
int size = modules.length;
boolean found = false;
for (int i = 0; i < size; i++) {
@@ -141,7 +167,7 @@
/**
* @throws Exception
*/
- public void test200VerifyDefaultDeployConfig() throws Exception {
+ public void verifyDefaultDeployConfig() throws Exception {
TomcatServer ts = getTomcatServer();
assertNotNull(ts);
TomcatServerBehaviour tsb = getTomcatServerBehaviour();
@@ -189,7 +215,7 @@
/**
* @throws Exception
*/
- public void test201VerifyDefaultAddPublish() throws Exception {
+ public void verifyDefaultAddPublish() throws Exception {
IModule webModule = ModuleTestCase.webModule;
IServerWorkingCopy wc = getServer().createWorkingCopy();
wc.modifyModules(new IModule[] { webModule }, null, null);
@@ -206,9 +232,9 @@
/**
* @throws Exception
*/
- public void test202VerifyDefaultRemovePublish() throws Exception {
+ public void verifyDefaultRemovePublish() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IServerWorkingCopy wc = server.createWorkingCopy();
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
wc.modifyModules(null, new IModule[] { webModule }, null);
wc.save(true, null);
getServer().publish(IServer.PUBLISH_FULL, null);
@@ -224,7 +250,7 @@
* Deployment directory should default to "webapps".
* @throws Exception
*/
- public void test203VerifyLegacyDeployConfig() throws Exception {
+ public void verifyLegacyDeployConfig() throws Exception {
TomcatServer ts = getTomcatServer();
assertNotNull(ts);
ts.setDeployDirectory("webapps");
@@ -247,7 +273,7 @@
/**
* @throws Exception
*/
- public void test204VerifyLegacyAddPublish() throws Exception {
+ public void verifyLegacyAddPublish() throws Exception {
IModule webModule = ModuleTestCase.webModule;
IServerWorkingCopy wc = getServer().createWorkingCopy();
// Unset the deployment directory
@@ -266,9 +292,9 @@
/**
* @throws Exception
*/
- public void test205VerifyLegacyRemovePublish() throws Exception {
+ public void verifyLegacyRemovePublish() throws Exception {
IModule webModule = ModuleTestCase.webModule;
- IServerWorkingCopy wc = server.createWorkingCopy();
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
// Unset the deployment directory
((TomcatServer)wc.loadAdapter(TomcatServer.class, null)).setDeployDirectory(null);
wc.modifyModules(null, new IModule[] { webModule }, null);
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 8044c6e..a7cefb0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 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
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.eclipse.jst.server.tomcat.core.tests.internal.UtilTestCase;
import org.eclipse.jst.server.tomcat.core.tests.internal.XmlTestCase;
import org.eclipse.jst.server.tomcat.core.tests.module.DeleteModuleTestCase;
import org.eclipse.jst.server.tomcat.core.tests.module.ModuleTestCase;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.jst.server.tomcat.core.tests");
@@ -25,15 +25,19 @@
System.setProperty("wtp.autotest.noninteractive", "true");
suite.addTestSuite(ExistenceTest.class);
- suite.addTest(new OrderedTestSuite(TomcatRuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleTestCase.class));
+ suite.addTestSuite(TomcatRuntimeTestCase.class);
+ suite.addTestSuite(ModuleTestCase.class);
String s = System.getProperty("org.eclipse.jst.server.tomcat.32");
//s = "D:\\Tools\\tomcat\\jakarta-tomcat-3.2.4";
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat32RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat32ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat32RuntimeTestCase.class);
+ Tomcat32RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat32ServerTestCase.class);
+ Tomcat32ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 3.2 not found - tests skipped");
}
@@ -41,8 +45,12 @@
s = System.getProperty("org.eclipse.jst.server.tomcat.40");
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat40RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat40ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat40RuntimeTestCase.class);
+ Tomcat40RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat40ServerTestCase.class);
+ Tomcat40ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 4.0 not found - tests skipped");
}
@@ -50,8 +58,12 @@
s = System.getProperty("org.eclipse.jst.server.tomcat.41");
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat41RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat41ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat41RuntimeTestCase.class);
+ Tomcat41RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat41ServerTestCase.class);
+ Tomcat41ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 4.1 not found - tests skipped");
}
@@ -60,8 +72,12 @@
//s = "D:\\Tools\\tomcat\\jakarta-tomcat-5.0.19";
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat50RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat50ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat50RuntimeTestCase.class);
+ Tomcat50RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat50ServerTestCase.class);
+ Tomcat50ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 5.0 not found - tests skipped");
}
@@ -69,8 +85,12 @@
s = System.getProperty("org.eclipse.jst.server.tomcat.55");
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat55RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat55ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat55RuntimeTestCase.class);
+ Tomcat55RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat55ServerTestCase.class);
+ Tomcat55ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 5.5 not found - tests skipped");
}
@@ -78,8 +98,12 @@
s = System.getProperty("org.eclipse.jst.server.tomcat.60");
if (s != null && s.length() > 0) {
RuntimeLocation.runtimeLocation = s;
- suite.addTest(new OrderedTestSuite(Tomcat60RuntimeTestCase.class));
- suite.addTest(new OrderedTestSuite(Tomcat60ServerTestCase.class));
+ TestSuite subSuite = new TestSuite(Tomcat60RuntimeTestCase.class);
+ Tomcat60RuntimeTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ subSuite = new TestSuite(Tomcat60ServerTestCase.class);
+ Tomcat60ServerTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
} else {
System.err.println("Warning: Tomcat 6.0 not found - tests skipped");
}
@@ -87,7 +111,7 @@
suite.addTestSuite(UtilTestCase.class);
suite.addTestSuite(XmlTestCase.class);
- suite.addTest(new OrderedTestSuite(DeleteModuleTestCase.class));
+ suite.addTestSuite(DeleteModuleTestCase.class);
//$JUnit-END$
return suite;
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/OrderedTestSuite.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/OrderedTestSuite.java
deleted file mode 100644
index 3ada6b8..0000000
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/OrderedTestSuite.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 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 java.util.Enumeration;
-import java.util.Vector;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class OrderedTestSuite extends TestSuite {
- public OrderedTestSuite(Class theClass) {
- super(theClass);
- }
-
- public Enumeration tests() {
- Enumeration enum2 = super.tests();
-
- Vector list = new Vector();
- while (enum2.hasMoreElements()) {
- list.add(enum2.nextElement());
- }
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- TestCase t1 = (TestCase) list.get(i);
- TestCase t2 = (TestCase) list.get(j);
- if (t1.getName().compareTo(t2.getName()) > 0) {
- Object obj = list.get(i);
- list.set(i, list.get(j));
- list.set(j, obj);
- }
- }
- }
-
- return list.elements();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32RuntimeTestCase.java
index c888692..9032432 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat32RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.32";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat32RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32ServerTestCase.java
index 75d5986..77bd4e7 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat32ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat32Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.32";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat32ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat32TestConfiguration config = new Tomcat32TestConfiguration(null);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40RuntimeTestCase.java
index f272874..14de4f6 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat40RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.40";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat40RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40ServerTestCase.java
index 3d42777..25e3231 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat40ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat40Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.40";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat40ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat40TestConfiguration config = new Tomcat40TestConfiguration(null);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41RuntimeTestCase.java
index 5f1dbb2..b4a8b7c 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat41RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.41";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat41RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41ServerTestCase.java
index 222d5c8..c5a09a1 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat41ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat41Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.41";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat41ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat41TestConfiguration config = new Tomcat41TestConfiguration(null);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50RuntimeTestCase.java
index bcb010a..4aa9efe 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat50RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.50";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat50RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50ServerTestCase.java
index b35b23a..6faf012 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat50ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat50Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.50";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat50ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat50TestConfiguration config = new Tomcat50TestConfiguration(null);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55RuntimeTestCase.java
index 1ad54e2..8230669 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat55RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.55";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat55RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55ServerTestCase.java
index e94d343..a253adf 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat55ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat55Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.55";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat55ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat55TestConfiguration config = new Tomcat55TestConfiguration(null);
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60RuntimeTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60RuntimeTestCase.java
index 50e3b2d..e6c43d3 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60RuntimeTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60RuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.tests;
+import junit.framework.TestSuite;
+
public class Tomcat60RuntimeTestCase extends AbstractTomcatRuntimeTestCase {
protected String getRuntimeTypeId() {
return "org.eclipse.jst.server.tomcat.runtime.60";
}
+
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatRuntimeTestCase.addOrderedTests(Tomcat60RuntimeTestCase.class, suite);
+ }
}
diff --git a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60ServerTestCase.java b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60ServerTestCase.java
index ad952aa..76b30fb 100644
--- a/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60ServerTestCase.java
+++ b/tests/org.eclipse.jst.server.tomcat.core.tests/src/org/eclipse/jst/server/tomcat/core/tests/Tomcat60ServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -10,6 +10,8 @@
*******************************************************************************/
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.Tomcat60Configuration;
@@ -25,6 +27,10 @@
return "org.eclipse.jst.server.tomcat.60";
}
+ public static void addOrderedTests(TestSuite suite) {
+ AbstractTomcatServerTestCase.addOrderedTests(Tomcat60ServerTestCase.class, suite);
+ }
+
protected void verifyPublishedModule(IPath baseDir, IModule module)
throws Exception {
Tomcat60TestConfiguration config = new Tomcat60TestConfiguration(null);
diff --git a/tests/org.eclipse.wst.server.core.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.server.core.tests/META-INF/MANIFEST.MF
index df22916..ea8e1bd 100644
--- a/tests/org.eclipse.wst.server.core.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.wst.server.core.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.wst.server.core.tests
Bundle-SymbolicName: org.eclipse.wst.server.core.tests
-Bundle-Version: 1.0.500.qualifier
+Bundle-Version: 1.1.000.qualifier
Bundle-ClassPath: servertests.jar
Bundle-Activator: org.eclipse.wst.server.core.tests.TestsPlugin
Bundle-Vendor: Eclipse.org
@@ -15,7 +15,7 @@
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.debug.core,
- org.junit;bundle-version="[3.8.0,4.0.0)",
+ org.junit;bundle-version="3.8.0",
org.eclipse.wst.server.core
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/AllTests.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/AllTests.java
index eb278a7..968944b 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/AllTests.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2004, 2009 Eteration Bilisim A.S. and others
+* Copyright (c) 2004, 2010 Eteration Bilisim A.S. 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
@@ -58,9 +58,11 @@
suite.addTestSuite(ServerCoreTestCase.class);
suite.addTestSuite(ServerUtilTestCase.class);
- suite.addTest(new OrderedTestSuite(ProjectPropertiesTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerPreferencesTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerPortTestCase.class));
+ TestSuite subSuite = new TestSuite(ProjectPropertiesTestCase.class);
+ ProjectPropertiesTestCase.addOrderedTests(subSuite);
+ suite.addTest(subSuite);
+ suite.addTestSuite(ServerPreferencesTestCase.class);
+ suite.addTestSuite(ServerPortTestCase.class);
suite.addTestSuite(ServerOperationTestCase.class);
suite.addTestSuite(IModuleTestCase.class);
@@ -73,34 +75,34 @@
suite.addTestSuite(ServerLifecycleListenerTestCase.class);
suite.addTestSuite(PublishListenerTestCase.class);
suite.addTestSuite(ServerListenerTestCase.class);
- suite.addTest(new OrderedTestSuite(ServerEventTestCase.class));
+ suite.addTestSuite(ServerEventTestCase.class);
- suite.addTest(new OrderedTestSuite(ClientDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(RuntimeLocatorDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(RuntimeDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerBehaviourDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerTaskDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ServerLocatorDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleFileTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleFolderTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleResourceTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleResourceDeltaTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleArtifactAdapterDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(LaunchableAdapterDelegateTestCase.class));
- suite.addTest(new OrderedTestSuite(ModuleFactoryDelegateTestCase.class));
+ suite.addTestSuite(ClientDelegateTestCase.class);
+ suite.addTestSuite(RuntimeLocatorDelegateTestCase.class);
+ suite.addTestSuite(ModuleDelegateTestCase.class);
+ suite.addTestSuite(RuntimeDelegateTestCase.class);
+ suite.addTestSuite(ServerDelegateTestCase.class);
+ suite.addTestSuite(ServerBehaviourDelegateTestCase.class);
+ suite.addTestSuite(ServerTaskDelegateTestCase.class);
+ suite.addTestSuite(ServerLocatorDelegateTestCase.class);
+ suite.addTestSuite(ModuleFileTestCase.class);
+ suite.addTestSuite(ModuleFolderTestCase.class);
+ suite.addTestSuite(ModuleResourceTestCase.class);
+ suite.addTestSuite(ModuleResourceDeltaTestCase.class);
+ suite.addTestSuite(ModuleArtifactAdapterDelegateTestCase.class);
+ suite.addTestSuite(LaunchableAdapterDelegateTestCase.class);
+ suite.addTestSuite(ModuleFactoryDelegateTestCase.class);
- suite.addTest(new OrderedTestSuite(ProjectModuleTestCase.class));
- suite.addTest(new OrderedTestSuite(ProjectModuleFactoryDelegateTestCase.class));
+ suite.addTestSuite(ProjectModuleTestCase.class);
+ suite.addTestSuite(ProjectModuleFactoryDelegateTestCase.class);
- suite.addTest(new OrderedTestSuite(HTTPLaunchableTestCase.class));
- suite.addTest(new OrderedTestSuite(StaticWebTestCase.class));
- suite.addTest(new OrderedTestSuite(WebResourceTestCase.class));
+ suite.addTestSuite(HTTPLaunchableTestCase.class);
+ suite.addTestSuite(StaticWebTestCase.class);
+ suite.addTestSuite(WebResourceTestCase.class);
// Disable for now. java.io.File.renameTo() isn't able to move a file on the build system,
// likely because the location of "temp" directory and workspace are on different drives
//suite.addTest(new OrderedTestSuite(PublishUtilTestCase.class));
- suite.addTest(new OrderedTestSuite(NullModuleArtifactTestCase.class));
+ suite.addTestSuite(NullModuleArtifactTestCase.class);
suite.addTestSuite(SocketUtilTestCase.class);
suite.addTestSuite(RuntimeLifecycleAdapterTestCase.class);
suite.addTestSuite(ServerLifecycleAdapterTestCase.class);
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/OrderedTestSuite.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/OrderedTestSuite.java
deleted file mode 100644
index 947290a..0000000
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/OrderedTestSuite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 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.server.core.tests;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class OrderedTestSuite extends TestSuite {
- public OrderedTestSuite(Class theClass) {
- super(theClass);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration tests() {
- Enumeration<TestCase> enum2 = super.tests();
-
- Vector<TestCase> list = new Vector<TestCase>();
- while (enum2.hasMoreElements()) {
- list.add(enum2.nextElement());
- }
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- TestCase t1 = list.get(i);
- TestCase t2 = list.get(j);
- if (t1.getName().compareTo(t2.getName()) > 0) {
- TestCase obj = list.get(i);
- list.set(i, list.get(j));
- list.set(j, obj);
- }
- }
- }
-
- return list.elements();
- }
-}
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ProjectPropertiesTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ProjectPropertiesTestCase.java
index 6001bce..9ca01ad 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ProjectPropertiesTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ProjectPropertiesTestCase.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
@@ -11,6 +11,7 @@
package org.eclipse.wst.server.core.tests;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -21,34 +22,48 @@
protected static IProject project;
protected static ProjectProperties props;
- public void test00GetProperties() throws Exception {
- project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
- if (project != null && !project.exists()) {
- project.create(null);
- project.open(null);
+ protected ProjectProperties getProjectProperties() throws Exception{
+ if (props == null) {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
+ if (project != null && !project.exists()) {
+ project.create(null);
+ project.open(null);
+ }
+ props = ServerPlugin.getProjectProperties(project);
}
- props = ServerPlugin.getProjectProperties(project);
+ return props;
}
- public void test03GetRuntime() throws Exception {
- assertNull(props.getRuntimeTarget());
+ public static void addOrderedTests(TestSuite suite) {
+ suite.addTest(TestSuite.createTest(ProjectPropertiesTestCase.class, "deleteProject"));
}
- public void test04GetServerProject() throws Exception {
- assertFalse(props.isServerProject());
+ public void testGetProperties() throws Exception {
+ getProjectProperties();
}
- public void test10SetServerProject() throws Exception {
- props.setServerProject(true, null);
- assertTrue(props.isServerProject());
+ public void testGetRuntime() throws Exception {
+ assertNull(getProjectProperties().getRuntimeTarget());
}
- public void test11UnsetServerProject() throws Exception {
- props.setServerProject(false, null);
- assertFalse(props.isServerProject());
+ public void testGetServerProject() throws Exception {
+ assertFalse(getProjectProperties().isServerProject());
}
- public void test14End() throws Exception {
- project.delete(true, true, null);
+ public void testSetServerProject() throws Exception {
+ getProjectProperties().setServerProject(true, null);
+ assertTrue(getProjectProperties().isServerProject());
}
+
+ public void testUnsetServerProject() throws Exception {
+ getProjectProperties().setServerProject(false, null);
+ assertFalse(getProjectProperties().isServerProject());
+ }
+
+ public void deleteProject() throws Exception {
+ if (project != null) {
+ project.delete(true, true, null);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerEventTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerEventTestCase.java
index 4b1b7d8..a7c20ca 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerEventTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerEventTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -26,7 +26,8 @@
import junit.framework.TestCase;
public class ServerEventTestCase extends TestCase {
- private static ServerEvent event;
+ private static ServerEvent serverEvent;
+ private static ServerEvent moduleEvent;
private static int SAMPLE_KIND = ServerEvent.STATE_CHANGE;
private static IServer SAMPLE_SERVER = createSampleServer();
@@ -236,67 +237,66 @@
};
}
- public static ServerEvent createSampleServerEvent() {
- return new ServerEvent(SAMPLE_KIND, SAMPLE_SERVER, SAMPLE_STATE, SAMPLE_PUBLISHING_STATE, SAMPLE_RESTART_STATE);
- }
-
- public void test010CreateServerEvent() {
- event = ServerEventTestCase.createSampleServerEvent();
- }
-
- public void test011ServerGetKind() {
- assertTrue((event.getKind() & (ServerEvent.SERVER_CHANGE | SAMPLE_KIND)) != 0);
- }
-
- public void test013ServerGetPublishingState() {
- assertEquals(SAMPLE_PUBLISHING_STATE, event.getPublishState());
- }
-
- public void test014ServerGetRestartState() {
- assertEquals(SAMPLE_RESTART_STATE, event.getRestartState());
- }
-
- public void test015ServerGetServer() {
- assertEquals(SAMPLE_SERVER, event.getServer());
- }
-
- public void test016ServerGetState() {
- assertEquals(SAMPLE_STATE,event.getState());
- }
-
- public void test110CreateModuleEvent() {
- try {
- event = new ServerEvent(SAMPLE_KIND, SAMPLE_SERVER, SAMPLE_MODULE_TREE, SAMPLE_STATE, SAMPLE_PUBLISHING_STATE, SAMPLE_RESTART_STATE);
- } catch (Exception e) {
- // ignore
+ protected ServerEvent getSampleServerEvent() {
+ if (serverEvent == null) {
+ serverEvent = new ServerEvent(SAMPLE_KIND, SAMPLE_SERVER, SAMPLE_STATE, SAMPLE_PUBLISHING_STATE, SAMPLE_RESTART_STATE);
}
+ return serverEvent;
}
- public void test111ModuleGetKind() {
- assertTrue((event.getKind() & (ServerEvent.MODULE_CHANGE | SAMPLE_KIND)) != 0);
+ protected ServerEvent getSampleModuleEvent() {
+ if (moduleEvent == null) {
+ moduleEvent = new ServerEvent(SAMPLE_KIND, SAMPLE_SERVER, SAMPLE_MODULE_TREE, SAMPLE_STATE, SAMPLE_PUBLISHING_STATE, SAMPLE_RESTART_STATE);
+ }
+ return moduleEvent;
}
- public void test112ModuleGetModuleTree() {
+
+ public void testServerGetKind() {
+ assertTrue((getSampleServerEvent().getKind() & (ServerEvent.SERVER_CHANGE | SAMPLE_KIND)) != 0);
+ }
+
+ public void testServerGetPublishingState() {
+ assertEquals(SAMPLE_PUBLISHING_STATE, getSampleServerEvent().getPublishState());
+ }
+
+ public void testServerGetRestartState() {
+ assertEquals(SAMPLE_RESTART_STATE, getSampleServerEvent().getRestartState());
+ }
+
+ public void testServerGetServer() {
+ assertEquals(SAMPLE_SERVER, getSampleServerEvent().getServer());
+ }
+
+ public void testServerGetState() {
+ assertEquals(SAMPLE_STATE,getSampleServerEvent().getState());
+ }
+
+ public void testModuleGetKind() {
+ assertTrue((getSampleModuleEvent().getKind() & (ServerEvent.MODULE_CHANGE | SAMPLE_KIND)) != 0);
+ }
+
+ public void testModuleGetModuleTree() {
try {
- assertEquals(SAMPLE_MODULE_TREE, event.getModule());
+ assertEquals(SAMPLE_MODULE_TREE, getSampleModuleEvent().getModule());
} catch (Exception e) {
// allow failure for now - will need to fix this test
}
}
- public void test113ModuleGetPublishingState() {
- assertEquals(SAMPLE_PUBLISHING_STATE, event.getPublishState());
+ public void testModuleGetPublishingState() {
+ assertEquals(SAMPLE_PUBLISHING_STATE, getSampleModuleEvent().getPublishState());
}
- public void test114ModuleGetRestartState() {
- assertEquals(SAMPLE_RESTART_STATE, event.getRestartState());
+ public void testModuleGetRestartState() {
+ assertEquals(SAMPLE_RESTART_STATE, getSampleModuleEvent().getRestartState());
}
- public void test115ModuleGetServer() {
- assertEquals(SAMPLE_SERVER, event.getServer());
+ public void testModuleGetServer() {
+ assertEquals(SAMPLE_SERVER, getSampleModuleEvent().getServer());
}
- public void test116ModuleGetState() {
- assertEquals(SAMPLE_STATE,event.getState());
+ public void testModuleGetState() {
+ assertEquals(SAMPLE_STATE,getSampleModuleEvent().getState());
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerOperationTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerOperationTestCase.java
index 207c7c8..8a0f8f4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerOperationTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerOperationTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,15 +17,22 @@
public class ServerOperationTestCase extends TestCase {
protected static IServer.IOperationListener listener;
- public void test00Create() throws Exception {
- listener = new IServer.IOperationListener() {
- public void done(IStatus result) {
- // ignore
- }
- };
+ protected IServer.IOperationListener getListener() {
+ if (listener == null) {
+ listener = new IServer.IOperationListener() {
+ public void done(IStatus result) {
+ // ignore
+ }
+ };
+ }
+ return listener;
+ }
+
+ public void testCreate() throws Exception {
+ getListener();
}
- public void test01Done() throws Exception {
- listener.done(null);
+ public void testDone() throws Exception {
+ getListener().done(null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerPreferencesTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerPreferencesTestCase.java
index b4e6ca0..497d727 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerPreferencesTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerPreferencesTestCase.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004, 2007 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
@@ -17,26 +17,29 @@
public class ServerPreferencesTestCase extends TestCase {
protected static ServerPreferences prefs;
- public void test00GetProperties() throws Exception {
- prefs = ServerPreferences.getInstance();
+ protected ServerPreferences getServerPrefs() {
+ if (prefs == null) {
+ prefs = ServerPreferences.getInstance();
+ }
+ return prefs;
}
- public void test01GetPref() throws Exception {
- prefs.isAutoPublishing();
+ public void testGetAutoPubPref() throws Exception {
+ getServerPrefs().isAutoPublishing();
}
- public void test04SetPref() throws Exception {
- prefs.setAutoPublishing(false);
- assertFalse(prefs.isAutoPublishing());
+ public void testSetAutoPubPrefFalse() throws Exception {
+ getServerPrefs().setAutoPublishing(false);
+ assertFalse(getServerPrefs().isAutoPublishing());
}
- public void test05SetPref() throws Exception {
- prefs.setAutoPublishing(true);
- assertTrue(prefs.isAutoPublishing());
+ public void testSetAutoPubPrefTrue() throws Exception {
+ getServerPrefs().setAutoPublishing(true);
+ assertTrue(getServerPrefs().isAutoPublishing());
}
- public void test10DefaultPref() throws Exception {
- prefs.setAutoPublishing(prefs.isDefaultAutoPublishing());
- assertEquals(prefs.isAutoPublishing(), prefs.isDefaultAutoPublishing());
+ public void testDefaultAutoPubPref() throws Exception {
+ getServerPrefs().setAutoPublishing(getServerPrefs().isDefaultAutoPublishing());
+ assertEquals(getServerPrefs().isAutoPublishing(), getServerPrefs().isDefaultAutoPublishing());
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractRuntimeTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractRuntimeTestCase.java
index e72bb3c..8dc857d 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractRuntimeTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractRuntimeTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -14,9 +14,11 @@
import java.beans.PropertyChangeListener;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.*;
import org.eclipse.wst.server.core.internal.ProjectProperties;
@@ -52,48 +54,84 @@
return runtime;
}
+ protected IProject getProject() throws CoreException {
+ if (project == null) {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
+ if (project != null && !project.exists()) {
+ project.create(null);
+ project.open(null);
+ }
+ }
+ return project;
+ }
+
+ protected ProjectProperties getProjectProperties() throws CoreException {
+ if (props == null) {
+ props = ServerPlugin.getProjectProperties(getProject());
+ }
+ return props;
+ }
+
+ protected IRuntimeWorkingCopy getRuntimeWorkingCopy() throws Exception {
+ if (runtimeWC == null) {
+ runtimeWC = getRuntime().createWorkingCopy();
+ }
+ return runtimeWC;
+ }
+
public abstract IRuntime createRuntime() throws Exception;
public abstract void deleteRuntime(IRuntime runtime2) throws Exception;
- public void test0000GetProperties() throws Exception {
- project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
- if (project != null && !project.exists()) {
- project.create(null);
- project.open(null);
- }
- props = ServerPlugin.getProjectProperties(project);
+ public static void addOrderedTests(Class<? extends TestCase> testClass, TestSuite suite) {
+ suite.addTest(TestSuite.createTest(testClass, "deleteProject"));
+ suite.addTest(TestSuite.createTest(testClass, "createWorkingCopy"));
+ suite.addTest(TestSuite.createTest(testClass, "isWorkingCopyDirty"));
+ suite.addTest(TestSuite.createTest(testClass, "setReadOnly"));
+ suite.addTest(TestSuite.createTest(testClass, "setStub"));
+ suite.addTest(TestSuite.createTest(testClass, "isWorkingCopyDirty2"));
+ suite.addTest(TestSuite.createTest(testClass, "addPropertyChangeListener"));
+ suite.addTest(TestSuite.createTest(testClass, "removePropertyChangeListener"));
}
- public void test0001GetRuntime() throws Exception {
- assertNull(props.getRuntimeTarget());
+ public static void addFinalTests(Class<? extends TestCase> testClass,TestSuite suite) {
+ suite.addTest(TestSuite.createTest(testClass, "clearWorkingCopy"));
+ suite.addTest(TestSuite.createTest(testClass, "deleteRuntime"));
}
- public void test0003End() throws Exception {
- project.delete(true, true, null);
+ public void testGetProperties() throws Exception {
+ getProjectProperties();
}
- public void test0004GetAdapter() throws Exception {
+ public void testGetRuntime() throws Exception {
+ assertNull(getProjectProperties().getRuntimeTarget());
+ }
+
+ public void deleteProject() throws Exception {
+ getProject().delete(true, true, null);
+ }
+
+ public void testGetAdapter() throws Exception {
getRuntime().getAdapter(RuntimeDelegate.class);
}
- public void test0005LoadAdapter() throws Exception {
+ public void testLoadAdapter() throws Exception {
getRuntime().loadAdapter(RuntimeDelegate.class, null);
}
- public void test0006Validate() throws Exception {
+ public void testValidate() throws Exception {
IStatus status = getRuntime().validate(null);
assertTrue(status.isOK() || status.getSeverity() == IStatus.WARNING);
}
- public void test0007Validate() throws Exception {
+ public void testValidate2() throws Exception {
IRuntimeWorkingCopy wc = getRuntime().createWorkingCopy();
wc.setLocation(null);
IStatus status = wc.validate(null);
assertTrue(!status.isOK());
}
- public void test0008ModifyRuntime() throws Exception {
+ public void testModifyRuntime() throws Exception {
IRuntimeWorkingCopy wc = getRuntime().createWorkingCopy();
String name = wc.getName();
wc.setName(name + "x");
@@ -101,73 +139,73 @@
wc.save(false, null);
}
- public void test0009IsPrivate() {
- ((Runtime)runtime).isPrivate();
+ public void testIsPrivate() throws Exception {
+ ((Runtime)getRuntime()).isPrivate();
}
- public void test0010IsReadOnly() {
- runtime.isReadOnly();
+ public void testIsReadOnly() throws Exception {
+ getRuntime().isReadOnly();
}
- public void test0011GetId() {
- runtime.getId();
+ public void testGetId() throws Exception {
+ getRuntime().getId();
}
- public void test0011GetName() {
- runtime.getName();
+ public void testGetName() throws Exception {
+ getRuntime().getName();
}
- public void test0012GetTimestamp() {
- ((Runtime)runtime).getTimestamp();
+ public void testGetTimestamp() throws Exception {
+ ((Runtime)getRuntime()).getTimestamp();
}
- public void test0013GetRuntimeType() {
- assertNotNull(runtime.getRuntimeType());
+ public void testGetRuntimeType() throws Exception {
+ assertNotNull(getRuntime().getRuntimeType());
}
- public void test0014GetLocation() {
- assertNotNull(runtime.getLocation());
+ public void testGetLocation() throws Exception {
+ assertNotNull(getRuntime().getLocation());
}
- public void test0015IsStub() {
- runtime.isStub();
+ public void testIsStub() throws Exception {
+ getRuntime().isStub();
}
- public void test0016CreateWorkingCopy() {
- runtimeWC = runtime.createWorkingCopy();
+ public void createWorkingCopy() throws Exception {
+ getRuntimeWorkingCopy();
}
- public void test0017IsDirty() {
- assertFalse(runtimeWC.isDirty());
+ public void isWorkingCopyDirty() throws Exception {
+ assertFalse(getRuntimeWorkingCopy().isDirty());
}
- public void test0018SetReadOnly() {
- runtimeWC.setReadOnly(true);
- runtimeWC.setReadOnly(false);
+ public void setReadOnly() throws Exception {
+ getRuntimeWorkingCopy().setReadOnly(true);
+ getRuntimeWorkingCopy().setReadOnly(false);
}
- public void test0019SetStub() {
- runtimeWC.setStub(true);
- runtimeWC.setStub(false);
+ public void setStub() throws Exception {
+ getRuntimeWorkingCopy().setStub(true);
+ getRuntimeWorkingCopy().setStub(false);
}
- public void test0019IsDirty() {
- assertTrue(runtimeWC.isDirty());
+ public void isWorkingCopyDirty2() throws Exception {
+ assertTrue(getRuntimeWorkingCopy().isDirty());
}
- public void test0020AddPropertyChangeListener() {
- runtimeWC.addPropertyChangeListener(pcl);
+ public void addPropertyChangeListener() throws Exception {
+ getRuntimeWorkingCopy().addPropertyChangeListener(pcl);
}
- public void test0020RemovePropertyChangeListener() {
- runtimeWC.removePropertyChangeListener(pcl);
+ public void removePropertyChangeListener() throws Exception {
+ getRuntimeWorkingCopy().removePropertyChangeListener(pcl);
}
- public void test0021Clear() {
+ public void clearWorkingCopy() {
runtimeWC = null;
}
- public void test1001Delete() throws Exception {
+ public void deleteRuntime() throws Exception {
deleteRuntime(getRuntime());
runtime = null;
}
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractServerTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractServerTestCase.java
index 2eb142f..19b0f1c 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractServerTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ext/AbstractServerTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -14,6 +14,7 @@
import java.beans.PropertyChangeListener;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -64,11 +65,43 @@
return server;
}
+ protected IServerAttributes getServerAttributes() throws Exception {
+ if (serverAttr == null) {
+ serverAttr = getServer();
+ }
+ return serverAttr;
+ }
+
+ protected IServerWorkingCopy getServerWorkingCopy() throws Exception {
+ if (serverWC == null) {
+ serverWC = getServer().createWorkingCopy();
+ }
+ return serverWC;
+ }
+
public abstract IServer createServer() throws Exception;
public abstract void deleteServer(IServer server2) throws Exception;
- public void test0000GetProperties() throws Exception {
+ public static void addOrderedTests(Class<? extends TestCase> testClass, TestSuite suite) {
+ suite.addTest(TestSuite.createTest(testClass, "serverPublish"));
+ suite.addTest(TestSuite.createTest(testClass, "serverCanRun"));
+ suite.addTest(TestSuite.createTest(testClass, "serverRun"));
+ suite.addTest(TestSuite.createTest(testClass, "serverCanStop"));
+ suite.addTest(TestSuite.createTest(testClass, "serverStop"));
+ suite.addTest(TestSuite.createTest(testClass, "serverCanDebug"));
+ suite.addTest(TestSuite.createTest(testClass, "serverDebug"));
+ suite.addTest(TestSuite.createTest(testClass, "serverCanStop2"));
+ suite.addTest(TestSuite.createTest(testClass, "serverStop2"));
+ suite.addTest(TestSuite.createTest(testClass, "deleteProject"));
+ }
+
+ public static void addFinalTests(Class<? extends TestCase> testClass,TestSuite suite) {
+ suite.addTest(TestSuite.createTest(testClass, "clearWorkingCopy"));
+ suite.addTest(TestSuite.createTest(testClass, "deleteServer"));
+ }
+
+ public void testGetProperties() throws Exception {
project = ResourcesPlugin.getWorkspace().getRoot().getProject("test");
if (project != null && !project.exists()) {
project.create(null);
@@ -77,68 +110,69 @@
props = ServerPlugin.getProjectProperties(project);
}
- public void test0004End() throws Exception {
- project.delete(true, true, null);
+ public void deleteProject() throws Exception {
+ if (project != null) {
+ project.delete(true, true, null);
+ }
}
- public void test0005Delegate() throws Exception {
+ public void testServerGetDelegate() throws Exception {
getServer().getAdapter(ServerDelegate.class);
}
- public void test0005bDelegate() throws Exception {
+ public void testServerLoadDelegate() throws Exception {
getServer().loadAdapter(ServerDelegate.class, null);
}
- public void test0005cDelegate() throws Exception {
- serverAttr = server;
- serverAttr.getAdapter(ServerDelegate.class);
+ public void testServerAttributesGetDelegate() throws Exception {
+ getServerAttributes().getAdapter(ServerDelegate.class);
}
- public void test0005dDelegate() throws Exception {
- serverAttr.loadAdapter(ServerDelegate.class, null);
+ public void testServerAttributesLoadDelegate() throws Exception {
+ getServerAttributes().loadAdapter(ServerDelegate.class, null);
}
- public void test0006Delegate() throws Exception {
+ public void testServerGetBehaviourDelegate() throws Exception {
getServer().getAdapter(ServerBehaviourDelegate.class);
}
- public void test0007Publish() throws Exception {
+ public void serverPublish() throws Exception {
getServer().publish(IServer.PUBLISH_FULL, null);
}
- public void test0008CanRun() throws Exception {
+ public void serverCanRun() throws Exception {
assertTrue(getServer().canStart(ILaunchManager.RUN_MODE).isOK());
}
- public void test0009Run() throws Exception {
+ public void serverRun() throws Exception {
getServer().synchronousStart(ILaunchManager.RUN_MODE, null);
}
- public void test0010CanStop() throws Exception {
+ public void serverCanStop() throws Exception {
assertTrue(getServer().canStop().isOK());
}
- public void test0011Stop() throws Exception {
+ public void serverStop() throws Exception {
getServer().synchronousStop(false);
}
- public void test0012CanDebug() throws Exception {
+ public void serverCanDebug() throws Exception {
assertTrue(getServer().canStart(ILaunchManager.DEBUG_MODE).isOK());
}
- public void test0013Debug() throws Exception {
- server.synchronousStart(ILaunchManager.DEBUG_MODE, null);
+ public void serverDebug() throws Exception {
+ getServer().synchronousStart(ILaunchManager.DEBUG_MODE, null);
}
- public void test0014CanStop() {
- assertTrue(server.canStop().isOK());
+ public void serverCanStop2() throws Exception {
+ assertTrue(getServer().canStop().isOK());
}
- public void test0015Stop() {
- server.synchronousStop(false);
+ public void serverStop2() throws Exception {
+ getServer().synchronousStop(false);
}
- public void test0016GetServerPorts() {
+ public void testGetServerPorts() {
ServerPort[] ports = server.getServerPorts(null);
if (ports != null) {
for (ServerPort port : ports) {
@@ -155,209 +189,199 @@
}
}
- public void test0017GetServerState() {
- server.getServerState();
+ public void testGetServerState() throws Exception {
+ getServer().getServerState();
}
- public void test0018GetServerPublishState() {
- server.getServerPublishState();
+ public void testGetServerPublishState() throws Exception {
+ getServer().getServerPublishState();
}
- public void test0019GetServerRestartState() {
- server.getServerRestartState();
+ public void testGetServerRestartState() throws Exception {
+ getServer().getServerRestartState();
}
- public void test0020GetModuleState() {
+ public void testGetModuleState() {
try {
- server.getModuleState(null);
+ getServer().getModuleState(null);
} catch (Exception e) {
// ignore
}
}
- public void test0021GetModulePublishState() {
+ public void testGetModulePublishState() {
try {
- server.getModulePublishState(null);
+ getServer().getModulePublishState(null);
} catch (Exception e) {
// ignore
}
}
- public void test0022GetModuleRestartState() {
+ public void testGetModuleRestartState() {
try {
- server.getModuleRestartState(null);
+ getServer().getModuleRestartState(null);
} catch (Exception e) {
// ignore
}
}
- public void test0023GetMode() {
- server.getMode();
+ public void testGetMode() throws Exception {
+ getServer().getMode();
}
- public void test0024CanPublish() {
- server.canPublish();
+ public void testCanPublish() throws Exception {
+ getServer().canPublish();
}
- public void test0025CanRestart() {
- server.canRestart("run");
+ public void testCanRestart() throws Exception {
+ getServer().canRestart("run");
}
- public void test0026CanControlModule() {
+ public void testCanControlModule() {
try {
- server.canControlModule(null, null);
+ getServer().canControlModule(null, null);
} catch (Exception e) {
// ignore
}
}
- public void test0027AddServerListener() {
- server.addServerListener(sl);
+ public void testAddServerListener() throws Exception {
+ getServer().addServerListener(sl);
}
- public void test0028AddServerListener() {
- server.addServerListener(sl, 0);
+ public void testAddServerListener2() throws Exception {
+ getServer().addServerListener(sl, 0);
}
- public void test0029RemoveServerListener() {
- server.removeServerListener(sl);
+ public void testRemoveServerListener() throws Exception {
+ getServer().removeServerListener(sl);
}
- public void test0030GetServerAttributes() {
- serverAttr = server;
+ public void testGetName() throws Exception {
+ getServerAttributes().getName();
}
- public void test0031GetName() {
- serverAttr.getName();
+ public void testGetId() throws Exception {
+ getServerAttributes().getId();
}
- public void test0032GetId() {
- serverAttr.getId();
+ public void testIsReadOnly() throws Exception {
+ getServerAttributes().isReadOnly();
}
- public void test0033IsReadOnly() {
- serverAttr.isReadOnly();
+ public void testIsWorkingCopy() throws Exception {
+ getServerAttributes().isWorkingCopy();
}
- public void test0034IsWorkingCopy() {
- serverAttr.isWorkingCopy();
+ public void testGetHost() throws Exception {
+ getServerAttributes().getHost();
}
- public void test0035GetHost() {
- serverAttr.getHost();
+ public void testGetRuntime() throws Exception {
+ getServerAttributes().getRuntime();
}
- public void test0036GetRuntime() {
- serverAttr.getRuntime();
- }
-
- public void test0037GetServerType() {
- serverAttr.getServerType();
+ public void testGetServerType() throws Exception {
+ getServerAttributes().getServerType();
}
- public void test0038GetServerConfiguration() {
- serverAttr.getServerConfiguration();
+ public void testGetServerConfiguration() throws Exception {
+ getServerAttributes().getServerConfiguration();
}
- public void test0039CreateWorkingCopy() {
- serverAttr.createWorkingCopy();
+ public void testCreateWorkingCopy() throws Exception {
+ getServerAttributes().createWorkingCopy();
}
- public void test0040GetModules() {
- serverAttr.getModules();
+ public void testGetModules() throws Exception {
+ getServerAttributes().getModules();
}
- public void test0041CanModifyModules() {
+ public void testCanModifyModules() {
try {
- serverAttr.canModifyModules(null, null, null);
+ getServerAttributes().canModifyModules(null, null, null);
} catch (Exception e) {
// ignore
}
}
- public void test0042GetChildModules() {
+ public void testGetChildModules() {
try {
- serverAttr.getChildModules(null, null);
+ getServerAttributes().getChildModules(null, null);
} catch (Exception e) {
// ignore
}
}
- public void test0043GetRootModules() {
+ public void testGetRootModules() {
try {
- serverAttr.getRootModules(null, null);
+ getServerAttributes().getRootModules(null, null);
} catch (Exception e) {
// ignore
}
}
- public void test0044GetServerPorts() {
- serverAttr.getServerPorts(null);
+ public void testGetServerPorts2() throws Exception {
+ getServerAttributes().getServerPorts(null);
}
- public void test0045Delete() {
+ public void testServerAttributesDelete() {
try {
- IServerAttributes sa = serverAttr.createWorkingCopy();
+ IServerAttributes sa = getServerAttributes().createWorkingCopy();
sa.delete();
} catch (Exception e) {
// ignore
}
}
- public void test0046CreateWorkingCopy() {
- serverWC = server.createWorkingCopy();
+ public void testIsDirty() throws Exception {
+ assertFalse(getServerWorkingCopy().isDirty());
}
- public void test0047IsDirty() {
- assertFalse(serverWC.isDirty());
+ public void testSetName() throws Exception {
+ getServerWorkingCopy().setName("test");
}
- public void test0048SetName() {
- serverWC.setName("test");
+ public void testSetHost() throws Exception {
+ getServerWorkingCopy().setHost("www.eclipse.org");
}
- public void test0049SetHost() {
- serverWC.setHost("www.eclipse.org");
+ public void testSetReadOnly() throws Exception {
+ getServerWorkingCopy().setReadOnly(true);
}
- public void test0050SetReadOnly() {
- serverWC.setReadOnly(true);
+ public void testServerWCIsDirty() throws Exception {
+ assertTrue(getServerWorkingCopy().isDirty());
}
- public void test0051IsDirty() {
- assertTrue(serverWC.isDirty());
+ public void testPropertyChangeListener() throws Exception {
+ getServerWorkingCopy().addPropertyChangeListener(pcl);
+
+ getServerWorkingCopy().removePropertyChangeListener(pcl);
}
- public void test0052AddPropertyChangeListener() {
- serverWC.addPropertyChangeListener(pcl);
- }
-
- public void test0053RemovePropertyChangeListener() {
- serverWC.removePropertyChangeListener(pcl);
- }
-
- public void test0054GetOriginal() {
- serverWC.getOriginal();
+ public void testGetOriginal() throws Exception{
+ getServerWorkingCopy().getOriginal();
}
- public void test0055SetServerConfiguration() {
- serverWC.setServerConfiguration(null);
+ public void testSetServerConfiguration() throws Exception {
+ getServerWorkingCopy().setServerConfiguration(null);
}
- public void test0056ModifyModules() {
+ public void testModifyModules() {
try {
- serverWC.modifyModules(null, null, null);
+ getServerWorkingCopy().modifyModules(null, null, null);
} catch (Exception e) {
// ignore
}
}
- public void test0057Clear() {
+ public void clearWorkingCopy() {
serverAttr = null;
serverWC = null;
}
- public void test1001Delete() throws Exception {
+ public void deleteServer() throws Exception {
deleteServer(getServer());
server = null;
}
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ClientDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ClientDelegateTestCase.java
index 580a82f..f4fd6bc 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ClientDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ClientDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,15 +18,18 @@
public class ClientDelegateTestCase extends TestCase {
protected static ClientDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestClientDelegate();
+ protected ClientDelegate getClientDelegate() {
+ if (delegate == null) {
+ delegate = new TestClientDelegate();
+ }
+ return delegate;
+ }
+
+ public void testSupports() throws Exception {
+ getClientDelegate().supports(null, null, null);
}
- public void test01Supports() throws Exception {
- delegate.supports(null, null, null);
- }
-
- public void test02Launch() throws Exception {
- delegate.launch(null, null, null, null);
+ public void testLaunch() throws Exception {
+ getClientDelegate().launch(null, null, null, null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/LaunchableAdapterDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/LaunchableAdapterDelegateTestCase.java
index a933df1..7712915 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/LaunchableAdapterDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/LaunchableAdapterDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -20,15 +20,18 @@
public class LaunchableAdapterDelegateTestCase extends TestCase {
protected static LaunchableAdapterDelegate delegate;
- public void test00CreateDelegate() {
- delegate = new LaunchableAdapterDelegate() {
- public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException {
- return null;
- }
- };
+ protected LaunchableAdapterDelegate getLaunchableAdapterDelegate() {
+ if (delegate == null) {
+ delegate = new LaunchableAdapterDelegate() {
+ public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException {
+ return null;
+ }
+ };
+ }
+ return delegate;
}
-
- public void test01GetLaunchable() throws Exception {
- delegate.getLaunchable(null, null);
+
+ public void testGetLaunchable() throws Exception {
+ getLaunchableAdapterDelegate().getLaunchable(null, null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleArtifactAdapterDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleArtifactAdapterDelegateTestCase.java
index 6add1d6..0de15d7 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleArtifactAdapterDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleArtifactAdapterDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,15 +18,18 @@
public class ModuleArtifactAdapterDelegateTestCase extends TestCase {
protected static ModuleArtifactAdapterDelegate delegate;
- public void test00CreateDelegate() {
- delegate = new ModuleArtifactAdapterDelegate() {
- public IModuleArtifact getModuleArtifact(Object obj) {
- return null;
- }
- };
+ protected ModuleArtifactAdapterDelegate getModuleArtifactAdapterDelegate() {
+ if (delegate == null) {
+ delegate = new ModuleArtifactAdapterDelegate() {
+ public IModuleArtifact getModuleArtifact(Object obj) {
+ return null;
+ }
+ };
+ }
+ return delegate;
}
-
- public void test01GetModuleArtifact() {
- delegate.getModuleArtifact(null);
+
+ public void testGetModuleArtifact() {
+ getModuleArtifactAdapterDelegate().getModuleArtifact(null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleDelegateTestCase.java
index c6100a4..5ba7ad3 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,31 +18,33 @@
public class ModuleDelegateTestCase extends TestCase {
protected static ModuleDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestModuleDelegate();
+ protected ModuleDelegate getModuleDelegate() {
+ if (delegate == null) {
+ delegate = new TestModuleDelegate();
+ }
+ return delegate;
+ }
+ public void testInitialize() throws Exception {
+ getModuleDelegate().initialize();
}
- public void test01Initialize() throws Exception {
- delegate.initialize();
+ public void testInitialize2() throws Exception {
+ getModuleDelegate().initialize(null);
}
- public void test02Initialize() throws Exception {
- delegate.initialize(null);
+ public void testGetChildModules() throws Exception {
+ getModuleDelegate().getChildModules();
}
- public void test03GetChildModules() throws Exception {
- delegate.getChildModules();
+ public void testGetModule() throws Exception {
+ getModuleDelegate().getModule();
}
- public void test04GetModule() throws Exception {
- delegate.getModule();
+ public void testValidate() throws Exception {
+ getModuleDelegate().validate();
}
- public void test05Validate() throws Exception {
- delegate.validate();
- }
-
- public void test06Members() throws Exception {
- delegate.members();
+ public void testMembers() throws Exception {
+ getModuleDelegate().members();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFactoryDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFactoryDelegateTestCase.java
index 14dd4eb..34684d7 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFactoryDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFactoryDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,19 +18,22 @@
public class ModuleFactoryDelegateTestCase extends TestCase {
protected static ModuleFactoryDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestModuleFactoryDelegate();
+ protected ModuleFactoryDelegate getModuleFactoryDelegate() {
+ if (delegate == null) {
+ delegate = new TestModuleFactoryDelegate();
+ }
+ return delegate;
}
- public void test03GetModuleDelegate() {
- delegate.getModuleDelegate(null);
+ public void testGetModuleDelegate() {
+ getModuleFactoryDelegate().getModuleDelegate(null);
}
- public void test04GetModules() {
- delegate.getModules();
+ public void testGetModules() {
+ getModuleFactoryDelegate().getModules();
}
- public void test07TestProtected() {
- ((TestModuleFactoryDelegate)delegate).testProtectedMethods();
+ public void testTestProtected() {
+ ((TestModuleFactoryDelegate)getModuleFactoryDelegate()).testProtectedMethods();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFileTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFileTestCase.java
index 34a5dea..c9d0c48 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFileTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFileTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -19,19 +19,22 @@
public class ModuleFileTestCase extends TestCase {
protected static IModuleFile delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new ModuleFile((IFile)null, "name", null);
+ protected IModuleFile getModuleFile() {
+ if (delegate == null) {
+ delegate = new ModuleFile((IFile)null, "name", null);
+ }
+ return delegate;
}
- public void test01Name() throws Exception {
- assertEquals(delegate.getName(), "name");
+ public void testName() throws Exception {
+ assertEquals(getModuleFile().getName(), "name");
}
- public void test02Path() throws Exception {
- assertNull(delegate.getModuleRelativePath());
+ public void testPath() throws Exception {
+ assertNull(getModuleFile().getModuleRelativePath());
}
- public void test03Stamp() throws Exception {
- assertEquals(delegate.getModificationStamp(), -1);
+ public void testStamp() throws Exception {
+ assertEquals(getModuleFile().getModificationStamp(), -1);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFolderTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFolderTestCase.java
index fd372e5..9bc9453 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFolderTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleFolderTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,19 +18,22 @@
public class ModuleFolderTestCase extends TestCase {
protected static IModuleFolder delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new ModuleFolder(null, "name", null);
+ protected IModuleFolder getModuleFolder() {
+ if (delegate == null) {
+ delegate = new ModuleFolder(null, "name", null);
+ }
+ return delegate;
+ }
+
+ public void testName() throws Exception {
+ assertEquals(getModuleFolder().getName(), "name");
}
- public void test01Name() throws Exception {
- assertEquals(delegate.getName(), "name");
+ public void testPath() throws Exception {
+ assertNull(getModuleFolder().getModuleRelativePath());
}
- public void test02Path() throws Exception {
- assertNull(delegate.getModuleRelativePath());
- }
-
- public void test03Members() throws Exception {
- delegate.members();
+ public void testMembers() throws Exception {
+ getModuleFolder().members();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceDeltaTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceDeltaTestCase.java
index 69f2bec..30c3ca4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceDeltaTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceDeltaTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,23 +18,26 @@
public class ModuleResourceDeltaTestCase extends TestCase {
protected static IModuleResourceDelta delta;
- public void test00CreateDelegate() {
- delta = new TestModuleResourceDelta();
+ protected IModuleResourceDelta getModuleResourceDelta() {
+ if (delta == null) {
+ delta = new TestModuleResourceDelta();
+ }
+ return delta;
+ }
+
+ public void testGetModuleResource() {
+ assertNull(getModuleResourceDelta().getModuleResource());
}
- public void test01GetModuleResource() {
- assertNull(delta.getModuleResource());
+ public void testGetAffectedChildren() {
+ assertNull(getModuleResourceDelta().getAffectedChildren());
}
- public void test02GetAffectedChildren() {
- assertNull(delta.getAffectedChildren());
+ public void testGetModuleRelativePath() {
+ assertNull(getModuleResourceDelta().getModuleRelativePath());
}
- public void test03GetModuleRelativePath() {
- assertNull(delta.getModuleRelativePath());
- }
-
- public void test04GetKind() {
- delta.getKind();
+ public void testGetKind() {
+ getModuleResourceDelta().getKind();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceTestCase.java
index 270d9a6..97aa2f4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ModuleResourceTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,15 +18,18 @@
public class ModuleResourceTestCase extends TestCase {
protected static IModuleResource resource;
- public void test00CreateDelegate() throws Exception {
- resource = new TestModuleResource();
+ protected IModuleResource getModuleResource() {
+ if (resource == null) {
+ resource = new TestModuleResource();
+ }
+ return resource;
+ }
+
+ public void testName() throws Exception {
+ assertNull(getModuleResource().getName());
}
- public void test01Name() throws Exception {
- assertNull(resource.getName());
- }
-
- public void test02Path() throws Exception {
- assertNull(resource.getModuleRelativePath());
+ public void testPath() throws Exception {
+ assertNull(getModuleResource().getModuleRelativePath());
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeDelegateTestCase.java
index a1fa5b2..6ec4c88 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,36 +17,39 @@
public class RuntimeDelegateTestCase extends TestCase {
protected static RuntimeDelegate delegate;
-
- public void test00CreateDelegate() throws Exception {
- delegate = new TestRuntimeDelegate();
+
+ protected RuntimeDelegate getRuntimeDelegate() {
+ if (delegate == null) {
+ delegate = new TestRuntimeDelegate();
+ }
+ return delegate;
}
- public void test03GetRuntime() throws Exception {
- delegate.getRuntime();
+ public void testGetRuntime() throws Exception {
+ getRuntimeDelegate().getRuntime();
}
- public void test04GetRuntimeWorkingCopy() throws Exception {
- delegate.getRuntimeWorkingCopy();
+ public void testGetRuntimeWorkingCopy() throws Exception {
+ getRuntimeDelegate().getRuntimeWorkingCopy();
}
- public void test05Validate() {
+ public void testValidate() {
try {
- delegate.validate();
+ getRuntimeDelegate().validate();
} catch (Exception e) {
// ignore
}
}
- public void test11Dispose() throws Exception {
- delegate.dispose();
+ public void testDispose() throws Exception {
+ getRuntimeDelegate().dispose();
}
- public void test12SetDefaults() throws Exception {
- delegate.setDefaults(null);
+ public void testSetDefaults() throws Exception {
+ getRuntimeDelegate().setDefaults(null);
}
- public void test13Protected() throws Exception {
- ((TestRuntimeDelegate)delegate).testProtected();
+ public void testProtected() throws Exception {
+ ((TestRuntimeDelegate)getRuntimeDelegate()).testProtected();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeLocatorDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeLocatorDelegateTestCase.java
index 11d4c43..4eb2020 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeLocatorDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/RuntimeLocatorDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -19,15 +19,18 @@
public class RuntimeLocatorDelegateTestCase extends TestCase {
protected static RuntimeLocatorDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestRuntimeLocatorDelegate();
+ protected RuntimeLocatorDelegate getRuntimeLocatorDelegate() {
+ if (delegate == null) {
+ delegate = new TestRuntimeLocatorDelegate();
+ }
+ return delegate;
}
- public void test01Search() throws Exception {
- delegate.searchForRuntimes(null, null, null);
+ public void testSearch() throws Exception {
+ getRuntimeLocatorDelegate().searchForRuntimes(null, null, null);
}
- public void test02Listener() {
+ public void testListener() {
RuntimeLocatorDelegate.IRuntimeSearchListener listener = new RuntimeLocatorDelegate.IRuntimeSearchListener() {
public void runtimeFound(IRuntimeWorkingCopy runtime) {
// ignore
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerBehaviourDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerBehaviourDelegateTestCase.java
index 6b6d5ab..5e9525d 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerBehaviourDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerBehaviourDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,35 +18,38 @@
public class ServerBehaviourDelegateTestCase extends TestCase {
protected static ServerBehaviourDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestServerBehaviourDelegate();
+ protected ServerBehaviourDelegate getServerBehaviourDelegate() {
+ if (delegate == null) {
+ delegate = new TestServerBehaviourDelegate();
+ }
+ return delegate;
}
- public void test03GetServer() throws Exception {
- delegate.getServer();
+ public void testGetServer() throws Exception {
+ getServerBehaviourDelegate().getServer();
}
- public void test04Dispose() throws Exception {
- delegate.dispose();
+ public void testDispose() throws Exception {
+ getServerBehaviourDelegate().dispose();
}
- public void test17SetupLaunchConfiguration() throws Exception {
- delegate.setupLaunchConfiguration(null, null);
+ public void testSetupLaunchConfiguration() throws Exception {
+ getServerBehaviourDelegate().setupLaunchConfiguration(null, null);
}
- public void test18Restart() throws Exception {
+ public void testRestart() throws Exception {
try {
- delegate.restart(null);
+ getServerBehaviourDelegate().restart(null);
} catch (Exception e) {
// ignore
}
}
- public void test21Stop() {
- delegate.stop(false);
+ public void testStop() {
+ getServerBehaviourDelegate().stop(false);
}
- public void test27TestProtected() {
+ public void testTestProtected() {
((TestServerBehaviourDelegate)delegate).testProtected();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerDelegateTestCase.java
index d6374e3..6dcbac9 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,59 +18,62 @@
public class ServerDelegateTestCase extends TestCase {
protected static ServerDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestServerDelegate();
+ protected ServerDelegate getServerDelegate() {
+ if (delegate == null) {
+ delegate = new TestServerDelegate();
+ }
+ return delegate;
}
- public void test03GetServer() throws Exception {
- delegate.getServer();
+ public void testGetServer() throws Exception {
+ getServerDelegate().getServer();
}
- public void test04GetServerWorkingCopy() throws Exception {
- delegate.getServerWorkingCopy();
+ public void testGetServerWorkingCopy() throws Exception {
+ getServerDelegate().getServerWorkingCopy();
}
- public void test11Dispose() throws Exception {
- delegate.dispose();
+ public void testDispose() throws Exception {
+ getServerDelegate().dispose();
}
- public void test12SetDefaults() throws Exception {
- delegate.setDefaults(null);
+ public void testSetDefaults() throws Exception {
+ getServerDelegate().setDefaults(null);
}
- public void test18CanModifyModules() throws Exception {
- delegate.canModifyModules(null, null);
+ public void testCanModifyModules() throws Exception {
+ getServerDelegate().canModifyModules(null, null);
}
- public void test19GetChildModules() throws Exception {
- delegate.getChildModules(null);
+ public void testGetChildModules() throws Exception {
+ getServerDelegate().getChildModules(null);
}
- public void test20GetRootModules() throws Exception {
- delegate.getRootModules(null);
+ public void testGetRootModules() throws Exception {
+ getServerDelegate().getRootModules(null);
}
- public void test21GetServerPorts() throws Exception {
- delegate.getServerPorts();
+ public void testGetServerPorts() throws Exception {
+ getServerDelegate().getServerPorts();
}
- public void test22ModifyModules() throws Exception {
- delegate.modifyModules(null, null, null);
+ public void testModifyModules() throws Exception {
+ getServerDelegate().modifyModules(null, null, null);
}
- public void test23ImportConfiguration() throws Exception {
- delegate.importRuntimeConfiguration(null, null);
+ public void testImportConfiguration() throws Exception {
+ getServerDelegate().importRuntimeConfiguration(null, null);
}
- public void test24ImportConfiguration() throws Exception {
- delegate.saveConfiguration(null);
+ public void testImportConfiguration2() throws Exception {
+ getServerDelegate().saveConfiguration(null);
}
- public void test25ConfigurationChanged() throws Exception {
- delegate.configurationChanged();
+ public void testConfigurationChanged() throws Exception {
+ getServerDelegate().configurationChanged();
}
- public void test26TestProtected() {
- ((TestServerDelegate)delegate).testProtected();
+ public void testTestProtected() {
+ ((TestServerDelegate)getServerDelegate()).testProtected();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerLocatorDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerLocatorDelegateTestCase.java
index 70624b2..30f3070 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerLocatorDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerLocatorDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -19,15 +19,18 @@
public class ServerLocatorDelegateTestCase extends TestCase {
protected static ServerLocatorDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestServerLocatorDelegate();
+ protected ServerLocatorDelegate getServerLocatorDelegate() {
+ if (delegate == null) {
+ delegate = new TestServerLocatorDelegate();
+ }
+ return delegate;
+ }
+
+ public void testSearch() throws Exception {
+ getServerLocatorDelegate().searchForServers("host", null, null);
}
- public void test01Search() throws Exception {
- delegate.searchForServers("host", null, null);
- }
-
- public void test02Listener() {
+ public void testListener() {
ServerLocatorDelegate.IServerSearchListener listener = new ServerLocatorDelegate.IServerSearchListener() {
public void serverFound(IServerWorkingCopy server) {
// ignore
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerTaskDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerTaskDelegateTestCase.java
index 8c82400..4689309 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerTaskDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerTaskDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -18,11 +18,14 @@
public class ServerTaskDelegateTestCase extends TestCase {
protected static PublishTaskDelegate delegate;
- public void test00CreateDelegate() throws Exception {
- delegate = new TestServerTaskDelegate();
+ protected PublishTaskDelegate getPublishTaskDelegate() {
+ if (delegate == null) {
+ delegate = new TestServerTaskDelegate();
+ }
+ return delegate;
}
-
- public void test01GetTasks() throws Exception {
- delegate.getTasks(null, null);
+
+ public void testGetTasks() throws Exception {
+ getPublishTaskDelegate().getTasks(null, null);
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/HTTPLaunchableTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/HTTPLaunchableTestCase.java
index 07b823f..a519503 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/HTTPLaunchableTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/HTTPLaunchableTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,17 +16,20 @@
public class HTTPLaunchableTestCase extends TestCase {
protected static HttpLaunchable launch;
- public void test00Create() {
- launch = new HttpLaunchable(null);
+ protected HttpLaunchable getHttpLaunchable() {
+ if (launch == null) {
+ launch = new HttpLaunchable(null);
+ }
+ return launch;
+ }
+
+ public void testGetURL() {
+ assertNull(getHttpLaunchable().getURL());
}
- public void test01GetURL() {
- assertNull(launch.getURL());
- }
-
- public void test02ToString() {
+ public void testToString() {
try {
- launch.toString();
+ getHttpLaunchable().toString();
} catch (Exception e) {
// ignore
}
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/NullModuleArtifactTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/NullModuleArtifactTestCase.java
index 519fb49..42acbb4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/NullModuleArtifactTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/NullModuleArtifactTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,15 +16,18 @@
public class NullModuleArtifactTestCase extends TestCase {
protected static NullModuleArtifact nma;
- public void test00Create() {
- nma = new NullModuleArtifact(null);
+ protected NullModuleArtifact getNullModuleArtifact() {
+ if (nma == null) {
+ nma = new NullModuleArtifact(null);
+ }
+ return nma;
}
- public void test01GetModule() {
- assertNull(nma.getModule());
+ public void testGetModule() {
+ assertNull(getNullModuleArtifact().getModule());
}
- public void test02ToString() {
- nma.toString();
+ public void testToString() {
+ getNullModuleArtifact().toString();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleFactoryDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleFactoryDelegateTestCase.java
index 76326e0..cc7b0b0 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleFactoryDelegateTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleFactoryDelegateTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,19 +17,22 @@
public class ProjectModuleFactoryDelegateTestCase extends TestCase {
protected static ProjectModuleFactoryDelegate delegate;
- public void test00Create() {
- delegate = new TestProjectModuleFactoryDelegate();
+ protected ProjectModuleFactoryDelegate getProjectModuleFactoryDelegate() {
+ if (delegate == null) {
+ delegate = new TestProjectModuleFactoryDelegate();
+ }
+ return delegate;
}
- public void test03GetModuleDelegate() {
- delegate.getModuleDelegate(null);
+ public void testGetModuleDelegate() {
+ getProjectModuleFactoryDelegate().getModuleDelegate(null);
}
- public void test04GetModules() {
- delegate.getModules();
+ public void testGetModules() {
+ getProjectModuleFactoryDelegate().getModules();
}
- public void test06TestProtected() throws Exception {
- ((TestProjectModuleFactoryDelegate)delegate).testProtected();
+ public void testTestProtected() throws Exception {
+ ((TestProjectModuleFactoryDelegate)getProjectModuleFactoryDelegate()).testProtected();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleTestCase.java
index 2f21fdc..748f662 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/ProjectModuleTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,55 +17,58 @@
public class ProjectModuleTestCase extends TestCase {
protected static ProjectModule pm;
- public void test00Create() {
- pm = new TestProjectModule();
+ protected ProjectModule getProjectModule() {
+ if (pm == null) {
+ pm = new TestProjectModule(null);
+ }
+ return pm;
}
- public void test01Create() {
- pm = new TestProjectModule(null);
+ public void testCreate() {
+ new TestProjectModule();
}
- public void test02GetProject() {
- pm.getProject();
+ public void testGetProject() {
+ getProjectModule().getProject();
}
- public void test04GetId() {
+ public void testGetId() {
try {
- pm.getId();
+ getProjectModule().getId();
} catch (Exception e) {
// ignore
}
}
- public void test05Validate() {
- pm.validate();
+ public void testValidate() {
+ getProjectModule().validate();
}
- public void test06Members() {
+ public void testMembers() {
try {
- pm.members();
+ getProjectModule().members();
} catch (Exception e) {
// ignore
}
}
- public void test07GetName() {
+ public void testGetName() {
try {
- pm.getName();
+ getProjectModule().getName();
} catch (Exception e) {
// ignore
}
}
- public void test08Exists() {
- pm.exists();
+ public void testExists() {
+ getProjectModule().exists();
}
- public void test09Equals() {
- pm.equals(null);
+ public void testEquals() {
+ getProjectModule().equals(null);
}
- public void test10() {
- pm.getChildModules();
+ public void testChildModules() {
+ getProjectModule().getChildModules();
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/StaticWebTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/StaticWebTestCase.java
index b538d87..97d85a4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/StaticWebTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/StaticWebTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -17,11 +17,14 @@
public class StaticWebTestCase extends TestCase {
protected static IStaticWeb web;
- public void test00Create() {
- web = new TestStaticWeb();
+ protected IStaticWeb getStaticWeb() {
+ if (web == null) {
+ web = new TestStaticWeb();
+ }
+ return web;
}
-
- public void test01GetContextRoot() {
- assertNull(web.getContextRoot());
+
+ public void testGetContextRoot() {
+ assertNull(getStaticWeb().getContextRoot());
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/WebResourceTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/WebResourceTestCase.java
index 0686512..eb641e4 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/WebResourceTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/util/WebResourceTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -16,19 +16,22 @@
public class WebResourceTestCase extends TestCase {
protected static WebResource web;
- public void test00Create() {
- web = new WebResource(null, null);
+ protected WebResource getWebResource() {
+ if (web == null) {
+ web = new WebResource(null, null);
+ }
+ return web;
+ }
+
+ public void testGetModule() {
+ assertNull(getWebResource().getModule());
}
- public void test01GetModule() {
- assertNull(web.getModule());
+ public void testGetPath() {
+ assertNull(getWebResource().getPath());
}
- public void test02GetPath() {
- assertNull(web.getPath());
- }
-
- public void test03ToString() {
- web.toString();
+ public void testToString() {
+ getWebResource().toString();
}
}
\ No newline at end of file