use of org.openmuc.framework.data.DoubleValue in project OpenMUC by isc-konstanz.
the class OpenmucParserServiceImplTest method serializeMultipleRecords.
@Test
void serializeMultipleRecords() throws SerializationException {
StringBuilder sb = new StringBuilder();
sb.append("{\"timestamp\":1582722316,\"flag\":\"VALID\",\"value\":3.0}");
sb.append("\n");
sb.append("{\"timestamp\":1582722316,\"flag\":\"VALID\",\"value\":5.0}");
sb.append("\n");
String controlString = sb.toString();
Value doubleValue1 = new DoubleValue(3.0);
long timestamp1 = 1582722316;
Flag flag1 = Flag.VALID;
Record record1 = new Record(doubleValue1, timestamp1, flag1);
Value doubleValue2 = new DoubleValue(5.0);
long timestamp2 = 1582722316;
Flag flag2 = Flag.VALID;
Record record2 = new Record(doubleValue2, timestamp2, flag2);
List<LoggingRecord> openMucRecords = new ArrayList<>();
openMucRecords.add(new LoggingRecord("channel1", record1));
openMucRecords.add(new LoggingRecord("channel2", record2));
byte[] serializedRecord = parserService.serialize(openMucRecords);
String serializedJson = new String(serializedRecord);
assertEquals(controlString, serializedJson);
}
Aggregations