|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TransformToServiceCall | Line # 28 | 8 | 0% | 4 | 5 | 61.5% |
0.61538464
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (15) | |||
| Result | |||
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testFileDownload
net.sf.arestc.core.OverallDesignTest.testFileDownload
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testFileUpload
net.sf.arestc.core.OverallDesignTest.testFileUpload
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
|
1 PASS | |
|
0.61538464
|
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForDownloadFile
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForDownloadFile
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadMultipart
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadMultipart
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForLogin
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForLogin
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadFile
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadFile
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeCreate
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeCreate
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeRetrieve
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeRetrieve
|
1 PASS | |
|
0.23076923
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeDelete
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeDelete
|
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 net.sf.arestc.core.services.HTTPMethods; | |
| 22 | import net.sf.arestc.core.validations.RequestValidator; | |
| 23 | ||
| 24 | // TODO: Auto-generated Javadoc | |
| 25 | /** | |
| 26 | * The Class TransformToServiceCall. | |
| 27 | */ | |
| 28 | public class TransformToServiceCall extends BaseCommand { | |
| 29 | /** The validator. */ | |
| 30 | protected final RequestValidator validator; | |
| 31 | ||
| 32 | /** The transformer. */ | |
| 33 | protected final RequestTransformer transformer; | |
| 34 | ||
| 35 | /** | |
| 36 | * Instantiates a new transform to service call. | |
| 37 | * | |
| 38 | * @param method | |
| 39 | * the method | |
| 40 | */ | |
| 41 | 17 |
public TransformToServiceCall(final HTTPMethods method) { |
| 42 | 17 | validator = new RequestValidator(); |
| 43 | 17 | transformer = RequestTransformerFactory.instance.getTransformer(method, |
| 44 | this); | |
| 45 | } | |
| 46 | ||
| 47 | /** | |
| 48 | * Gets the validator. | |
| 49 | * | |
| 50 | * @return the validator | |
| 51 | */ | |
| 52 | 0 |
public RequestValidator getValidator() { |
| 53 | 0 | return validator; |
| 54 | } | |
| 55 | ||
| 56 | /* | |
| 57 | * (non-Javadoc) | |
| 58 | * | |
| 59 | * @see | |
| 60 | * net.sf.arestc.core.BaseCommand#process(net.sf.arestc.core.ConnectorRequest | |
| 61 | * , net.sf.arestc.core.ConnectorContext) | |
| 62 | */ | |
| 63 | 10 |
@Override |
| 64 | public ConnectorContext process(final ConnectorRequest request, | |
| 65 | final ConnectorContext context) throws CommandException { | |
| 66 | ||
| 67 | 10 | if (validator.isValidRequest(request.getParameters(), |
| 68 | request.getCredentials(), context.getService())) { | |
| 69 | 10 | transformer.transform(request, context); |
| 70 | } else { | |
| 71 | 0 | context.add(new BaseError( |
| 72 | -1, | |
| 73 | this, | |
| 74 | "Validation failed, look for configuration discrepancies with the actual runtime feeds", | |
| 75 | null)); | |
| 76 | 0 | return context; |
| 77 | } | |
| 78 | ||
| 79 | 10 | return super.process(request, context); |
| 80 | } | |
| 81 | } | |
|
||||||||||||