List<SystemInformationData> toRecord = storageDataDao.getSystemInformationData(involvedAgentsSet); for (SystemInformationData defaultData : toRecord) { record(defaultData);
/** * Tests that stop recording will correctly flush the data processor and record the system * information data for all recorded platforms. */ @Test public void stopRecording() throws BusinessException { cmrStorageRecorder = spy(cmrStorageRecorder); when(recordingProperties.getRecordingDataProcessors()).thenReturn(Collections.singleton(dataProcessor)); cmrStorageRecorder.startOrScheduleRecording(storageWriter, recordingProperties); long platformId = 10L; DefaultData defaultData = mock(DefaultData.class); when(defaultData.getPlatformIdent()).thenReturn(platformId); cmrStorageRecorder.record(defaultData); SystemInformationData systemInformationData = mock(SystemInformationData.class); when(storageDataDao.getSystemInformationData(Collections.singleton(platformId))).thenReturn(Collections.singletonList(systemInformationData)); cmrStorageRecorder.stopRecording(); verify(dataProcessor, times(1)).flush(); verify(cmrStorageRecorder, times(1)).record(systemInformationData); assertThat(cmrStorageRecorder.isRecordingOn(), is(false)); }