|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoginHandler | Line # 35 | 5 | 0% | 2 | 2 | 75% |
0.75
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (2) | |||
| Result | |||
|
0.75
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
|
1 PASS | |
|
0.75
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
|
1 PASS | |
| 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 | // TODO: Auto-generated Javadoc | |
| 30 | /** | |
| 31 | * The Class LoginHandler. | |
| 32 | * | |
| 33 | * @author georgosn | |
| 34 | */ | |
| 35 | public class LoginHandler extends AbstractRequestHandler { | |
| 36 | ||
| 37 | /** The Constant RESPONSE_FILE_NAME. */ | |
| 38 | private static final String RESPONSE_FILE_NAME = "stubs/loginresponse.xml"; | |
| 39 | ||
| 40 | /** The Constant URL. */ | |
| 41 | public static final String URL = "/alfresco/service/api/login"; | |
| 42 | ||
| 43 | /* (non-Javadoc) | |
| 44 | * @see net.sf.arestc.testserver.AbstractRequestHandler#handle(org.apache.http.HttpRequest, org.apache.http.HttpResponse, org.apache.http.protocol.HttpContext) | |
| 45 | */ | |
| 46 | 4 |
@Override |
| 47 | public void handle(final HttpRequest request, final HttpResponse response, | |
| 48 | final HttpContext context) throws HttpException, IOException { | |
| 49 | 4 | if ("GET".equals(request.getRequestLine().getMethod())) { |
| 50 | 4 | response.setStatusCode(HttpStatus.SC_CREATED); |
| 51 | 4 | response.addHeader("Content-Type", "application/xml"); |
| 52 | 4 | addFileAsBody(response, RESPONSE_FILE_NAME); |
| 53 | } else { | |
| 54 | 0 | response.setStatusCode(HttpStatus.SC_METHOD_FAILURE); |
| 55 | } | |
| 56 | } | |
| 57 | ||
| 58 | } | |
|
||||||||||||