mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
[sinttest] Do not lazily create fromMarkers
If we do not create the fromMarkers initialized with 'false' at the start, then it may appear like all messages are received, because we only check for false markers. But if there is not even the fromMarkers array, then we do not see those 'false' markers.
This commit is contained in:
parent
47178fd27d
commit
35cd1a8f88
1 changed files with 4 additions and 8 deletions
|
@ -136,6 +136,10 @@ public class XmppConnectionStressTest {
|
|||
for (XMPPConnection connection : connections) {
|
||||
final Map<EntityFullJid, boolean[]> myReceiveMarkers = new HashMap<>(connections.size());
|
||||
receiveMarkers.put(connection, myReceiveMarkers);
|
||||
for (XMPPConnection otherConnection : connections) {
|
||||
boolean[] fromMarkers = new boolean[configuration.messagesPerConnection];
|
||||
myReceiveMarkers.put(otherConnection.getUser(), fromMarkers);
|
||||
}
|
||||
|
||||
connection.addSyncStanzaListener(new StanzaListener() {
|
||||
@Override
|
||||
|
@ -149,10 +153,6 @@ public class XmppConnectionStressTest {
|
|||
Integer messageNumber = (Integer) extension.getProperty(MESSAGE_NUMBER_PROPERTY);
|
||||
|
||||
boolean[] fromMarkers = myReceiveMarkers.get(from);
|
||||
if (fromMarkers == null) {
|
||||
fromMarkers = new boolean[configuration.messagesPerConnection];
|
||||
myReceiveMarkers.put(from, fromMarkers);
|
||||
}
|
||||
|
||||
// Sanity check: All markers before must be true, all markers including the messageNumber marker must be false.
|
||||
for (int i = 0; i < fromMarkers.length; i++) {
|
||||
|
@ -191,10 +191,6 @@ public class XmppConnectionStressTest {
|
|||
|
||||
fromMarkers[messageNumber] = true;
|
||||
|
||||
if (myReceiveMarkers.size() != connections.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (boolean[] markers : myReceiveMarkers.values()) {
|
||||
if (BooleansUtils.contains(markers, false)) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue