1st drop of performance plugins
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/.classpath b/tests/org.eclipse.jst.server.tomcat.tests.performance/.classpath
new file mode 100644
index 0000000..9742e41
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="performance"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/.project b/tests/org.eclipse.jst.server.tomcat.tests.performance/.project
new file mode 100644
index 0000000..611ace0
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jst.server.tomcat.tests.performance</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/build.properties b/tests/org.eclipse.jst.server.tomcat.tests.performance/build.properties
new file mode 100644
index 0000000..3542325
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/build.properties
@@ -0,0 +1,7 @@
+bin.includes = performance.jar,\
+ performancesrc.zip,\
+ plugin.xml,\
+ test.xml
+source.performance.jar = performance/
+output.performance.jar = bin/
+src.includes = build.properties
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/PerformancePlugin.java b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/PerformancePlugin.java
new file mode 100644
index 0000000..f5c4b79
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/PerformancePlugin.java
@@ -0,0 +1,72 @@
+package org.eclipse.jst.server.tomcat.tests.performance;
+
+import org.eclipse.ui.plugin.*;
+import org.osgi.framework.BundleContext;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class PerformancePlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static PerformancePlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public PerformancePlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static PerformancePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = PerformancePlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.jst.server.tomcat.tests.performance.PerformancePluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+}
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/AllTests.java b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/AllTests.java
new file mode 100644
index 0000000..edf90d7
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/AllTests.java
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.jst.server.tomcat.tests.performance.tomcat50;
+
+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.tests.performance.tomcat50");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(GetDelegateTestCase.class);
+ suite.addTestSuite(OpenEditorTestCase.class);
+ suite.addTestSuite(ServerActionsTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/GetDelegateTestCase.java b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/GetDelegateTestCase.java
new file mode 100644
index 0000000..375f957
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/GetDelegateTestCase.java
@@ -0,0 +1,62 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.jst.server.tomcat.tests.performance.tomcat50;
+
+import java.io.File;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jst.server.tomcat.core.ITomcatRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.tests.performance.common.AbstractGetDelegateTestCase;
+
+public class GetDelegateTestCase extends AbstractGetDelegateTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(GetDelegateTestCase.class, "GetDelegateTestCase");
+ }
+
+ protected IRuntimeWorkingCopy createRuntime(String runtimeTypeId, String runtimeTypeLocaiton) throws CoreException
+ {
+ IRuntimeWorkingCopy runtimeCopy = ServerCore.getRuntimeType(runtimeTypeId).createRuntime(runtimeTypeId);
+ runtimeCopy.setLocation(new Path(runtimeTypeLocaiton));
+ runtimeCopy.setLocked(false);
+ runtimeCopy.setTestEnvironment(true);
+ IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
+ ((ITomcatRuntimeWorkingCopy)runtimeCopy.getWorkingCopyDelegate()).setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId());
+ runtimeCopy.save(null);
+ return runtimeCopy;
+ }
+
+ protected String getRuntimeTypeId()
+ {
+ return "org.eclipse.jst.server.tomcat.50.runtime";
+ }
+
+ protected String getRuntimeTypeLocation()
+ {
+ String location = System.getProperty("org.eclipse.jst.server.tomcat.50");
+ assertNotNull(location);
+ assertTrue((new File(location)).exists());
+ return location;
+ }
+
+ protected String getServerTypeId()
+ {
+ return "org.eclipse.jst.server.tomcat.50";
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/OpenEditorTestCase.java b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/OpenEditorTestCase.java
new file mode 100644
index 0000000..f7afe8f
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/OpenEditorTestCase.java
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.jst.server.tomcat.tests.performance.tomcat50;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.wst.server.tests.performance.common.AbstractOpenEditorTestCase;
+
+public class OpenEditorTestCase extends AbstractOpenEditorTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(OpenEditorTestCase.class, "OpenEditorTestCase");
+ }
+
+ protected String getServerTypeId()
+ {
+ return "org.eclipse.jst.server.tomcat.50";
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/ServerActionsTestCase.java b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/ServerActionsTestCase.java
new file mode 100644
index 0000000..51314c0
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/performance/org/eclipse/jst/server/tomcat/tests/performance/tomcat50/ServerActionsTestCase.java
@@ -0,0 +1,29 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.jst.server.tomcat.tests.performance.tomcat50;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.wst.server.tests.performance.common.AbstractServerActionsTestCase;
+
+public class ServerActionsTestCase extends AbstractServerActionsTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(ServerActionsTestCase.class, "ServerActionsTestCase");
+ }
+
+ protected String getServerTypeId()
+ {
+ return "org.eclipse.jst.server.tomcat.50";
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/plugin.xml b/tests/org.eclipse.jst.server.tomcat.tests.performance/plugin.xml
new file mode 100644
index 0000000..90c3fdb
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.jst.server.tomcat.tests.performance"
+ name="Server Tomcat Performance Plug-in"
+ version="1.0.0"
+ provider-name=""
+ class="org.eclipse.jst.server.tomcat.tests.performance.PerformancePlugin">
+
+ <runtime>
+ <library name="performance.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.test.performance"/>
+ <import plugin="org.junit"/>
+ <import plugin="org.eclipse.wst.server.ui"/>
+ <import plugin="org.eclipse.wst.server.core"/>
+ <import plugin="org.eclipse.jst.server.tomcat.core"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.wst.server.tests.performance"/>
+ </requires>
+
+</plugin>
diff --git a/tests/org.eclipse.jst.server.tomcat.tests.performance/test.xml b/tests/org.eclipse.jst.server.tomcat.tests.performance/test.xml
new file mode 100644
index 0000000..8bf1bd5
--- /dev/null
+++ b/tests/org.eclipse.jst.server.tomcat.tests.performance/test.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="performance" basedir=".">
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}\..\.."/>
+
+ <!-- sets the properties eclipse-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.jst.server.tomcat.tests.performance"/>
+ <property name="library-file"
+ value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
+
+ <property name="workspace" value="${eclipse-home}/workspace_servertomcat_performance"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org.eclipse.jst.server.tomcat.*.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the performance tests that need to be run. -->
+ <target name="performance_suite">
+
+ <delete dir="${workspace}" quiet="true"/>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jst.server.tomcat.tests.performance.tomcat50.GetDelegateTestCase"/>
+ </ant>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jst.server.tomcat.tests.performance.tomcat50.OpenEditorTestCase"/>
+ </ant>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jst.server.tomcat.tests.performance.tomcat50.ServerActionsTestCase"/>
+ </ant>
+
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <delete dir="${workspace}" quiet="true"/>
+ </target>
+
+ <!-- This target runs the performance test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="performance" depends="init,performance_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org.eclipse.jst.server.tomcat.*.xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+
+</project>
diff --git a/tests/org.eclipse.wst.server.tests.performance/.classpath b/tests/org.eclipse.wst.server.tests.performance/.classpath
new file mode 100644
index 0000000..9742e41
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="performance"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/org.eclipse.wst.server.tests.performance/.project b/tests/org.eclipse.wst.server.tests.performance/.project
new file mode 100644
index 0000000..6a1412e
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.server.tests.performance</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/org.eclipse.wst.server.tests.performance/build.properties b/tests/org.eclipse.wst.server.tests.performance/build.properties
new file mode 100644
index 0000000..3542325
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/build.properties
@@ -0,0 +1,7 @@
+bin.includes = performance.jar,\
+ performancesrc.zip,\
+ plugin.xml,\
+ test.xml
+source.performance.jar = performance/
+output.performance.jar = bin/
+src.includes = build.properties
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/AllTests.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/AllTests.java
new file mode 100644
index 0000000..1d3343a
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/AllTests.java
@@ -0,0 +1,28 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Test for org.eclipse.wst.server.tests.performance");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(StartupExtensionTestCase.class);
+ suite.addTestSuite(ModuleFactoriesExtensionTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/ModuleFactoriesExtensionTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/ModuleFactoriesExtensionTestCase.java
new file mode 100644
index 0000000..aed11e4
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/ModuleFactoriesExtensionTestCase.java
@@ -0,0 +1,35 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.test.performance.PerformanceTestCase;
+import org.eclipse.wst.server.core.ServerUtil;
+
+public class ModuleFactoriesExtensionTestCase extends PerformanceTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(ModuleFactoriesExtensionTestCase.class, "ModuleFactoriesExtensionTestCase");
+ }
+
+ public void testModuleFactoriesExtension() throws Exception
+ {
+ // get modules
+ startMeasuring();
+ ServerUtil.getModules();
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/PerformancePlugin.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/PerformancePlugin.java
new file mode 100644
index 0000000..6573b76
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/PerformancePlugin.java
@@ -0,0 +1,72 @@
+package org.eclipse.wst.server.tests.performance;
+
+import org.eclipse.ui.plugin.*;
+import org.osgi.framework.BundleContext;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class PerformancePlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static PerformancePlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public PerformancePlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static PerformancePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = PerformancePlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.server.tests.performance.PerformancePluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+}
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/StartupExtensionTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/StartupExtensionTestCase.java
new file mode 100644
index 0000000..d84eb19
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/StartupExtensionTestCase.java
@@ -0,0 +1,40 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance;
+
+import java.util.Iterator;
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.test.performance.PerformanceTestCase;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.model.IStartup;
+
+public class StartupExtensionTestCase extends PerformanceTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(StartupExtensionTestCase.class, "StartupExtensionTestCase");
+ }
+
+ public void testStartupExtension() throws Exception
+ {
+ // startup
+ startMeasuring();
+ List startups = ServerCore.getStartups();
+ for (Iterator it = startups.iterator(); it.hasNext();)
+ ((IStartup)it.next()).startup();
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractGetDelegateTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractGetDelegateTestCase.java
new file mode 100644
index 0000000..0f98aa7
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractGetDelegateTestCase.java
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance.common;
+
+import org.eclipse.wst.server.core.IServer;
+
+public abstract class AbstractGetDelegateTestCase extends ServerPerformanceTestCase
+{
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ closeIntro();
+ }
+
+ public void testGetDelegate() throws Exception
+ {
+ startMeasuring();
+ createRuntime(getRuntimeTypeId(), getRuntimeTypeLocation());
+ IServer server = createServer(getServerTypeId());
+ server.getDelegate();
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ protected abstract String getRuntimeTypeId();
+ protected abstract String getRuntimeTypeLocation();
+ protected abstract String getServerTypeId();
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractOpenEditorTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractOpenEditorTestCase.java
new file mode 100644
index 0000000..8d7bf5a
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractOpenEditorTestCase.java
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance.common;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorInput;
+
+public abstract class AbstractOpenEditorTestCase extends ServerPerformanceTestCase
+{
+ private final String SERVER_EDITOR_ID = "org.eclipse.wst.server.ui.editor";
+
+ public void testOpenEditor() throws Exception
+ {
+ startMeasuring();
+ IServer server = getFirstServer(getServerTypeId());
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart editor = page.openEditor(new ServerEditorInput(server.getId(), server.getServerConfiguration().getId()), SERVER_EDITOR_ID, true);
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ page.closeEditor(editor, false);
+ }
+
+ protected abstract String getServerTypeId();
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractServerActionsTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractServerActionsTestCase.java
new file mode 100644
index 0000000..52cc61f
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/AbstractServerActionsTestCase.java
@@ -0,0 +1,34 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance.common;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.actions.ServerAction;
+
+public abstract class AbstractServerActionsTestCase extends ServerPerformanceTestCase
+{
+ public void testServerActions() throws Exception
+ {
+ startMeasuring();
+ IServer server = getFirstServer(getServerTypeId());
+ List actions = ServerAction.getServerActions();
+ for (Iterator it = actions.iterator(); it.hasNext();)
+ ((ServerAction)it.next()).getDelegate().supports(server, server.getServerConfiguration());
+ stopMeasuring();
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ protected abstract String getServerTypeId();
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/ServerPerformanceTestCase.java b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/ServerPerformanceTestCase.java
new file mode 100644
index 0000000..b7852ed
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/performance/org/eclipse/wst/server/tests/performance/common/ServerPerformanceTestCase.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.wst.server.tests.performance.common;
+
+import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.test.performance.PerformanceTestCase;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.intro.IIntroManager;
+import org.eclipse.ui.intro.IIntroPart;
+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;
+
+public abstract class ServerPerformanceTestCase extends PerformanceTestCase
+{
+ protected void closeIntro()
+ {
+ IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
+ IIntroPart introPart = introManager.getIntro();
+ if (introPart != null)
+ introManager.closeIntro(introPart);
+ }
+
+ protected IRuntimeWorkingCopy createRuntime(String runtimeTypeId, String runtimeTypeLocation) throws CoreException
+ {
+ IRuntimeWorkingCopy runtimeCopy = ServerCore.getRuntimeType(runtimeTypeId).createRuntime(runtimeTypeId);
+ runtimeCopy.setLocation(new Path(runtimeTypeLocation));
+ runtimeCopy.setLocked(false);
+ runtimeCopy.setTestEnvironment(true);
+ runtimeCopy.save(null);
+ return runtimeCopy;
+ }
+
+ protected IServer createServer(String serverTypeId) throws CoreException
+ {
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ IServerType serverType = ServerCore.getServerType(serverTypeId);
+ IServerWorkingCopy serverCopy = serverType.createServer(serverTypeId, null, monitor);
+ serverCopy.saveAll(monitor);
+ serverCopy.release();
+ return serverCopy;
+ }
+
+ protected IServer getFirstServer(String serverTypeId)
+ {
+ List servers = ServerCore.getResourceManager().getServers();
+ assertTrue(servers.size() > 0);
+ IServer server = (IServer)servers.get(0);
+ assertNotNull(server);
+ assertTrue(server.getServerType().getId().equals(serverTypeId));
+ return server;
+ }
+}
\ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.tests.performance/plugin.xml b/tests/org.eclipse.wst.server.tests.performance/plugin.xml
new file mode 100644
index 0000000..83e1032
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/plugin.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.eclipse.wst.server.tests.performance"
+ name="Server Performance Plug-in"
+ version="1.0.0"
+ provider-name=""
+ class="org.eclipse.wst.server.tests.performance.PerformancePlugin">
+
+ <runtime>
+ <library name="performance.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="org.junit"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.test.performance"/>
+ <import plugin="org.eclipse.wst.server.core"/>
+ <import plugin="org.eclipse.wst.server.ui"/>
+ </requires>
+
+</plugin>
diff --git a/tests/org.eclipse.wst.server.tests.performance/test.xml b/tests/org.eclipse.wst.server.tests.performance/test.xml
new file mode 100644
index 0000000..ba13e44
--- /dev/null
+++ b/tests/org.eclipse.wst.server.tests.performance/test.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="performance" basedir=".">
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}\..\.."/>
+
+ <!-- sets the properties eclipse-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.wst.server.tests.performance"/>
+ <property name="library-file"
+ value="${eclipse-home}/plugins/org.eclipse.test_3.1.0/library.xml"/>
+
+ <property name="workspace" value="${eclipse-home}/workspace_server_performance"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org.eclipse.wst.server.tests.performance*.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the performance tests that need to be run. -->
+ <target name="performance_suite">
+
+ <delete dir="${workspace}" quiet="true"/>
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.wst.server.tests.performance.StartupExtensionTestCase"/>
+ </ant>
+
+ <delete dir="${workspace}" quiet="true"/>
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${workspace}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.wst.server.tests.performance.ModuleFactoriesExtensionTestCase"/>
+ </ant>
+
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <delete dir="${workspace}" quiet="true"/>
+ </target>
+
+ <!-- This target runs the performance test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="performance" depends="init,performance_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org.eclipse.wst.server.tests.performance*.xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+
+</project>