1   /*
2    *  soapUI, copyright (C) 2004-2007 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by 
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.support;
14  
15  import junit.framework.TestCase;
16  
17  import org.mortbay.jetty.Handler;
18  import org.mortbay.jetty.Server;
19  import org.mortbay.jetty.handler.DefaultHandler;
20  import org.mortbay.jetty.handler.HandlerList;
21  import org.mortbay.jetty.handler.ResourceHandler;
22  
23  public class TestCaseWithJetty extends TestCase
24  {
25  	private static Server server;
26  	
27  	protected void setUp() throws Exception
28  	{
29  		if( server != null )
30  		{	
31  			return;
32  		}
33  		
34  		server = new Server( 8082 );
35  		ResourceHandler resource_handler = new ResourceHandler();
36  		resource_handler.setResourceBase( ".//src//test-resources" );
37  
38  		HandlerList handlers = new HandlerList();
39  		handlers.setHandlers( new Handler[] { resource_handler, new DefaultHandler() } );
40  		server.setHandler( handlers );
41  
42  		try
43  		{
44  			server.start();
45  		}
46  		catch( Exception e )
47  		{
48  			e.printStackTrace();
49  		}
50  	}
51  	
52  	public void testDummy() throws Exception
53  	{
54  		assertTrue( 1 == 1 );
55  	}
56  }