コード例 #1
0
 /**
  * Change life cycle state for a list of sims or a list of filters
  */
 public function lifecycleAction()
 {
     $data = $this->_checkAndGetListData('change_lifecycle_status', true);
     if (empty($data['state'])) {
         throw new InvalidArgumentException('Bad Request. Malformed Json. parameter {state} is required');
     }
     $dumbSim = new SimModel();
     if (in_array($data['state'], array(Application\Model\LifeCycleModel::STATUS_RETIRED, Application\Model\LifeCycleModel::STATUS_SUSPENDED))) {
         $this->_helper->allowed('change_lifecycle_status_to_suspended_or_retired', $dumbSim);
     }
     if ($data['state'] === Application\Model\LifeCycleModel::STATUS_DEACTIVATED) {
         $this->_helper->allowed('change_lifecycle_status_to_deactivated', $dumbSim);
     }
     if ($data['state'] === Application\Model\LifeCycleModel::STATUS_RESTORE) {
         $this->_helper->allowed('restore_suspended_lifecycle_status', $dumbSim);
     }
     $watcher = $this->_simSrv->changeLifeCycleState($data['state'], $data['list'], isset($data['isPublishRollback']) ? $data['isPublishRollback'] : null);
     $this->_helper->filterNotAllowedFields('read_field', $watcher);
     // Respond with the transaction ID
     $this->view->watcher = $watcher;
 }
コード例 #2
0
 /**
  * @expectedException \Application\Exceptions\InvalidArgumentException
  */
 public function testChangeLifeCycleStateSuspendedByInvalidState()
 {
     $filterList = $this->_service->buildFilterList(array(\Application\Model\Sorting\SimSortingFields::SIM_TYPE => \Application\Model\SimModel::SIM_TYPE_GLOBAL));
     $result = $this->_service->changeLifeCycleState("asd", $filterList);
     $this->assertNotNull($result);
 }