I have the following projection:
fromAll()
.when({
‘org.hltv.languageextension.ges.Event1’: function (s, e) {
linkTo(“Events-1”, e);
},
‘org.hltv.languageextension.ges.Event2’: function (s, e) {
linkTo(“Events-1”, e);
}
});
}
``
(I have two event types in their own stream, and now I link them to the stream 'Events-1')
When I run the following test:
@Test
public void weirdReplicatedEventsBug() throws InterruptedException {
List lotsOfEvent1s = lotsOfEvent1s(5);
List lotsOfEvent2s = lotsOfEvent2s(5);
repo.addAll("event-1", lotsOfEvent1s.stream());
repo.addAll("event-2", lotsOfEvent2s.stream());
Thread.sleep(1000);
assertEquals(lotsOfEvent1s.size(), repo.getAggregate("event-1").count());
assertEquals(lotsOfEvent2s.size(), repo.getAggregate("event-2").count());
assertEquals(lotsOfEvent1s.size() + lotsOfEvent2s.size(), repo.getAggregate("Events-1").count());
}
``
I create 5 of each events and put them into stream 'event-1' and 'event-2' respectively. I assert that there are 5 events in each stream.
But HORROR the last assertion fails with:
java.lang.AssertionError:
Expected :10
Actual :860
``
(this is not a stable result. Actually sometimes the test passes :S )
The repository is a bit clunky so I created a [repo gist](https://gist.github.com/mathiasbn/364c75257eef84f24ba4e2cbc1fada76).
I don't know if I supplied sufficient context (or too much...), but hope the mistake is mine and a simple fix.