1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

SINT: Removing invalid test

The implementation of the test that is being removed depends on a server
characteristic that will cause a loop of presence stanzas (which obviously is
bad). A RFC3921-compliant client can send an 'acknowledgement' after receiving
a presence 'subscribed' stanza, in the form of a presence 'subscribe' stanza.
See section 8.2 of RFC3921.

When a server implementation does not ignore this acknowledgement, the domain
of the recipient MUST (RFC6121 section 3.1.3) respond with a 'subscribed' on
behalf of the recipient (which is what the now removed test was verifying).
This can trigger the RFC3921-compliant sender to again receive 'subscribed',
that it again can acknowledge, which causes a loop.

To test RFC6121, the subscription state of the recipient must somehow be
modified to reflect a different state than that of the initiator. I'm not sure
if that is feasible with the SINT framework.
This commit is contained in:
Guus der Kinderen 2022-03-03 17:06:25 +01:00
parent 26ec0d412d
commit ad756810c1

View file

@ -178,54 +178,6 @@ public class RosterIntegrationTest extends AbstractSmackIntegrationTest {
}
}
/**
* Asserts that when a user sends out a presence subscription request to an entity for which the user already has
* an approved subscription, the server sends an auto-reply back to the user.
*
* <p>From RFC6121 § 3.1.3:</p>
* <blockquote>
* If the contact exists and the user already has a subscription to the contact's presence, then the contact's
* server MUST auto-reply on behalf of the contact by sending a presence stanza of type "subscribed" from the
* contact's bare JID to the user's bare JID.
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
public void testAutoReplyForRequestWhenAlreadySubscribed() throws Exception {
IntegrationTestRosterUtil.ensureBothAccountsAreSubscribedToEachOther(conOne, conTwo, connection.getReplyTimeout());
final SimpleResultSyncPoint added = new SimpleResultSyncPoint();
final StanzaListener stanzaListener = stanza -> {
final Presence presence = (Presence) stanza;
if (!presence.getTo().isEntityBareJid()) {
added.signalFailure("'to' address should be a bare JID, but is a full JID.");
} else if (!presence.getFrom().isEntityBareJid()) {
added.signalFailure("'from' address should be a bare JID, but is a full JID.");
} else if (presence.getType() != Presence.Type.subscribed) {
added.signalFailure("Incorrect subscription type on auto-reply: " + presence.getType());
} else {
added.signal();
}
};
conOne.addAsyncStanzaListener(stanzaListener, new AndFilter(StanzaTypeFilter.PRESENCE, FromMatchesFilter.createBare(conTwo.getUser())));
final Presence subscribe = PresenceBuilder.buildPresence()
.ofType(Presence.Type.subscribe)
.to(conTwo.getUser().asBareJid())
.build();
try {
conOne.sendStanza(subscribe);
assertTrue(added.waitForResult(2 * connection.getReplyTimeout()));
} finally {
conOne.removeAsyncStanzaListener(stanzaListener);
}
}
/**
* Asserts that when a user sends out a presence subscription request to an entity for which the user does not have
* a pre-existing subscription, the server will deliver the subscription request to that entity.