1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.plugin.selenium.util;
20
21 import org.openqa.selenium.server.SeleniumServer;
22
23 public class SeleniumProxyServer {
24
25 protected static SeleniumProxyServer spServer;
26 protected SeleniumServer server;
27
28 private SeleniumProxyServer(){
29 }
30
31 public static SeleniumProxyServer getInstance(){
32 if (spServer == null){
33 spServer = new SeleniumProxyServer();
34 }
35 return spServer;
36 }
37
38 public void setSeleniumServer(SeleniumServer server){
39 this.server = server;
40 }
41
42 public SeleniumServer getSeleniumServer(){
43 return server;
44 }
45
46 public void setTimeoutSeconds(int seconds){
47 SeleniumServer.timeoutInSeconds = seconds;
48 }
49
50 public static void clearInstance(){
51 if (spServer != null && spServer.server != null){
52 spServer.server.stop();
53 spServer.server = null;
54 }
55 spServer = null;
56 }
57
58 public void run(){
59 startUp();
60 }
61
62 public void startUp(){
63 if (server != null){
64 try {
65 server.start();
66 }catch (Exception e) {
67 e.printStackTrace();
68 }
69 }
70 }
71
72 public void shutDown(){
73 if (server != null){
74 server.stop();
75 server = null;
76 }
77 }
78 }