diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java index f1fc24cf2..19c7d4d93 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/Configuration.java @@ -106,6 +106,10 @@ public final class Configuration { private final Map> disabledTestsMap; + public final Set enabledSpecifications; + + public final Set disabledSpecifications; + public final String defaultConnectionNickname; public final Set enabledConnections; @@ -176,6 +180,8 @@ public final class Configuration { this.enabledTestsMap = convertTestsToMap(enabledTests); this.disabledTests = CollectionUtil.nullSafeUnmodifiableSet(builder.disabledTests); this.disabledTestsMap = convertTestsToMap(disabledTests); + this.enabledSpecifications = CollectionUtil.nullSafeUnmodifiableSet(builder.enabledSpecifications); + this.disabledSpecifications = CollectionUtil.nullSafeUnmodifiableSet(builder.disabledSpecifications); this.defaultConnectionNickname = builder.defaultConnectionNickname; this.enabledConnections = builder.enabledConnections; this.disabledConnections = builder.disabledConnections; @@ -239,6 +245,10 @@ public final class Configuration { private Set disabledTests; + private Set enabledSpecifications; + + private Set disabledSpecifications; + private String defaultConnectionNickname; private Set enabledConnections; @@ -370,6 +380,16 @@ public final class Configuration { return this; } + public Builder setEnabledSpecifications(String enabledSpecificationsString) { + enabledSpecifications = getSpecificationSetFrom(enabledSpecificationsString); + return this; + } + + public Builder setDisabledSpecifications(String disabledSpecificationsString) { + disabledSpecifications = getSpecificationSetFrom(disabledSpecificationsString); + return this; + } + public Builder setDefaultConnection(String defaultConnectionNickname) { this.defaultConnectionNickname = defaultConnectionNickname; return this; @@ -515,6 +535,8 @@ public final class Configuration { builder.setDebugger(properties.getProperty("debugger")); builder.setEnabledTests(properties.getProperty("enabledTests")); builder.setDisabledTests(properties.getProperty("disabledTests")); + builder.setEnabledSpecifications(properties.getProperty("enabledSpecifications")); + builder.setDisabledSpecifications(properties.getProperty("disabledSpecifications")); builder.setDefaultConnection(properties.getProperty("defaultConnection")); builder.setEnabledConnections(properties.getProperty("enabledConnections")); builder.setDisabledConnections(properties.getProperty("disabledConnections")); @@ -579,6 +601,10 @@ public final class Configuration { }); } + private static Set getSpecificationSetFrom(String input) { + return split(input, Configuration::normalizeSpecification); + } + private static Map> convertTestsToMap(Set tests) { Map> res = new HashMap<>(); for (String test : tests) { @@ -687,4 +713,34 @@ public final class Configuration { return contains(method, disabledTestsMap); } + public boolean isSpecificationEnabled(String specification) { + if (enabledSpecifications.isEmpty()) { + return true; + } + + if (specification == null) { + return false; + } + + return enabledSpecifications.contains(normalizeSpecification(specification)); + } + + public boolean isSpecificationDisabled(String specification) { + if (disabledSpecifications.isEmpty()) { + return false; + } + + if (specification == null) { + return false; + } + + return disabledSpecifications.contains(normalizeSpecification(specification)); + } + + static String normalizeSpecification(String specification) { + if (specification == null || specification.isBlank()) { + return null; + } + return specification.replaceAll("\\s", "").toUpperCase(); + } } diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java index a55607939..ae8198ba7 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java @@ -44,6 +44,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; @@ -72,6 +74,7 @@ import org.igniterealtime.smack.inttest.Configuration.AccountRegistration; 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; import org.reflections.Reflections; import org.reflections.scanners.MethodAnnotationsScanner; import org.reflections.scanners.MethodParameterScanner; @@ -131,10 +134,21 @@ public class SmackIntegrationTestFramework { final int exitStatus; if (failedTests > 0) { LOGGER.warning("๐Ÿ’€ The following " + failedTests + " tests failed! ๐Ÿ’€"); + final SortedSet bySpecification = new TreeSet<>(); for (FailedTest failedTest : testRunResult.failedIntegrationTests) { final Throwable cause = failedTest.failureReason; LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause); + if (failedTest.concreteTest.method.isAnnotationPresent(SpecificationReference.class)) { + final String specificationReference = getSpecificationReference(failedTest.concreteTest.method); + if (specificationReference != null) { + bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')"); + } + } } + if (!bySpecification.isEmpty()) { + LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification)); + } + exitStatus = 2; } else { LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/"); @@ -148,6 +162,24 @@ public class SmackIntegrationTestFramework { System.exit(exitStatus); } + private static String getSpecificationReference(Method method) { + final SpecificationReference spec = method.getDeclaringClass().getAnnotation(SpecificationReference.class); + if (spec == null || spec.document().isBlank()) { + return null; + } + String line = spec.document().trim(); + + final SmackIntegrationTest test = method.getAnnotation(SmackIntegrationTest.class); + if (!test.section().isBlank()) { + line += " section " + test.section().trim(); + } + if (!test.quote().isBlank()) { + line += ":\t\"" + test.quote().trim() + "\""; + } + assert !line.isBlank(); + return line; + } + public SmackIntegrationTestFramework(Configuration configuration) { this.config = configuration; } @@ -300,6 +332,26 @@ public class SmackIntegrationTestFramework { continue; } + final String specification; + if (testClass.isAnnotationPresent(SpecificationReference.class)) { + final SpecificationReference specificationReferenceAnnotation = testClass.getAnnotation(SpecificationReference.class); + specification = Configuration.normalizeSpecification(specificationReferenceAnnotation.document()); + } else { + specification = null; + } + + if (!config.isSpecificationEnabled(specification)) { + DisabledTestClass disabledTestClass = new DisabledTestClass(testClass, "Skipping test method " + testClass + " because it tests a specification ('" + specification + "') that is not enabled"); + testRunResult.disabledTestClasses.add(disabledTestClass); + continue; + } + + if (config.isSpecificationDisabled(specification)) { + DisabledTestClass disabledTestClass = new DisabledTestClass(testClass, "Skipping test method " + testClass + " because it tests a specification ('" + specification + "') that is disabled"); + testRunResult.disabledTestClasses.add(disabledTestClass); + continue; + } + final Constructor cons; try { cons = testClass.getConstructor(SmackIntegrationTestEnvironment.class); diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java index 173b4d2e9..55b1ef684 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SmackIntegrationTest.java @@ -31,4 +31,18 @@ public @interface SmackIntegrationTest { int connectionCount() default -1; + /** + * Unique identifier for a section (or paragraph) of the document referenced by {@link SpecificationReference}, + * such as '6.2.1'. + * + * @return a document section identifier + */ + String section() default ""; + + /** + * A quotation of relevant text from the section referenced by {@link #section()}. + * + * @return human-readable text from the references document and section. + */ + String quote() default ""; } diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SpecificationReference.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SpecificationReference.java new file mode 100644 index 000000000..947dc3b90 --- /dev/null +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/annotations/SpecificationReference.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2024 Guus der Kinderen + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.igniterealtime.smack.inttest.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Reference to a specific part of a specification. + * + * @author Guus der Kinderen, guus@goodbytes.nl + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface SpecificationReference { + + /** + * Unique identifier for a specification document, such as 'RFC 6120' or 'XEP-0485'. + * + * @return a document identifier + */ + String document(); +} diff --git a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/package-info.java b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/package-info.java index aca4270b7..38898eced 100644 --- a/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/package-info.java +++ b/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/package-info.java @@ -136,6 +136,14 @@ * List of disabled tests * * + * enabledSpecifications + * List of specifications for which to enable tests + * + * + * disabledSpecifications + * List of specificatinos for which to disable tests + * + * * defaultConnection * Nickname of the default connection * @@ -187,6 +195,20 @@ *

* would run all tests defined in the SoftwareInfoIntegrationTest class. *

+ *

+ * Use enabledSpecifications to run all tests that assert implementation of functionality that is described + * in standards identified by the provided specification-reference. + *

+ *

+ * For example: + *

+ * + *
+ * $ gradle integrationTest -Dsinttest.enabledSpecifications=XEP-0045
+ * 
+ *

+ * would run all tests that are annotated to verify functionality specified in XEP-0045: "Multi-User Chat". + *

*

Overview of the components

*

* Package org.igniterealtime.smack.inttest diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java index 4c373a9ce..bcf23f627 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java @@ -51,7 +51,9 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; 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; +@SpecificationReference(document = "XEP-0115") public class EntityCapsTest extends AbstractSmackIntegrationTest { private final EntityCapsManager ecmTwo; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java index 11e1340f4..fad509c4c 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/chatstate/ChatStateIntegrationTest.java @@ -27,8 +27,10 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0085") public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest { // Listener for composing chat state diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java index f29f07f91..6d37399d8 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandIntegrationTest.java @@ -36,7 +36,9 @@ import org.jivesoftware.smackx.xdata.packet.DataForm; 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; +@SpecificationReference(document = "XEP-0050") public class AdHocCommandIntegrationTest extends AbstractSmackIntegrationTest { public AdHocCommandIntegrationTest(SmackIntegrationTestEnvironment environment) { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java index ac79e46ec..023959539 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java @@ -31,8 +31,10 @@ import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; 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; +@SpecificationReference(document = "XEP-0096") public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest { private static final int MAX_FT_DURATION = 360; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java index 7e149ff3b..a67a3ee03 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/geolocation/GeolocationIntegrationTest.java @@ -34,11 +34,13 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; import org.jxmpp.util.XmppDateTime; +@SpecificationReference(document = "XEP-0080") public class GeolocationIntegrationTest extends AbstractSmackIntegrationTest { private final GeoLocationManager glm1; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java index 243bfec36..a823e03ad 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadIntegrationTest.java @@ -36,7 +36,9 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0363") public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest { private static final int FILE_SIZE = 1024 * 128; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java index 498493b5b..1cbf4f2a9 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTControlIntegrationTest.java @@ -33,10 +33,12 @@ import org.jivesoftware.smackx.iot.control.element.SetData; 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; +@SpecificationReference(document = "XEP-0347") public class IoTControlIntegrationTest extends AbstractSmackIntegrationTest { private final IoTControlManager IoTControlManagerOne; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java index 858eae9a7..c95209cdb 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDataIntegrationTest.java @@ -37,8 +37,10 @@ import org.jivesoftware.smackx.iot.data.element.TimestampElement; 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; +@SpecificationReference(document = "XEP-0347") public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest { private final IoTDataManager iotDataManagerOne; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java index df6bf345e..3ef48c837 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iot/IoTDiscoveryIntegrationTest.java @@ -34,8 +34,10 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0347") public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest { private final IoTDiscoveryManager discoveryManagerOne; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java index 9e903bbb8..c12ea5370 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/iqversion/VersionIntegrationTest.java @@ -28,7 +28,9 @@ import org.jivesoftware.smackx.iqversion.packet.Version; 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; +@SpecificationReference(document = "XEP-0092") public class VersionIntegrationTest extends AbstractSmackIntegrationTest { public VersionIntegrationTest(SmackIntegrationTestEnvironment environment) { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java index 046a33ac6..b9fcbea7e 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mam/MamIntegrationTest.java @@ -42,9 +42,11 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0313") public class MamIntegrationTest extends AbstractSmackIntegrationTest { private final MamManager mamManagerConTwo; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java index 1a83085dc..bdfaa520e 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/mood/MoodIntegrationTest.java @@ -30,10 +30,12 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0107") public class MoodIntegrationTest extends AbstractSmackIntegrationTest { private final MoodManager mm1; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java index 279160c0f..edf71b0a2 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java @@ -34,10 +34,12 @@ import org.jivesoftware.smackx.disco.packet.DiscoverItems; 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; +@SpecificationReference(document = "XEP-0045") public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatIntegrationTest { public MultiUserChatEntityIntegrationTest(SmackIntegrationTestEnvironment environment) @@ -47,18 +49,14 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt } /** - * Asserts that a MUC service can have its features discovered - * - *

From XEP-0045 ยง 6.2:

- *
- * 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. - *
+ * Asserts that a MUC service can have its features discovered. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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); @@ -68,17 +66,13 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt /** * Asserts that a MUC Service lists its public rooms. * - *

From XEP-0045 ยง 6.3:

- *
- * 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). - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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); @@ -104,15 +98,11 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt /** * Asserts that a MUC Service returns disco info for a room. * - *

From XEP-0045 ยง 6.4:

- *
- * 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 - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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); @@ -133,16 +123,12 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt /** * Asserts that a MUC Service returns disco info for a room's items. * - *

From XEP-0045 ยง 6.5:

- *
- * 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. - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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); @@ -162,15 +148,11 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt * Asserts that a non-occupant receives a Bad Request error when attempting to query an occupant by their * occupant JID. * - *

From XEP-0045 ยง 6.6:

- *
- * 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 - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "6.6", quote = + "If a non-occupant attempts to send a disco request to an address of the form , a MUC " + + "service MUST return a error") public void mucTestForRejectingDiscoOnRoomOccupantByNonOccupant() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems"); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java index 36fa47815..c6e4e9209 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java @@ -34,11 +34,13 @@ import org.jivesoftware.smackx.muc.packet.MUCUser; 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; import org.jxmpp.jid.parts.Resourcepart; +@SpecificationReference(document = "XEP-0045") public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrationTest { public MultiUserChatIntegrationTest(SmackIntegrationTestEnvironment environment) @@ -50,15 +52,11 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati /** * Asserts that when a user joins a room, they are themselves included on the list of users notified (self-presence). * - *

From XEP-0045 ยง 7.2.2:

- *
- * ...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) - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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"); @@ -80,16 +78,12 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati /** * Asserts that when a user leaves a room, they are themselves included on the list of users notified (self-presence). * - *

From XEP-0045 ยง 7.14:

- *
- * 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" - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(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"); @@ -144,18 +138,15 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati } - /** - * Asserts that a user is notified when a room is destroyed - * - *

From XEP-0045 ยง 10.9:

- *
- * 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 - *
+ /** + * 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(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"); @@ -190,7 +181,4 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati assertEquals(0, muc.getOccupantsCount()); assertNull(muc.getNickname()); } - - - } diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java index e0f476306..7cc418b2c 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatLowLevelIntegrationTest.java @@ -33,11 +33,13 @@ import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest; 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; import org.jxmpp.jid.parts.Resourcepart; +@SpecificationReference(document = "XEP-0048") public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelIntegrationTest { public MultiUserChatLowLevelIntegrationTest(SmackIntegrationTestEnvironment environment) throws Exception { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java index d26e22593..b4259bae1 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatRolesAffiliationsPrivilegesIntegrationTest.java @@ -32,6 +32,7 @@ import org.jivesoftware.smackx.muc.packet.MUCUser; 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.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityFullJid; @@ -40,6 +41,7 @@ import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.parts.Resourcepart; +@SpecificationReference(document = "XEP-0045") public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends AbstractMultiUserChatIntegrationTest{ public MultiUserChatRolesAffiliationsPrivilegesIntegrationTest(SmackIntegrationTestEnvironment environment) @@ -49,23 +51,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who undergoes a role change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 9.6:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the addition of - * moderator status... - *
+ * Asserts that a user who undergoes a role change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.3", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 9.6) The service MUST then send updated presence from this " + + "individual to all occupants, indicating the addition of moderator status...") public void mucRoleTestForReceivingModerator() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -97,23 +90,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 9.6:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the addition of - * moderator status... - *
+ * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "9.6", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 9.6) The service MUST then send updated presence from this " + + "individual to all occupants, indicating the addition of moderator status...") public void mucRoleTestForWitnessingModerator() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -146,23 +130,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who undergoes a role change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 9.7:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the removal of - * moderator status... - *
+ * Asserts that a user who undergoes a role change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.3", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 9.7) The service MUST then send updated presence from this " + + "individual to all occupants, indicating the removal of moderator status...") public void mucRoleTestForRemovingModerator() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -192,23 +167,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 9.7:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the removal of - * moderator status... - *
+ * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "9.7", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 9.7) The service MUST then send updated presence from this " + + "individual to all occupants, indicating the removal of moderator status...") public void mucRoleTestForWitnessingModeratorRemoval() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -241,23 +207,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user in an unmoderated room who undergoes an afilliation change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 8.4:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the removal of - * voice privileges... - *
+ * Asserts that a user in an unmoderated room who undergoes an afilliation change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.3", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 8.4) The service MUST then send updated presence from " + + "this individual to all occupants, indicating the removal of voice privileges...") public void mucRoleTestForRevokingVoice() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -285,23 +242,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update - * - *

From XEP-0045 ยง 5.1.3:

- *
- * ...a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change - * to all occupants... - *
- * - *

From XEP-0045 ยง 8.4:

- *
- * The service MUST then send updated presence from this individual to all occupants, indicating the removal of - * voice privileges... - *
+ * Asserts that a user who is present when another user undergoes a role change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "8.4", quote = + "(ยง 5.1.3)... a MUC service implementation MUST change the occupant's role to reflect the change and " + + "communicate the change to all occupants [...] (ยง 8.4) The service MUST then send updated presence from " + + "this individual to all occupants, indicating the removal of voice privileges...") public void mucRoleTestForWitnessingRevokingVoice() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -333,23 +281,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who undergoes an affiliation change receives that change as a presence update - * - *

From XEP-0045 ยง 5.2.2:

- *
- * ...a MUC service implementation MUST change the user's affiliation to reflect the change and communicate that - * to all occupants... - *
- * - *

From XEP-0045 ยง 10.6:

- *
- * If the user is in the room, the service MUST then send updated presence from this individual to all occupants, - * indicating the granting of admin status... - *
+ * Asserts that a user who undergoes an affiliation change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.2.2", quote = + "(ยง 5.2.2) ... a MUC service implementation MUST change the user's affiliation to reflect the change and " + + "communicate that to all occupants [...] (ยง 10.6) If the user is in the room, the service MUST then send " + + "updated presence from this individual to all occupants, indicating the granting of admin status...") public void mucAffiliationTestForReceivingAdmin() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -381,23 +320,14 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs /** * Asserts that a user who is present when another user undergoes an affiliation change receives that change as a - * presence update - * - *

From XEP-0045 ยง 5.2.2:

- *
- * ...a MUC service implementation MUST change the user's affiliation to reflect the change and communicate that - * to all occupants... - *
- * - *

From XEP-0045 ยง 10.6:

- *
- * If the user is in the room, the service MUST then send updated presence from this individual to all occupants, - * indicating the granting of admin status... - *
+ * presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "10.6", quote = + "(ยง 5.2.2) ... a MUC service implementation MUST change the user's affiliation to reflect the change and " + + "communicate that to all occupants [...] (ยง 10.6) If the user is in the room, the service MUST then send " + + "updated presence from this individual to all occupants, indicating the granting of admin status...") public void mucAffiliationTestForWitnessingAdmin() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -429,23 +359,15 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who undergoes an affiliation change receives that change as a presence update - * - *

From XEP-0045 ยง 5.2.2:

- *
- * ...a MUC service implementation MUST change the user's affiliation to reflect the change and communicate that to - * all occupants... - *
- * - *

From XEP-0045 ยง 10.7:

- *
- * If the user is in the room, the service MUST then send updated presence from this individual to all occupants, - * indicating the loss of admin status by sending a presence element... - *
+ * Asserts that a user who undergoes an affiliation change receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "10.7", quote = + "(ยง 5.2.2) ... a MUC service implementation MUST change the user's affiliation to reflect the change and " + + "communicate that to all occupants [...] (ยง 10.6) If the user is in the room, the service MUST then send " + + "updated presence from this individual to all occupants, indicating the loss of admin status by sending a " + + "presence element...") public void mucAffiliationTestForRemovingAdmin() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -491,7 +413,11 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "10.7", quote = + "(ยง 5.2.2) ... a MUC service implementation MUST change the user's affiliation to reflect the change and " + + "communicate that to all occupants [...] (ยง 10.6) If the user is in the room, the service MUST then send " + + "updated presence from this individual to all occupants, indicating the loss of admin status by sending a " + + "presence element...") public void mucAffiliationTestForWitnessingAdminRemoval() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -524,21 +450,16 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who gets kicked receives that change as a presence update - * - *

From XEP-0045 ยง 8.2:

- *
- * The kick is performed based on the occupant's room nickname and is completed by setting the role of a - * participant or visitor to a value of "none". - * - * The service MUST remove the kicked occupant by sending a presence stanza of type "unavailable" to each kicked - * occupant, including status code 307 in the extended presence information, optionally along with the reason (if - * provided) and the roomnick or bare JID of the user who initiated the kick. - *
+ * Asserts that a user who gets kicked receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "8.2", quote = + "The kick is performed based on the occupant's room nickname and is completed by setting the role of a " + + "participant or visitor to a value of \"none\". The service MUST remove the kicked occupant by sending a " + + "presence stanza of type \"unavailable\" to each kicked occupant, including status code 307 in the extended " + + "presence information, optionally along with the reason (if provided) and the roomnick or bare JID of the " + + "user who initiated the kick.") public void mucPresenceTestForGettingKicked() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -572,19 +493,15 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a user who is present when another user gets kicked receives that change as a presence update - * - *

From XEP-0045 ยง 8.2:

- *
- * ...the service MUST then inform all of the remaining occupants that the kicked occupant is no longer in the room - * by sending presence stanzas of type "unavailable" from the individual's roomnick (<room@service/nick>) to all - * the remaining occupants (just as it does when occupants exit the room of their own volition), including the - * status code and optionally the reason and actor. - *
+ * Asserts that a user who is present when another user gets kicked receives that change as a presence update. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "8.2", quote = + "...the service MUST then inform all of the remaining occupants that the kicked occupant is no longer in the " + + "room by sending presence stanzas of type \"unavailable\" from the individual's roomnick " + + "() to all the remaining occupants (just as it does when occupants exit the room of their " + + "own volition), including the status code and optionally the reason and actor.") public void mucPresenceTestForWitnessingKick() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -624,16 +541,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs /** * Asserts that an affiliation is persistent between visits to the room. * - *

From XEP-0045 ยง 5.2:

- *
- * These affiliations are long-lived in that they persist across a user's visits to the room and are not affected - * by happenings in the room...Affiliations are granted, revoked, and maintained based on the user's bare JID, not - * the nick as with roles. - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.2", quote = + "These affiliations are long-lived in that they persist across a user's visits to the room and are not " + + "affected by happenings in the room...Affiliations are granted, revoked, and maintained based on the user's " + + "bare JID, not the nick as with roles.") public void mucTestPersistentAffiliation() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -665,24 +578,16 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a moderator cannot revoke voice from an owner - * - *

From XEP-0045 ยง 5.1.1:

- *
- * A moderator MUST NOT be able to revoke voice privileges from an admin or owner - *
- * - *

From XEP-0045 ยง 8.4:

- *
- * A moderator MUST NOT be able to revoke voice from a user whose affiliation is at or above the moderator's level. - * In addition, a service MUST NOT allow the voice privileges of an admin or owner to be removed by anyone. If a - * moderator attempts to revoke voice privileges from such a user, the service MUST deny the request and return a - * <not-allowed/> error to the sender along with the offending item(s) - *
+ * Asserts that a moderator cannot revoke voice from an owner. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.1", quote = + "A moderator MUST NOT be able to revoke voice privileges from an admin or owner [...] (ยง 8.4) A moderator " + + "MUST NOT be able to revoke voice from a user whose affiliation is at or above the moderator's level. In " + + "addition, a service MUST NOT allow the voice privileges of an admin or owner to be removed by anyone. If a " + + "moderator attempts to revoke voice privileges from such a user, the service MUST deny the request and return " + + "a error to the sender along with the offending item(s)") public void mucTestModeratorCannotRevokeVoiceFromOwner() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -708,16 +613,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs * Asserts that a moderator cannot revoke moderator privileges from a moderator with a higher affiliation * than themselves. * - *

From XEP-0045 ยง 5.1.3 and ยง5.2.1:

- *
- * A moderator SHOULD NOT be allowed to revoke moderation privileges from someone with a higher affiliation than - * themselves (i.e., an unaffiliated moderator SHOULD NOT be allowed to revoke moderation privileges from an admin - * or an owner, and an admin SHOULD NOT be allowed to revoke moderation privileges from an owner) - *
- * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.3", quote = + "A moderator SHOULD NOT be allowed to revoke moderation privileges from someone with a higher affiliation " + + "than themselves (i.e., an unaffiliated moderator SHOULD NOT be allowed to revoke moderation privileges from " + + "an admin or an owner, and an admin SHOULD NOT be allowed to revoke moderation privileges from an owner)") public void mucTestModeratorCannotBeRevokedFromHigherAffiliation() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest"); @@ -755,16 +656,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that an unmoderated room assigns the correct default roles for a given affiliation - * - *

From XEP-0045 ยง 5.1.2:

- *
- * ...the initial default roles that a service SHOULD set based on the user's affiliation... - *
+ * Asserts that an unmoderated room assigns the correct default roles for a given affiliation. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.2", quote = + "...the initial default roles that a service SHOULD set based on the user's affiliation...") public void mucTestDefaultRoleForAffiliationInUnmoderatedRoom() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest-unmoderatedroles"); @@ -804,16 +701,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a moderated room assigns the correct default roles for a given affiliation - * - *

From XEP-0045 ยง 5.1.2:

- *
- * ...the initial default roles that a service SHOULD set based on the user's affiliation... - *
+ * Asserts that a moderated room assigns the correct default roles for a given affiliation. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.2", quote = + "...the initial default roles that a service SHOULD set based on the user's affiliation...") public void mucTestDefaultRoleForAffiliationInModeratedRoom() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest-moderatedroles"); @@ -864,16 +757,12 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs } /** - * Asserts that a members-only room assigns the correct default roles for a given affiliation - * - *

From XEP-0045 ยง 5.1.2:

- *
- * ...the initial default roles that a service SHOULD set based on the user's affiliation... - *
+ * Asserts that a members-only room assigns the correct default roles for a given affiliation. * * @throws Exception when errors occur */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "5.1.2", quote = + "...the initial default roles that a service SHOULD set based on the user's affiliation...") public void mucTestDefaultRoleForAffiliationInMembersOnlyRoom() throws Exception { EntityBareJid mucAddress = getRandomRoom("smack-inttest-membersonlyroles"); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java index 2efd1fb1a..a8d5fe441 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/MessageEncryptionIntegrationTest.java @@ -29,12 +29,14 @@ import org.jivesoftware.smackx.omemo.element.OmemoBundleElement; 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; /** * Simple OMEMO message encryption integration test. * During this test Alice sends an encrypted message to Bob. Bob decrypts it and sends a response to Alice. * It is checked whether the messages can be decrypted, and if used up pre-keys result in renewed bundles. */ +@SpecificationReference(document = "XEP-0384") public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { public MessageEncryptionIntegrationTest(SmackIntegrationTestEnvironment environment) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java index 442643071..489dee26c 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoMamDecryptionTest.java @@ -35,11 +35,13 @@ import org.jivesoftware.smackx.omemo.util.MessageOrOmemoMessage; 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; /** * This test sends a message from Alice to Bob, while Bob has automatic decryption disabled. * Then Bob fetches his Mam archive and decrypts the result. */ +@SpecificationReference(document = "XEP-0384") public class OmemoMamDecryptionTest extends AbstractTwoUsersOmemoIntegrationTest { public OmemoMamDecryptionTest(SmackIntegrationTestEnvironment environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java index 94c671962..ee593c012 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/ReadOnlyDeviceIntegrationTest.java @@ -32,7 +32,9 @@ import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException; 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; +@SpecificationReference(document = "XEP-0384") public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { public ReadOnlyDeviceIntegrationTest(SmackIntegrationTestEnvironment environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, TestNotPossibleException { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java index c4a649911..e8a48fd7b 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/SessionRenegotiationIntegrationTest.java @@ -24,7 +24,9 @@ import org.jivesoftware.smack.packet.MessageBuilder; 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; +@SpecificationReference(document = "XEP-0384") public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest { public SessionRenegotiationIntegrationTest(SmackIntegrationTestEnvironment environment) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java index 60e3361ad..dc64db3a9 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java @@ -48,9 +48,11 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException; 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; import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.protection.UnprotectedKeysProtector; +@SpecificationReference(document = "XEP-0374") public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegrationTest { private static final String sessionId = StringUtils.randomString(10); @@ -101,7 +103,7 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration org.apache.commons.io.FileUtils.deleteDirectory(beforePath); } - @SmackIntegrationTest + @SmackIntegrationTest(section = "5") public void test() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, IOException, InterruptedException, PubSubException.NotALeafNodeException, SmackException.NoResponseException, SmackException.NotConnectedException, XMPPException.XMPPErrorException, diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java index 683bc199a..cb5e914af 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java @@ -39,11 +39,13 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException; 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; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.protection.UnprotectedKeysProtector; +@SpecificationReference(document = "XEP-0374") public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegrationTest { private static final String sessionId = StringUtils.randomString(10); diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java index 65c683093..035b9ed32 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ping/PingIntegrationTest.java @@ -35,8 +35,10 @@ import org.jivesoftware.smack.XMPPConnection; 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.jxmpp.jid.Jid; +@SpecificationReference(document = "XEP-0199") public class PingIntegrationTest extends AbstractSmackIntegrationTest { public PingIntegrationTest(SmackIntegrationTestEnvironment environment) { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java index 1890caf2d..4e2377c26 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/pubsub/PubSubIntegrationTest.java @@ -34,8 +34,10 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0060") public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { private final PubSubManager pubSubManagerOne; @@ -82,21 +84,10 @@ public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { } } - /** - - */ - /** * Asserts that an error is returned when a publish request to a node that is both * 'notification-only' as well as 'transient' contains an item element. * - *

From XEP-0060 ยง 7.1.3.6:

- *
- * If the event type is notification + transient and the publisher provides an item, - * the service MUST bounce the publication request with a <bad-request/> error - * and a pubsub-specific error condition of <item-forbidden/>. - *
- * * @throws NoResponseException if there was no response from the remote entity. * @throws XMPPErrorException if there was an XMPP error returned. * @throws NotConnectedException if the XMPP connection is not connected. @@ -104,7 +95,9 @@ public class PubSubIntegrationTest extends AbstractSmackIntegrationTest { * @see * 7.1.3.6 Request Does Not Match Configuration */ - @SmackIntegrationTest + @SmackIntegrationTest(section = "7.1.3.6", quote = + "If the event type is notification + transient and the publisher provides an item, the service MUST bounce " + + "the publication request with a error and a pubsub-specific error condition of .") public void transientNotificationOnlyNodeWithItemTest() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final String nodename = "sinttest-transient-notificationonly-withitem-nodename-" + testRunId; final String itemId = "sinttest-transient-notificationonly-withitem-itemid-" + testRunId; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java index 3bf111f53..64374e173 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java @@ -33,8 +33,10 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.annotations.BeforeClass; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; +import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; +@SpecificationReference(document = "XEP-0232") public class SoftwareInfoIntegrationTest extends AbstractSmackIntegrationTest { public final SoftwareInfoManager sim1; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java index 653bded72..db3275d00 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/usertune/UserTuneIntegrationTest.java @@ -32,10 +32,12 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; 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; +@SpecificationReference(document = "XEP-0118") public class UserTuneIntegrationTest extends AbstractSmackIntegrationTest { private final UserTuneManager utm1;