Clover Coverage Report - ARESTC 0.1.7-SNAPSHOT
Coverage timestamp: Fri Aug 27 2010 19:12:04 CEST
../../../../img/srcFileCovDistChart8.png 54% of files have more coverage
15   70   4   7.5
4   27   0.27   2
2     2  
1    
 
  ServerFactory       Line # 25 15 0% 4 6 71.4% 0.71428573
 
No Tests
 
1    /*
2    *
3    * (C)opyright 2010, Nikolaos Georgosopoulos
4    *
5    * This file is part of ARESTC.
6    *
7    * ARESTC is free software: you can redistribute it and/or modify it under the
8    * terms of the Lesser General Public License as published by the Free Software
9    * Foundation, either version 3 of the License, or (at your option) any later
10    * version.
11    *
12    * ARESTC is distributed in the hope that it will be useful, but WITHOUT ANY
13    * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14    * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15    *
16    * You should have received a copy of the Lesser General Public License along
17    * with ARESTC. If not, see <http://www.gnu.org/licenses/>.
18    */
19    package net.sf.arestc.testserver;
20   
21    // TODO: Auto-generated Javadoc
22    /**
23    * A factory for creating Server objects.
24    */
 
25    public class ServerFactory {
26   
27    /** The server. */
28    private LocalTestServer server;
29   
30    /** The Constant factory. */
31    public static final ServerFactory factory = new ServerFactory();
32   
33    /**
34    * Start server.
35    *
36    * @throws Exception
37    * the exception
38    */
 
39  10 toggle public void startServer() throws Exception {
40  10 if (null == server) {
41   
42  1 server = new LocalTestServer(null, null);
43  1 server.registerDefaultHandlers();
44  1 server.register(CreateNodeHandler.URL, new CreateNodeHandler());
45  1 server.register(DeleteNodeHandler.URL, new DeleteNodeHandler());
46  1 server.register(LoginHandler.URL, new LoginHandler());
47  1 server.register(NodeRetrieveHandler.URL, new NodeRetrieveHandler());
48  1 server.register(FileUploadRequestHandler.URL,
49    new FileUploadRequestHandler());
50  1 server.register(DownloadFileHandler.URL, new DownloadFileHandler());
51  1 server.register(MULTIPOSTHandler.URL, new MULTIPOSTHandler());
52  1 server.register("/alfresco/*", new AuthHandler());
53  1 server.start();
54    }
55    }
56   
57    /**
58    * Stop server.
59    *
60    * @throws Exception
61    * the exception
62    */
 
63  0 toggle public void stopServer() throws Exception {
64  0 if (null != server) {
65  0 server.stop();
66  0 server.awaitTermination(3000);
67    }
68    }
69   
70    }