Fix JUnit tests
diff --git a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/AllTests.java b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/AllTests.java
index 9bd15e5..d492dee 100644
--- a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/AllTests.java
+++ b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/AllTests.java
@@ -23,6 +23,8 @@
suite.addTest(new OrderedTestSuite(MonitorTestCase.class));
suite.addTest(new OrderedTestSuite(MonitorListenerTestCase.class));
suite.addTest(new OrderedTestSuite(RequestTestCase.class));
+
+ suite.addTest(new OrderedTestSuite(ContentFilterTestCase.class));
//$JUnit-END$
return suite;
}
diff --git a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/ContentFilterTestCase.java b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/ContentFilterTestCase.java
new file mode 100644
index 0000000..819c9f1
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/ContentFilterTestCase.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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.internet.monitor.core.tests;
+
+import org.eclipse.wst.internet.monitor.core.ContentFilterDelegate;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+public class ContentFilterTestCase extends TestCase {
+ protected static ContentFilterDelegate delegate;
+
+ public static Test suite() {
+ return new OrderedTestSuite(MonitorListenerTestCase.class, "MonitorTestCase");
+ }
+
+ public void test00Creation() {
+ delegate = new TestContentFilterDelegate();
+ }
+
+ public void test01Filter() throws Exception {
+ delegate.filter(null, false, null);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/MonitorTestCase.java b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/MonitorTestCase.java
index 61646a4..cd2f757 100644
--- a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/MonitorTestCase.java
+++ b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/MonitorTestCase.java
@@ -279,4 +279,19 @@
public void test31GetProtocol() {
assertNotNull(monitor.getProtocol());
}
+
+ public void test32CheckListener() throws Exception {
+ IRequestListener listener2 = new IRequestListener() {
+ public void requestAdded(IMonitor monitor2, Request request) {
+ // ignore
+ }
+
+ public void requestChanged(IMonitor monitor2, Request request) {
+ // ignore
+ }
+ };
+
+ listener2.requestAdded(null, null);
+ listener2.requestChanged(null, null);
+ }
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/TestContentFilterDelegate.java b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/TestContentFilterDelegate.java
new file mode 100644
index 0000000..9025fca
--- /dev/null
+++ b/tests/org.eclipse.wst.internet.monitor.core.tests/src/org/eclipse/wst/internet/monitor/core/tests/TestContentFilterDelegate.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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.internet.monitor.core.tests;
+
+import java.io.IOException;
+import org.eclipse.wst.internet.monitor.core.ContentFilterDelegate;
+import org.eclipse.wst.internet.monitor.core.Request;
+
+public class TestContentFilterDelegate extends ContentFilterDelegate{
+ public byte[] filter(Request request, boolean isRequest, byte[] content) throws IOException {
+ return null;
+ }
+}
\ No newline at end of file
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 bde15d1..3795f5e 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
@@ -60,6 +60,15 @@
suite.addTest(new OrderedTestSuite(ProjectPropertiesTestCase.class));
suite.addTest(new OrderedTestSuite(ServerPreferencesTestCase.class));
+ suite.addTestSuite(TaskModelTestCase.class);
+
+ suite.addTestSuite(RuntimeLifecycleListenerTestCase.class);
+ suite.addTestSuite(ServerLifecycleListenerTestCase.class);
+ suite.addTestSuite(ServerListenerTestCase.class);
+ suite.addTestSuite(RuntimeLifecycleAdapterTestCase.class);
+ suite.addTestSuite(ServerLifecycleAdapterTestCase.class);
+ suite.addTestSuite(ServerAdapterTestCase.class);
+
suite.addTest(new OrderedTestSuite(ClientDelegateTestCase.class));
suite.addTest(new OrderedTestSuite(RuntimeLocatorDelegateTestCase.class));
suite.addTest(new OrderedTestSuite(ModuleDelegateTestCase.class));
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 606919f..638b840 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
@@ -20,7 +20,7 @@
public class ProjectPropertiesTestCase extends TestCase {
protected static IProject project;
- protected static ProjectProperties props;
+ protected static IProjectProperties props;
protected static IProject projectEvent;
protected static IServer serverEvent;
@@ -51,7 +51,7 @@
project.create(null);
project.open(null);
}
- props = (ProjectProperties) ServerCore.getProjectProperties(project);
+ props = ServerCore.getProjectProperties(project);
}
public void test01AddListener() throws Exception {
@@ -67,7 +67,7 @@
}
public void test04GetServerProject() throws Exception {
- assertFalse(props.isServerProject());
+ assertFalse(((ProjectProperties) props).isServerProject());
}
public void test05TestListener() throws Exception {
@@ -97,15 +97,17 @@
}
public void test10SetServerProject() throws Exception {
- props.setServerProject(true, null);
- assertTrue(props.isServerProject());
+ ProjectProperties pp = (ProjectProperties) props;
+ pp.setServerProject(true, null);
+ assertTrue(pp.isServerProject());
}
public void test11UnsetServerProject() throws Exception {
- props.setServerProject(false, null);
- assertFalse(props.isServerProject());
+ ProjectProperties pp = (ProjectProperties) props;
+ pp.setServerProject(false, null);
+ assertFalse(pp.isServerProject());
}
-
+
public void test12TestListener() throws Exception {
assertTrue(count == 0);
}
@@ -117,4 +119,19 @@
public void test14End() throws Exception {
project.delete(true, true, null);
}
+
+ public void test15CheckListener() throws Exception {
+ IProjectPropertiesListener listener2 = new IProjectPropertiesListener() {
+ public void defaultServerChanged(IProject project2, IServer server) {
+ // ignore
+ }
+
+ public void runtimeTargetChanged(IProject project2, IRuntime runtime) {
+ // ignore
+ }
+ };
+
+ listener2.defaultServerChanged(null, null);
+ listener2.runtimeTargetChanged(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/RuntimeLifecycleAdapterTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/RuntimeLifecycleAdapterTestCase.java
new file mode 100644
index 0000000..05b8e11
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/RuntimeLifecycleAdapterTestCase.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.util.RuntimeLifecycleAdapter;
+
+import junit.framework.TestCase;
+
+public class RuntimeLifecycleAdapterTestCase extends TestCase {
+ public void testListener() {
+ RuntimeLifecycleAdapter listener = new RuntimeLifecycleAdapter();
+
+ listener.runtimeAdded(null);
+ listener.runtimeChanged(null);
+ listener.runtimeRemoved(null);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/RuntimeLifecycleListenerTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/RuntimeLifecycleListenerTestCase.java
new file mode 100644
index 0000000..9c970e5
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/RuntimeLifecycleListenerTestCase.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeLifecycleListener;
+
+import junit.framework.TestCase;
+
+public class RuntimeLifecycleListenerTestCase extends TestCase {
+ public void testListener() {
+ IRuntimeLifecycleListener listener = new IRuntimeLifecycleListener() {
+ public void runtimeAdded(IRuntime runtime) {
+ // ignore
+ }
+
+ public void runtimeChanged(IRuntime runtime) {
+ // ignore
+ }
+
+ public void runtimeRemoved(IRuntime runtime) {
+ // ignore
+ }
+ };
+
+ listener.runtimeAdded(null);
+ listener.runtimeChanged(null);
+ listener.runtimeRemoved(null);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerAdapterTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerAdapterTestCase.java
new file mode 100644
index 0000000..c6a5d7c
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerAdapterTestCase.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.util.ServerAdapter;
+
+import junit.framework.TestCase;
+
+public class ServerAdapterTestCase extends TestCase {
+ public void testListener() {
+ ServerAdapter listener = new ServerAdapter();
+
+ listener.configurationSyncStateChange(null);
+ listener.restartStateChange(null);
+ listener.serverStateChange(null);
+ listener.modulesChanged(null);
+ listener.moduleStateChange(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/ServerLifecycleAdapterTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerLifecycleAdapterTestCase.java
new file mode 100644
index 0000000..2f63915
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerLifecycleAdapterTestCase.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.util.ServerLifecycleAdapter;
+
+import junit.framework.TestCase;
+
+public class ServerLifecycleAdapterTestCase extends TestCase {
+ public void testListener() {
+ ServerLifecycleAdapter listener = new ServerLifecycleAdapter();
+
+ listener.serverAdded(null);
+ listener.serverChanged(null);
+ listener.serverRemoved(null);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerLifecycleListenerTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerLifecycleListenerTestCase.java
new file mode 100644
index 0000000..592d7ad
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerLifecycleListenerTestCase.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerLifecycleListener;
+
+import junit.framework.TestCase;
+
+public class ServerLifecycleListenerTestCase extends TestCase {
+ public void testListener() {
+ IServerLifecycleListener listener = new IServerLifecycleListener() {
+ public void serverAdded(IServer server) {
+ // ignore
+ }
+
+ public void serverChanged(IServer server) {
+ // ignore
+ }
+
+ public void serverRemoved(IServer server) {
+ // ignore
+ }
+ };
+
+ listener.serverAdded(null);
+ listener.serverChanged(null);
+ listener.serverRemoved(null);
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerListenerTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerListenerTestCase.java
new file mode 100644
index 0000000..aeb01aa
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/ServerListenerTestCase.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerListener;
+
+import junit.framework.TestCase;
+
+public class ServerListenerTestCase extends TestCase {
+ public void testListener() {
+ IServerListener listener = new IServerListener() {
+ public void configurationSyncStateChange(IServer server) {
+ // ignore
+ }
+
+ public void restartStateChange(IServer server) {
+ // ignore
+ }
+
+ public void serverStateChange(IServer server) {
+ // ignore
+ }
+
+ public void modulesChanged(IServer server) {
+ // ignore
+ }
+
+ public void moduleStateChange(IServer server, IModule[] parents, IModule module) {
+ // ignore
+ }
+ };
+
+ listener.configurationSyncStateChange(null);
+ listener.restartStateChange(null);
+ listener.serverStateChange(null);
+ listener.modulesChanged(null);
+ listener.moduleStateChange(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/TaskModelTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/TaskModelTestCase.java
new file mode 100644
index 0000000..f2b7378
--- /dev/null
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/TaskModelTestCase.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2005 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 org.eclipse.wst.server.core.TaskModel;
+
+import junit.framework.TestCase;
+
+public class TaskModelTestCase extends TestCase {
+ protected static TaskModel taskModel;
+
+ public void testListener() {
+ taskModel = new TaskModel();
+ taskModel.getObject("test");
+ taskModel.putObject("test", "test");
+ }
+}
\ 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 c62bd4c..451c6bd 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
@@ -13,6 +13,7 @@
import junit.framework.Test;
import junit.framework.TestCase;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate;
import org.eclipse.wst.server.core.tests.OrderedTestSuite;
import org.eclipse.wst.server.core.tests.impl.TestRuntimeLocatorDelegate;
@@ -31,4 +32,14 @@
public void test01Search() throws Exception {
delegate.searchForRuntimes(null, null, null);
}
+
+ public void test02Listener() {
+ RuntimeLocatorDelegate.IRuntimeSearchListener listener = new RuntimeLocatorDelegate.IRuntimeSearchListener() {
+ public void runtimeFound(IRuntimeWorkingCopy runtime) {
+ // ignore
+ }
+ };
+
+ listener.runtimeFound(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/ServerLocatorDelegateTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/model/ServerLocatorDelegateTestCase.java
index 1896cdc..a7d8db0 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
@@ -13,6 +13,7 @@
import junit.framework.Test;
import junit.framework.TestCase;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.model.ServerLocatorDelegate;
import org.eclipse.wst.server.core.tests.OrderedTestSuite;
import org.eclipse.wst.server.core.tests.impl.TestServerLocatorDelegate;
@@ -31,4 +32,14 @@
public void test01Search() throws Exception {
delegate.searchForServers("host", null, null);
}
+
+ public void test02Listener() {
+ ServerLocatorDelegate.IServerSearchListener listener = new ServerLocatorDelegate.IServerSearchListener() {
+ public void serverFound(IServerWorkingCopy server) {
+ // ignore
+ }
+ };
+
+ listener.serverFound(null);
+ }
}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/util/WebResourceTestCase.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/util/WebResourceTestCase.java
index 9fabf69..62531c5 100644
--- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/util/WebResourceTestCase.java
+++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/util/WebResourceTestCase.java
@@ -32,4 +32,8 @@
public void test02GetPath() {
assertNull(web.getPath());
}
+
+ public void test03ToString() {
+ web.toString();
+ }
}
\ No newline at end of file