/******************************************************************************* * Copyright (c) 2009 Cloudsmith 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: * Cloudsmith - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.testserver.helper; import junit.framework.TestCase; /** * Testsuite that manages the start and stop of the testserver for a suite of tests. * * A derived class should implement the following:

* * public static Test suite() throws Exception {
*     final TestSuite suite = new TestSuite("...name of suite...");
*     suite.addTest(new AbstractTestServerSuite("startServer"));
*
*     // Add tests in the suite - here is an example:
*     suite.addTestSuite(ExampleTest.class);
*
*     suite.addTest(new AbstractTestServerSuite("startServer"));
*     return suite;
* }
*
* The tests in the suite should call {@link TestServerLauncher} to make sure the server is * running either started by this suite, or directly when test is run individually. This is * handled by the class {@link AbstractTestServerClientCase} which serves as the base for * tests requiring access to a running server. */ public class AbstractTestServerSuite extends TestCase { // TEMPLATE CODE: do not remove - it is useful to copy this when creating a new class. // public static Test suite() throws Exception { // final TestSuite suite = new TestSuite("AllServerBasedTestSuite"); // addToSuite(suite); // return suite; // } // // public static void addToSuite(TestSuite suite) { // suite.addTest(new AbstractTestServerSuite("startServer")); // // AuthTest *should* run twice to make sure that second attempt produces the same result. // suite.addTestSuite(AuthTest.class); // suite.addTestSuite(AuthTest.class); // suite.addTestSuite(HttpStatusTest.class); // suite.addTestSuite(TimeoutTest.class); // suite.addTest(new AbstractTestServerSuite("stopServer")); // } public void startServer() throws Exception { TestServerController.oneTimeSetUp(); } public void stopServer() throws Exception { TestServerController.oneTimeTearDown(); } public AbstractTestServerSuite(String testName) { super(testName); } }