Skip to content

Commit

Permalink
SINT: Retrofit MultiUserChatEntityIntegrationTest to use new tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Mar 14, 2024
1 parent ae8d0df commit 9589b52
Showing 1 changed file with 21 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.parts.Resourcepart;
Expand All @@ -47,18 +48,15 @@ public MultiUserChatEntityIntegrationTest(SmackIntegrationTestEnvironment enviro
}

/**
* Asserts that a MUC service can have its features discovered
*
* <p>From XEP-0045 § 6.2:</p>
* <blockquote>
* An entity may wish to discover if a service implements the Multi-User Chat protocol; in order to do so, it
* sends a service discovery information ("disco#info") query to the MUC service's JID. The service MUST return
* its identity and the features it supports.
* </blockquote>
* Asserts that a MUC service can have its features discovered.
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "6.2", quote =
"An entity may wish to discover if a service implements the Multi-User Chat protocol; in order to do so, it " +
"sends a service discovery information (\"disco#info\") query to the MUC service's JID. The service MUST " +
"return its identity and the features it supports.")
public void mucTestForDiscoveringFeatures() throws Exception {
DiscoverInfo info = mucManagerOne.getMucServiceDiscoInfo(mucManagerOne.getMucServiceDomains().get(0));
assertTrue(info.getIdentities().size() > 0);
Expand All @@ -68,17 +66,14 @@ public void mucTestForDiscoveringFeatures() throws Exception {
/**
* Asserts that a MUC Service lists its public rooms.
*
* <p>From XEP-0045 § 6.3:</p>
* <blockquote>
* The service discovery items ("disco#items") protocol enables an entity to query a service for a list of
* associated items, which in the case of a chat service would consist of the specific chat rooms hosted by the
* service. The service SHOULD return a full list of the public rooms it hosts (i.e., not return any rooms that
* are hidden).
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "6.3", quote =
"The service discovery items (\"disco#items\") protocol enables an entity to query a service for a list of " +
"associated items, which in the case of a chat service would consist of the specific chat rooms hosted by the" +
"service. The service SHOULD return a full list of the public rooms it hosts (i.e., not return any rooms that" +
"are hidden).")
public void mucTestForDiscoveringRooms() throws Exception {
EntityBareJid mucAddressPublic = getRandomRoom("smack-inttest-publicroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddressPublic);
Expand All @@ -104,15 +99,12 @@ public void mucTestForDiscoveringRooms() throws Exception {
/**
* Asserts that a MUC Service returns disco info for a room.
*
* <p>From XEP-0045 § 6.4:</p>
* <blockquote>
* Using the disco#info protocol, an entity may also query a specific chat room for more detailed information
* about the room....The room MUST return its identity and SHOULD return the features it supports
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "6.4", quote =
"Using the disco#info protocol, an entity may also query a specific chat room for more detailed information " +
"about the room....The room MUST return its identity and SHOULD return the features it supports")
public void mucTestForDiscoveringRoomInfo() throws Exception {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
Expand All @@ -133,16 +125,13 @@ public void mucTestForDiscoveringRoomInfo() throws Exception {
/**
* Asserts that a MUC Service returns disco info for a room's items.
*
* <p>From XEP-0045 § 6.5:</p>
* <blockquote>
* An entity MAY also query a specific chat room for its associated items. An implementation MAY return a list
* of existing occupants if that information is publicly available, or return no list at all if this information is
* kept private.
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "6.5", quote =
"An entity MAY also query a specific chat room for its associated items. An implementation MAY return a list " +
"of existing occupants if that information is publicly available, or return no list at all if this " +
"information is kept private.")
public void mucTestForDiscoveringRoomItems() throws Exception {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
Expand All @@ -162,15 +151,12 @@ public void mucTestForDiscoveringRoomItems() throws Exception {
* Asserts that a non-occupant receives a Bad Request error when attempting to query an occupant by their
* occupant JID.
*
* <p>From XEP-0045 § 6.6:</p>
* <blockquote>
* If a non-occupant attempts to send a disco request to an address of the form &lt;room@service/nick&gt;, a MUC service
* MUST return a &lt;bad-request/&gt; error
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "6.6", quote =
"If a non-occupant attempts to send a disco request to an address of the form <room@service/nick>, a MUC " +
"service MUST return a <bad-request> error")
public void mucTestForRejectingDiscoOnRoomOccupantByNonOccupant() throws Exception {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
Expand Down

0 comments on commit 9589b52

Please sign in to comment.