Github user ahgittin commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/835#discussion_r142982817 --- Diff: core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java --- @@ -170,4 +181,84 @@ public void run() { if (threadException.get() != null) throw threadException.get(); } + @Test + // same test as in PolicySubscriptionTest, but for entities / simpler + public void testSubscriptionReceivesInitialValueEventsInOrder() { + RecordingSensorEventListener<Object> listener = new RecordingSensorEventListener<>(); + + entity.sensors().set(TestEntity.NAME, "myname"); + entity.sensors().set(TestEntity.SEQUENCE, 123); + entity.sensors().emit(TestEntity.MY_NOTIF, -1); + + // delivery should be in subscription order, so 123 then 456 + entity.subscriptions().subscribe(ImmutableMap.of("notifyOfInitialValue", true), entity, TestEntity.SEQUENCE, listener); + // wait for the above delivery - otherwise it might get dropped + Asserts.succeedsEventually(MutableMap.of("timeout", Duration.seconds(5)), () -> { --- End diff -- ooh handy forgot about this!
---