1 package org.apache.maven.wagon.providers.http;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.wagon.Wagon;
23 import org.codehaus.plexus.PlexusTestCase;
24 import org.mortbay.jetty.Server;
25 import org.mortbay.jetty.handler.ResourceHandler;
26 import org.mortbay.jetty.servlet.Context;
27
28
29
30
31 public abstract class HttpWagonHttpServerTestCase
32 extends PlexusTestCase
33 {
34 protected final int httpServerPort = 10008;
35
36 private Server server;
37
38 protected ResourceHandler resourceHandler;
39
40 protected Context context;
41
42 protected void setUp()
43 throws Exception
44 {
45 super.setUp();
46 server = new Server( httpServerPort );
47
48 context = new Context( server, "/", Context.SESSIONS );
49
50 resourceHandler = new ResourceHandler();
51 server.addHandler( resourceHandler );
52 }
53
54 protected Wagon getWagon()
55 throws Exception
56 {
57 return (Wagon) lookup( HttpWagon.ROLE );
58 }
59
60 protected void startServer()
61 throws Exception
62 {
63 server.start();
64 }
65
66 protected void stopServer()
67 throws Exception
68 {
69 server.stop();
70 }
71 }