Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 23 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| LegacyClientContainer | |
0.00% |
0 / 23 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 1 |
| getSourceTest | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getPublicDirId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getPrivateDirId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getServiceCallParam | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| getExecutionContainer | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2016 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | namespace oat\taoDelivery\model\container\delivery; |
| 22 | |
| 23 | use oat\taoDelivery\model\execution\DeliveryExecution; |
| 24 | use oat\taoDelivery\model\DeliveryContainerService; |
| 25 | use oat\taoDelivery\model\container\execution\ExecutionClientContainer; |
| 26 | |
| 27 | /** |
| 28 | * Legacy Client Container, requires to do its own data retrieval |
| 29 | */ |
| 30 | class LegacyClientContainer extends AbstractContainer |
| 31 | { |
| 32 | private $serviceCallParam = []; |
| 33 | |
| 34 | /** |
| 35 | * Return the URI of the test for the delivery |
| 36 | * @param DeliveryExecution $execution |
| 37 | * @return string |
| 38 | */ |
| 39 | public function getSourceTest(DeliveryExecution $execution) |
| 40 | { |
| 41 | $containerService = $this->getServiceLocator()->get(DeliveryContainerService::SERVICE_ID); |
| 42 | return $containerService->getTestDefinition($execution); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Return the id of the storage directory for the public content |
| 47 | * @param DeliveryExecution $execution |
| 48 | * @return string |
| 49 | */ |
| 50 | public function getPublicDirId(DeliveryExecution $execution) |
| 51 | { |
| 52 | list($private, $public) = explode('|', $this->getServiceCallParam($execution)); |
| 53 | return $public; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Return the id of the storage directory for the private content |
| 58 | * @param DeliveryExecution $execution |
| 59 | * @return string |
| 60 | */ |
| 61 | public function getPrivateDirId(DeliveryExecution $execution) |
| 62 | { |
| 63 | list($private, $public) = explode('|', $this->getServiceCallParam($execution)); |
| 64 | return $private; |
| 65 | } |
| 66 | |
| 67 | private function getServiceCallParam(DeliveryExecution $execution) |
| 68 | { |
| 69 | if (!isset($this->serviceCallParam[$execution->getIdentifier()])) { |
| 70 | $containerService = $this->getServiceLocator()->get(DeliveryContainerService::SERVICE_ID); |
| 71 | $this->serviceCallParam[$execution->getIdentifier()] = $containerService->getTestCompilation($execution); |
| 72 | } |
| 73 | return $this->serviceCallParam[$execution->getIdentifier()]; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * {@inheritDoc} |
| 78 | * @see \oat\taoDelivery\model\container\delivery\AbstractContainer::getExecutionContainer() |
| 79 | */ |
| 80 | public function getExecutionContainer(DeliveryExecution $execution) |
| 81 | { |
| 82 | $container = new ExecutionClientContainer($execution); |
| 83 | $containerService = $this->getServiceLocator()->get(DeliveryContainerService::SERVICE_ID); |
| 84 | |
| 85 | // set the test parameters |
| 86 | $container->setData('testDefinition', $this->getSourceTest($execution)); |
| 87 | $container->setData( |
| 88 | 'testCompilation', |
| 89 | $this->getPrivateDirId($execution) . '|' . $this->getPublicDirId($execution) |
| 90 | ); |
| 91 | |
| 92 | $container->setData('providers', $containerService->getProviders($execution)); |
| 93 | $container->setData('bootstrap', $containerService->getBootstrap($execution)); |
| 94 | $container->setData('serviceCallId', $execution->getIdentifier()); |
| 95 | $container->setData('deliveryExecution', $execution->getIdentifier()); |
| 96 | $container->setData('deliveryServerConfig', []); |
| 97 | return $container; |
| 98 | } |
| 99 | } |