|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StandardConnectorResponse | Line # 31 | 7 | 0% | 7 | 2 | 85.7% |
0.85714287
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (9) | |||
| Result | |||
|
0.85714287
|
net.sf.arestc.core.OverallDesignTest.testFileDownload
net.sf.arestc.core.OverallDesignTest.testFileDownload
|
1 PASS | |
|
0.71428573
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
|
1 PASS | |
|
0.71428573
|
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
|
1 PASS | |
|
0.71428573
|
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
|
1 PASS | |
|
0.71428573
|
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
|
1 PASS | |
|
0.5714286
|
net.sf.arestc.core.OverallDesignTest.testFileUpload
net.sf.arestc.core.OverallDesignTest.testFileUpload
|
1 PASS | |
|
0.5714286
|
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
|
1 PASS | |
|
0.2857143
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
|
1 PASS | |
|
0.2857143
|
net.sf.arestc.core.OverallDesignTest.testLoadResponseFromFile
net.sf.arestc.core.OverallDesignTest.testLoadResponseFromFile
|
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.core; | |
| 20 | ||
| 21 | import java.io.InputStream; | |
| 22 | import java.util.Collection; | |
| 23 | ||
| 24 | ||
| 25 | import org.apache.commons.httpclient.Header; | |
| 26 | ||
| 27 | // TODO: Auto-generated Javadoc | |
| 28 | /** | |
| 29 | * The Class StandardConnectorResponse. | |
| 30 | */ | |
| 31 | public class StandardConnectorResponse implements ConnectorResponse { | |
| 32 | ||
| 33 | /** The context. */ | |
| 34 | private final ConnectorContext context; | |
| 35 | ||
| 36 | /** | |
| 37 | * Instantiates a new standard connector response. | |
| 38 | * | |
| 39 | * @param context | |
| 40 | * the context | |
| 41 | */ | |
| 42 | 11 |
public StandardConnectorResponse(final ConnectorContext context) { |
| 43 | 11 | this.context = context; |
| 44 | } | |
| 45 | ||
| 46 | /* | |
| 47 | * (non-Javadoc) | |
| 48 | * | |
| 49 | * @see net.sf.arestc.core.ConnectorResponse#getErrors() | |
| 50 | */ | |
| 51 | 0 |
public Collection<ARESTCError> getErrors() { |
| 52 | 0 | return context.getErrors(); |
| 53 | } | |
| 54 | ||
| 55 | /* | |
| 56 | * (non-Javadoc) | |
| 57 | * | |
| 58 | * @see net.sf.arestc.core.ConnectorResponse#getResponseBody() | |
| 59 | */ | |
| 60 | 11 |
public Object getResponseBody() { |
| 61 | 11 | return context.getReturnedBody(); |
| 62 | } | |
| 63 | ||
| 64 | /* | |
| 65 | * (non-Javadoc) | |
| 66 | * | |
| 67 | * @see net.sf.arestc.core.ConnectorResponse#getResponseHeaders() | |
| 68 | */ | |
| 69 | 9 |
public Header[] getResponseHeaders() { |
| 70 | 9 | return context.getReturnedHeaders(); |
| 71 | } | |
| 72 | ||
| 73 | /* | |
| 74 | * (non-Javadoc) | |
| 75 | * | |
| 76 | * @see net.sf.arestc.core.ConnectorResponse#getStreamedBody() | |
| 77 | */ | |
| 78 | 2 |
public InputStream getStreamedBody() { |
| 79 | 2 | return (InputStream) context.getReturnedBody(); |
| 80 | } | |
| 81 | ||
| 82 | /* | |
| 83 | * (non-Javadoc) | |
| 84 | * | |
| 85 | * @see net.sf.arestc.core.ConnectorResponse#hasErrors() | |
| 86 | */ | |
| 87 | 9 |
public boolean hasErrors() { |
| 88 | 9 | return context.isError_occured(); |
| 89 | } | |
| 90 | ||
| 91 | 7 |
public void releaseConnection() { |
| 92 | 7 | context.getMethod().releaseConnection(); |
| 93 | } | |
| 94 | } | |
|
||||||||||||