public function testClose()
 {
     $attendance = new \Application\Model\Alarm\Attendance(array("timestamp" => '24234234', "user" => "test_user", "observation" => "Alarm closed"));
     $result = $this->_alarmMapper->close("234234", $attendance);
     $this->assertNotNull($result);
     $this->assertEquals("234234", $result);
 }
 /**
  * Maps an enum value
  * @param  \DrSlump\Protobuf\Field   $descriptor
  * @param  \App_ListFilter_Interface $filter
  * @return mixed                     Enum value.
  */
 protected function _mapEnumValue(\DrSlump\Protobuf\Field $descriptor, \App_ListFilter_Interface $filter, \App_ListFilter $filterList)
 {
     $alarmRuleMapper = AlarmRuleMapper::getInstance();
     $alarmMapper = AlarmMapper::getInstance();
     switch ($filter->getFieldName()) {
         case AlarmFilterFields::RULE_CONDITION:
             return $alarmRuleMapper->mapConditionToEricsson($filter->getValue());
         case AlarmFilterFields::UNIVERSE_TYPE:
             return $alarmRuleMapper->mapUniverseToEricsson($filter->getValue());
         case AlarmFilterFields::SEVERITY:
             return $alarmRuleMapper->mapSeverityToEricsson($filter->getValue());
         case AlarmFilterFields::STATE:
             return $alarmMapper->mapStateToEricsson($filter->getValue());
         case AlarmFilterFields::ALARM_TYPE:
             return $alarmMapper->mapTypeToEricsson($filter->getValue());
     }
     parent::_mapEnumValue($descriptor, $filter, $filterList);
 }
 public function close($id, Attendance $attendance)
 {
     /**
      * @var $mapper AlarmMapper
      */
     $mapper = AlarmMapper::getInstance();
     if (!isset($id) && !strlen($id) || !$attendance) {
         throw new InvalidArgumentException("Invalid params");
     }
     $alarm = $mapper->findOneById($id);
     if ($alarm->state == AlarmModel::STATE_CLOSED) {
         throw new ValidateException("Can't close an alarm already closed", ValidationCodes::ALARM_ALREADY_CLOSED);
     }
     $this->validate($attendance, true);
     $result = $mapper->close($id, $attendance);
     \App::audit('Close alarm for alarmId:' . $id, $attendance);
     return $result;
 }
 /**
  * @expectedException Application\Exceptions\NotImplementedException
  */
 public function testUpdate()
 {
     $this->_mapper->update(new OrgConfigModel(array('id' => 'eeeeeeee')));
 }