Skip to content

Commit

Permalink
SINT: Retrofit most pre-existing tests 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 13a4fdd commit e50908c
Show file tree
Hide file tree
Showing 25 changed files with 164 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;

public class EntityCapsTest extends AbstractSmackIntegrationTest {

Expand Down Expand Up @@ -91,6 +92,7 @@ public void tearDown() throws NotConnectedException, InterruptedException {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0115")
public void testLocalEntityCaps() throws InterruptedException, NoResponseException, XMPPErrorException, NotConnectedException {
final String dummyFeature = getNewDummyFeature();
DiscoverInfo info = EntityCapsManager.getDiscoveryInfoByNodeVer(ecmTwo.getLocalNodeVer());
Expand Down Expand Up @@ -128,6 +130,7 @@ public void run() {
* @throws Exception if exception.
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0115")
public void testPreventDiscoInfo() throws Exception {
final String dummyFeature = getNewDummyFeature();
final AtomicBoolean discoInfoSend = new AtomicBoolean();
Expand Down Expand Up @@ -159,6 +162,7 @@ public void processStanza(Stanza stanza) {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0115")
public void testCapsChanged() throws Exception {
final String dummyFeature = getNewDummyFeature();
String nodeVerBefore = EntityCapsManager.getNodeVersionByJid(conTwo.getUser());
Expand All @@ -169,6 +173,7 @@ public void testCapsChanged() throws Exception {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0115")
public void testEntityCaps() throws XMPPException, InterruptedException, NoResponseException, NotConnectedException, TimeoutException {
final String dummyFeature = getNewDummyFeature();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;

public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
Expand All @@ -53,6 +54,7 @@ public ChatStateIntegrationTest(SmackIntegrationTestEnvironment environment) {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0085")
public void testChatStateListeners() throws Exception {
ChatStateManager manOne = ChatStateManager.getInstance(conOne);
ChatStateManager manTwo = ChatStateManager.getInstance(conTwo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;

public class AdHocCommandIntegrationTest extends AbstractSmackIntegrationTest {

Expand All @@ -44,6 +45,7 @@ public AdHocCommandIntegrationTest(SmackIntegrationTestEnvironment environment)
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0050")
public void singleStageAdHocCommandTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AdHocCommandManager manOne = AdHocCommandManager.getInstance(conOne);
AdHocCommandManager manTwo = AdHocCommandManager.getInstance(conTwo);
Expand Down Expand Up @@ -217,6 +219,7 @@ public void cancel() {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0050")
public void multiStageAdHocCommandTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AdHocCommandManager manOne = AdHocCommandManager.getInstance(conOne);
AdHocCommandManager manTwo = AdHocCommandManager.getInstance(conTwo);
Expand Down Expand Up @@ -264,6 +267,7 @@ public void multiStageAdHocCommandTest() throws NoResponseException, XMPPErrorEx
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0050")
public void multiStageWithPrevAdHocCommandTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AdHocCommandManager manOne = AdHocCommandManager.getInstance(conOne);
AdHocCommandManager manTwo = AdHocCommandManager.getInstance(conTwo);
Expand Down Expand Up @@ -322,6 +326,7 @@ public void multiStageWithPrevAdHocCommandTest() throws NoResponseException, XMP
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0050")
public void multiStageInvalidArgAdHocCommandTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
AdHocCommandManager manOne = AdHocCommandManager.getInstance(conOne);
AdHocCommandManager manTwo = AdHocCommandManager.getInstance(conTwo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;

public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {
Expand All @@ -53,11 +54,13 @@ public FileTransferIntegrationTest(SmackIntegrationTestEnvironment environment)
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0096")
public void fileTransferTest() throws Exception {
genericfileTransferTest();
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0096")
public void ibbFileTransferTest() throws Exception {
FileTransferNegotiator.IBB_ONLY = true;
genericfileTransferTest();
Expand Down
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.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -62,6 +63,7 @@ public void unsubscribe() throws NotLoggedInException, NoResponseException, XMPP
* @throws Exception if the test fails
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0080")
public void testNotification() throws Exception {
GeoLocation.Builder builder = GeoLocation.builder();
GeoLocation data = builder.setAccuracy(23d)
Expand Down Expand Up @@ -126,6 +128,7 @@ public void testNotification() throws Exception {
* @throws Exception if the test fails
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0080")
public void testNotificationAfterFilterChange() throws Exception {
GeoLocation.Builder builder = GeoLocation.builder();
GeoLocation data = builder.setAccuracy(12d)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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;

public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest {

Expand Down Expand Up @@ -63,6 +64,7 @@ public HttpFileUploadIntegrationTest(SmackIntegrationTestEnvironment environment
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0363")
public void httpFileUploadTest() throws IOException, XMPPErrorException, InterruptedException, SmackException {
final int fileSize = FILE_SIZE;
File file = createNewTempFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.Jid;
Expand All @@ -57,6 +58,7 @@ public IoTControlIntegrationTest(SmackIntegrationTestEnvironment environment) {
*/
@SmackIntegrationTest
// @SmackSerialIntegrationTest
@SpecificationReference(document = "XEP-0347")
public void controlTest() throws Exception {
final String key = StringUtils.randomString(12);
final String sn = StringUtils.randomString(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;

public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest {
Expand All @@ -58,6 +59,7 @@ public IoTDataIntegrationTest(SmackIntegrationTestEnvironment environment) {
* @throws TimeoutException if there was a timeout.
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0347")
public void dataTest() throws Exception {
final String key = StringUtils.randomString(12);
final String sn = StringUtils.randomString(12);
Expand Down
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.Jid;

public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest {
Expand All @@ -50,6 +51,7 @@ public IoTDiscoveryIntegrationTest(SmackIntegrationTestEnvironment environment)
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0347")
public void registerClaimAndUnregisterThing()
throws XMPPErrorException, InterruptedException, SmackException {
final String key = StringUtils.randomString(12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;

public class VersionIntegrationTest extends AbstractSmackIntegrationTest {

Expand All @@ -36,6 +37,7 @@ public VersionIntegrationTest(SmackIntegrationTestEnvironment environment) {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0092")
public void testVersion() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// TODO put into @BeforeClass method
VersionManager.setAutoAppendSmackVersion(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid;

Expand Down Expand Up @@ -74,6 +75,7 @@ public MamIntegrationTest(SmackIntegrationTestEnvironment environment) throws No
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0313")
public void mamTest() throws TimeoutException, Exception {
EntityBareJid userOne = conOne.getUser().asEntityBareJid();
EntityBareJid userTwo = conTwo.getUser().asEntityBareJid();
Expand Down Expand Up @@ -124,6 +126,7 @@ public void processStanza(Stanza stanza) {
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0313")
public void mamPageTest() throws TimeoutException, Exception {
final int messagesPerPage = 10;
final int numPages = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -59,6 +60,7 @@ public void unsubscribe()
* @throws Exception if the test fails
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0107")
public void testNotification() throws Exception {
Mood data = Mood.satisfied;

Expand Down Expand Up @@ -97,6 +99,7 @@ public void testNotification() throws Exception {
* @throws Exception if the test fails
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0107")
public void testNotificationAfterFilterChange() throws Exception {
Mood data = Mood.cautious;

Expand Down
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.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid;
Expand All @@ -50,15 +51,12 @@ public MultiUserChatIntegrationTest(SmackIntegrationTestEnvironment environment)
/**
* Asserts that when a user joins a room, they are themselves included on the list of users notified (self-presence).
*
* <p>From XEP-0045 § 7.2.2:</p>
* <blockquote>
* ...the service MUST also send presence from the new participant's occupant JID to the full JIDs of all the
* occupants (including the new occupant)
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "7.2.2", quote =
"... the service MUST also send presence from the new participant's occupant JID to the full JIDs of all the " +
"occupants (including the new occupant)")
public void mucJoinTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-join");

Expand All @@ -80,16 +78,13 @@ public void mucJoinTest() throws Exception {
/**
* Asserts that when a user leaves a room, they are themselves included on the list of users notified (self-presence).
*
* <p>From XEP-0045 § 7.14:</p>
* <blockquote>
* The service MUST then send a presence stanzas of type "unavailable" from the departing user's occupant JID to
* the departing occupant's full JIDs, including a status code of "110" to indicate that this notification is
* "self-presence"
* </blockquote>
*
* @throws Exception when errors occur
*/
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "7.14", quote =
"The service MUST then send a presence stanzas of type \"unavailable\" from the departing user's occupant " +
"JID to the departing occupant's full JIDs, including a status code of \"110\" to indicate that this " +
"notification is \"self-presence\"")
public void mucLeaveTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("smack-inttest-leave");

Expand Down Expand Up @@ -144,18 +139,16 @@ public void processMessage(Message message) {
}


/**
* Asserts that a user is notified when a room is destroyed
*
* <p>From XEP-0045 § 10.9:</p>
* <blockquote>
* A room owner MUST be able to destroy a room, especially if the room is persistent... The room removes all users from the room... and destroys the room
* </blockquote>
/**
* Asserts that a user is notified when a room is destroyed.
*
* @throws TimeoutException when roomDestroyed event doesn't get fired
* @throws Exception when other errors occur
*/
@SmackIntegrationTest
@SmackIntegrationTest
@SpecificationReference(document = "XEP-0045", section = "10.9", quote =
"A room owner MUST be able to destroy a room, especially if the room is persistent... The room removes all " +
"users from the room... and destroys the room")
public void mucDestroyTest() throws TimeoutException, Exception {

EntityBareJid mucAddress = getRandomRoom("smack-inttest-destroy");
Expand Down Expand Up @@ -190,7 +183,4 @@ public void roomDestroyed(MultiUserChat alternateMUC, String reason) {
assertEquals(0, muc.getOccupantsCount());
assertNull(muc.getNickname());
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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.DomainBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart;
Expand All @@ -53,6 +54,7 @@ public MultiUserChatLowLevelIntegrationTest(SmackIntegrationTestEnvironment envi
}

@SmackIntegrationTest
@SpecificationReference(document = "XEP-0048")
public void testMucBookmarksAutojoin(AbstractXMPPConnection connection) throws InterruptedException,
TestNotPossibleException, XMPPException, SmackException, IOException {
final BookmarkManager bookmarkManager = BookmarkManager.getBookmarkManager(connection);
Expand Down
Loading

0 comments on commit e50908c

Please sign in to comment.