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
5   59   2   5
2   22   0.4   1
1     2  
1    
 
  CreateNodeHandler       Line # 32 5 0% 2 2 75% 0.75
 
  (1)
 
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    import java.io.IOException;
22   
23    import org.apache.http.HttpException;
24    import org.apache.http.HttpRequest;
25    import org.apache.http.HttpResponse;
26    import org.apache.http.HttpStatus;
27    import org.apache.http.protocol.HttpContext;
28   
29    /**
30    * The Class CreateNodeHandler.
31    */
 
32    public class CreateNodeHandler extends AbstractRequestHandler {
33   
34    /** The Constant RESPONSE_FILE_NAME. */
35    private static final String RESPONSE_FILE_NAME = "stubs/returned_cmis_create.xml";
36   
37    /** The Constant URL. */
38    public static final String URL = "/alfresco/service/api/node/workspace/SpacesStore/fe424d83-d697-401c-b29e-ce1a915d7283/children";
39   
40    /*
41    * (non-Javadoc)
42    *
43    * @see
44    * net.sf.arestc.testserver.AbstractRequestHandler#handle(org.apache.http
45    * .HttpRequest, org.apache.http.HttpResponse,
46    * org.apache.http.protocol.HttpContext)
47    */
 
48  1 toggle @Override
49    public void handle(final HttpRequest request, final HttpResponse response,
50    final HttpContext context) throws HttpException, IOException {
51  1 if ("POST".equals(request.getRequestLine().getMethod())) {
52  1 response.setStatusCode(HttpStatus.SC_CREATED);
53  1 response.addHeader("Content-Type", "application/xml");
54  1 addFileAsBody(response, RESPONSE_FILE_NAME);
55    } else {
56  0 response.setStatusCode(HttpStatus.SC_METHOD_FAILURE);
57    }
58    }
59    }