Skip to content

Commit

Permalink
Fix tests for the Archive Appliance Reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
willrogers committed Jul 22, 2020
1 parent 70b2bd0 commit 69b7ca0
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ public void testDataRetrievalWhenThereAreNotManyPoints() throws Exception {

ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = (ArchiveVNumber) vals[i];
val = vals[i];
assertEquals(
"Value comparison",
Double.valueOf(TestGenMsgIteratorRaw.VALUES_DOUBLE[i % TestGenMsgIteratorRaw.VALUES_DOUBLE.length]),
(Double) val.getValue(), 0.0001);
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i%TestGenMsgIteratorRaw.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i%TestGenMsgIteratorRaw.SEVERITIES.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i%TestGenMsgIteratorRaw.SEVERITIES.length], val.getAlarmName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testDataRetrievalWhenThereAreNotManyPoints() throws Exception{
assertEquals("Value comparison", Double.valueOf(TestGenMsgIteratorRaw.VALUES_DOUBLE[i%TestGenMsgIteratorRaw.VALUES_DOUBLE.length]),(Double)val.getValue(),0.0001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand Down Expand Up @@ -247,7 +247,7 @@ public void testDataRetrievalString() throws Exception {
assertEquals("Value comparison", "9554.0",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -272,7 +272,7 @@ public void testDataRetrievalEnum() throws Exception {
assertEquals("Value comparison", "Enum <" + (i+1) + ">",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i], val.getAlarmName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public void testDataRetrievalWhenThereAreNotManyPoints() throws Exception{

ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = (ArchiveVNumber)vals[i];
val = vals[i];
assertEquals("Value comparison", Double.valueOf(TestGenMsgIteratorRaw.VALUES_DOUBLE[i%TestGenMsgIteratorRaw.VALUES_DOUBLE.length]),(Double)val.getValue(),0.0001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i%TestGenMsgIteratorRaw.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i%TestGenMsgIteratorRaw.SEVERITIES.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i%TestGenMsgIteratorRaw.SEVERITIES.length], val.getAlarmName());
}
}

Expand All @@ -79,7 +79,7 @@ public void testDataRetrievalDouble() throws Exception {
assertEquals("Value comparison", Double.valueOf(TestGenMsgIteratorOptimized.VALUES_DOUBLE[i%TestGenMsgIteratorOptimized.VALUES_DOUBLE.length]),(Double)val.getValue(),0.0001);
assertEquals("Timestamp comparison", startM + i*step, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -106,7 +106,7 @@ public void testDataRetrievalFloat() throws Exception {
assertEquals("Value comparison", Float.valueOf(TestGenMsgIteratorOptimized.VALUES_FLOAT[i%TestGenMsgIteratorOptimized.VALUES_FLOAT.length]),(Float)val.getValue(),0.0001);
assertEquals("Timestamp comparison", startM + i*step, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -130,10 +130,10 @@ public void testDataRetrievalInt() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Integer.valueOf(TestGenMsgIteratorOptimized.VALUES_INT[i%TestGenMsgIteratorOptimized.VALUES_INT.length]),(Integer)val.getValue());
assertEquals("Value comparison", Integer.valueOf(TestGenMsgIteratorOptimized.VALUES_INT[i%TestGenMsgIteratorOptimized.VALUES_INT.length]),val.getValue());
assertEquals("Timestamp comparison", startM + i*step, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -157,10 +157,10 @@ public void testDataRetrievalShort() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Short.valueOf(TestGenMsgIteratorOptimized.VALUES_SHORT[i%TestGenMsgIteratorOptimized.VALUES_SHORT.length]),(Short)val.getValue());
assertEquals("Value comparison", Short.valueOf(TestGenMsgIteratorOptimized.VALUES_SHORT[i%TestGenMsgIteratorOptimized.VALUES_SHORT.length]),val.getValue());
assertEquals("Timestamp comparison", startM + i*step, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -184,10 +184,10 @@ public void testDataRetrievalByte() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Byte.valueOf(TestGenMsgIteratorOptimized.VALUES_BYTE[i%TestGenMsgIteratorOptimized.VALUES_BYTE.length]),(Byte)val.getValue());
assertEquals("Value comparison", Byte.valueOf(TestGenMsgIteratorOptimized.VALUES_BYTE[i%TestGenMsgIteratorOptimized.VALUES_BYTE.length]),val.getValue());
assertEquals("Timestamp comparison", startM + i*step, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -212,7 +212,7 @@ public void testDataRetrievalString() throws Exception {
assertEquals("Value comparison", "9554.0",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}

Expand All @@ -237,7 +237,7 @@ public void testataRetrievalEnum() throws Exception {
assertEquals("Value comparison", "Enum <" + TestGenMsgIteratorOptimized.VALUES_INT[i%TestGenMsgIteratorOptimized.VALUES_INT.length] + ">",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorOptimized.SEVERITIES[i%TestGenMsgIteratorOptimized.SEVERITIES.length]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorOptimized.STATUS[i%TestGenMsgIteratorOptimized.STATUS.length]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorOptimized.STATUS_STRING[i%TestGenMsgIteratorOptimized.STATUS.length], val.getAlarmName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testDataRetrievalDouble() throws Exception {
assertArrayEquals("Value comparison", TestGenMsgIteratorWaveform.VALUE_DOUBLE[i*2],array,0.000001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i*2, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i*2]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i*2]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i*2], val.getAlarmName());
}
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public void testDataRetrievalFloat() throws Exception {
assertArrayEquals("Value comparison", TestGenMsgIteratorWaveform.VALUE_FLOAT[i*2],array,0.000001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i*2, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i*2]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i*2]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i*2], val.getAlarmName());
}
}

Expand Down Expand Up @@ -110,7 +110,7 @@ public void testDataRetrievalInt() throws Exception {
assertArrayEquals("Value comparison", TestGenMsgIteratorWaveform.VALUE_INT[i*2],array);
assertEquals("Timestamp comparison", start.toEpochMilli() + i*2, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i*2]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i*2]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i*2], val.getAlarmName());
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public void testDataRetrievalShort() throws Exception {
assertArrayEquals("Value comparison", TestGenMsgIteratorWaveform.VALUE_SHORT[i*2],array);
assertEquals("Timestamp comparison", start.toEpochMilli() + i*2, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i*2]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i*2]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i*2], val.getAlarmName());
}
}

Expand Down Expand Up @@ -166,7 +166,7 @@ public void testDataRetrievalByte() throws Exception {
assertArrayEquals("Value comparison", TestGenMsgIteratorWaveform.VALUE_BYTE[i*2],array);
assertEquals("Timestamp comparison", start.toEpochMilli() + i*2, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i*2]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i*2]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i*2], val.getAlarmName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testDataRetrievalDouble() throws Exception {
assertEquals("Value comparison", Double.valueOf(TestGenMsgIteratorRaw.VALUES_DOUBLE[i]),(Double)val.getValue(),0.0001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -72,7 +72,7 @@ public void testDataRetrievalFloat() throws Exception {
assertEquals("Value comparison", Float.valueOf(TestGenMsgIteratorRaw.VALUES_FLOAT[i]),(Float)val.getValue(),0.0001);
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -93,10 +93,10 @@ public void testDataRetrievalInt() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Integer.valueOf(TestGenMsgIteratorRaw.VALUES_INT[i]),(Integer)val.getValue());
assertEquals("Value comparison", Integer.valueOf(TestGenMsgIteratorRaw.VALUES_INT[i]),val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i, val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -117,10 +117,10 @@ public void testDataRetrievalShort() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Short.valueOf(TestGenMsgIteratorRaw.VALUES_SHORT[i] ),(Short)val.getValue());
assertEquals("Value comparison", Short.valueOf(TestGenMsgIteratorRaw.VALUES_SHORT[i] ),val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -141,10 +141,10 @@ public void testDataRetrievalByte() throws Exception {
ArchiveVNumber val = null;
for (int i = 0; i < vals.length; i++) {
val = vals[i];
assertEquals("Value comparison", Byte.valueOf(TestGenMsgIteratorRaw.VALUES_BYTE[i]) ,(Byte)val.getValue());
assertEquals("Value comparison", Byte.valueOf(TestGenMsgIteratorRaw.VALUES_BYTE[i]) ,val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -168,7 +168,7 @@ public void testDataRetrievalString() throws Exception {
assertEquals("Value comparison", "9554.0",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}

Expand All @@ -192,7 +192,7 @@ public void testDataRetrievalEnum() throws Exception {
assertEquals("Value comparison", "Enum <" + TestGenMsgIteratorRaw.VALUES_INT[i] + ">",val.getValue());
assertEquals("Timestamp comparison", start.toEpochMilli() + i,val.getTimestamp().toEpochMilli());
assertEquals("Severity", getSeverity(TestGenMsgIteratorRaw.SEVERITIES[i]), val.getAlarmSeverity());
assertEquals("Status", String.valueOf(TestGenMsgIteratorRaw.STATUS[i]), val.getAlarmName());
assertEquals("Status", TestGenMsgIteratorRaw.STATUS_STRING[i], val.getAlarmName());
}
}
}
Loading

0 comments on commit 69b7ca0

Please sign in to comment.