1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Compare commits

..

1 commit

Author SHA1 Message Date
a8f16a1122
Migrate from libsignal-protocol-java to libsignal 2024-10-06 01:18:45 +02:00
123 changed files with 253 additions and 372 deletions

View file

@ -56,7 +56,7 @@ jobs:
uses: android-actions/setup-android@v3 uses: android-actions/setup-android@v3
- name: Install Android SDK - name: Install Android SDK
run: | run: |
sdkmanager "platforms;android-26" sdkmanager "platforms;android-23"
# Testing # Testing
- name: Gradle Check - name: Gradle Check

View file

@ -1,12 +1,12 @@
GRADLE ?= ./gradlew GRADLE ?= ./gradlew
.PHONY: all .PHONY: all
all: check codecov eclipse javadocAll sinttest all: check jacocoRootReport javadocAll sinttest
.PHONY: codecov .PHONY: codecov
codecov: codecov:
$(GRADLE) smack-java11-full:testCodeCoverageReport $(GRADLE) smack-java11-full:testCodeCoverageReport
echo "code coverage report available at file://$(PWD)/smack-java11-full/build/reports/jacoco/testCodeCoverageReport/html/index.html" echo "Report available at smack-java11-full/build/reports/jacoco/testCodeCoverageReport/html/index.html"
.PHONY: check .PHONY: check
check: check:
@ -20,7 +20,11 @@ eclipse:
sinttest: sinttest:
$(GRADLE) $@ $(GRADLE) $@
.PHONY: jacocoRootReport
jacocoRootReport:
$(GRADLE) $@
.PHONY: javadocAll .PHONY: javadocAll
javadocAll: javadocAll:
$(GRADLE) $@ $(GRADLE) $@
echo "javadoc available at file://$(PWD)/build/javadoc/index.html" echo "Smack javadoc available at build/javadoc/index.html"

View file

@ -3,7 +3,7 @@ plugins {
id 'org.igniterealtime.smack.global-conventions' id 'org.igniterealtime.smack.global-conventions'
} }
dependencies { dependencies {
signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:8.0.0_r2@signature" signature "net.sf.androidscents.signature:android-api-level-${smackMinAndroidSdk}:6.0_r3@signature"
} }
animalsniffer { animalsniffer {
sourceSets = [sourceSets.main] sourceSets = [sourceSets.main]

View file

@ -1,7 +1,7 @@
ext { ext {
javaVersion = JavaVersion.VERSION_11 javaVersion = JavaVersion.VERSION_11
javaMajor = javaVersion.getMajorVersion() javaMajor = javaVersion.getMajorVersion()
smackMinAndroidSdk = 26 smackMinAndroidSdk = 23
androidBootClasspath = { getAndroidRuntimeJar() } androidBootClasspath = { getAndroidRuntimeJar() }
} }

View file

@ -89,7 +89,28 @@ tasks.withType(JavaCompile) {
'-Xlint:-serial', '-Xlint:-serial',
'-Werror', '-Werror',
] ]
options.release = Integer.valueOf(javaMajor) }
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// The '-quiet' as second argument is actually a hack,
// since the one parameter addStringOption doesn't seem to
// work, we extra add '-quiet', which is added anyway by
// gradle.
// We disable 'missing' as we do most of javadoc checking via checkstyle.
options.addStringOption('Xdoclint:all,-missing', '-quiet')
// Abort on javadoc warnings.
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
options.addStringOption('Xwerror', '-quiet')
}
}
if (JavaVersion.current().isJava9Compatible()) {
tasks.withType(JavaCompile) {
options.compilerArgs.addAll([
'--release', javaMajor,
])
}
} }
jacoco { jacoco {
@ -156,7 +177,7 @@ jar {
} }
checkstyle { checkstyle {
toolVersion = '10.18.2' toolVersion = '8.27'
if (project in gplLicensedProjects) { if (project in gplLicensedProjects) {
configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header" configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header"
@ -323,6 +344,17 @@ def getGitCommit() {
gitCommit gitCommit
} }
def getAndroidRuntimeJar() {
def androidHome = new File("$System.env.ANDROID_HOME")
if (!androidHome.isDirectory()) throw new Exception("ANDROID_HOME not found or set")
def androidJar = new File("$androidHome/platforms/android-$smackMinAndroidSdk/android.jar")
if (androidJar.isFile()) {
return androidJar
} else {
throw new Exception("Can't find android.jar for $smackMinAndroidSdk API. Please install corresponding SDK platform package")
}
}
def readVersionFile() { def readVersionFile() {
def versionFile = new File(rootDir, 'version') def versionFile = new File(rootDir, 'version')
if (!versionFile.isFile()) { if (!versionFile.isFile()) {

View file

@ -4,19 +4,25 @@ plugins {
id 'org.igniterealtime.smack.global-conventions' id 'org.igniterealtime.smack.global-conventions'
} }
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// The '-quiet' as second argument is actually a hack,
// since the one parameter addStringOption doesn't seem to
// work, we extra add '-quiet', which is added anyway by
// gradle.
// We disable 'missing' as we do most of javadoc checking via checkstyle.
options.addStringOption('Xdoclint:all,-missing', '-quiet')
// Abort on javadoc warnings.
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
options.addStringOption('Xwerror', '-quiet')
}
}
tasks.withType(Javadoc) { if (JavaVersion.current().isJava9Compatible()) {
// The '-quiet' as second argument is actually a hack, tasks.withType(Javadoc) {
// since the one parameter addStringOption doesn't seem to options.addStringOption('-release', javaMajor)
// work, we extra add '-quiet', which is added anyway by }
// gradle.
// We disable 'missing' as we do most of javadoc checking via checkstyle.
options.addStringOption('Xdoclint:all,-missing', '-quiet')
// Abort on javadoc warnings.
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
options.addStringOption('Xwerror', '-quiet')
options.addStringOption('-release', javaMajor)
} }
tasks.withType(Javadoc) { tasks.withType(Javadoc) {

View file

@ -104,7 +104,7 @@
</module> </module>
<module name="JavadocMethod"> <module name="JavadocMethod">
<!-- TODO stricten those checks --> <!-- TODO stricten those checks -->
<property name="accessModifiers" value="public,protected"/> <property name="scope" value="protected"/>
</module> </module>
<module name="JavadocStyle"> <module name="JavadocStyle">
<property name="scope" value="public"/> <property name="scope" value="public"/>
@ -195,15 +195,15 @@
, TYPE_EXTENSION_AND , TYPE_EXTENSION_AND
"/> "/>
</module> </module>
<module name="ImportOrder"> <module name="CustomImportOrder">
<property name="groups" value="/^java\./,/^javax\./,/^org\.jivesoftware\.smack\./,/^org\.jivesoftware\.smackx\./,/^org\.igniterealtime\.smack\./,/^org\.igniterealtime\.smackx\./"/> <property name="customImportOrderRules"
<property name="separated" value="true"/> value="STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE"/>
<property name="option" value="top"/> <property name="specialImportsRegExp" value="^org\.jivesoftware\.smack"/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
</module> </module>
<module name="MissingJavadocPackage"/> <module name="MissingJavadocPackage"/>
<!-- this seems to cause false positives with checkstyle 10.18.2
<module name="UnnecessaryParentheses"/> <module name="UnnecessaryParentheses"/>
-->
<module name="UnnecessarySemicolonInEnumeration"/> <module name="UnnecessarySemicolonInEnumeration"/>
<module name="UnnecessarySemicolonInTryWithResources"/> <module name="UnnecessarySemicolonInTryWithResources"/>
</module> </module>

View file

@ -1,8 +1,6 @@
#Organize Import Order #Organize Import Order
#Wed Jun 14 16:42:40 CEST 2017 #Wed Jun 14 16:42:40 CEST 2017
7= 5=
6=org.igniterealtime.smackx
5=org.igniterealtime.smack
4=org.jivesoftware.smackx 4=org.jivesoftware.smackx
3=org.jivesoftware.smack 3=org.jivesoftware.smack
2=javax 2=javax

View file

@ -28,7 +28,6 @@ import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.util.Async; import org.jivesoftware.smack.util.Async;
import org.jivesoftware.smackx.ping.PingManager; import org.jivesoftware.smackx.ping.PingManager;
import android.app.AlarmManager; import android.app.AlarmManager;
@ -174,13 +173,7 @@ public final class ServerPingWithAlarmManager extends Manager {
*/ */
public static void onCreate(Context context) { public static void onCreate(Context context) {
sContext = context; sContext = context;
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION));
int receiverFlags = 0;
if (Build.VERSION.SDK_INT >= 34) {
receiverFlags |= 4; // RECEIVER_NOT_EXPORTED
}
context.registerReceiver(ALARM_BROADCAST_RECEIVER, new IntentFilter(PING_ALARM_ACTION), receiverFlags);
sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); sAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
int pendingIntentFlags = 0; int pendingIntentFlags = 0;
if (Build.VERSION.SDK_INT >= 23) { if (Build.VERSION.SDK_INT >= 23) {

View file

@ -499,7 +499,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
* *
* @author Guenther Niess * @author Guenther Niess
*/ */
private final class BOSHConnectionListener implements BOSHClientConnListener { private class BOSHConnectionListener implements BOSHClientConnListener {
/** /**
* Notify the BOSHConnection about connection state changes. * Notify the BOSHConnection about connection state changes.
@ -556,7 +556,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
* *
* @author Guenther Niess * @author Guenther Niess
*/ */
private final class BOSHPacketReader implements BOSHClientResponseListener { private class BOSHPacketReader implements BOSHClientResponseListener {
/** /**
* Parse the received packets and notify the corresponding connection. * Parse the received packets and notify the corresponding connection.

View file

@ -281,7 +281,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
*/ */
protected Writer writer; protected Writer writer;
private Exception currentConnectionException; protected SmackException currentSmackException;
protected XMPPException currentXmppException;
protected boolean tlsHandled; protected boolean tlsHandled;
@ -510,7 +511,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
public abstract boolean isUsingCompression(); public abstract boolean isUsingCompression();
protected void initState() { protected void initState() {
currentConnectionException = null; currentSmackException = null;
currentXmppException = null;
saslFeatureReceived = lastFeaturesReceived = tlsHandled = false; saslFeatureReceived = lastFeaturesReceived = tlsHandled = false;
// TODO: We do not init closingStreamReceived here, as the integration tests use it to check if we waited for // TODO: We do not init closingStreamReceived here, as the integration tests use it to check if we waited for
// it. // it.
@ -684,12 +686,28 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return streamId; return streamId;
} }
protected final void throwCurrentConnectionException() throws SmackException, XMPPException {
if (currentSmackException != null) {
throw currentSmackException;
} else if (currentXmppException != null) {
throw currentXmppException;
}
throw new AssertionError("No current connection exception set, although throwCurrentException() was called");
}
protected final boolean hasCurrentConnectionException() { protected final boolean hasCurrentConnectionException() {
return currentConnectionException != null; return currentSmackException != null || currentXmppException != null;
} }
protected final void setCurrentConnectionExceptionAndNotify(Exception exception) { protected final void setCurrentConnectionExceptionAndNotify(Exception exception) {
currentConnectionException = exception; if (exception instanceof SmackException) {
currentSmackException = (SmackException) exception;
} else if (exception instanceof XMPPException) {
currentXmppException = (XMPPException) exception;
} else {
currentSmackException = new SmackException.SmackWrappedException(exception);
}
notifyWaitingThreads(); notifyWaitingThreads();
} }
@ -723,12 +741,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return true; return true;
} }
protected final void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) protected final void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) throws InterruptedException, SmackException, XMPPException {
throws InterruptedException, SmackException.SmackWrappedException, NoResponseException {
boolean success = waitFor(() -> condition.get().booleanValue() || hasCurrentConnectionException()); boolean success = waitFor(() -> condition.get().booleanValue() || hasCurrentConnectionException());
final Exception currentConnectionException = this.currentConnectionException; if (hasCurrentConnectionException()) {
if (currentConnectionException != null) { throwCurrentConnectionException();
throw new SmackException.SmackWrappedException(currentConnectionException);
} }
// If there was no connection exception and we still did not successfully wait for the condition to hold, then // If there was no connection exception and we still did not successfully wait for the condition to hold, then
@ -1032,7 +1048,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
protected final boolean waitForClosingStreamTagFromServer() { protected final boolean waitForClosingStreamTagFromServer() {
try { try {
waitForConditionOrThrowConnectionException(() -> closingStreamReceived, "closing stream tag from the server"); waitForConditionOrThrowConnectionException(() -> closingStreamReceived, "closing stream tag from the server");
} catch (InterruptedException | SmackException.SmackWrappedException | NoResponseException e) { } catch (InterruptedException | SmackException | XMPPException e) {
LOGGER.log(Level.INFO, "Exception while waiting for closing stream element from the server " + this, e); LOGGER.log(Level.INFO, "Exception while waiting for closing stream element from the server " + this, e);
return false; return false;
} }
@ -1444,14 +1460,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
int parserDepth = parser.getDepth(); int parserDepth = parser.getDepth();
Stanza stanza = null; Stanza stanza = null;
try { try {
try { stanza = PacketParserUtils.parseStanza(parser, incomingStreamXmlEnvironment);
stanza = PacketParserUtils.parseStanza(parser, incomingStreamXmlEnvironment);
} catch (NullPointerException e) {
// Those exceptions should probably be wrapped into a SmackParsingException and therefore likely constitute a missing verification in the throwing parser.
String message = "Smack parser throw unexpected exception '" + e.getMessage() + "', please report this at " + Smack.BUG_REPORT_URL;
LOGGER.log(Level.SEVERE, message, e);
throw new IOException(message, e);
}
} }
catch (XmlPullParserException | SmackParsingException | IOException | IllegalArgumentException e) { catch (XmlPullParserException | SmackParsingException | IOException | IllegalArgumentException e) {
CharSequence content = PacketParserUtils.parseContentDepth(parser, CharSequence content = PacketParserUtils.parseContentDepth(parser,

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2020-2024 Florian Schmaus * Copyright 2020-2021 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,9 +17,6 @@
package org.jivesoftware.smack; package org.jivesoftware.smack;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smack.util.FileUtils; import org.jivesoftware.smack.util.FileUtils;
@ -32,16 +29,6 @@ public class Smack {
public static final String SMACK_PACKAGE = SMACK_ORG + ".smack"; public static final String SMACK_PACKAGE = SMACK_ORG + ".smack";
public static final URL BUG_REPORT_URL;
static {
try {
BUG_REPORT_URL = URI.create("https://discourse.igniterealtime.org/c/smack/smack-support/9").toURL();
} catch (MalformedURLException e) {
throw new ExceptionInInitializerError(e);
}
}
/** /**
* Returns the Smack version information, e.g."1.3.0". * Returns the Smack version information, e.g."1.3.0".
* *

View file

@ -18,7 +18,6 @@
package org.jivesoftware.smack; package org.jivesoftware.smack;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -61,7 +60,7 @@ public final class SmackConfiguration {
static { static {
try { try {
SMACK_URL = URI.create(SMACK_URL_STRING).toURL(); SMACK_URL = new URL(SMACK_URL_STRING);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }

View file

@ -164,7 +164,7 @@ public class SmackReactor {
return scheduledActions.remove(scheduledAction); return scheduledActions.remove(scheduledAction);
} }
private final class Reactor extends Thread { private class Reactor extends Thread {
private volatile long shutdownRequestTimestamp = -1; private volatile long shutdownRequestTimestamp = -1;

View file

@ -117,7 +117,7 @@ public final class HttpLookupMethod {
*/ */
public static InputStream getXrdStream(DomainBareJid xmppServiceAddress) throws IOException { public static InputStream getXrdStream(DomainBareJid xmppServiceAddress) throws IOException {
final String metadataUrl = "https://" + xmppServiceAddress + "/.well-known/host-meta"; final String metadataUrl = "https://" + xmppServiceAddress + "/.well-known/host-meta";
final URL putUrl = URI.create(metadataUrl).toURL(); final URL putUrl = new URL(metadataUrl);
final URLConnection urlConnection = putUrl.openConnection(); final URLConnection urlConnection = putUrl.openConnection();
return urlConnection.getInputStream(); return urlConnection.getInputStream();
} }

View file

@ -39,7 +39,6 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.OutgoingQueueFullException; import org.jivesoftware.smack.SmackException.OutgoingQueueFullException;
import org.jivesoftware.smack.SmackException.SmackWrappedException;
import org.jivesoftware.smack.SmackFuture; import org.jivesoftware.smack.SmackFuture;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.FailedNonzaException; import org.jivesoftware.smack.XMPPException.FailedNonzaException;
@ -260,7 +259,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
@Override @Override
public void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) public void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor)
throws InterruptedException, SmackWrappedException, NoResponseException { throws InterruptedException, SmackException, XMPPException {
ModularXmppClientToServerConnection.this.waitForConditionOrThrowConnectionException(condition, waitFor); ModularXmppClientToServerConnection.this.waitForConditionOrThrowConnectionException(condition, waitFor);
} }
@ -597,7 +596,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
case "error": case "error":
StreamError streamError = PacketParserUtils.parseStreamError(parser, null); StreamError streamError = PacketParserUtils.parseStreamError(parser, null);
StreamErrorException streamErrorException = new StreamErrorException(streamError); StreamErrorException streamErrorException = new StreamErrorException(streamError);
setCurrentConnectionExceptionAndNotify(streamErrorException); currentXmppException = streamErrorException;
notifyWaitingThreads();
throw streamErrorException; throw streamErrorException;
case "features": case "features":
parseFeatures(parser); parseFeatures(parser);
@ -1048,7 +1048,8 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
XmppInputOutputFilter filter = it.next(); XmppInputOutputFilter filter = it.next();
try { try {
filter.waitUntilInputOutputClosed(); filter.waitUntilInputOutputClosed();
} catch (IOException | CertificateException | InterruptedException | SmackException | XMPPException e) { } catch (IOException | CertificateException | InterruptedException | SmackException
| XMPPException e) {
LOGGER.log(Level.WARNING, "waitUntilInputOutputClosed() threw", e); LOGGER.log(Level.WARNING, "waitUntilInputOutputClosed() threw", e);
} }
} }

View file

@ -26,7 +26,6 @@ import java.util.Queue;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.SmackWrappedException;
import org.jivesoftware.smack.SmackReactor; import org.jivesoftware.smack.SmackReactor;
import org.jivesoftware.smack.SmackReactor.ChannelSelectedCallback; import org.jivesoftware.smack.SmackReactor.ChannelSelectedCallback;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
@ -128,8 +127,7 @@ public abstract class ModularXmppClientToServerConnectionInternal {
public abstract void asyncGo(Runnable runnable); public abstract void asyncGo(Runnable runnable);
public abstract void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) public abstract void waitForConditionOrThrowConnectionException(Supplier<Boolean> condition, String waitFor) throws InterruptedException, SmackException, XMPPException;
throws InterruptedException, SmackWrappedException, NoResponseException;
public abstract void notifyWaitingThreads(); public abstract void notifyWaitingThreads();

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2019-2024 Florian Schmaus * Copyright 2019-2021 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,15 +20,10 @@ import java.io.IOException;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable; import java.lang.reflect.TypeVariable;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException; import java.text.ParseException;
import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.Element;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
public class AbstractProvider<E extends Element> { public class AbstractProvider<E extends Element> {
@ -111,14 +106,4 @@ public class AbstractProvider<E extends Element> {
return e; return e;
} }
public static URL toUrl(String string) throws SmackUriSyntaxParsingException, MalformedURLException {
URI uri;
try {
uri = new URI(string);
} catch (URISyntaxException e) {
throw new SmackUriSyntaxParsingException(e);
}
return uri.toURL();
}
} }

View file

@ -87,7 +87,7 @@ public class EventManger<K, R, E extends Exception> {
return true; return true;
} }
private static final class Reference<V> { private static class Reference<V> {
volatile V eventResult; volatile V eventResult;
} }

View file

@ -49,7 +49,6 @@ import org.jivesoftware.smackx.iot.provisioning.BecameFriendListener;
import org.jivesoftware.smackx.iot.provisioning.IoTProvisioningManager; import org.jivesoftware.smackx.iot.provisioning.IoTProvisioningManager;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2021-2024 Florian Schmaus * Copyright 2021 Florian Schmaus
* *
* This file is part of smack-examples. * This file is part of smack-examples.
* *
@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection; import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration; import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils; import org.jivesoftware.smack.util.TLSUtils;

View file

@ -31,7 +31,6 @@ import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration; import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
import org.jivesoftware.smack.debugger.ConsoleDebugger; import org.jivesoftware.smack.debugger.ConsoleDebugger;
import org.jivesoftware.smack.debugger.SmackDebuggerFactory; import org.jivesoftware.smack.debugger.SmackDebuggerFactory;
import org.jivesoftware.smackx.omemo.util.OmemoConstants; import org.jivesoftware.smackx.omemo.util.OmemoConstants;
import org.jivesoftware.smackx.pep.PepManager; import org.jivesoftware.smackx.pep.PepManager;
import org.jivesoftware.smackx.pubsub.PubSubManager; import org.jivesoftware.smackx.pubsub.PubSubManager;

View file

@ -37,7 +37,6 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection; import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils; import org.jivesoftware.smack.util.TLSUtils;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.iqregister.AccountManager; import org.jivesoftware.smackx.iqregister.AccountManager;

View file

@ -32,7 +32,6 @@ import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode; import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.hashes.HashManager; import org.jivesoftware.smackx.hashes.HashManager;
import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement; import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement; import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement;
import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider; import org.jivesoftware.smackx.hashes.provider.HashElementProvider;

View file

@ -160,7 +160,7 @@ public abstract class AbstractHttpOverXmppProvider<H extends AbstractHttpOverXmp
while (!done) { while (!done) {
XmlPullParser.Event eventType = parser.next(); XmlPullParser.Event eventType = parser.next();
if (eventType == XmlPullParser.Event.END_ELEMENT && parser.getName().equals(ELEMENT_XML)) { if ((eventType == XmlPullParser.Event.END_ELEMENT) && parser.getName().equals(ELEMENT_XML)) {
done = true; done = true;
} else { // just write everything else as text } else { // just write everything else as text

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2017 Grigory Fedorov, 2017-2024 Florian Schmaus * Copyright © 2017 Grigory Fedorov, 2017-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,14 +17,12 @@
package org.jivesoftware.smackx.httpfileupload.provider; package org.jivesoftware.smackx.httpfileupload.provider;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.packet.IqData; import org.jivesoftware.smack.packet.IqData;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException.SmackUriSyntaxParsingException;
import org.jivesoftware.smack.provider.IqProvider; import org.jivesoftware.smack.provider.IqProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
@ -44,7 +42,7 @@ import org.jivesoftware.smackx.httpfileupload.element.Slot_V0_2;
public class SlotProvider extends IqProvider<Slot> { public class SlotProvider extends IqProvider<Slot> {
@Override @Override
public Slot parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackUriSyntaxParsingException { public Slot parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException {
final String namespace = parser.getNamespace(); final String namespace = parser.getNamespace();
final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace); final UploadService.Version version = HttpFileUploadManager.namespaceToVersion(namespace);
@ -65,7 +63,7 @@ public class SlotProvider extends IqProvider<Slot> {
switch (version) { switch (version) {
case v0_2: case v0_2:
String putUrlString = parser.nextText(); String putUrlString = parser.nextText();
putUrl = toUrl(putUrlString); putUrl = new URL(putUrlString);
break; break;
case v0_3: case v0_3:
putElementV04Content = parsePutElement_V0_4(parser); putElementV04Content = parsePutElement_V0_4(parser);
@ -87,7 +85,7 @@ public class SlotProvider extends IqProvider<Slot> {
default: default:
throw new AssertionError(); throw new AssertionError();
} }
getUrl = toUrl(getUrlString); getUrl = new URL(getUrlString);
break; break;
} }
break; break;
@ -116,7 +114,7 @@ public class SlotProvider extends IqProvider<Slot> {
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
String putUrlString = parser.getAttributeValue(null, "url"); String putUrlString = parser.getAttributeValue(null, "url");
URL putUrl = URI.create(putUrlString).toURL(); URL putUrl = new URL(putUrlString);
Map<String, String> headers = null; Map<String, String> headers = null;
outerloop: while (true) { outerloop: while (true) {

View file

@ -20,7 +20,6 @@ import java.util.List;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet; import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.packet.MessageView;
import org.jivesoftware.smack.packet.XmlElement; import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;

View file

@ -17,11 +17,9 @@
package org.jivesoftware.smackx.mam.element; package org.jivesoftware.smackx.mam.element;
import java.util.List; import java.util.List;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet; import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;

View file

@ -17,11 +17,9 @@
package org.jivesoftware.smackx.mam.element; package org.jivesoftware.smackx.mam.element;
import java.util.List; import java.util.List;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.forward.packet.Forwarded; import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.rsm.packet.RSMSet; import org.jivesoftware.smackx.rsm.packet.RSMSet;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement; import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
public class ThumbnailElementProvider extends ExtensionElementProvider<ThumbnailElement> { public class ThumbnailElementProvider extends ExtensionElementProvider<ThumbnailElement> {

View file

@ -26,7 +26,6 @@ import java.util.Date;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.SmackTestUtil; import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement; import org.jivesoftware.smackx.file_metadata.element.FileMetadataElement;
import org.jivesoftware.smackx.file_metadata.provider.FileMetadataElementProvider; import org.jivesoftware.smackx.file_metadata.provider.FileMetadataElementProvider;
import org.jivesoftware.smackx.hashes.HashManager; import org.jivesoftware.smackx.hashes.HashManager;

View file

@ -24,7 +24,6 @@ import java.io.IOException;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.SmackTestUtil; import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement; import org.jivesoftware.smackx.thumbnails.element.ThumbnailElement;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;

View file

@ -461,7 +461,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* IQIBBInputStream class implements IBBInputStream to be used with IQ stanzas encapsulating the * IQIBBInputStream class implements IBBInputStream to be used with IQ stanzas encapsulating the
* data packets. * data packets.
*/ */
private final class IQIBBInputStream extends IBBInputStream { private class IQIBBInputStream extends IBBInputStream {
@Override @Override
protected StanzaListener getDataPacketListener() { protected StanzaListener getDataPacketListener() {
@ -541,7 +541,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* MessageIBBInputStream class implements IBBInputStream to be used with message stanzas * MessageIBBInputStream class implements IBBInputStream to be used with message stanzas
* encapsulating the data packets. * encapsulating the data packets.
*/ */
private final class MessageIBBInputStream extends IBBInputStream { private class MessageIBBInputStream extends IBBInputStream {
@Override @Override
protected StanzaListener getDataPacketListener() { protected StanzaListener getDataPacketListener() {
@ -590,7 +590,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* containing an In-Band Bytestream data stanza extension whose session ID matches this sessions * containing an In-Band Bytestream data stanza extension whose session ID matches this sessions
* ID. * ID.
*/ */
private final class IBBDataPacketFilter implements StanzaFilter { private class IBBDataPacketFilter implements StanzaFilter {
@Override @Override
public boolean accept(Stanza packet) { public boolean accept(Stanza packet) {
@ -814,7 +814,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* IQIBBOutputStream class implements IBBOutputStream to be used with IQ stanzas encapsulating * IQIBBOutputStream class implements IBBOutputStream to be used with IQ stanzas encapsulating
* the data packets. * the data packets.
*/ */
private final class IQIBBOutputStream extends IBBOutputStream { private class IQIBBOutputStream extends IBBOutputStream {
@Override @Override
protected synchronized void writeToXML(DataPacketExtension data) throws IOException { protected synchronized void writeToXML(DataPacketExtension data) throws IOException {
@ -845,7 +845,7 @@ public class InBandBytestreamSession implements BytestreamSession {
* MessageIBBOutputStream class implements IBBOutputStream to be used with message stanzas * MessageIBBOutputStream class implements IBBOutputStream to be used with message stanzas
* encapsulating the data packets. * encapsulating the data packets.
*/ */
private final class MessageIBBOutputStream extends IBBOutputStream { private class MessageIBBOutputStream extends IBBOutputStream {
@Override @Override
protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException { protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException {

View file

@ -433,7 +433,7 @@ public class Socks5Proxy {
/** /**
* Implementation of a simplified SOCKS5 proxy server. * Implementation of a simplified SOCKS5 proxy server.
*/ */
private final class Socks5ServerProcess implements Runnable { private class Socks5ServerProcess implements Runnable {
@Override @Override
public void run() { public void run() {

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData.Action; import org.jivesoftware.smackx.commands.packet.AdHocCommandData.Action;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData.AllowedAction; import org.jivesoftware.smackx.commands.packet.AdHocCommandData.AllowedAction;

View file

@ -22,7 +22,6 @@ import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.xdata.form.FillableForm; import org.jivesoftware.smackx.xdata.form.FillableForm;
import org.jivesoftware.smackx.xdata.form.SubmitForm; import org.jivesoftware.smackx.xdata.form.SubmitForm;

View file

@ -20,7 +20,6 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder; import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder;
import org.jivesoftware.smackx.xdata.form.SubmitForm; import org.jivesoftware.smackx.xdata.form.SubmitForm;

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.commands; package org.jivesoftware.smackx.commands;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.xdata.form.FillableForm; import org.jivesoftware.smackx.xdata.form.FillableForm;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.muc; package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation; import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
public interface DirectMucInvitationListener { public interface DirectMucInvitationListener {

View file

@ -29,7 +29,6 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.StanzaExtensionFilter; import org.jivesoftware.smack.filter.StanzaExtensionFilter;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.MessageBuilder; import org.jivesoftware.smack.packet.MessageBuilder;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation; import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;

View file

@ -18,11 +18,10 @@
package org.jivesoftware.smackx.muc; package org.jivesoftware.smackx.muc;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
@ -216,9 +215,9 @@ public class RoomInfo {
if (urlField != null && !urlField.getValues().isEmpty()) { if (urlField != null && !urlField.getValues().isEmpty()) {
String urlString = urlField.getFirstValue(); String urlString = urlField.getFirstValue();
try { try {
logs = new URI(urlString).toURL(); logs = new URL(urlString);
} catch (MalformedURLException | URISyntaxException e) { } catch (MalformedURLException e) {
throw new IllegalArgumentException("Could not parse '" + urlString + "' to URL", e); LOGGER.log(Level.SEVERE, "Could not parse URL", e);
} }
} }

View file

@ -29,7 +29,6 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation; import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;

View file

@ -20,7 +20,6 @@ import java.util.List;
import org.jivesoftware.smack.util.EqualsUtil; import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode; import org.jivesoftware.smack.util.HashCode;
import org.jivesoftware.smackx.formtypes.FormFieldRegistry; import org.jivesoftware.smackx.formtypes.FormFieldRegistry;
import org.jivesoftware.smackx.mediaelement.element.MediaElement; import org.jivesoftware.smackx.mediaelement.element.MediaElement;
import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.FormField;

View file

@ -28,7 +28,7 @@ public interface FormFieldWithOptions {
*/ */
List<FormField.Option> getOptions(); List<FormField.Option> getOptions();
interface Builder<B extends FormField.Builder<?, ?>> { public interface Builder<B extends FormField.Builder<?, ?>> {
default B addOption(String option) { default B addOption(String option) {
return addOption(new FormField.Option(option)); return addOption(new FormField.Option(option));

View file

@ -29,7 +29,6 @@ import javax.xml.namespace.QName;
import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.parsing.SmackParsingException.RequiredValueMissingException;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.roster.packet.RosterPacket; import org.jivesoftware.smack.roster.packet.RosterPacket;
import org.jivesoftware.smack.roster.provider.RosterPacketProvider; import org.jivesoftware.smack.roster.provider.RosterPacketProvider;
@ -186,8 +185,9 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
FormField.Type type = null; FormField.Type type = null;
{ {
String fieldTypeString = parser.getAttributeValue("type"); String fieldTypeString = parser.getAttributeValue("type");
// FormField.Type.fromString() will return null if its input is null. if (fieldTypeString != null) {
type = FormField.Type.fromString(fieldTypeString); type = FormField.Type.fromString(fieldTypeString);
}
} }
List<FormField.Value> values = new ArrayList<>(); List<FormField.Value> values = new ArrayList<>();
@ -238,14 +238,6 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
} }
} }
if (type != FormField.Type.fixed && fieldName == null) {
String typeString = "unspecified";
if (type != null) {
typeString = type.toString();
}
throw new RequiredValueMissingException("The data form field of " + typeString + " type has no 'var' attribute, even though one is required as per XEP-0004 § 3.2");
}
if (type == null) { if (type == null) {
// The field name 'FORM_TYPE' is magic. // The field name 'FORM_TYPE' is magic.
if (fieldName.equals(FormField.FORM_TYPE)) { if (fieldName.equals(FormField.FORM_TYPE)) {

View file

@ -46,7 +46,6 @@ import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.test.util.NetworkUtil; import org.jivesoftware.smack.test.util.NetworkUtil;
import org.jivesoftware.smack.util.ExceptionUtil; import org.jivesoftware.smack.util.ExceptionUtil;
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils; import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;

View file

@ -33,7 +33,6 @@ import org.jivesoftware.smack.packet.EmptyResultIQ;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.CloseableUtil; import org.jivesoftware.smack.util.CloseableUtil;
import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils; import org.jivesoftware.smackx.bytestreams.ibb.IBBPacketUtils;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost; import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;

View file

@ -31,7 +31,6 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.WaitForPacketListener; import org.jivesoftware.smack.test.util.WaitForPacketListener;
import org.jivesoftware.smackx.muc.packet.GroupChatInvitation; import org.jivesoftware.smackx.muc.packet.GroupChatInvitation;
import org.jivesoftware.smackx.muc.packet.MUCUser; import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.jivesoftware.smackx.muc.packet.MUCUser.Invite; import org.jivesoftware.smackx.muc.packet.MUCUser.Invite;

View file

@ -24,7 +24,6 @@ import java.io.IOException;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.muc.provider.GroupChatInvitationProvider; import org.jivesoftware.smackx.muc.provider.GroupChatInvitationProvider;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -96,7 +96,7 @@ public class DeliveryReceiptTest extends SmackTestSuite {
rrl.waitUntilInvocationOrTimeout(); rrl.waitUntilInvocationOrTimeout();
} }
private static final class TestReceiptReceivedListener extends WaitForPacketListener implements ReceiptReceivedListener { private static class TestReceiptReceivedListener extends WaitForPacketListener implements ReceiptReceivedListener {
@Override @Override
public void onReceiptReceived(Jid fromJid, Jid toJid, String receiptId, Stanza receipt) { public void onReceiptReceived(Jid fromJid, Jid toJid, String receiptId, Stanza receipt) {
assertThat("julia@capulet.com", equalsCharSequence(fromJid)); assertThat("julia@capulet.com", equalsCharSequence(fromJid));

View file

@ -17,13 +17,11 @@
package org.jivesoftware.smackx.xdata.provider; package org.jivesoftware.smackx.xdata.provider;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
@ -32,8 +30,6 @@ import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
public class DataFormProviderTest { public class DataFormProviderTest {
@ -148,14 +144,4 @@ public class DataFormProviderTest {
assertEquals(FormField.Type.hidden, usernameFormField.getType()); assertEquals(FormField.Type.hidden, usernameFormField.getType());
assertEquals("", usernameFormField.getLabel()); assertEquals("", usernameFormField.getLabel());
} }
@ParameterizedTest
@EnumSource(SmackTestUtil.XmlPullParserKind.class)
public void testShouldThrowSmackParsingException(SmackTestUtil.XmlPullParserKind parserKind) {
String form = "<x xmlns='jabber:x:data' type='form'>"
+ "<field/>"
+ "</x>";
SmackParsingException.RequiredValueMissingException exception = assertThrows(SmackParsingException.RequiredValueMissingException.class, () -> SmackTestUtil.parse(form, DataFormProvider.class, parserKind));
assertEquals("The data form field of unspecified type has no 'var' attribute, even though one is required as per XEP-0004 § 3.2", exception.getMessage());
}
} }

View file

@ -1557,9 +1557,6 @@ public final class Roster extends Manager {
* Ignore ItemTypes as of RFC 6121, 2.1.2.5. * Ignore ItemTypes as of RFC 6121, 2.1.2.5.
* *
* This is used by {@link RosterPushListener} and {@link RosterResultListener}. * This is used by {@link RosterPushListener} and {@link RosterResultListener}.
*
* @param item the roster item to check
* @return <code>true</code> if the item type should be ignored
* */ * */
private static boolean hasValidSubscriptionType(RosterPacket.Item item) { private static boolean hasValidSubscriptionType(RosterPacket.Item item) {
switch (item.getItemType()) { switch (item.getItemType()) {
@ -1618,7 +1615,7 @@ public final class Roster extends Manager {
/** /**
* Listens for all presence packets and processes them. * Listens for all presence packets and processes them.
*/ */
private final class PresencePacketListener implements StanzaListener { private class PresencePacketListener implements StanzaListener {
@Override @Override
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException { public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
@ -1793,7 +1790,7 @@ public final class Roster extends Manager {
/** /**
* Handles Roster results as described in <a href="https://tools.ietf.org/html/rfc6121#section-2.1.4">RFC 6121 2.1.4</a>. * Handles Roster results as described in <a href="https://tools.ietf.org/html/rfc6121#section-2.1.4">RFC 6121 2.1.4</a>.
*/ */
private final class RosterResultListener implements SuccessCallback<IQ> { private class RosterResultListener implements SuccessCallback<IQ> {
@Override @Override
public void onSuccess(IQ packet) { public void onSuccess(IQ packet) {

View file

@ -396,7 +396,7 @@ public class ChatConnectionTest {
} }
} }
private static final class TestMessageListener implements ChatMessageListener { private static class TestMessageListener implements ChatMessageListener {
private Chat msgChat; private Chat msgChat;
private int counter = 0; private int counter = 0;

View file

@ -13,7 +13,6 @@ application {
dependencies { dependencies {
api project(':smack-java11-full') api project(':smack-java11-full')
api project(':smack-websocket-okhttp')
api project(':smack-resolver-dnsjava') api project(':smack-resolver-dnsjava')
implementation project(':smack-websocket-java11') implementation project(':smack-websocket-java11')
implementation "com.google.guava:guava:${guavaVersion}" implementation "com.google.guava:guava:${guavaVersion}"

View file

@ -44,7 +44,6 @@ import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException; import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException;
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException; import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
public class XmppConnectionStressTest { public class XmppConnectionStressTest {

View file

@ -392,12 +392,12 @@ public final class Configuration {
} }
public Builder setEnabledTests(String enabledTestsString) { public Builder setEnabledTests(String enabledTestsString) {
enabledTests = getTestSetFrom(enabledTestsString, "enabled"); enabledTests = getTestSetFrom(enabledTestsString);
return this; return this;
} }
public Builder setDisabledTests(String disabledTestsString) { public Builder setDisabledTests(String disabledTestsString) {
disabledTests = getTestSetFrom(disabledTestsString, "disabled"); disabledTests = getTestSetFrom(disabledTestsString);
return this; return this;
} }
@ -625,8 +625,7 @@ public final class Configuration {
return res; return res;
} }
private static Set<String> getTestSetFrom(String input, String name) { private static Set<String> getTestSetFrom(String input) {
StringUtils.requireNullOrNotEmpty(input, "Most provide a value for " + name + " tests");
return split(input, s -> { return split(input, s -> {
s = s.trim(); s = s.trim();
if (s.startsWith("smackx.") || s.startsWith("smack.")) { if (s.startsWith("smackx.") || s.startsWith("smack.")) {

View file

@ -74,7 +74,6 @@ import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.reflections.scanners.MethodAnnotationsScanner; import org.reflections.scanners.MethodAnnotationsScanner;
import org.reflections.scanners.MethodParameterScanner; import org.reflections.scanners.MethodParameterScanner;
@ -151,28 +150,24 @@ public class SmackIntegrationTestFramework {
LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: " LOGGER.info("SmackIntegrationTestFramework[" + testRunResult.testRunId + ']' + " finished: "
+ successfulTests + '/' + availableTests + " [" + failedTests + " failed]"); + successfulTests + '/' + availableTests + " [" + failedTests + " failed]");
if (failedTests == 0) { if (failedTests > 0) {
LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/"); LOGGER.warning("💀 The following " + failedTests + " tests failed! 💀");
return; final SortedSet<String> bySpecification = new TreeSet<>();
} for (FailedTest failedTest : testRunResult.failedIntegrationTests) {
final Throwable cause = failedTest.failureReason;
StringBuilder sb = new StringBuilder("💀 The following " + failedTests + " tests failed! 💀\n -"); LOGGER.log(Level.SEVERE, failedTest.concreteTest + " failed: " + cause, cause);
StringUtils.appendTo(testRunResult.failedIntegrationTests, "\n- ", sb, t -> sb.append(t.concreteTest));
LOGGER.warning(sb.toString());
final SortedSet<String> 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.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) { if (failedTest.concreteTest.method.getDeclaringClass().isAnnotationPresent(SpecificationReference.class)) {
final String specificationReference = getSpecificationReference(failedTest.concreteTest.method); final String specificationReference = getSpecificationReference(failedTest.concreteTest.method);
if (specificationReference != null) { if (specificationReference != null) {
bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')"); bySpecification.add("- " + specificationReference + " (as tested by '" + failedTest.concreteTest + "')");
}
} }
} }
} if (!bySpecification.isEmpty()) {
if (!bySpecification.isEmpty()) { LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification));
LOGGER.log(Level.SEVERE, "The failed tests correspond to the following specifications:" + System.lineSeparator() + String.join(System.lineSeparator(), bySpecification)); }
} else {
LOGGER.info("All possible Smack Integration Tests completed successfully. \\o/");
} }
} }
} }

View file

@ -47,13 +47,11 @@ import org.jivesoftware.smack.util.MultiMap;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.websocket.java11.Java11WebSocketFactory; import org.jivesoftware.smack.websocket.java11.Java11WebSocketFactory;
import org.jivesoftware.smack.websocket.okhttp.OkHttpWebSocketFactory; import org.jivesoftware.smack.websocket.okhttp.OkHttpWebSocketFactory;
import org.jivesoftware.smackx.admin.ServiceAdministrationManager; import org.jivesoftware.smackx.admin.ServiceAdministrationManager;
import org.jivesoftware.smackx.iqregister.AccountManager; import org.jivesoftware.smackx.iqregister.AccountManager;
import org.igniterealtime.smack.inttest.Configuration.AccountRegistration; import org.igniterealtime.smack.inttest.Configuration.AccountRegistration;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.AccountNum; import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.AccountNum;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart; import org.jxmpp.jid.parts.Localpart;

View file

@ -32,7 +32,6 @@ import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegration
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> { public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> {

View file

@ -22,7 +22,6 @@ import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
public class IncomingMessageListenerIntegrationTest extends AbstractChatIntegrationTest { public class IncomingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {

View file

@ -23,7 +23,6 @@ import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
public class OutgoingMessageListenerIntegrationTest extends AbstractChatIntegrationTest { public class OutgoingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {

View file

@ -26,7 +26,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.FullJid; import org.jxmpp.jid.FullJid;
public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrationTest { public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrationTest {

View file

@ -40,7 +40,6 @@ import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;

View file

@ -24,7 +24,6 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smackx.commands.packet.AdHocCommandData; import org.jivesoftware.smackx.commands.packet.AdHocCommandData;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder; import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder;
import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder.NextStage; import org.jivesoftware.smackx.commands.packet.AdHocCommandDataBuilder.NextStage;

View file

@ -26,7 +26,6 @@ import java.util.Arrays;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.filetransfer.FileTransfer.Status; import org.jivesoftware.smackx.filetransfer.FileTransfer.Status;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;

View file

@ -36,7 +36,6 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.util.XmppDateTime; import org.jxmpp.util.XmppDateTime;
@SpecificationReference(document = "XEP-0080", version = "1.9") @SpecificationReference(document = "XEP-0080", version = "1.9")

View file

@ -36,7 +36,6 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0347", version = "0.5.1") @SpecificationReference(document = "XEP-0347", version = "0.5.1")

View file

@ -35,7 +35,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0347", version = "0.5.1") @SpecificationReference(document = "XEP-0347", version = "0.5.1")

View file

@ -35,7 +35,6 @@ import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaBuilder; import org.jivesoftware.smack.packet.StanzaBuilder;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smackx.mam.MamManager.MamQuery; import org.jivesoftware.smackx.mam.MamManager.MamQuery;
import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs; import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs;
@ -45,7 +44,6 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
@SpecificationReference(document = "XEP-0313", version = "0.6.3") @SpecificationReference(document = "XEP-0313", version = "0.6.3")

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException; import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException; import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException;
@ -35,7 +34,6 @@ import org.jivesoftware.smackx.xdata.form.Form;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
@ -107,7 +105,7 @@ public abstract class AbstractMultiUserChatIntegrationTest extends AbstractSmack
* @throws XmppStringprepException if the prefix isn't a valid XMPP Localpart * @throws XmppStringprepException if the prefix isn't a valid XMPP Localpart
*/ */
public EntityBareJid getRandomRoom(String prefix) throws XmppStringprepException { public EntityBareJid getRandomRoom(String prefix) throws XmppStringprepException {
final String roomNameLocal = String.join("-", "sinttest", prefix, testRunId, StringUtils.insecureRandomString(3)); final String roomNameLocal = String.join("-", prefix, testRunId, StringUtils.insecureRandomString(6));
return JidCreate.entityBareFrom(Localpart.from(roomNameLocal), mucService.getDomain()); return JidCreate.entityBareFrom(Localpart.from(roomNameLocal), mucService.getDomain());
} }

View file

@ -28,7 +28,6 @@ import java.util.Map;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
import org.jivesoftware.smackx.disco.packet.DiscoverItems; import org.jivesoftware.smackx.disco.packet.DiscoverItems;
@ -98,7 +97,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"service. The service SHOULD return a full list of the public rooms it hosts (i.e., not return any rooms that" + "service. The service SHOULD return a full list of the public rooms it hosts (i.e., not return any rooms that" +
"are hidden).") "are hidden).")
public void mucTestForDiscoveringRooms() throws Exception { public void mucTestForDiscoveringRooms() throws Exception {
EntityBareJid mucAddressPublic = getRandomRoom("publicroom"); EntityBareJid mucAddressPublic = getRandomRoom("smack-inttest-publicroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddressPublic); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddressPublic);
EntityBareJid mucAddressHidden = getRandomRoom("smack-inttest-hiddenroom"); EntityBareJid mucAddressHidden = getRandomRoom("smack-inttest-hiddenroom");
@ -128,7 +127,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"Using the disco#info protocol, an entity may also query a specific chat room for more detailed information " + "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") "about the room....The room MUST return its identity and SHOULD return the features it supports")
public void mucTestForDiscoveringRoomInfo() throws Exception { public void mucTestForDiscoveringRoomInfo() throws Exception {
EntityBareJid mucAddress = getRandomRoom("discoinfo"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString)); createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));
@ -155,7 +154,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"of existing occupants if that information is publicly available, or return no list at all if this " + "of existing occupants if that information is publicly available, or return no list at all if this " +
"information is kept private.") "information is kept private.")
public void mucTestForDiscoveringRoomItems() throws Exception { public void mucTestForDiscoveringRoomItems() throws Exception {
EntityBareJid mucAddress = getRandomRoom("discoitems"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString)); createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));
@ -179,7 +178,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
"If a non-occupant attempts to send a disco request to an address of the form <room@service/nick>, a MUC " + "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") "service MUST return a <bad-request> error")
public void mucTestForRejectingDiscoOnRoomOccupantByNonOccupant() throws Exception { public void mucTestForRejectingDiscoOnRoomOccupantByNonOccupant() throws Exception {
EntityBareJid mucAddress = getRandomRoom("discoitems"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoitems");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString); final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString);
createMuc(mucAsSeenByOne, nicknameOne); createMuc(mucAsSeenByOne, nicknameOne);

View file

@ -32,7 +32,6 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException; import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException;
@ -43,7 +42,6 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.parts.Resourcepart; import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException; import org.jxmpp.stringprep.XmppStringprepException;
@ -59,7 +57,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
@SmackIntegrationTest @SmackIntegrationTest
public void mucTest() throws Exception { public void mucTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("message"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-message");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -100,7 +98,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
"users from the room... and destroys the room") "users from the room... and destroys the room")
public void mucDestroyOwnerTest() throws TimeoutException, Exception { public void mucDestroyOwnerTest() throws TimeoutException, Exception {
EntityBareJid mucAddress = getRandomRoom("destroy-owner"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-destroy-owner");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(muc, Resourcepart.from("one-" + randomString)); createMuc(muc, Resourcepart.from("one-" + randomString));
@ -147,7 +145,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
"users from the room... and destroys the room") "users from the room... and destroys the room")
public void mucDestroyTestOccupant() throws TimeoutException, Exception { public void mucDestroyTestOccupant() throws TimeoutException, Exception {
EntityBareJid mucAddress = getRandomRoom("destroy-occupant"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-destroy-occupant");
MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByParticipant = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByParticipant = mucManagerTwo.getMultiUserChat(mucAddress);
@ -191,7 +189,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
throws XmppStringprepException, MucAlreadyJoinedException, MissingMucCreationAcknowledgeException, throws XmppStringprepException, MucAlreadyJoinedException, MissingMucCreationAcknowledgeException,
NotAMucServiceException, NoResponseException, XMPPErrorException, NotConnectedException, NotAMucServiceException, NoResponseException, XMPPErrorException, NotConnectedException,
InterruptedException, MucConfigurationNotSupportedException { InterruptedException, MucConfigurationNotSupportedException {
EntityBareJid mucAddress = getRandomRoom("muc-name-change"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-muc-name-change");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
createMuc(muc, Resourcepart.from("one-" + randomString)); createMuc(muc, Resourcepart.from("one-" + randomString));
@ -216,7 +214,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
public void mucTestVisitorNotAllowedToChangeSubject() throws XmppStringprepException, MucAlreadyJoinedException, public void mucTestVisitorNotAllowedToChangeSubject() throws XmppStringprepException, MucAlreadyJoinedException,
MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException, MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException { XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
final EntityBareJid mucAddress = getRandomRoom("visitor-change-subject"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-visitor-change-subject");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -252,7 +250,7 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
public void mucTestChangeRoomName() throws XmppStringprepException, MucAlreadyJoinedException, public void mucTestChangeRoomName() throws XmppStringprepException, MucAlreadyJoinedException,
MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException, MissingMucCreationAcknowledgeException, NotAMucServiceException, NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException { XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
final EntityBareJid mucAddress = getRandomRoom("change-room-name"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-change-room-name");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString); final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString);

View file

@ -34,7 +34,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Localpart; import org.jxmpp.jid.parts.Localpart;

View file

@ -41,7 +41,6 @@ import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaError; import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.sm.predicates.ForEveryMessage; import org.jivesoftware.smack.sm.predicates.ForEveryMessage;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException; import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucConfigurationNotSupportedException;
@ -50,7 +49,6 @@ import org.jivesoftware.smackx.muc.packet.MUCItem;
import org.jivesoftware.smackx.muc.packet.MUCUser; import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.igniterealtime.smack.inttest.Configuration; import org.igniterealtime.smack.inttest.Configuration;
import org.igniterealtime.smack.inttest.Configuration.CompatibilityMode;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
@ -58,7 +56,6 @@ import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.MultiResultSyncPoint; import org.igniterealtime.smack.inttest.util.MultiResultSyncPoint;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Resourcepart; import org.jxmpp.jid.parts.Resourcepart;
@ -86,7 +83,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
// stanzas arrive. Instead, it joins a chatroom and listens for its stanzas using basic stanza handling. As // stanzas arrive. Instead, it joins a chatroom and listens for its stanzas using basic stanza handling. As
// this uses exactly one stanza listener, that's guaranteed to be invoked in order of stanza arrival, which is // this uses exactly one stanza listener, that's guaranteed to be invoked in order of stanza arrival, which is
// not necessarily the case when using the MUC API. // not necessarily the case when using the MUC API.
EntityBareJid mucAddress = getRandomRoom("eventordering"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-eventordering");
final String mucSubject = "Subject smack-inttest-eventordering " + randomString; final String mucSubject = "Subject smack-inttest-eventordering " + randomString;
final String mucMessage = "Message smack-inttest-eventordering " + randomString; final String mucMessage = "Message smack-inttest-eventordering " + randomString;
@ -117,13 +114,8 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
final List<Stanza> results = new ArrayList<>(); final List<Stanza> results = new ArrayList<>();
final StanzaListener stanzaListener = stanza -> { final StanzaListener stanzaListener = stanza -> {
results.add(stanza); results.add(stanza);
// TODO: Use pattern matching for instanceof once Smack is Java 16 or higher. if (stanza instanceof Message && ((Message) stanza).getSubject() != null) {
if (stanza instanceof Message) { subjectResultSyncPoint.signal(((Message) stanza).getSubject());
Message message = (Message) stanza;
String subject = message.getSubject();
if (subject != null) {
subjectResultSyncPoint.signal(subject);
}
} }
}; };
conTwo.addStanzaListener(stanzaListener, FromMatchesFilter.create(mucAddress)); conTwo.addStanzaListener(stanzaListener, FromMatchesFilter.create(mucAddress));
@ -133,12 +125,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
subjectResultSyncPoint.waitForResult(timeout); // Wait for subject, as it should be 4th (last) subjectResultSyncPoint.waitForResult(timeout); // Wait for subject, as it should be 4th (last)
if (sinttestConfiguration.compatibilityMode == CompatibilityMode.ejabberd) { assertEquals(4, results.size(), "Unexpected amount of stanzas received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'.");
// ejabberd MUCs also send their own presence with caps information as very first presence.
results.remove(0);
}
assertEquals(4, results.size(), "Unexpected amount of stanzas received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'. Results: " + results);
assertTrue(results.get(0) instanceof Presence, "Expected the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not)."); assertTrue(results.get(0) instanceof Presence, "Expected the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not).");
assertEquals(JidCreate.fullFrom(mucAddress, nicknameOne), results.get(0).getFrom(), "Unexpected 'from' address of the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'."); assertEquals(JidCreate.fullFrom(mucAddress, nicknameOne), results.get(0).getFrom(), "Unexpected 'from' address of the first stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "'.");
assertTrue(results.get(1) instanceof Presence, "Expected the second stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not)."); assertTrue(results.get(1) instanceof Presence, "Expected the second stanza that was received by '" + conTwo.getUser() + "' after it joined room '" + mucAddress + "' to be a presence stanza (but it was not).");
@ -175,7 +162,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"§ 7.2.1: In order to participate in the discussions held in a multi-user chat room, a user MUST first become an occupant by entering the room [...] " + "§ 7.2.1: In order to participate in the discussions held in a multi-user chat room, a user MUST first become an occupant by entering the room [...] " +
"§ 7.4: If the sender is not an occupant of the room, the service SHOULD return a <not-acceptable/> error to the sender and SHOULD NOT reflect the message to all occupants") "§ 7.4: If the sender is not an occupant of the room, the service SHOULD return a <not-acceptable/> error to the sender and SHOULD NOT reflect the message to all occupants")
public void mucSendBeforeJoiningTest() throws Exception { public void mucSendBeforeJoiningTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("send-without-joining"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-send-without-joining");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -215,7 +202,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"complete list of the existing occupants to the new occupant and only then send the new occupant's own " + "complete list of the existing occupants to the new occupant and only then send the new occupant's own " +
"presence to the new occupant.") "presence to the new occupant.")
public void mucJoinPresenceInformationTest() throws Exception { public void mucJoinPresenceInformationTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("presenceinfo"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-presenceinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -274,7 +261,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"the service MUST also send presence from the new participant's occupant JID to the full JIDs of all the " + "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)") "occupants (including the new occupant)")
public void mucJoinPresenceBroadcastTest() throws Exception { public void mucJoinPresenceBroadcastTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("presenceinfo"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-presenceinfo");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -333,7 +320,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"full JID as shown above), the service MUST warn the user by including a status code of \"100\" in the " + "full JID as shown above), the service MUST warn the user by including a status code of \"100\" in the " +
"initial presence that the room sends to the new occupant.") "initial presence that the room sends to the new occupant.")
public void mucJoinNonAnonymousRoomTest() throws Exception { public void mucJoinNonAnonymousRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("joinnonanonymousroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-joinnonanonymousroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -390,7 +377,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"option), but MUST include the new occupant's full JID only in the presence notifications it sends to " + "option), but MUST include the new occupant's full JID only in the presence notifications it sends to " +
"occupants with a role of \"moderator\" and not to non-moderator occupants.") "occupants with a role of \"moderator\" and not to non-moderator occupants.")
public void mucJoinSemiAnonymousRoomReceivedByNonModeratorTest() throws Exception { public void mucJoinSemiAnonymousRoomReceivedByNonModeratorTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("seminanonymous-by-non-moderator"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-seminanonymous-by-non-moderator");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -436,7 +423,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"option), but MUST include the new occupant's full JID only in the presence notifications it sends to " + "option), but MUST include the new occupant's full JID only in the presence notifications it sends to " +
"occupants with a role of \"moderator\" and not to non-moderator occupants.") "occupants with a role of \"moderator\" and not to non-moderator occupants.")
public void mucJoinSemiAnonymousRoomReceivedByModeratorTest() throws Exception { public void mucJoinSemiAnonymousRoomReceivedByModeratorTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("seminanonymous-by-moderator"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-seminanonymous-by-moderator");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -480,7 +467,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " + "service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a <not-authorized/> error.") "a presence stanza of type \"error\" specifying a <not-authorized/> error.")
public void mucJoinPasswordProtectedWithoutPasswordRoomTest() throws Exception { public void mucJoinPasswordProtectedWithoutPasswordRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -516,7 +503,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " + "service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a <not-authorized/> error.") "a presence stanza of type \"error\" specifying a <not-authorized/> error.")
public void mucJoinPasswordProtectedRoomWrongPasswordTest() throws Exception { public void mucJoinPasswordProtectedRoomWrongPasswordTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -553,7 +540,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " + "service MUST deny access to the room and inform the user that they are unauthorized; this is done by returning " +
"a presence stanza of type \"error\" specifying a <not-authorized/> error.") "a presence stanza of type \"error\" specifying a <not-authorized/> error.")
public void mucJoinPasswordProtectedRoomCorrectPasswordTest() throws Exception { public void mucJoinPasswordProtectedRoomCorrectPasswordTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("enterpasswordprotectedroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-enterpasswordprotectedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -595,7 +582,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room and inform the user that they are not allowed to enter the room; this is done by returning a presence " + "room and inform the user that they are not allowed to enter the room; this is done by returning a presence " +
"stanza of type \"error\" specifying a <registration-required/> error condition.") "stanza of type \"error\" specifying a <registration-required/> error condition.")
public void mucJoinMembersOnlyRoomTest() throws Exception { public void mucJoinMembersOnlyRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("entermembersonlyroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-entermembersonlyroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -633,7 +620,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"access to the room and inform the user of the fact that they are banned; this is done by returning a presence " + "access to the room and inform the user of the fact that they are banned; this is done by returning a presence " +
"stanza of type \"error\" specifying a <forbidden/> error condition.") "stanza of type \"error\" specifying a <forbidden/> error condition.")
public void mucBannedUserJoinRoomTest() throws Exception { public void mucBannedUserJoinRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("banneduser"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-banneduser");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -669,7 +656,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room and inform the user of the conflict; this is done by returning a presence stanza of type \"error\" " + "room and inform the user of the conflict; this is done by returning a presence stanza of type \"error\" " +
"specifying a <conflict/> error condition.") "specifying a <conflict/> error condition.")
public void mucNicknameConflictJoinRoomTest() throws Exception { public void mucNicknameConflictJoinRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("nicknameclash"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-nicknameclash");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -703,7 +690,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"specifying a <service-unavailable/> error condition. Alternatively, the room could kick an \"idle user\" " + "specifying a <service-unavailable/> error condition. Alternatively, the room could kick an \"idle user\" " +
"in order to free up space (where the definition of \"idle user\" is up to the implementation).") "in order to free up space (where the definition of \"idle user\" is up to the implementation).")
public void mucMaxUsersLimitJoinRoomTest() throws Exception { public void mucMaxUsersLimitJoinRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("maxusersreached"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -782,7 +769,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " + "room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " +
"helps to prevent denial of service attacks caused by stuffing the room with non-admin users.") "helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
public void mucMaxUsersLimitAdminCanStillJoinRoomTest() throws Exception { public void mucMaxUsersLimitAdminCanStillJoinRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("maxusersreached-adminjoin"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached-adminjoin");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -834,7 +821,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " + "room MUST allow the admin or owner to join, up to some reasonable number of additional occupants; this " +
"helps to prevent denial of service attacks caused by stuffing the room with non-admin users.") "helps to prevent denial of service attacks caused by stuffing the room with non-admin users.")
public void mucMaxUsersLimitOwnerCanStillJoinRoomTest() throws Exception { public void mucMaxUsersLimitOwnerCanStillJoinRoomTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("maxusersreached-ownerjoin"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-maxusersreached-ownerjoin");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -891,7 +878,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
throw new TestNotPossibleException("ejabberd does not implement MUC locked rooms as per XEP-0045 § 7.2.10"); throw new TestNotPossibleException("ejabberd does not implement MUC locked rooms as per XEP-0045 § 7.2.10");
} }
EntityBareJid mucAddress = getRandomRoom("lockedroom"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-lockedroom");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -928,7 +915,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"discussions are logged. This is done by including a status code of \"170\" in the initial presence that the " + "discussions are logged. This is done by including a status code of \"170\" in the initial presence that the " +
"room sends to the new occupant.") "room sends to the new occupant.")
public void mucJoinRoomWithPublicLoggingTest() throws Exception { public void mucJoinRoomWithPublicLoggingTest() throws Exception {
final EntityBareJid mucAddress = getRandomRoom("publiclogging"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-publiclogging");
final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -969,7 +956,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"case, nick='oldhag') - A status code of 303 This enables the recipients to correlate the old roomnick with " + "case, nick='oldhag') - A status code of 303 This enables the recipients to correlate the old roomnick with " +
"the new roomnick.\n") "the new roomnick.\n")
public void mucChangeNicknameInformationTest() throws Exception { public void mucChangeNicknameInformationTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("changenickname"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-changenickname");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -1064,7 +1051,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"service MUST deny the nickname change request and inform the user of the conflict; this is done by " + "service MUST deny the nickname change request and inform the user of the conflict; this is done by " +
"returning a presence stanza of type \"error\" specifying a <conflict/> error condition:") "returning a presence stanza of type \"error\" specifying a <conflict/> error condition:")
public void mucBlockChangeNicknameInformationTest() throws Exception { public void mucBlockChangeNicknameInformationTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("blockchangenickname"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-blockchangenickname");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -1109,7 +1096,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
"JID to the departing occupant's full JIDs, including a status code of \"110\" to indicate that this " + "JID to the departing occupant's full JIDs, including a status code of \"110\" to indicate that this " +
"notification is \"self-presence\"") "notification is \"self-presence\"")
public void mucLeaveTest() throws Exception { public void mucLeaveTest() throws Exception {
EntityBareJid mucAddress = getRandomRoom("leave"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-leave");
MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress);
try { try {

View file

@ -32,7 +32,6 @@ import java.util.stream.Collectors;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException; import org.jivesoftware.smackx.muc.MultiUserChatException.MissingMucCreationAcknowledgeException;
import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException; import org.jivesoftware.smackx.muc.MultiUserChatException.MucAlreadyJoinedException;
import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException; import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceException;
@ -44,7 +43,6 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.ResultSyncPoint; import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@ -72,7 +70,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.6) The service MUST then send updated presence from this " + "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...") "individual to all occupants, indicating the addition of moderator status...")
public void mucRoleTestForReceivingModerator() throws Exception { public void mucRoleTestForReceivingModerator() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -111,7 +109,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.6) The service MUST then send updated presence from this " + "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...") "individual to all occupants, indicating the addition of moderator status...")
public void mucRoleTestForWitnessingModerator() throws Exception { public void mucRoleTestForWitnessingModerator() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -152,7 +150,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.7) The service MUST then send updated presence from this " + "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...") "individual to all occupants, indicating the removal of moderator status...")
public void mucRoleTestForRemovingModerator() throws Exception { public void mucRoleTestForRemovingModerator() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -190,7 +188,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 9.7) The service MUST then send updated presence from this " + "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...") "individual to all occupants, indicating the removal of moderator status...")
public void mucRoleTestForWitnessingModeratorRemoval() throws Exception { public void mucRoleTestForWitnessingModeratorRemoval() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -230,7 +228,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 8.4) The service MUST then send updated presence from " + "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...") "this individual to all occupants, indicating the removal of voice privileges...")
public void mucRoleTestForRevokingVoice() throws Exception { public void mucRoleTestForRevokingVoice() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -265,7 +263,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate the change to all occupants [...] (§ 8.4) The service MUST then send updated presence from " + "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...") "this individual to all occupants, indicating the removal of voice privileges...")
public void mucRoleTestForWitnessingRevokingVoice() throws Exception { public void mucRoleTestForWitnessingRevokingVoice() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -304,7 +302,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate that to all occupants [...] (§ 10.6) If the user is in the room, the service MUST then send " + "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...") "updated presence from this individual to all occupants, indicating the granting of admin status...")
public void mucAffiliationTestForReceivingAdmin() throws Exception { public void mucAffiliationTestForReceivingAdmin() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -343,7 +341,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"communicate that to all occupants [...] (§ 10.6) If the user is in the room, the service MUST then send " + "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...") "updated presence from this individual to all occupants, indicating the granting of admin status...")
public void mucAffiliationTestForWitnessingAdmin() throws Exception { public void mucAffiliationTestForWitnessingAdmin() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -383,7 +381,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"updated presence from this individual to all occupants, indicating the loss of admin status by sending a " + "updated presence from this individual to all occupants, indicating the loss of admin status by sending a " +
"presence element...") "presence element...")
public void mucAffiliationTestForRemovingAdmin() throws Exception { public void mucAffiliationTestForRemovingAdmin() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -433,7 +431,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"updated presence from this individual to all occupants, indicating the loss of admin status by sending a " + "updated presence from this individual to all occupants, indicating the loss of admin status by sending a " +
"presence element...") "presence element...")
public void mucAffiliationTestForWitnessingAdminRemoval() throws Exception { public void mucAffiliationTestForWitnessingAdminRemoval() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -475,7 +473,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"presence information, optionally along with the reason (if provided) and the roomnick or bare JID of the " + "presence information, optionally along with the reason (if provided) and the roomnick or bare JID of the " +
"user who initiated the kick.") "user who initiated the kick.")
public void mucPresenceTestForGettingKicked() throws Exception { public void mucPresenceTestForGettingKicked() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -519,7 +517,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"(<room@service/nick>) to all the remaining occupants (just as it does when occupants exit the room of their " + "(<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.") "own volition), including the status code and optionally the reason and actor.")
public void mucPresenceTestForWitnessingKick() throws Exception { public void mucPresenceTestForWitnessingKick() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -566,7 +564,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"affected by happenings in the room...Affiliations are granted, revoked, and maintained based on the user's " + "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.") "bare JID, not the nick as with roles.")
public void mucTestPersistentAffiliation() throws Exception { public void mucTestPersistentAffiliation() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -607,7 +605,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"moderator attempts to revoke voice privileges from such a user, the service MUST deny the request and return " + "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)") "a <not-allowed/> error to the sender along with the offending item(s)")
public void mucTestModeratorCannotRevokeVoiceFromOwner() throws Exception { public void mucTestModeratorCannotRevokeVoiceFromOwner() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -639,7 +637,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
"than themselves (i.e., an unaffiliated moderator SHOULD NOT be allowed to revoke moderation privileges from " + "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)") "an admin or an owner, and an admin SHOULD NOT be allowed to revoke moderation privileges from an owner)")
public void mucTestModeratorCannotBeRevokedFromHigherAffiliation() throws Exception { public void mucTestModeratorCannotBeRevokedFromHigherAffiliation() throws Exception {
EntityBareJid mucAddress = getRandomRoom("inttest"); EntityBareJid mucAddress = getRandomRoom("smack-inttest");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -685,7 +683,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote = @SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...") "...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInUnmoderatedRoom() throws Exception { public void mucTestDefaultRoleForAffiliationInUnmoderatedRoom() throws Exception {
EntityBareJid mucAddress = getRandomRoom("unmoderatedroles"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-unmoderatedroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -738,7 +736,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote = @SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...") "...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInModeratedRoom() throws Exception { public void mucTestDefaultRoleForAffiliationInModeratedRoom() throws Exception {
EntityBareJid mucAddress = getRandomRoom("moderatedroles"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-moderatedroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);
@ -801,7 +799,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
@SmackIntegrationTest(section = "5.1.2", quote = @SmackIntegrationTest(section = "5.1.2", quote =
"...the initial default roles that a service SHOULD set based on the user's affiliation...") "...the initial default roles that a service SHOULD set based on the user's affiliation...")
public void mucTestDefaultRoleForAffiliationInMembersOnlyRoom() throws Exception { public void mucTestDefaultRoleForAffiliationInMembersOnlyRoom() throws Exception {
EntityBareJid mucAddress = getRandomRoom("membersonlyroles"); EntityBareJid mucAddress = getRandomRoom("smack-inttest-membersonlyroles");
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress); MultiUserChat mucAsSeenByTwo = mucManagerTwo.getMultiUserChat(mucAddress);

View file

@ -24,7 +24,6 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
@ -49,7 +48,7 @@ public class ParticipantStatusIntegrationTest extends AbstractMultiUserChatInteg
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an <x/> element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an <item/> child with the 'affiliation' attribute set to a value of \"none\".") @SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an <x/> element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an <item/> child with the 'affiliation' attribute set to a value of \"none\".")
public void testMembershipRevokedInOpenRoom() throws Exception { public void testMembershipRevokedInOpenRoom() throws Exception {
// Setup test fixture. // Setup test fixture.
final EntityBareJid mucAddress = getRandomRoom("participantstatus-membership-revoked-open"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-participantstatus-membership-revoked-open");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
@ -90,7 +89,7 @@ public class ParticipantStatusIntegrationTest extends AbstractMultiUserChatInteg
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants") @SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants")
public void testMembershipRevokedInMemberOnlyRoom() throws Exception { public void testMembershipRevokedInMemberOnlyRoom() throws Exception {
// Setup test fixture. // Setup test fixture.
final EntityBareJid mucAddress = getRandomRoom("participantstatus-membership-revoked-membersonly"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-participantstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);

View file

@ -19,7 +19,6 @@ package org.jivesoftware.smackx.muc;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smackx.muc.packet.MUCUser; import org.jivesoftware.smackx.muc.packet.MUCUser;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
@ -27,7 +26,6 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.EntityFullJid; import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.impl.JidCreate;
@ -52,7 +50,7 @@ public class UserStatusIntegrationTest extends AbstractMultiUserChatIntegrationT
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an <x/> element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an <item/> child with the 'affiliation' attribute set to a value of \"none\".") @SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] The service MUST then send updated presence from this individual to all occupants, indicating the loss of membership by sending a presence element that contains an <x/> element qualified by the 'http://jabber.org/protocol/muc#user' namespace and containing an <item/> child with the 'affiliation' attribute set to a value of \"none\".")
public void testMembershipRevokedInOpenRoom() throws Exception { public void testMembershipRevokedInOpenRoom() throws Exception {
// Setup test fixture. // Setup test fixture.
final EntityBareJid mucAddress = getRandomRoom("userstatus-membership-revoked-membersonly"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-userstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);
@ -91,7 +89,7 @@ public class UserStatusIntegrationTest extends AbstractMultiUserChatIntegrationT
@SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants") @SmackIntegrationTest(section = "9.4", quote = "An admin might want to revoke a user's membership [...] If the room is members-only, the service MUST remove the user from the room, including a status code of 321 to indicate that the user was removed because of an affiliation change, and inform all remaining occupants")
public void testMembershipRevokedInMemberOnlyRoom() throws Exception { public void testMembershipRevokedInMemberOnlyRoom() throws Exception {
// Setup test fixture. // Setup test fixture.
final EntityBareJid mucAddress = getRandomRoom("userstatus-membership-revoked-membersonly"); final EntityBareJid mucAddress = getRandomRoom("smack-inttest-userstatus-membership-revoked-membersonly");
final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByOwner = mucManagerOne.getMultiUserChat(mucAddress);
final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress); final MultiUserChat mucAsSeenByTarget = mucManagerTwo.getMultiUserChat(mucAddress);

View file

@ -26,7 +26,6 @@ import org.jivesoftware.smackx.pep.PepManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest; import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.jxmpp.jid.BareJid; import org.jxmpp.jid.BareJid;
public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegrationTest { public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegrationTest {

View file

@ -31,7 +31,6 @@ import java.security.NoSuchProviderException;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider; import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
import org.jivesoftware.smackx.ox.exception.InvalidBackupCodeException; import org.jivesoftware.smackx.ox.exception.InvalidBackupCodeException;
import org.jivesoftware.smackx.ox.exception.MissingOpenPgpKeyException; import org.jivesoftware.smackx.ox.exception.MissingOpenPgpKeyException;
@ -42,16 +41,15 @@ import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil; import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
import org.jivesoftware.smackx.pubsub.PubSubException; import org.jivesoftware.smackx.pubsub.PubSubException;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.AfterClass; import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector; import org.pgpainless.key.protection.UnprotectedKeysProtector;

View file

@ -42,7 +42,6 @@ import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.pgpainless.decryption_verification.OpenPgpMetadata; import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.key.OpenPgpV4Fingerprint; import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.protection.UnprotectedKeysProtector; import org.pgpainless.key.protection.UnprotectedKeysProtector;

View file

@ -36,7 +36,6 @@ import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment; import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.jxmpp.jid.Jid; import org.jxmpp.jid.Jid;
@SpecificationReference(document = "XEP-0199", version = "2.0.1") @SpecificationReference(document = "XEP-0199", version = "2.0.1")

View file

@ -35,7 +35,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException; import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.jxmpp.jid.DomainBareJid; import org.jxmpp.jid.DomainBareJid;
@SpecificationReference(document = "XEP-0060", version = "1.26.0") @SpecificationReference(document = "XEP-0060", version = "1.26.0")

View file

@ -25,7 +25,6 @@ import java.net.URISyntaxException;
import org.jivesoftware.smack.parsing.SmackParsingException; import org.jivesoftware.smack.parsing.SmackParsingException;
import org.jivesoftware.smack.util.Async.ThrowingRunnable; import org.jivesoftware.smack.util.Async.ThrowingRunnable;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.mediaelement.element.MediaElement; import org.jivesoftware.smackx.mediaelement.element.MediaElement;
import org.jivesoftware.smackx.softwareinfo.SoftwareInfoManager; import org.jivesoftware.smackx.softwareinfo.SoftwareInfoManager;
import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm; import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;

View file

@ -34,7 +34,6 @@ import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.annotations.SpecificationReference; import org.igniterealtime.smack.inttest.annotations.SpecificationReference;
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil; import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint; import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@SpecificationReference(document = "XEP-0118", version = "1.3.0") @SpecificationReference(document = "XEP-0118", version = "1.3.0")

View file

@ -30,26 +30,26 @@ import org.junit.jupiter.api.Test;
public class SmackIntegrationTestFrameWorkTest { public class SmackIntegrationTestFrameWorkTest {
private static final class ValidLowLevelList { private static class ValidLowLevelList {
@SuppressWarnings({"unused", "MethodCanBeStatic"}) @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List<AbstractXMPPConnection> connections) { public void test(List<AbstractXMPPConnection> connections) {
} }
} }
private static final class InvalidLowLevelList { private static class InvalidLowLevelList {
@SuppressWarnings({"unused", "MethodCanBeStatic"}) @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(List<AbstractXMPPConnection> connections, boolean invalid) { public void test(List<AbstractXMPPConnection> connections, boolean invalid) {
} }
} }
private static final class ValidLowLevelVarargs { private static class ValidLowLevelVarargs {
@SuppressWarnings({"unused", "MethodCanBeStatic"}) @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo, public void test(AbstractXMPPConnection connectionOne, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) { AbstractXMPPConnection connectionThree) {
} }
} }
private static final class InvalidLowLevelVarargs { private static class InvalidLowLevelVarargs {
@SuppressWarnings({"unused", "MethodCanBeStatic"}) @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo, public void test(AbstractXMPPConnection connectionOne, Integer invalid, AbstractXMPPConnection connectionTwo,
AbstractXMPPConnection connectionThree) { AbstractXMPPConnection connectionThree) {
@ -96,7 +96,7 @@ public class SmackIntegrationTestFrameWorkTest {
assertNull(determinedParameterType); assertNull(determinedParameterType);
} }
private static final class ValidUnconnectedConnectionSource { private static class ValidUnconnectedConnectionSource {
@SuppressWarnings({"unused", "MethodCanBeStatic"}) @SuppressWarnings({"unused", "MethodCanBeStatic"})
public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) { public void test(AbstractSmackLowLevelIntegrationTest.UnconnectedConnectionSource source) {
} }

View file

@ -44,7 +44,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunRes
import org.igniterealtime.smack.inttest.annotations.AfterClass; import org.igniterealtime.smack.inttest.annotations.AfterClass;
import org.igniterealtime.smack.inttest.annotations.BeforeClass; import org.igniterealtime.smack.inttest.annotations.BeforeClass;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest; import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View file

@ -97,7 +97,7 @@ public class MultiResultSyncPointTest {
} }
} }
private static final class TestException extends Exception { private static class TestException extends Exception {
/** /**
* *

View file

@ -73,7 +73,7 @@ public class ResultSyncPointTest {
} }
} }
private static final class TestException extends Exception { private static class TestException extends Exception {
/** /**
* *

View file

@ -16,7 +16,8 @@ dependencies {
api project(':smack-openpgp') api project(':smack-openpgp')
api project(':smack-resolver-minidns') api project(':smack-resolver-minidns')
api project(':smack-resolver-minidns-dox') api project(':smack-resolver-minidns-dox')
api project(':smack-websocket-java11') // TODO: Change this to smack-websocket-java11 once it arrives.
api project(':smack-websocket-okhttp')
api project(':smack-tcp') api project(':smack-tcp')
testImplementation(testFixtures(project(":smack-core"))) testImplementation(testFixtures(project(":smack-core")))
@ -49,7 +50,7 @@ task convertModularXmppClientToServerConnectionStateGraphDotToPng(type: Exec) {
} }
copyJavadocDocFiles.dependsOn convertModularXmppClientToServerConnectionStateGraphDotToPng copyJavadocDocFiles.dependsOn convertModularXmppClientToServerConnectionStateGraphDotToPng
task cleanGeneratedFiles(type: Delete) { task cleanGenerateFiles(type: Delete) {
delete 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.dot', 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.png' delete 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.dot', 'src/javadoc/org/jivesoftware/smack/full/doc-files/ModularXmppClientToServerConnectionStateGraph.png'
} }
clean.dependsOn cleanGeneratedFiles clean.dependsOn cleanGenerateFiles

View file

@ -221,7 +221,7 @@ public class XmppHostnameVerifier implements HostnameVerifier {
afterWildcard = afterWildcard.substring(wildcardIndex + 1); afterWildcard = afterWildcard.substring(wildcardIndex + 1);
int beforeStartIndex = name.indexOf(beforeWildcard); int beforeStartIndex = name.indexOf(beforeWildcard);
if (beforeStartIndex == -1 || (isBeginning && beforeStartIndex != 0)) { if ((beforeStartIndex == -1) || (isBeginning && beforeStartIndex != 0)) {
return false; return false;
} }
isBeginning = false; isBeginning = false;

View file

@ -20,7 +20,6 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.jingleold.JingleSession; import org.jivesoftware.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.media.PayloadType; import org.jivesoftware.smackx.jingleold.media.PayloadType;
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate; import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;

View file

@ -20,7 +20,6 @@ import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate; import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
/** /**

View file

@ -21,7 +21,6 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.jingleold.JingleSession; import org.jivesoftware.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener; import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener; import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;

View file

@ -25,7 +25,6 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smackx.jingleold.JingleSession; import org.jivesoftware.smackx.jingleold.JingleSession;
import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener; import org.jivesoftware.smackx.jingleold.listeners.CreatedJingleSessionListener;
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener; import org.jivesoftware.smackx.jingleold.listeners.JingleSessionListener;

View file

@ -301,7 +301,7 @@ public class AgentRoster {
/** /**
* Listens for all presence packets and processes them. * Listens for all presence packets and processes them.
*/ */
private final class PresencePacketListener implements StanzaListener { private class PresencePacketListener implements StanzaListener {
@Override @Override
public void processStanza(Stanza packet) { public void processStanza(Stanza packet) {
Presence presence = (Presence) packet; Presence presence = (Presence) packet;
@ -376,7 +376,7 @@ public class AgentRoster {
/** /**
* Listens for all roster packets and processes them. * Listens for all roster packets and processes them.
*/ */
private final class AgentStatusListener implements StanzaListener { private class AgentStatusListener implements StanzaListener {
@Override @Override
public void processStanza(Stanza packet) { public void processStanza(Stanza packet) {

View file

@ -39,9 +39,8 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException; import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
import org.jivesoftware.smackx.omemo.signal.SignalOmemoService; import org.jivesoftware.smackx.omemo.signal.SignalOmemoService;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework;
public class SmackOmemoSignalIntegrationTestFramework { public class SmackOmemoSignalIntegrationTestFramework {

View file

@ -20,17 +20,11 @@
*/ */
package org.jivesoftware.smackx.omemo.signal; package org.jivesoftware.smackx.omemo.signal;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import org.jivesoftware.smackx.omemo.element.OmemoBundleElement; import org.jivesoftware.smackx.omemo.element.OmemoBundleElement;
import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException; import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException;
import org.jivesoftware.smackx.omemo.internal.OmemoDevice; import org.jivesoftware.smackx.omemo.internal.OmemoDevice;
import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint; import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint;
import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil; import org.jivesoftware.smackx.omemo.util.OmemoKeyUtil;
import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.IdentityKeyPair; import org.signal.libsignal.protocol.IdentityKeyPair;
import org.signal.libsignal.protocol.InvalidKeyException; import org.signal.libsignal.protocol.InvalidKeyException;
@ -44,6 +38,11 @@ import org.signal.libsignal.protocol.state.SessionRecord;
import org.signal.libsignal.protocol.state.SignedPreKeyRecord; import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
import org.signal.libsignal.protocol.util.Medium; import org.signal.libsignal.protocol.util.Medium;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
/** /**
* Concrete implementation of the KeyUtil for an implementation using the Signal library. * Concrete implementation of the KeyUtil for an implementation using the Signal library.
* *
@ -73,8 +72,8 @@ public class SignalOmemoKeyUtil extends OmemoKeyUtil<IdentityKeyPair, IdentityKe
start--; start--;
for (int i = 0; i < count; i++) { for (int i=0;i<count;i++) {
int pkIdx = ((start + i) % (Medium.MAX_VALUE - 1)) + 1; int pkIdx = ((start + i) % (Medium.MAX_VALUE-1)) + 1;
results.add(new PreKeyRecord(pkIdx, Curve.generateKeyPair())); results.add(new PreKeyRecord(pkIdx, Curve.generateKeyPair()));
} }

View file

@ -468,7 +468,7 @@ public class CachingOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Se
* @param <T_SigPreKey> type of the public signed preKey * @param <T_SigPreKey> type of the public signed preKey
* @param <T_Sess> type of the OMEMO session * @param <T_Sess> type of the OMEMO session
*/ */
private static final class KeyCache<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess> { private static class KeyCache<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess> {
private T_IdKeyPair identityKeyPair; private T_IdKeyPair identityKeyPair;
private final TreeMap<Integer, T_PreKey> preKeys = new TreeMap<>(); private final TreeMap<Integer, T_PreKey> preKeys = new TreeMap<>();
private final TreeMap<Integer, T_SigPreKey> signedPreKeys = new TreeMap<>(); private final TreeMap<Integer, T_SigPreKey> signedPreKeys = new TreeMap<>();

Some files were not shown because too many files have changed in this diff Show more