diff --git a/src/test/java/com/serotonin/bacnet4j/obj/TrendLogMultipleObjectTest.java b/src/test/java/com/serotonin/bacnet4j/obj/TrendLogMultipleObjectTest.java index 9b028d2e..704c7d93 100644 --- a/src/test/java/com/serotonin/bacnet4j/obj/TrendLogMultipleObjectTest.java +++ b/src/test/java/com/serotonin/bacnet4j/obj/TrendLogMultipleObjectTest.java @@ -116,30 +116,6 @@ public void pollingAlignedWithOffset() throws Exception { assertEquals(noPropSpecified, record1.getLogData().getData().get(3).getDatum()); assertEquals(noPropSpecified, record1.getLogData().getData().get(4).getDatum()); - // - // Update the log interval to 1 hour. - tl.writeProperty(null, PropertyIdentifier.logInterval, new UnsignedInteger(60 * 60 * 100)); - ai.writePropertyInternal(PropertyIdentifier.presentValue, new Real(3)); - - // Advance the clock to the new polling time. - int minutes = (62 - clock.get(ChronoField.MINUTE_OF_HOUR)) % 60; - if (minutes < 34) - minutes += 60; - clock.plus(minutes, MINUTES, 100); - LOG.debug("poll: {}", clock.instant()); - - TestUtils.assertSize(tl.getBuffer(), 3, 500); - assertEquals(3, tl.getBuffer().size()); - final LogMultipleRecord record2 = tl.getBuffer().get(2); - assertEquals(2, record2.getTimestamp().getTime().getMinute()); - assertEquals(3, record2.getSequenceNumber()); - assertEquals(5, record2.getLogData().getData().size()); - assertEquals(new Real(3), record2.getLogData().getData().get(0).getDatum()); - assertEquals(new Real(0), record2.getLogData().getData().get(1).getDatum()); - assertEquals(unknownObject, record2.getLogData().getData().get(2).getDatum()); - assertEquals(noPropSpecified, record2.getLogData().getData().get(3).getDatum()); - assertEquals(noPropSpecified, record2.getLogData().getData().get(4).getDatum()); - // // Try a trigger for fun. ai.writePropertyInternal(PropertyIdentifier.presentValue, new Real(4)); @@ -147,9 +123,9 @@ public void pollingAlignedWithOffset() throws Exception { // Wait for the polling to finish. Thread.sleep(100); - TestUtils.assertSize(tl.getBuffer(), 4, 500); - final LogMultipleRecord record3 = tl.getBuffer().get(3); - assertEquals(4, record3.getSequenceNumber()); + TestUtils.assertSize(tl.getBuffer(), 3, 500); + final LogMultipleRecord record3 = tl.getBuffer().get(2); + assertEquals(3, record3.getSequenceNumber()); assertEquals(5, record3.getLogData().getData().size()); assertEquals(new Real(4), record3.getLogData().getData().get(0).getDatum()); assertEquals(new Real(0), record3.getLogData().getData().get(1).getDatum()); diff --git a/src/test/java/com/serotonin/bacnet4j/obj/TrendLogObjectTest.java b/src/test/java/com/serotonin/bacnet4j/obj/TrendLogObjectTest.java index 732a2942..649e4486 100644 --- a/src/test/java/com/serotonin/bacnet4j/obj/TrendLogObjectTest.java +++ b/src/test/java/com/serotonin/bacnet4j/obj/TrendLogObjectTest.java @@ -105,24 +105,6 @@ private void polling(final TrendLogObject tl, final BACnetObject bo) throws Exce assertEquals(new Real(2), record3.getChoice()); assertEquals(new StatusFlags(false, false, true, false), record3.getStatusFlags()); - // Update the log interval to 1 hour. - tl.writeProperty(null, PropertyIdentifier.enable, Boolean.FALSE); - tl.writeProperty(null, PropertyIdentifier.recordCount, new UnsignedInteger(0)); - tl.writeProperty(null, PropertyIdentifier.logInterval, new UnsignedInteger(60 * 60 * 100)); - tl.writeProperty(null, PropertyIdentifier.enable, Boolean.TRUE); - bo.writePropertyInternal(PropertyIdentifier.presentValue, new Real(3)); - - // Advance the clock to the new polling time. - int minutes = (62 - clock.get(ChronoField.MINUTE_OF_HOUR)); - if (minutes < 34) - minutes += 60; - clock.plus(minutes, MINUTES, 100); - TestUtils.assertSize(tl.getBuffer(), 2, 500); - final LogRecord record4 = tl.getBuffer().get(1); - assertEquals(2, record4.getTimestamp().getTime().getMinute()); - assertEquals(new Real(3), record4.getChoice()); - assertEquals(new StatusFlags(false, false, true, false), record4.getStatusFlags()); - // Try a trigger for fun. tl.writePropertyInternal(PropertyIdentifier.loggingType, LoggingType.triggered); bo.writePropertyInternal(PropertyIdentifier.presentValue, new Real(4)); @@ -131,11 +113,11 @@ private void polling(final TrendLogObject tl, final BACnetObject bo) throws Exce // Wait for the polling to finish. Thread.sleep(50); - assertEquals(3, tl.getBuffer().size()); - final LogRecord record5 = tl.getBuffer().get(2); + assertEquals(4, tl.getBuffer().size()); + final LogRecord record5 = tl.getBuffer().get(3); assertEquals(new Real(4), record5.getChoice()); assertEquals(new StatusFlags(false, false, false, false), record5.getStatusFlags()); - Thread.sleep(2000); + Thread.sleep(1000); } @Test