public function apnAction()
 {
     // Add/remove apn
     $data = $this->_checkAndGetListData('async_change_apn', true, array('POST', 'DELETE'));
     $method = $this->getRequest()->getMethod();
     if (empty($data['apns'])) {
         throw new InvalidArgumentException('Bad Request. Malformed Json. parameter {apns} is required');
     }
     // Support single apn or list
     $data['apns'] = is_array($data['apns']) ? $data['apns'] : array($data['apns']);
     if ($method == 'POST') {
         $watcher = $this->_simSrv->addApn($data['list'], $data['apns']);
     } else {
         if ($method == 'DELETE') {
             $watcher = $this->_simSrv->removeApn($data['list'], $data['apns']);
         } else {
             throw new AppEx\UnexpectedException("Resquest must be POST or DELETE");
         }
     }
     $this->_helper->filterNotAllowedFields('read_field', $watcher);
     $this->view->watcher = $watcher;
 }
 public function testAddApn()
 {
     $filterList = $this->_service->buildFilterList(array(\Application\Model\Sorting\SimSortingFields::SIM_TYPE => \Application\Model\SimModel::SIM_TYPE_GLOBAL));
     $result = $this->_service->addApn($filterList, array("123456"));
     $this->assertNotNull($result);
 }