|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ChainBuilder | Line # 28 | 14 | 0% | 4 | 6 | 70% |
0.7
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (16) | |||
| Result | |||
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testFileDownload
net.sf.arestc.core.OverallDesignTest.testFileDownload
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
net.sf.arestc.core.OverallDesignTest.testTicketRetrieval
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
net.sf.arestc.core.OverallDesignTest.testRepositoryRetrieval
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForDownloadFile
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForDownloadFile
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadMultipart
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadMultipart
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForLogin
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForLogin
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadFile
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForUploadFile
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
net.sf.arestc.core.OverallDesignTest.testRepositoryMultiPost
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeCreate
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeCreate
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testFileUpload
net.sf.arestc.core.OverallDesignTest.testFileUpload
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
net.sf.arestc.core.OverallDesignTest.testTicketRetrievalWithTicketer
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
net.sf.arestc.core.OverallDesignTest.testRepositoryCreate
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
net.sf.arestc.core.OverallDesignTest.testRepositoryDelete
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeRetrieve
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeRetrieve
|
1 PASS | |
|
0.4
|
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeDelete
net.sf.arestc.core.commands.ChainBuilderTest.testGetDefaultChainForNodeDelete
|
1 PASS | |
|
0.3
|
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 | |
| 8 | it under the terms of the Lesser General Public License as published by | |
| 9 | the Free Software Foundation, either version 3 of the License, or | |
| 10 | (at your option) any later version. | |
| 11 | ||
| 12 | ARESTC is distributed in the hope that it will be useful, | |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | GNU General Public License for more details. | |
| 16 | ||
| 17 | You should have received a copy of the Lesser General Public License | |
| 18 | along with ARESTC. If not, see <http://www.gnu.org/licenses/>. | |
| 19 | ||
| 20 | */ | |
| 21 | package net.sf.arestc.core; | |
| 22 | ||
| 23 | ||
| 24 | // TODO: Auto-generated Javadoc | |
| 25 | /** | |
| 26 | * The Class ChainBuilder. | |
| 27 | */ | |
| 28 | public class ChainBuilder { | |
| 29 | ||
| 30 | /** The Constant instance. */ | |
| 31 | public static final ChainBuilder instance = new ChainBuilder(); | |
| 32 | ||
| 33 | /** | |
| 34 | * Gets the default chain. | |
| 35 | * | |
| 36 | * @param context | |
| 37 | * the context | |
| 38 | * @param initialTransformer | |
| 39 | * the initial transformer | |
| 40 | * @param endTransformer | |
| 41 | * the end transformer | |
| 42 | * @return the default chain | |
| 43 | */ | |
| 44 | 17 |
public ConnectorCommand getDefaultChain(final ConnectorContext context, |
| 45 | final ConnectorCommand initialTransformer, | |
| 46 | final ConnectorCommand endTransformer) { | |
| 47 | ||
| 48 | 17 | final ConnectorCommand transform = new TransformToServiceCall(context |
| 49 | .getService().getMethod()); | |
| 50 | 17 | final ConnectorCommand call = new CallServer(new TransformResponse( |
| 51 | endTransformer)); | |
| 52 | 17 | transform.setNextLink(call); |
| 53 | 17 | ConnectorCommand firstLink = transform; |
| 54 | 17 | if (null != initialTransformer) { |
| 55 | 0 | initialTransformer.setNextLink(transform); |
| 56 | 0 | firstLink = initialTransformer; |
| 57 | } | |
| 58 | ||
| 59 | 17 | return firstLink; |
| 60 | } | |
| 61 | ||
| 62 | /** | |
| 63 | * Gets the dummy chain. | |
| 64 | * | |
| 65 | * @param context | |
| 66 | * the context | |
| 67 | * @param initialTransformer | |
| 68 | * the initial transformer | |
| 69 | * @param endTransformer | |
| 70 | * the end transformer | |
| 71 | * @return the dummy chain | |
| 72 | */ | |
| 73 | 1 |
public ConnectorCommand getDummyChain(final ConnectorContext context, |
| 74 | final ConnectorCommand initialTransformer, | |
| 75 | final ConnectorCommand endTransformer) { | |
| 76 | ||
| 77 | 1 | final ConnectorCommand dummy = new DummyTransformer( |
| 78 | new TransformResponse(endTransformer)); | |
| 79 | ||
| 80 | 1 | ConnectorCommand firstLink = dummy; |
| 81 | 1 | if (null != initialTransformer) { |
| 82 | 0 | initialTransformer.setNextLink(dummy); |
| 83 | 0 | firstLink = initialTransformer; |
| 84 | } | |
| 85 | ||
| 86 | 1 | return firstLink; |
| 87 | } | |
| 88 | } | |
|
||||||||||||