AlarmServiceImpl implements AlarmService { @Override @Transactional(value = TxType.REQUIRED, rollbackOn = {RuntimeException.class}) public List<Alarm> getAlarms(PagingInput pagingInput) { return getAlarms(pagingInput, null); } AlarmServiceImpl(PersistenceManagerUtil persistenceManagerUtil, AlarmQueue alarmQueue); void init(); void close(); @Override void raiseAlarm(AlarmInfo alarm); @Override void raiseAlarms(List<AlarmInfo> alarmInfoList); @Override void clearAlarm(AlarmInfo alarm); @Override void clearAlarms(List<AlarmInfo> alarmInfoList); @Override @Transactional(value = TxType.REQUIRED, rollbackOn = {RuntimeException.class}) List<Alarm> getAlarms(PagingInput pagingInput); @Override @Transactional(value = TxType.REQUIRED, rollbackOn = {RuntimeException.class}) List<Alarm> getAlarms(PagingInput pagingInput, String deviceId); @Override void clearAlarmsOnNodeAndSubtree(ModelNodeId identifier, String mountKey); @Override void clearAlarmsOnDevice(String deviceId); @Override @Transactional(value = TxType.REQUIRED, rollbackOn = {RuntimeException.class}) List<Alarm> getAlarmsUnderResource(String resourceDbIdLike); @Override void updateAlarmsForResync(List<AlarmInfo> newRaiseAlarms, List<AlarmInfo> updateAlarms, List<AlarmInfo> clearAlarms); @Override void updateAlarmNotificationQNameToAdapterTypeVersion(QName alarmNotificationQName, String typeVersion); @Override void removeAlarmNotificationQNameToAdapterTypeVersion(QName alarmNotificationQName, String typeVersion); @Override Set<String> retrieveAdapterTypeVersionsFromAlarmNotificationQName(QName alarmNotificationQName);  }
@Test public void testGetAlarms() { m_persistenceManager.getEntityDataStoreManager().beginTransaction(); List<Alarm> alarms = getAlarmsFor(0, 0); m_persistenceManager.getEntityDataStoreManager().commitTransaction(); assertEquals(0, alarms.size()); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); createAlarms(timestamp, 1); m_persistenceManager.getEntityDataStoreManager().beginTransaction(); alarms = getAlarmsFor(0, 1); assertEquals(1, alarms.size()); assertEquals(timestamp, alarms.get(0).getRaisedTime()); alarms = getAlarmsFor(0, 100); assertEquals(1, alarms.size()); assertEquals(timestamp, alarms.get(0).getRaisedTime()); alarms = getAlarmsFor(1, 100); assertEquals(0, alarms.size()); alarms = getAlarmsFor(1, 1); assertEquals(0, alarms.size()); alarms = getAlarmsFor(0, 1); assertEquals(1, alarms.size()); assertEquals(timestamp, alarms.get(0).getRaisedTime()); m_persistenceManager.getEntityDataStoreManager().commitTransaction(); destroyAlarms(); }