mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +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) {
|
for (XMPPConnection connection : connections) {
|
||||||
final Map<EntityFullJid, boolean[]> myReceiveMarkers = new HashMap<>(connections.size());
|
final Map<EntityFullJid, boolean[]> myReceiveMarkers = new HashMap<>(connections.size());
|
||||||
receiveMarkers.put(connection, myReceiveMarkers);
|
receiveMarkers.put(connection, myReceiveMarkers);
|
||||||
|
for (XMPPConnection otherConnection : connections) {
|
||||||
|
boolean[] fromMarkers = new boolean[configuration.messagesPerConnection];
|
||||||
|
myReceiveMarkers.put(otherConnection.getUser(), fromMarkers);
|
||||||
|
}
|
||||||
|
|
||||||
connection.addSyncStanzaListener(new StanzaListener() {
|
connection.addSyncStanzaListener(new StanzaListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -149,10 +153,6 @@ public class XmppConnectionStressTest {
|
||||||
Integer messageNumber = (Integer) extension.getProperty(MESSAGE_NUMBER_PROPERTY);
|
Integer messageNumber = (Integer) extension.getProperty(MESSAGE_NUMBER_PROPERTY);
|
||||||
|
|
||||||
boolean[] fromMarkers = myReceiveMarkers.get(from);
|
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.
|
// 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++) {
|
for (int i = 0; i < fromMarkers.length; i++) {
|
||||||
|
@ -191,10 +191,6 @@ public class XmppConnectionStressTest {
|
||||||
|
|
||||||
fromMarkers[messageNumber] = true;
|
fromMarkers[messageNumber] = true;
|
||||||
|
|
||||||
if (myReceiveMarkers.size() != connections.size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (boolean[] markers : myReceiveMarkers.values()) {
|
for (boolean[] markers : myReceiveMarkers.values()) {
|
||||||
if (BooleansUtils.contains(markers, false)) {
|
if (BooleansUtils.contains(markers, false)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue