Jump to: navigation, search

EDT:IDE Test Server

Revision as of 17:51, 3 February 2012 by Jspadea.us.ibm.com (Talk | contribs)

The IDE Test Server is a Jetty-based server which allows users to test their applications on the fly with virtually no configuration, and zero deployment, required. An example is that you can invoke a service directly from its source project without having to deploy the service, or even set up a server for it to run on.

The user never has to define, configure, or start the test server. A test server is created for each project in the workspace, as needed. The test server is started the first time it's requested. If the user wishes to restart the server, for example a classpath change was made, then the user only needs to terminate the server and it will be started back up automatically on the next access. This server lives under the covers, and the only place you see it running is the Debug view. Since each project has its own test server, each instance is a separate Java process in this view. This allows you to kill/restart a single project's server without affecting the other running servers.

The following sections are for EDT developers; they explain how you can get a server instance and how you can actually extend the server itself.


Using the test server in your application

If you want to invoke the test server from your application, you will need to depend on the org.eclipse.edt.ide.testserver project. Since each project has its own test server you will need to know the project for which you want a test server.  Once you know this, you should use org.eclipse.edt.ide.testserver.TestServerManager.getInstance().getServerConfiguration(IProject project, boolean debug) to get a org.eclipse.edt.ide.testserver.TestServerConfiguration. You can also directly instantiate TestServerConfiguration but this makes sure there is just one server per project instead of spawning multiple instances.

Once you have a TestServerConfiguration you can invoke its start(IProgressMonitor monitor, boolean waitForServerToStart) method to start it up. If the server is already started this method will immediately return. An example of invoking this code can be found in org.eclipse.edt.ide.rui.server.EvServer of the org.eclipse.edt.ide.rui plug-in.

Once you have a running server, the TestServerConfiguration can tell you the port on which it is running, which is information you'll need to know when you want to load some URL on the server.


Extending the test server

TODO