/** * Tests {@code ApplianceArchiveReader#getRawValues(int, String, Timestamp, Timestamp)} method for * a float waveform type pv. * * @throws Exception */ @Test public void testDataRetrievalFloat() throws Exception { Timestamp end = Timestamp.now(); Timestamp start = end.minus(TimeDuration.ofHours(24.0)); ArchiveVNumberArray[] vals = getValuesNumberArray("test_pv_wave_float", false, 0, start, end); assertEquals( "Number of values comparison", TestGenMsgIteratorRaw.MESSAGE_LIST_LENGTH, vals.length); ArchiveVNumberArray val = null; for (int i = 0; i < vals.length; i++) { val = vals[i]; double[] array = new double[val.getData().size()]; for (int j = 0; j < array.length; j++) { array[j] = val.getData().getFloat(j); } assertArrayEquals( "Value comparison", TestGenMsgIteratorWaveform.VALUE_FLOAT[i], array, 0.000001); assertEquals( "Timestamp comparison", TimestampHelper.toMillisecs(start) + i, TimestampHelper.toMillisecs(val.getTimestamp())); assertEquals( "Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity()); assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName()); } }
/** * Tests {@code ApplianceArchiveReader#getRawValues(int, String, Timestamp, Timestamp)} method for * an enum waveform type pv. * * @throws Exception */ @Test public void testDataRetrievalEnum() throws Exception { // this doesn't seem to be supported on the IOC side Timestamp end = Timestamp.now(); Timestamp start = end.minus(TimeDuration.ofHours(24.0)); try { getValuesEnumArray("test_pv_wave_enum", false, 0, start, end); fail(); } catch (UnsupportedOperationException e) { assertNotNull(e); } }
/** * Tests {@code ApplianceArchiveReader#getRawValues(int, String, Timestamp, Timestamp)} method for * a string wavefdorm type pv. * * @throws Exception */ @Test public void testDataRetrievalString() throws Exception { // this is not supported on the CSS core side Timestamp end = Timestamp.now(); Timestamp start = end.minus(TimeDuration.ofHours(24.0)); try { getValuesStringArray("test_pv_wave_string", false, 0, start, end); fail(); } catch (UnsupportedOperationException e) { assertNotNull(e); } }