mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-24 15:22:07 +01:00
Fix minor codestyle issues
This commit is contained in:
parent
200f90ffdc
commit
cb18056613
422 changed files with 1404 additions and 1444 deletions
|
@ -341,7 +341,7 @@ public abstract class ConnectionConfiguration {
|
||||||
* An enumeration for TLS security modes that are available when making a connection
|
* An enumeration for TLS security modes that are available when making a connection
|
||||||
* to the XMPP server.
|
* to the XMPP server.
|
||||||
*/
|
*/
|
||||||
public static enum SecurityMode {
|
public enum SecurityMode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security via TLS encryption is required in order to connect. If the server
|
* Security via TLS encryption is required in order to connect. If the server
|
||||||
|
@ -492,7 +492,7 @@ public abstract class ConnectionConfiguration {
|
||||||
* <p>
|
* <p>
|
||||||
* This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of
|
* This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of
|
||||||
* the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build
|
* the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build
|
||||||
* instructions from the superclasses followed by build instructions of a sublcass would not be possible, because
|
* instructions from the superclasses followed by build instructions of a subclass would not be possible, because
|
||||||
* the superclass build instructions would return the builder of the superclass and not the one of the subclass. You
|
* the superclass build instructions would return the builder of the superclass and not the one of the subclass. You
|
||||||
* can read more about it a Angelika Langer's Generics FAQ, especially the entry <a
|
* can read more about it a Angelika Langer's Generics FAQ, especially the entry <a
|
||||||
* href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206">What is the
|
* href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206">What is the
|
||||||
|
@ -646,7 +646,7 @@ public abstract class ConnectionConfiguration {
|
||||||
public B setPort(int port) {
|
public B setPort(int port) {
|
||||||
if (port < 0 || port > 65535) {
|
if (port < 0 || port > 65535) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Port must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + port);
|
"Port must be a 16-bit unsigned integer (i.e. between 0-65535. Port was: " + port);
|
||||||
}
|
}
|
||||||
this.port = port;
|
this.port = port;
|
||||||
return getThis();
|
return getThis();
|
||||||
|
@ -930,7 +930,7 @@ public abstract class ConnectionConfiguration {
|
||||||
Set<String> blacklistedMechanisms = SASLAuthentication.getBlacklistedSASLMechanisms();
|
Set<String> blacklistedMechanisms = SASLAuthentication.getBlacklistedSASLMechanisms();
|
||||||
for (String mechanism : saslMechanisms) {
|
for (String mechanism : saslMechanisms) {
|
||||||
if (!SASLAuthentication.isSaslMechanismRegistered(mechanism)) {
|
if (!SASLAuthentication.isSaslMechanismRegistered(mechanism)) {
|
||||||
throw new IllegalArgumentException("SASL " + mechanism + " is not avaiable. Consider registering it with Smack");
|
throw new IllegalArgumentException("SASL " + mechanism + " is not available. Consider registering it with Smack");
|
||||||
}
|
}
|
||||||
if (blacklistedMechanisms.contains(mechanism)) {
|
if (blacklistedMechanisms.contains(mechanism)) {
|
||||||
throw new IllegalArgumentException("SALS " + mechanism + " is blacklisted.");
|
throw new IllegalArgumentException("SALS " + mechanism + " is blacklisted.");
|
||||||
|
|
|
@ -33,6 +33,6 @@ public interface ConnectionCreationListener {
|
||||||
*
|
*
|
||||||
* @param connection the newly created connection.
|
* @param connection the newly created connection.
|
||||||
*/
|
*/
|
||||||
public void connectionCreated(XMPPConnection connection);
|
void connectionCreated(XMPPConnection connection);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public interface ConnectionListener {
|
||||||
*
|
*
|
||||||
* @param connection the XMPPConnection which successfully connected to its endpoint.
|
* @param connection the XMPPConnection which successfully connected to its endpoint.
|
||||||
*/
|
*/
|
||||||
public void connected(XMPPConnection connection);
|
void connected(XMPPConnection connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the connection has been authenticated.
|
* Notification that the connection has been authenticated.
|
||||||
|
@ -45,12 +45,12 @@ public interface ConnectionListener {
|
||||||
* @param connection the XMPPConnection which successfully authenticated.
|
* @param connection the XMPPConnection which successfully authenticated.
|
||||||
* @param resumed true if a previous XMPP session's stream was resumed.
|
* @param resumed true if a previous XMPP session's stream was resumed.
|
||||||
*/
|
*/
|
||||||
public void authenticated(XMPPConnection connection, boolean resumed);
|
void authenticated(XMPPConnection connection, boolean resumed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the connection was closed normally.
|
* Notification that the connection was closed normally.
|
||||||
*/
|
*/
|
||||||
public void connectionClosed();
|
void connectionClosed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the connection was closed due to an exception. When
|
* Notification that the connection was closed due to an exception. When
|
||||||
|
@ -59,7 +59,7 @@ public interface ConnectionListener {
|
||||||
*
|
*
|
||||||
* @param e the exception.
|
* @param e the exception.
|
||||||
*/
|
*/
|
||||||
public void connectionClosedOnError(Exception e);
|
void connectionClosedOnError(Exception e);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The connection has reconnected successfully to the server. Connections will
|
* The connection has reconnected successfully to the server. Connections will
|
||||||
|
@ -68,7 +68,7 @@ public interface ConnectionListener {
|
||||||
*/
|
*/
|
||||||
// TODO: Remove in Smack 4.3
|
// TODO: Remove in Smack 4.3
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void reconnectionSuccessful();
|
void reconnectionSuccessful();
|
||||||
|
|
||||||
// The next two methods *must* only be invoked by ReconnectionManager
|
// The next two methods *must* only be invoked by ReconnectionManager
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public interface ConnectionListener {
|
||||||
*/
|
*/
|
||||||
// TODO: Remove in Smack 4.3
|
// TODO: Remove in Smack 4.3
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void reconnectingIn(int seconds);
|
void reconnectingIn(int seconds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
|
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
|
||||||
|
@ -97,5 +97,5 @@ public interface ConnectionListener {
|
||||||
*/
|
*/
|
||||||
// TODO: Remove in Smack 4.3
|
// TODO: Remove in Smack 4.3
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void reconnectionFailed(Exception e);
|
void reconnectionFailed(Exception e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ package org.jivesoftware.smack;
|
||||||
|
|
||||||
public interface ExceptionCallback {
|
public interface ExceptionCallback {
|
||||||
|
|
||||||
public void processException(Exception exception);
|
void processException(Exception exception);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class Manager {
|
||||||
public Manager(XMPPConnection connection) {
|
public Manager(XMPPConnection connection) {
|
||||||
Objects.requireNonNull(connection, "XMPPConnection must not be null");
|
Objects.requireNonNull(connection, "XMPPConnection must not be null");
|
||||||
|
|
||||||
weakConnection = new WeakReference<XMPPConnection>(connection);
|
weakConnection = new WeakReference<>(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final XMPPConnection connection() {
|
protected final XMPPConnection connection() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public interface ReconnectionListener {
|
||||||
*
|
*
|
||||||
* @param seconds remaining seconds before attempting a reconnection.
|
* @param seconds remaining seconds before attempting a reconnection.
|
||||||
*/
|
*/
|
||||||
public void reconnectingIn(int seconds);
|
void reconnectingIn(int seconds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
|
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
|
||||||
|
@ -46,5 +46,5 @@ public interface ReconnectionListener {
|
||||||
*
|
*
|
||||||
* @param e the exception that caused the reconnection to fail.
|
* @param e the exception that caused the reconnection to fail.
|
||||||
*/
|
*/
|
||||||
public void reconnectionFailed(Exception e);
|
void reconnectionFailed(Exception e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ public final class ReconnectionManager {
|
||||||
private Thread reconnectionThread;
|
private Thread reconnectionThread;
|
||||||
|
|
||||||
private ReconnectionManager(AbstractXMPPConnection connection) {
|
private ReconnectionManager(AbstractXMPPConnection connection) {
|
||||||
weakRefConnection = new WeakReference<AbstractXMPPConnection>(connection);
|
weakRefConnection = new WeakReference<>(connection);
|
||||||
|
|
||||||
reconnectionRunnable = new Runnable() {
|
reconnectionRunnable = new Runnable() {
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@ public final class SASLAuthentication {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(SASLAuthentication.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SASLAuthentication.class.getName());
|
||||||
|
|
||||||
private static final List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<SASLMechanism>();
|
private static final List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<>();
|
||||||
|
|
||||||
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<String>();
|
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Blacklist SCRAM-SHA-1-PLUS for now.
|
// Blacklist SCRAM-SHA-1-PLUS for now.
|
||||||
|
@ -91,7 +91,7 @@ public final class SASLAuthentication {
|
||||||
* @return the registered SASLMechanism sorted by the level of preference.
|
* @return the registered SASLMechanism sorted by the level of preference.
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> getRegisterdSASLMechanisms() {
|
public static Map<String, String> getRegisterdSASLMechanisms() {
|
||||||
Map<String, String> answer = new LinkedHashMap<String, String>();
|
Map<String, String> answer = new LinkedHashMap<>();
|
||||||
synchronized (REGISTERED_MECHANISMS) {
|
synchronized (REGISTERED_MECHANISMS) {
|
||||||
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
|
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
|
||||||
answer.put(mechanism.getClass().getName(), mechanism.toString());
|
answer.put(mechanism.getClass().getName(), mechanism.toString());
|
||||||
|
@ -132,9 +132,9 @@ public final class SASLAuthentication {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean blacklistSASLMechanism(String mechansim) {
|
public static boolean blacklistSASLMechanism(String mechanism) {
|
||||||
synchronized (BLACKLISTED_MECHANISMS) {
|
synchronized (BLACKLISTED_MECHANISMS) {
|
||||||
return BLACKLISTED_MECHANISMS.add(mechansim);
|
return BLACKLISTED_MECHANISMS.add(mechanism);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,8 +356,8 @@ public final class SASLAuthentication {
|
||||||
throw new SmackException(
|
throw new SmackException(
|
||||||
"No supported and enabled SASL Mechanism provided by server. " +
|
"No supported and enabled SASL Mechanism provided by server. " +
|
||||||
"Server announced mechanisms: " + serverMechanisms + ". " +
|
"Server announced mechanisms: " + serverMechanisms + ". " +
|
||||||
"Registerd SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " +
|
"Registered SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " +
|
||||||
"Enabled SASL mechansisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " +
|
"Enabled SASL mechanisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " +
|
||||||
"Blacklisted SASL mechanisms: " + BLACKLISTED_MECHANISMS + '.'
|
"Blacklisted SASL mechanisms: " + BLACKLISTED_MECHANISMS + '.'
|
||||||
);
|
);
|
||||||
// @formatter;on
|
// @formatter;on
|
||||||
|
|
|
@ -55,11 +55,11 @@ public final class SmackConfiguration {
|
||||||
private static int defaultPacketReplyTimeout = 5000;
|
private static int defaultPacketReplyTimeout = 5000;
|
||||||
private static int packetCollectorSize = 5000;
|
private static int packetCollectorSize = 5000;
|
||||||
|
|
||||||
private static List<String> defaultMechs = new ArrayList<String>();
|
private static List<String> defaultMechs = new ArrayList<>();
|
||||||
|
|
||||||
static Set<String> disabledSmackClasses = new HashSet<String>();
|
static Set<String> disabledSmackClasses = new HashSet<>();
|
||||||
|
|
||||||
final static List<XMPPInputOutputStream> compressionHandlers = new ArrayList<XMPPInputOutputStream>(2);
|
final static List<XMPPInputOutputStream> compressionHandlers = new ArrayList<>(2);
|
||||||
|
|
||||||
static boolean smackInitialized = false;
|
static boolean smackInitialized = false;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public final class SmackConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value that indicates whether debugging is enabled. When enabled, a debug
|
* Value that indicates whether debugging is enabled. When enabled, a debug
|
||||||
* window will apear for each new connection that will contain the following
|
* window will appear for each new connection that will contain the following
|
||||||
* information:<ul>
|
* information:<ul>
|
||||||
* <li> Client Traffic -- raw XML traffic generated by Smack and sent to the server.
|
* <li> Client Traffic -- raw XML traffic generated by Smack and sent to the server.
|
||||||
* <li> Server Traffic -- raw XML traffic sent by the server to the client.
|
* <li> Server Traffic -- raw XML traffic sent by the server to the client.
|
||||||
|
@ -280,8 +280,8 @@ public final class SmackConfiguration {
|
||||||
compressionHandlers.add(xmppInputOutputStream);
|
compressionHandlers.add(xmppInputOutputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<XMPPInputOutputStream> getCompresionHandlers() {
|
public static List<XMPPInputOutputStream> getCompressionHandlers() {
|
||||||
List<XMPPInputOutputStream> res = new ArrayList<XMPPInputOutputStream>(compressionHandlers.size());
|
List<XMPPInputOutputStream> res = new ArrayList<>(compressionHandlers.size());
|
||||||
for (XMPPInputOutputStream ios : compressionHandlers) {
|
for (XMPPInputOutputStream ios : compressionHandlers) {
|
||||||
if (ios.isSupported()) {
|
if (ios.isSupported()) {
|
||||||
res.add(ios);
|
res.add(ios);
|
||||||
|
@ -293,7 +293,7 @@ public final class SmackConfiguration {
|
||||||
/**
|
/**
|
||||||
* Set the default HostnameVerifier that will be used by XMPP connections to verify the hostname
|
* Set the default HostnameVerifier that will be used by XMPP connections to verify the hostname
|
||||||
* of a TLS certificate. XMPP connections are able to overwrite this settings by supplying a
|
* of a TLS certificate. XMPP connections are able to overwrite this settings by supplying a
|
||||||
* HostnameVerifier in their ConnecitonConfiguration with
|
* HostnameVerifier in their ConnectionConfiguration with
|
||||||
* {@link ConnectionConfiguration.Builder#setHostnameVerifier(HostnameVerifier)}.
|
* {@link ConnectionConfiguration.Builder#setHostnameVerifier(HostnameVerifier)}.
|
||||||
*/
|
*/
|
||||||
public static void setDefaultHostnameVerifier(HostnameVerifier verifier) {
|
public static void setDefaultHostnameVerifier(HostnameVerifier verifier) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class SmackException extends Exception {
|
||||||
|
|
||||||
public ConnectionException(Throwable wrappedThrowable) {
|
public ConnectionException(Throwable wrappedThrowable) {
|
||||||
super(wrappedThrowable);
|
super(wrappedThrowable);
|
||||||
failedAddresses = new ArrayList<HostAddress>(0);
|
failedAddresses = new ArrayList<>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConnectionException(String message, List<HostAddress> failedAddresses) {
|
private ConnectionException(String message, List<HostAddress> failedAddresses) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ import org.jivesoftware.smack.util.FileUtils;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
import org.xmlpull.v1.XmlPullParserFactory;
|
import org.xmlpull.v1.XmlPullParserFactory;
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public final class SmackInitialization {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
|
LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
|
||||||
smackVersion = "unkown";
|
smackVersion = "unknown";
|
||||||
}
|
}
|
||||||
SMACK_VERSION = smackVersion;
|
SMACK_VERSION = smackVersion;
|
||||||
|
|
||||||
|
@ -182,7 +181,7 @@ public final class SmackInitialization {
|
||||||
|
|
||||||
private static void parseClassesToLoad(XmlPullParser parser, boolean optional,
|
private static void parseClassesToLoad(XmlPullParser parser, boolean optional,
|
||||||
Collection<Exception> exceptions, ClassLoader classLoader)
|
Collection<Exception> exceptions, ClassLoader classLoader)
|
||||||
throws XmlPullParserException, IOException, Exception {
|
throws Exception {
|
||||||
final String startName = parser.getName();
|
final String startName = parser.getName();
|
||||||
int eventType;
|
int eventType;
|
||||||
String name;
|
String name;
|
||||||
|
|
|
@ -288,7 +288,7 @@ public class StanzaCollector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void throwIfCancelled() {
|
private void throwIfCancelled() {
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
throw new IllegalStateException("Packet collector already cancelled");
|
throw new IllegalStateException("Packet collector already cancelled");
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,6 @@ public interface StanzaListener {
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
* @throws NotLoggedInException
|
* @throws NotLoggedInException
|
||||||
*/
|
*/
|
||||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
|
void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ package org.jivesoftware.smack;
|
||||||
|
|
||||||
public interface SuccessCallback<T> {
|
public interface SuccessCallback<T> {
|
||||||
|
|
||||||
public void onSuccess(T result);
|
void onSuccess(T result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class XMPPConnectionRegistry {
|
||||||
* A set of listeners which will be invoked if a new connection is created.
|
* A set of listeners which will be invoked if a new connection is created.
|
||||||
*/
|
*/
|
||||||
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
|
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
|
||||||
new CopyOnWriteArraySet<ConnectionCreationListener>();
|
new CopyOnWriteArraySet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new listener that will be notified when new Connections are created. Note
|
* Adds a new listener that will be notified when new Connections are created. Note
|
||||||
|
|
|
@ -30,10 +30,7 @@ public final class EmptyToMatcher implements StanzaFilter {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Stanza packet) {
|
public boolean accept(Stanza packet) {
|
||||||
Jid packetTo = packet.getTo();
|
Jid packetTo = packet.getTo();
|
||||||
if (packetTo == null) {
|
return packetTo == null;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,5 +54,5 @@ public interface StanzaFilter {
|
||||||
* @param stanza the stanza(/packet) to test.
|
* @param stanza the stanza(/packet) to test.
|
||||||
* @return true if and only if <tt>stanza</tt> passes the filter.
|
* @return true if and only if <tt>stanza</tt> passes the filter.
|
||||||
*/
|
*/
|
||||||
public boolean accept(Stanza stanza);
|
boolean accept(Stanza stanza);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,5 @@ import org.jivesoftware.smack.SmackConfiguration;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface SmackInitializer {
|
public interface SmackInitializer {
|
||||||
public List<Exception> initialize();
|
List<Exception> initialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.IQ;
|
||||||
*/
|
*/
|
||||||
public interface IQRequestHandler {
|
public interface IQRequestHandler {
|
||||||
|
|
||||||
public enum Mode {
|
enum Mode {
|
||||||
/**
|
/**
|
||||||
* Process requests synchronously, i.e. in the order they arrive. Uses a single thread, which means that the other
|
* Process requests synchronously, i.e. in the order they arrive. Uses a single thread, which means that the other
|
||||||
* requests have to wait until all previous synchronous requests have been handled. Use {@link #async} if
|
* requests have to wait until all previous synchronous requests have been handled. Use {@link #async} if
|
||||||
|
@ -41,13 +41,13 @@ public interface IQRequestHandler {
|
||||||
async,
|
async,
|
||||||
}
|
}
|
||||||
|
|
||||||
public IQ handleIQRequest(IQ iqRequest);
|
IQ handleIQRequest(IQ iqRequest);
|
||||||
|
|
||||||
public Mode getMode();
|
Mode getMode();
|
||||||
|
|
||||||
public IQ.Type getType();
|
IQ.Type getType();
|
||||||
|
|
||||||
public String getElement();
|
String getElement();
|
||||||
|
|
||||||
public String getNamespace();
|
String getNamespace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,5 +28,5 @@ public interface Element {
|
||||||
*
|
*
|
||||||
* @return the stanza(/packet) extension as XML.
|
* @return the stanza(/packet) extension as XML.
|
||||||
*/
|
*/
|
||||||
public CharSequence toXML();
|
CharSequence toXML();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class EmptyResultIQ extends IQ {
|
||||||
|
|
||||||
public EmptyResultIQ(IQ request) {
|
public EmptyResultIQ(IQ request) {
|
||||||
this();
|
this();
|
||||||
initialzeAsResultFor(request);
|
initializeAsResultFor(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,6 +40,6 @@ public interface ExtensionElement extends NamedElement {
|
||||||
*
|
*
|
||||||
* @return the namespace.
|
* @return the namespace.
|
||||||
*/
|
*/
|
||||||
public String getNamespace();
|
String getNamespace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ public abstract class IQ extends Stanza {
|
||||||
*/
|
*/
|
||||||
protected abstract IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml);
|
protected abstract IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml);
|
||||||
|
|
||||||
protected final void initialzeAsResultFor(IQ request) {
|
protected final void initializeAsResultFor(IQ request) {
|
||||||
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
|
||||||
|
|
|
@ -28,6 +28,6 @@ public interface NamedElement extends Element {
|
||||||
*
|
*
|
||||||
* @return the element name.
|
* @return the element name.
|
||||||
*/
|
*/
|
||||||
public String getElementName();
|
String getElementName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,15 +28,15 @@ import java.util.Set;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface Packet extends TopLevelStreamElement {
|
public interface Packet extends TopLevelStreamElement {
|
||||||
|
|
||||||
public static final String TEXT = "text";
|
String TEXT = "text";
|
||||||
public static final String ITEM = "item";
|
String ITEM = "item";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unique ID of the stanza. The returned value could be <code>null</code>.
|
* Returns the unique ID of the stanza. The returned value could be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @return the packet's unique ID or <code>null</code> if the id is not available.
|
* @return the packet's unique ID or <code>null</code> if the id is not available.
|
||||||
*/
|
*/
|
||||||
public String getStanzaId();
|
String getStanzaId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the stanza id.
|
* Get the stanza id.
|
||||||
|
@ -44,7 +44,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @deprecated use {@link #getStanzaId()} instead.
|
* @deprecated use {@link #getStanzaId()} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String getPacketID();
|
String getPacketID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the unique ID of the packet. To indicate that a stanza(/packet) has no id
|
* Sets the unique ID of the packet. To indicate that a stanza(/packet) has no id
|
||||||
|
@ -52,7 +52,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @param id the unique ID for the packet.
|
* @param id the unique ID for the packet.
|
||||||
*/
|
*/
|
||||||
public void setStanzaId(String id);
|
void setStanzaId(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the stanza ID.
|
* Set the stanza ID.
|
||||||
|
@ -60,7 +60,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @deprecated use {@link #setStanzaId(String)} instead.
|
* @deprecated use {@link #setStanzaId(String)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setPacketID(String packetID);
|
void setPacketID(String packetID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns who the stanza(/packet) is being sent "to", or <tt>null</tt> if
|
* Returns who the stanza(/packet) is being sent "to", or <tt>null</tt> if
|
||||||
|
@ -70,7 +70,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @return who the stanza(/packet) is being sent to, or <tt>null</tt> if the
|
* @return who the stanza(/packet) is being sent to, or <tt>null</tt> if the
|
||||||
* value has not been set.
|
* value has not been set.
|
||||||
*/
|
*/
|
||||||
public String getTo();
|
String getTo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets who the stanza(/packet) is being sent "to". The XMPP protocol often makes
|
* Sets who the stanza(/packet) is being sent "to". The XMPP protocol often makes
|
||||||
|
@ -78,7 +78,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @param to who the stanza(/packet) is being sent to.
|
* @param to who the stanza(/packet) is being sent to.
|
||||||
*/
|
*/
|
||||||
public void setTo(String to);
|
void setTo(String to);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns who the stanza(/packet) is being sent "from" or <tt>null</tt> if
|
* Returns who the stanza(/packet) is being sent "from" or <tt>null</tt> if
|
||||||
|
@ -88,7 +88,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @return who the stanza(/packet) is being sent from, or <tt>null</tt> if the
|
* @return who the stanza(/packet) is being sent from, or <tt>null</tt> if the
|
||||||
* value has not been set.
|
* value has not been set.
|
||||||
*/
|
*/
|
||||||
public String getFrom();
|
String getFrom();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets who the stanza(/packet) is being sent "from". The XMPP protocol often
|
* Sets who the stanza(/packet) is being sent "from". The XMPP protocol often
|
||||||
|
@ -97,7 +97,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @param from who the stanza(/packet) is being sent to.
|
* @param from who the stanza(/packet) is being sent to.
|
||||||
*/
|
*/
|
||||||
public void setFrom(String from);
|
void setFrom(String from);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the error associated with this packet, or <tt>null</tt> if there are
|
* Returns the error associated with this packet, or <tt>null</tt> if there are
|
||||||
|
@ -105,34 +105,34 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
*
|
*
|
||||||
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
|
||||||
*/
|
*/
|
||||||
public XMPPError getError();
|
XMPPError getError();
|
||||||
/**
|
/**
|
||||||
* Sets the error for this packet.
|
* Sets the error for this packet.
|
||||||
*
|
*
|
||||||
* @param error the error to associate with this packet.
|
* @param error the error to associate with this packet.
|
||||||
*/
|
*/
|
||||||
public void setError(XMPPError error);
|
void setError(XMPPError error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the xml:lang of this Stanza, or null if one has not been set.
|
* Returns the xml:lang of this Stanza, or null if one has not been set.
|
||||||
*
|
*
|
||||||
* @return the xml:lang of this Stanza, or null.
|
* @return the xml:lang of this Stanza, or null.
|
||||||
*/
|
*/
|
||||||
public String getLanguage();
|
String getLanguage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the xml:lang of this Stanza.
|
* Sets the xml:lang of this Stanza.
|
||||||
*
|
*
|
||||||
* @param language the xml:lang of this Stanza.
|
* @param language the xml:lang of this Stanza.
|
||||||
*/
|
*/
|
||||||
public void setLanguage(String language);
|
void setLanguage(String language);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of the stanza(/packet) extensions attached to the packet.
|
* Returns a copy of the stanza(/packet) extensions attached to the packet.
|
||||||
*
|
*
|
||||||
* @return the stanza(/packet) extensions.
|
* @return the stanza(/packet) extensions.
|
||||||
*/
|
*/
|
||||||
public List<ExtensionElement> getExtensions();
|
List<ExtensionElement> getExtensions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
|
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
|
||||||
|
@ -145,7 +145,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @return a set of all matching extensions.
|
* @return a set of all matching extensions.
|
||||||
* @since 4.1
|
* @since 4.1
|
||||||
*/
|
*/
|
||||||
public Set<ExtensionElement> getExtensions(String elementName, String namespace);
|
Set<ExtensionElement> getExtensions(String elementName, String namespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first extension of this stanza(/packet) that has the given namespace.
|
* Returns the first extension of this stanza(/packet) that has the given namespace.
|
||||||
|
@ -156,7 +156,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param namespace the namespace of the extension that is desired.
|
* @param namespace the namespace of the extension that is desired.
|
||||||
* @return the stanza(/packet) extension with the given namespace.
|
* @return the stanza(/packet) extension with the given namespace.
|
||||||
*/
|
*/
|
||||||
public ExtensionElement getExtension(String namespace);
|
ExtensionElement getExtension(String namespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first stanza(/packet) extension that matches the specified element name and
|
* Returns the first stanza(/packet) extension that matches the specified element name and
|
||||||
|
@ -173,20 +173,20 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param namespace the XML element namespace of the stanza(/packet) extension.
|
* @param namespace the XML element namespace of the stanza(/packet) extension.
|
||||||
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
||||||
*/
|
*/
|
||||||
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace);
|
<PE extends ExtensionElement> PE getExtension(String elementName, String namespace);
|
||||||
/**
|
/**
|
||||||
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
|
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
|
||||||
*
|
*
|
||||||
* @param extension a stanza(/packet) extension.
|
* @param extension a stanza(/packet) extension.
|
||||||
*/
|
*/
|
||||||
public void addExtension(ExtensionElement extension);
|
void addExtension(ExtensionElement extension);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
|
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
|
||||||
*
|
*
|
||||||
* @param extensions a collection of stanza(/packet) extensions
|
* @param extensions a collection of stanza(/packet) extensions
|
||||||
*/
|
*/
|
||||||
public void addExtensions(Collection<ExtensionElement> extensions);
|
void addExtensions(Collection<ExtensionElement> extensions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a stanza(/packet) extension with the given element and namespace exists.
|
* Check if a stanza(/packet) extension with the given element and namespace exists.
|
||||||
|
@ -198,7 +198,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean hasExtension(String elementName, String namespace);
|
boolean hasExtension(String elementName, String namespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a stanza(/packet) extension with the given namespace exists.
|
* Check if a stanza(/packet) extension with the given namespace exists.
|
||||||
|
@ -206,7 +206,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean hasExtension(String namespace);
|
boolean hasExtension(String namespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the stanza(/packet) extension with the given elementName and namespace.
|
* Remove the stanza(/packet) extension with the given elementName and namespace.
|
||||||
|
@ -215,7 +215,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param namespace
|
* @param namespace
|
||||||
* @return the removed stanza(/packet) extension or null.
|
* @return the removed stanza(/packet) extension or null.
|
||||||
*/
|
*/
|
||||||
public ExtensionElement removeExtension(String elementName, String namespace);
|
ExtensionElement removeExtension(String elementName, String namespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a stanza(/packet) extension from the packet.
|
* Removes a stanza(/packet) extension from the packet.
|
||||||
|
@ -223,10 +223,10 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
* @param extension the stanza(/packet) extension to remove.
|
* @param extension the stanza(/packet) extension to remove.
|
||||||
* @return the removed stanza(/packet) extension or null.
|
* @return the removed stanza(/packet) extension or null.
|
||||||
*/
|
*/
|
||||||
public ExtensionElement removeExtension(ExtensionElement extension);
|
ExtensionElement removeExtension(ExtensionElement extension);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// NOTE When Smack is using Java 8, then this method should be moved in Element as "Default Method".
|
// NOTE When Smack is using Java 8, then this method should be moved in Element as "Default Method".
|
||||||
public String toString();
|
String toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stream error packet. Stream errors are unrecoverable errors where the server
|
* Represents a stream error packet. Stream errors are unrecoverable errors where the server
|
||||||
* will close the unrelying TCP connection after the stream error was sent to the client.
|
* will close the underlying TCP connection after the stream error was sent to the client.
|
||||||
* These is the list of stream errors as defined in the XMPP spec:<p>
|
* These is the list of stream errors as defined in the XMPP spec:<p>
|
||||||
*
|
*
|
||||||
* <table border=1>
|
* <table border=1>
|
||||||
|
@ -174,7 +174,7 @@ public class StreamError extends AbstractError implements Nonza {
|
||||||
restricted_xml,
|
restricted_xml,
|
||||||
see_other_host,
|
see_other_host,
|
||||||
system_shutdown,
|
system_shutdown,
|
||||||
undeficed_condition,
|
undefined_condition,
|
||||||
unsupported_encoding,
|
unsupported_encoding,
|
||||||
unsupported_feature,
|
unsupported_feature,
|
||||||
unsupported_stanza_type,
|
unsupported_stanza_type,
|
||||||
|
|
|
@ -39,6 +39,6 @@ public interface ParsingExceptionCallback {
|
||||||
* @param stanzaData the raw stanza data that caused the exception
|
* @param stanzaData the raw stanza data that caused the exception
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void handleUnparsableStanza(UnparseableStanza stanzaData) throws Exception;
|
void handleUnparsableStanza(UnparseableStanza stanzaData) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.jxmpp.util.XmppStringUtils;
|
||||||
* <li>jabber:iq:register</ul>
|
* <li>jabber:iq:register</ul>
|
||||||
*
|
*
|
||||||
* Because many more IQ types are part of XMPP and its extensions, a pluggable IQ parsing
|
* Because many more IQ types are part of XMPP and its extensions, a pluggable IQ parsing
|
||||||
* mechanism is provided. IQ providers are registered programatically or by creating a
|
* mechanism is provided. IQ providers are registered programmatically or by creating a
|
||||||
* providers file. The file is an XML
|
* providers file. The file is an XML
|
||||||
* document that contains one or more iqProvider entries, as in the following example:
|
* document that contains one or more iqProvider entries, as in the following example:
|
||||||
*
|
*
|
||||||
|
@ -100,7 +100,7 @@ import org.jxmpp.util.XmppStringUtils;
|
||||||
* is found in a packet, parsing will be passed to the correct provider. Each provider
|
* is found in a packet, parsing will be passed to the correct provider. Each provider
|
||||||
* can either implement the PacketExtensionProvider interface or be a standard Java Bean. In
|
* can either implement the PacketExtensionProvider interface or be a standard Java Bean. In
|
||||||
* the former case, each extension provider is responsible for parsing the raw XML stream to
|
* the former case, each extension provider is responsible for parsing the raw XML stream to
|
||||||
* contruct an object. In the latter case, bean introspection is used to try to automatically
|
* construct an object. In the latter case, bean introspection is used to try to automatically
|
||||||
* set the properties of th class using the values in the stanza(/packet) extension sub-element. When an
|
* set the properties of th class using the values in the stanza(/packet) extension sub-element. When an
|
||||||
* extension provider is not registered for an element name and namespace combination, Smack will
|
* extension provider is not registered for an element name and namespace combination, Smack will
|
||||||
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
|
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
|
||||||
|
@ -207,7 +207,7 @@ public final class ProviderManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an IQ provider with the specified element name and namespace. This
|
* Removes an IQ provider with the specified element name and namespace. This
|
||||||
* method is typically called to cleanup providers that are programatically added
|
* method is typically called to cleanup providers that are programmatically added
|
||||||
* using the {@link #addIQProvider(String, String, Object) addIQProvider} method.
|
* using the {@link #addIQProvider(String, String, Object) addIQProvider} method.
|
||||||
*
|
*
|
||||||
* @param elementName the XML element name.
|
* @param elementName the XML element name.
|
||||||
|
@ -237,7 +237,7 @@ public final class ProviderManager {
|
||||||
*
|
*
|
||||||
* @param elementName element name associated with extension provider.
|
* @param elementName element name associated with extension provider.
|
||||||
* @param namespace namespace associated with extension provider.
|
* @param namespace namespace associated with extension provider.
|
||||||
* @return the extenion provider.
|
* @return the extension provider.
|
||||||
*/
|
*/
|
||||||
public static ExtensionElementProvider<ExtensionElement> getExtensionProvider(String elementName, String namespace) {
|
public static ExtensionElementProvider<ExtensionElement> getExtensionProvider(String elementName, String namespace) {
|
||||||
String key = getKey(elementName, namespace);
|
String key = getKey(elementName, namespace);
|
||||||
|
@ -269,7 +269,7 @@ public final class ProviderManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an extension provider with the specified element name and namespace. This
|
* Removes an extension provider with the specified element name and namespace. This
|
||||||
* method is typically called to cleanup providers that are programatically added
|
* method is typically called to cleanup providers that are programmatically added
|
||||||
* using the {@link #addExtensionProvider(String, String, Object) addExtensionProvider} method.
|
* using the {@link #addExtensionProvider(String, String, Object) addExtensionProvider} method.
|
||||||
*
|
*
|
||||||
* @param elementName the XML element name.
|
* @param elementName the XML element name.
|
||||||
|
|
|
@ -78,7 +78,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
|
||||||
got.append(c);
|
got.append(c);
|
||||||
if (got.length() > 1024)
|
if (got.length() > 1024)
|
||||||
{
|
{
|
||||||
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Recieved " +
|
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Received " +
|
||||||
"header of >1024 characters from "
|
"header of >1024 characters from "
|
||||||
+ proxyhost + ", cancelling connection");
|
+ proxyhost + ", cancelling connection");
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ package org.jivesoftware.smack.proxy;
|
||||||
|
|
||||||
public class ProxyInfo
|
public class ProxyInfo
|
||||||
{
|
{
|
||||||
public static enum ProxyType
|
public enum ProxyType
|
||||||
{
|
{
|
||||||
HTTP,
|
HTTP,
|
||||||
SOCKS4,
|
SOCKS4,
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.net.Socket;
|
||||||
|
|
||||||
public interface ProxySocketConnection {
|
public interface ProxySocketConnection {
|
||||||
|
|
||||||
public void connect(Socket socket, String host, int port, int timeout)
|
void connect(Socket socket, String host, int port, int timeout)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
|
||||||
|
|
||||||
90: request granted
|
90: request granted
|
||||||
91: request rejected or failed
|
91: request rejected or failed
|
||||||
92: request rejected becasue SOCKS server cannot connect to
|
92: request rejected because SOCKS server cannot connect to
|
||||||
identd on the client
|
identd on the client
|
||||||
93: request rejected because the client program and identd
|
93: request rejected because the client program and identd
|
||||||
report different user-ids
|
report different user-ids
|
||||||
|
|
|
@ -246,7 +246,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
return gs2Header;
|
return gs2Header;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ByteUtils.concact(gs2Header, cbindData);
|
return ByteUtils.concat(gs2Header, cbindData);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getChannelBindingName() {
|
protected String getChannelBindingName() {
|
||||||
|
@ -394,7 +394,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
// U1 := HMAC(str, salt + INT(1))
|
// U1 := HMAC(str, salt + INT(1))
|
||||||
byte[] u = hmac(key, ByteUtils.concact(salt, ONE));
|
byte[] u = hmac(key, ByteUtils.concat(salt, ONE));
|
||||||
byte[] res = u.clone();
|
byte[] res = u.clone();
|
||||||
for (int i = 1; i < iterations; i++) {
|
for (int i = 1; i < iterations; i++) {
|
||||||
u = hmac(key, u);
|
u = hmac(key, u);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class Async {
|
||||||
if (e instanceof RuntimeException) {
|
if (e instanceof RuntimeException) {
|
||||||
throw (RuntimeException) e;
|
throw (RuntimeException) e;
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.WARNING, "Catched Exception", e);
|
LOGGER.log(Level.WARNING, "Caught Exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.jivesoftware.smack.util;
|
package org.jivesoftware.smack.util;
|
||||||
|
|
||||||
public class ByteUtils {
|
public class ByteUtils {
|
||||||
public static byte[] concact(byte[] arrayOne, byte[] arrayTwo) {
|
public static byte[] concat(byte[] arrayOne, byte[] arrayTwo) {
|
||||||
int combinedLength = arrayOne.length + arrayTwo.length;
|
int combinedLength = arrayOne.length + arrayTwo.length;
|
||||||
byte[] res = new byte[combinedLength];
|
byte[] res = new byte[combinedLength];
|
||||||
System.arraycopy(arrayOne, 0, res, 0, arrayOne.length);
|
System.arraycopy(arrayOne, 0, res, 0, arrayOne.length);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class LazyStringBuilder implements Appendable, CharSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LazyStringBuilder() {
|
public LazyStringBuilder() {
|
||||||
list = new ArrayList<CharSequence>(20);
|
list = new ArrayList<>(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LazyStringBuilder append(LazyStringBuilder lsb) {
|
public LazyStringBuilder append(LazyStringBuilder lsb) {
|
||||||
|
|
|
@ -90,19 +90,17 @@ public class ObservableWriter extends Writer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify that a new string has been written.
|
* Notify that a new string has been written.
|
||||||
*
|
|
||||||
* @param str the written String to notify
|
|
||||||
*/
|
*/
|
||||||
private void notifyListeners() {
|
private void notifyListeners() {
|
||||||
WriterListener[] writerListeners = null;
|
WriterListener[] writerListeners;
|
||||||
synchronized (listeners) {
|
synchronized (listeners) {
|
||||||
writerListeners = new WriterListener[listeners.size()];
|
writerListeners = new WriterListener[listeners.size()];
|
||||||
listeners.toArray(writerListeners);
|
listeners.toArray(writerListeners);
|
||||||
}
|
}
|
||||||
String str = stringBuilder.toString();
|
String str = stringBuilder.toString();
|
||||||
stringBuilder.setLength(0);
|
stringBuilder.setLength(0);
|
||||||
for (int i = 0; i < writerListeners.length; i++) {
|
for (WriterListener writerListener : writerListeners) {
|
||||||
writerListeners[i].write(str);
|
writerListener.write(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ public class PacketParserUtils {
|
||||||
String language = getLanguageAttribute(parser);
|
String language = getLanguageAttribute(parser);
|
||||||
|
|
||||||
// determine message's default language
|
// determine message's default language
|
||||||
String defaultLanguage = null;
|
String defaultLanguage;
|
||||||
if (language != null && !"".equals(language.trim())) {
|
if (language != null && !"".equals(language.trim())) {
|
||||||
message.setLanguage(language);
|
message.setLanguage(language);
|
||||||
defaultLanguage = language;
|
defaultLanguage = language;
|
||||||
|
@ -746,7 +746,7 @@ public class PacketParserUtils {
|
||||||
public static Map<String, String> parseDescriptiveTexts(XmlPullParser parser, Map<String, String> descriptiveTexts)
|
public static Map<String, String> parseDescriptiveTexts(XmlPullParser parser, Map<String, String> descriptiveTexts)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (descriptiveTexts == null) {
|
if (descriptiveTexts == null) {
|
||||||
descriptiveTexts = new HashMap<String, String>();
|
descriptiveTexts = new HashMap<>();
|
||||||
}
|
}
|
||||||
String xmllang = getLanguageAttribute(parser);
|
String xmllang = getLanguageAttribute(parser);
|
||||||
if (xmllang == null) {
|
if (xmllang == null) {
|
||||||
|
@ -805,7 +805,7 @@ public class PacketParserUtils {
|
||||||
*/
|
*/
|
||||||
public static StreamError parseStreamError(XmlPullParser parser) throws Exception {
|
public static StreamError parseStreamError(XmlPullParser parser) throws Exception {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
|
List<ExtensionElement> extensions = new ArrayList<>();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
StreamError.Condition condition = null;
|
StreamError.Condition condition = null;
|
||||||
String conditionText = null;
|
String conditionText = null;
|
||||||
|
@ -857,7 +857,7 @@ public class PacketParserUtils {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
final int initialDepth = parser.getDepth();
|
final int initialDepth = parser.getDepth();
|
||||||
Map<String, String> descriptiveTexts = null;
|
Map<String, String> descriptiveTexts = null;
|
||||||
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
|
List<ExtensionElement> extensions = new ArrayList<>();
|
||||||
XMPPError.Builder builder = XMPPError.getBuilder();
|
XMPPError.Builder builder = XMPPError.getBuilder();
|
||||||
|
|
||||||
// Parse the error header
|
// Parse the error header
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class PacketUtil {
|
||||||
* @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead
|
* @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static <PE extends ExtensionElement> PE packetExtensionfromCollection(
|
public static <PE extends ExtensionElement> PE packetExtensionFromCollection(
|
||||||
Collection<ExtensionElement> collection, String element,
|
Collection<ExtensionElement> collection, String element,
|
||||||
String namespace) {
|
String namespace) {
|
||||||
return extensionElementFrom(collection, element, namespace);
|
return extensionElementFrom(collection, element, namespace);
|
||||||
|
|
|
@ -138,11 +138,7 @@ public class ParserUtils {
|
||||||
if (valueString == null)
|
if (valueString == null)
|
||||||
return null;
|
return null;
|
||||||
valueString = valueString.toLowerCase(Locale.US);
|
valueString = valueString.toLowerCase(Locale.US);
|
||||||
if (valueString.equals("true") || valueString.equals("0")) {
|
return valueString.equals("true") || valueString.equals("0");
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getBooleanAttribute(XmlPullParser parser, String name,
|
public static boolean getBooleanAttribute(XmlPullParser parser, String name,
|
||||||
|
@ -232,8 +228,7 @@ public class ParserUtils {
|
||||||
|
|
||||||
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, URISyntaxException {
|
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, URISyntaxException {
|
||||||
String uriString = parser.nextText();
|
String uriString = parser.nextText();
|
||||||
URI uri = new URI(uriString);
|
return new URI(uriString);
|
||||||
return uri;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getRequiredAttribute(XmlPullParser parser, String name) throws IOException {
|
public static String getRequiredAttribute(XmlPullParser parser, String name) throws IOException {
|
||||||
|
@ -253,7 +248,6 @@ public class ParserUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getXmlLang(XmlPullParser parser) {
|
public static String getXmlLang(XmlPullParser parser) {
|
||||||
String langString = parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
|
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
|
||||||
return langString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ public interface ReaderListener {
|
||||||
*
|
*
|
||||||
* @param str the read String
|
* @param str the read String
|
||||||
*/
|
*/
|
||||||
public abstract void read(String str);
|
void read(String str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ package org.jivesoftware.smack.util;
|
||||||
|
|
||||||
public interface StringTransformer {
|
public interface StringTransformer {
|
||||||
|
|
||||||
public String transform(String string);
|
String transform(String string);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,10 +444,10 @@ public class StringUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean nullSafeCharSequenceEquals(CharSequence csOne, CharSequence csTwo) {
|
public static boolean nullSafeCharSequenceEquals(CharSequence csOne, CharSequence csTwo) {
|
||||||
return nullSafeCharSequenceComperator(csOne, csTwo) == 0;
|
return nullSafeCharSequenceComparator(csOne, csTwo) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int nullSafeCharSequenceComperator(CharSequence csOne, CharSequence csTwo) {
|
public static int nullSafeCharSequenceComparator(CharSequence csOne, CharSequence csTwo) {
|
||||||
if (csOne == null ^ csTwo == null) {
|
if (csOne == null ^ csTwo == null) {
|
||||||
return (csOne == null) ? -1 : 1;
|
return (csOne == null) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class TLSUtils {
|
||||||
* According to the <a
|
* According to the <a
|
||||||
* href="https://raw.githubusercontent.com/stpeter/manifesto/master/manifesto.txt">Encrypted
|
* href="https://raw.githubusercontent.com/stpeter/manifesto/master/manifesto.txt">Encrypted
|
||||||
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
|
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
|
||||||
* TLSv1.1. This method goes one step boyond and upgrades the handshake to use TLSv1 or better.
|
* TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
|
||||||
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
|
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,6 @@ public interface TypedCloneable<T> extends Cloneable {
|
||||||
*
|
*
|
||||||
* @return a cloned version of this instance.
|
* @return a cloned version of this instance.
|
||||||
*/
|
*/
|
||||||
public T clone();
|
T clone();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ public interface WriterListener {
|
||||||
*
|
*
|
||||||
* @param str the written string
|
* @param str the written string
|
||||||
*/
|
*/
|
||||||
public abstract void write(String str);
|
void write(String str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
|
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
|
||||||
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}.
|
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}.
|
||||||
*
|
*
|
||||||
* @param name element name
|
* @param name element name
|
||||||
* @param content content of element
|
* @param content content of element
|
||||||
|
@ -123,7 +123,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
|
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
|
||||||
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}
|
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}
|
||||||
* if {@link java.util.Date} instance is not <code>null</code>.
|
* if {@link java.util.Date} instance is not <code>null</code>.
|
||||||
*
|
*
|
||||||
* @param name element name
|
* @param name element name
|
||||||
|
@ -245,7 +245,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
||||||
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}.
|
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}.
|
||||||
*
|
*
|
||||||
* @param name name of attribute
|
* @param name name of attribute
|
||||||
* @param value value of attribute
|
* @param value value of attribute
|
||||||
|
@ -280,7 +280,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
* Add a new attribute to this builder, with the {@link java.util.Date} instance as its value,
|
||||||
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}
|
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}
|
||||||
* if {@link java.util.Date} instance is not <code>null</code>.
|
* if {@link java.util.Date} instance is not <code>null</code>.
|
||||||
*
|
*
|
||||||
* @param name attribute name
|
* @param name attribute name
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class HostAddress {
|
||||||
public HostAddress(String fqdn, int port, List<InetAddress> inetAddresses) {
|
public HostAddress(String fqdn, int port, List<InetAddress> inetAddresses) {
|
||||||
if (port < 0 || port > 65535)
|
if (port < 0 || port > 65535)
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Port must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + port);
|
"Port must be a 16-bit unsigned integer (i.e. between 0-65535. Port was: " + port);
|
||||||
if (StringUtils.isNotEmpty(fqdn) && fqdn.charAt(fqdn.length() - 1) == '.') {
|
if (StringUtils.isNotEmpty(fqdn) && fqdn.charAt(fqdn.length() - 1) == '.') {
|
||||||
this.fqdn = fqdn.substring(0, fqdn.length() - 1);
|
this.fqdn = fqdn.substring(0, fqdn.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,12 @@ public class SRVRecord extends HostAddress implements Comparable<SRVRecord> {
|
||||||
StringUtils.requireNotNullOrEmpty(fqdn, "The FQDN must not be null");
|
StringUtils.requireNotNullOrEmpty(fqdn, "The FQDN must not be null");
|
||||||
if (weight < 0 || weight > 65535)
|
if (weight < 0 || weight > 65535)
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"DNS SRV records weight must be a 16-bit unsiged integer (i.e. between 0-65535. Weight was: "
|
"DNS SRV records weight must be a 16-bit unsigned integer (i.e. between 0-65535. Weight was: "
|
||||||
+ weight);
|
+ weight);
|
||||||
|
|
||||||
if (priority < 0 || priority > 65535)
|
if (priority < 0 || priority > 65535)
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"DNS SRV records priority must be a 16-bit unsiged integer (i.e. between 0-65535. Priority was: "
|
"DNS SRV records priority must be a 16-bit unsigned integer (i.e. between 0-65535. Priority was: "
|
||||||
+ priority);
|
+ priority);
|
||||||
|
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class StanzaCollectorTest
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Stanza p = null;
|
Stanza p;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,7 @@ public class StanzaCollectorTest
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Stanza p = null;
|
Stanza p;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,8 +37,8 @@ import org.jivesoftware.smack.packet.Stanza;
|
||||||
public class ThreadedDummyConnection extends DummyConnection {
|
public class ThreadedDummyConnection extends DummyConnection {
|
||||||
private static final Logger LOGGER = Logger.getLogger(ThreadedDummyConnection.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ThreadedDummyConnection.class.getName());
|
||||||
|
|
||||||
private BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<IQ>(1);
|
private final BlockingQueue<IQ> replyQ = new ArrayBlockingQueue<>(1);
|
||||||
private BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<Stanza>(5);
|
private final BlockingQueue<Stanza> messageQ = new LinkedBlockingQueue<>(5);
|
||||||
private volatile boolean timeout = false;
|
private volatile boolean timeout = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class MessageTest {
|
||||||
XmlUnitUtils.assertSimilar(control, message.toXML());
|
XmlUnitUtils.assertSimilar(control, message.toXML());
|
||||||
|
|
||||||
Collection<String> languages = message.getBodyLanguages();
|
Collection<String> languages = message.getBodyLanguages();
|
||||||
List<String> controlLanguages = new ArrayList<String>();
|
List<String> controlLanguages = new ArrayList<>();
|
||||||
controlLanguages.add(lang2);
|
controlLanguages.add(lang2);
|
||||||
controlLanguages.add(lang3);
|
controlLanguages.add(lang3);
|
||||||
controlLanguages.removeAll(languages);
|
controlLanguages.removeAll(languages);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.parsing;
|
package org.jivesoftware.smack.parsing;
|
||||||
|
|
||||||
import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence;
|
import static org.jivesoftware.smack.test.util.CharSequenceEquals.equalsCharSequence;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackException;
|
import org.jivesoftware.smack.SmackException;
|
||||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
import org.jxmpp.jid.EntityBareJid;
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
|
@ -40,7 +39,7 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
|
||||||
super(saslMechanism);
|
super(saslMechanism);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runTest(boolean useAuthzid) throws NotConnectedException, SmackException, InterruptedException, XmppStringprepException, UnsupportedEncodingException {
|
protected void runTest(boolean useAuthzid) throws SmackException, InterruptedException, XmppStringprepException, UnsupportedEncodingException {
|
||||||
EntityBareJid authzid = null;
|
EntityBareJid authzid = null;
|
||||||
if (useAuthzid) {
|
if (useAuthzid) {
|
||||||
authzid = JidCreate.entityBareFrom("shazbat@xmpp.org");
|
authzid = JidCreate.entityBareFrom("shazbat@xmpp.org");
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright © 2014 Florian Schmaus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jivesoftware.smack.test.util;
|
||||||
|
|
||||||
|
import org.hamcrest.Description;
|
||||||
|
import org.hamcrest.Factory;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
import org.hamcrest.TypeSafeMatcher;
|
||||||
|
|
||||||
|
public class CharSequenceEquals extends TypeSafeMatcher<CharSequence> {
|
||||||
|
|
||||||
|
private final String charSequenceString;
|
||||||
|
|
||||||
|
public CharSequenceEquals(CharSequence charSequence) {
|
||||||
|
charSequenceString = charSequence.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void describeTo(Description description) {
|
||||||
|
description.appendText("Does not match CharSequence ").appendValue(charSequenceString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean matchesSafely(CharSequence item) {
|
||||||
|
String itemString = item.toString();
|
||||||
|
return charSequenceString.equals(itemString);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Factory
|
||||||
|
public static Matcher<CharSequence> equalsCharSequence(CharSequence charSequence) {
|
||||||
|
return new CharSequenceEquals(charSequence);
|
||||||
|
}
|
||||||
|
}
|
|
@ -809,7 +809,7 @@ public class PacketParserUtilsTest {
|
||||||
IOException, TransformerException, SAXException {
|
IOException, TransformerException, SAXException {
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
final String stanza = XMLBuilder.create("outer", "outerNamespace").a("outerAttribute", "outerValue")
|
final String stanza = XMLBuilder.create("outer", "outerNamespace").a("outerAttribute", "outerValue")
|
||||||
.element("inner", "innerNamespace").a("innverAttribute", "innerValue")
|
.element("inner", "innerNamespace").a("innerAttribute", "innerValue")
|
||||||
.element("innermost")
|
.element("innermost")
|
||||||
.t("some text")
|
.t("some text")
|
||||||
.asString();
|
.asString();
|
||||||
|
|
|
@ -240,7 +240,7 @@ public final class EnhancedDebuggerWindow {
|
||||||
JPanel iqProvidersPanel = new JPanel();
|
JPanel iqProvidersPanel = new JPanel();
|
||||||
iqProvidersPanel.setLayout(new GridLayout(1, 1));
|
iqProvidersPanel.setLayout(new GridLayout(1, 1));
|
||||||
iqProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed IQ Providers"));
|
iqProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed IQ Providers"));
|
||||||
Vector<String> providers = new Vector<String>();
|
Vector<String> providers = new Vector<>();
|
||||||
for (Object provider : ProviderManager.getIQProviders()) {
|
for (Object provider : ProviderManager.getIQProviders()) {
|
||||||
if (provider.getClass() == Class.class) {
|
if (provider.getClass() == Class.class) {
|
||||||
providers.add(((Class<?>) provider).getName());
|
providers.add(((Class<?>) provider).getName());
|
||||||
|
@ -259,7 +259,7 @@ public final class EnhancedDebuggerWindow {
|
||||||
JPanel extensionProvidersPanel = new JPanel();
|
JPanel extensionProvidersPanel = new JPanel();
|
||||||
extensionProvidersPanel.setLayout(new GridLayout(1, 1));
|
extensionProvidersPanel.setLayout(new GridLayout(1, 1));
|
||||||
extensionProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed Extension Providers"));
|
extensionProvidersPanel.setBorder(BorderFactory.createTitledBorder("Installed Extension Providers"));
|
||||||
providers = new Vector<String>();
|
providers = new Vector<>();
|
||||||
for (Object provider : ProviderManager.getExtensionProviders()) {
|
for (Object provider : ProviderManager.getExtensionProviders()) {
|
||||||
if (provider.getClass() == Class.class) {
|
if (provider.getClass() == Class.class) {
|
||||||
providers.add(((Class<?>) provider).getName());
|
providers.add(((Class<?>) provider).getName());
|
||||||
|
@ -305,7 +305,7 @@ public final class EnhancedDebuggerWindow {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
ArrayList<EnhancedDebugger> debuggersToRemove = new ArrayList<EnhancedDebugger>();
|
ArrayList<EnhancedDebugger> debuggersToRemove = new ArrayList<>();
|
||||||
// Remove all the debuggers of which their connections are no longer valid
|
// Remove all the debuggers of which their connections are no longer valid
|
||||||
for (int index = 0; index < tabbedPane.getComponentCount() - 1; index++) {
|
for (int index = 0; index < tabbedPane.getComponentCount() - 1; index++) {
|
||||||
EnhancedDebugger debugger = debuggers.get(index);
|
EnhancedDebugger debugger = debuggers.get(index);
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class CarbonExtension implements ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* Defines the direction of a {@link CarbonExtension} message.
|
* Defines the direction of a {@link CarbonExtension} message.
|
||||||
*/
|
*/
|
||||||
public static enum Direction {
|
public enum Direction {
|
||||||
received,
|
received,
|
||||||
sent
|
sent
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement {
|
||||||
private final String namespace;
|
private final String namespace;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private ExplicitMessageEncryptionProtocol(String namespace, String name) {
|
ExplicitMessageEncryptionProtocol(String namespace, String name) {
|
||||||
this.namespace = namespace;
|
this.namespace = namespace;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
PROTOCOL_LUT.put(namespace, this);
|
PROTOCOL_LUT.put(namespace, this);
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class AbstractHttpOverXmpp extends IQ {
|
||||||
/**
|
/**
|
||||||
* A builder for XMPP connection configurations.
|
* A builder for XMPP connection configurations.
|
||||||
* <p>
|
* <p>
|
||||||
* See ConnectionConfiguration Buidler for more details.
|
* See ConnectionConfiguration Builder for more details.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param <B> the builder type parameter.
|
* @param <B> the builder type parameter.
|
||||||
|
|
|
@ -26,6 +26,6 @@ import org.jxmpp.jid.Jid;
|
||||||
|
|
||||||
public interface ThingControlRequest {
|
public interface ThingControlRequest {
|
||||||
|
|
||||||
public void processRequest(Jid from, Collection<SetData> setData) throws XMPPErrorException;
|
void processRequest(Jid from, Collection<SetData> setData) throws XMPPErrorException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class IoTSetResponse extends IQ {
|
||||||
|
|
||||||
public IoTSetResponse(IoTSetRequest iotSetRequest) {
|
public IoTSetResponse(IoTSetRequest iotSetRequest) {
|
||||||
this();
|
this();
|
||||||
initialzeAsResultFor(iotSetRequest);
|
initializeAsResultFor(iotSetRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class SetData implements NamedElement {
|
||||||
|
|
||||||
private final String toStringCache;
|
private final String toStringCache;
|
||||||
|
|
||||||
private Type() {
|
Type() {
|
||||||
toStringCache = this.name().toLowerCase(Locale.US);
|
toStringCache = this.name().toLowerCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,6 @@ package org.jivesoftware.smackx.iot.data;
|
||||||
|
|
||||||
public interface ThingMomentaryReadOutRequest {
|
public interface ThingMomentaryReadOutRequest {
|
||||||
|
|
||||||
public void momentaryReadOutRequest(ThingMomentaryReadOutResult callback);
|
void momentaryReadOutRequest(ThingMomentaryReadOutResult callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,6 @@ import org.jivesoftware.smackx.iot.data.element.IoTDataField;
|
||||||
|
|
||||||
public interface ThingMomentaryReadOutResult {
|
public interface ThingMomentaryReadOutResult {
|
||||||
|
|
||||||
public void momentaryReadOut(List<? extends IoTDataField> results);
|
void momentaryReadOut(List<? extends IoTDataField> results);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class IoTDataRequest extends IQ {
|
||||||
public static final String NAMESPACE = Constants.IOT_SENSORDATA_NAMESPACE;
|
public static final String NAMESPACE = Constants.IOT_SENSORDATA_NAMESPACE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sequence nummber. According to XEP-0323 an xs:int.
|
* The sequence number. According to XEP-0323 an xs:int.
|
||||||
*/
|
*/
|
||||||
private final int seqNr;
|
private final int seqNr;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,6 @@ import org.jxmpp.jid.BareJid;
|
||||||
|
|
||||||
public interface ThingStateChangeListener {
|
public interface ThingStateChangeListener {
|
||||||
|
|
||||||
public void owned(BareJid owner);
|
void owned(BareJid owner);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class Tag implements NamedElement {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
str,
|
str,
|
||||||
num;
|
num
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
|
@ -161,8 +161,8 @@ public final class IoTProvisioningManager extends Manager {
|
||||||
// Notify the recommended friend that we will now accept his
|
// Notify the recommended friend that we will now accept his
|
||||||
// friendship requests.
|
// friendship requests.
|
||||||
final XMPPConnection connection = connection();
|
final XMPPConnection connection = connection();
|
||||||
Friend friendNotifiacation = new Friend(connection.getUser().asBareJid());
|
Friend friendNotification = new Friend(connection.getUser().asBareJid());
|
||||||
Message notificationMessage = new Message(friendJid, friendNotifiacation);
|
Message notificationMessage = new Message(friendJid, friendNotification);
|
||||||
connection.sendStanza(notificationMessage);
|
connection.sendStanza(notificationMessage);
|
||||||
} else {
|
} else {
|
||||||
// Check is the message was send from a thing we previously
|
// Check is the message was send from a thing we previously
|
||||||
|
@ -236,7 +236,7 @@ public final class IoTProvisioningManager extends Manager {
|
||||||
}
|
}
|
||||||
catch (NoResponseException | XMPPErrorException | NotConnectedException | InterruptedException e) {
|
catch (NoResponseException | XMPPErrorException | NotConnectedException | InterruptedException e) {
|
||||||
LOGGER.log(Level.WARNING,
|
LOGGER.log(Level.WARNING,
|
||||||
"Could not determine privisioning server. Ignoring friend request from " + from, e);
|
"Could not determine provisioning server. Ignoring friend request from " + from, e);
|
||||||
}
|
}
|
||||||
if (provisioningServer == null) {
|
if (provisioningServer == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -420,7 +420,7 @@ public final class IoTProvisioningManager extends Manager {
|
||||||
if (!provisioningServer.equals(stanza.getFrom())) {
|
if (!provisioningServer.equals(stanza.getFrom())) {
|
||||||
if (log) {
|
if (log) {
|
||||||
LOGGER.warning("Ignoring request '" + stanza
|
LOGGER.warning("Ignoring request '" + stanza
|
||||||
+ "' because not from provising server '" + provisioningServer
|
+ "' because not from provisioning server '" + provisioningServer
|
||||||
+ "'.");
|
+ "'.");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -239,11 +239,11 @@ public final class MamManager extends Manager {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query an message archive like a MUC archive or a pubsub node archive, addressed by an archiveAddress, applying
|
* Query an message archive like a MUC archive or a PubSub node archive, addressed by an archiveAddress, applying
|
||||||
* filters: max count, start date, end date, from/to JID and with additional fields. When archiveAddress is null the
|
* filters: max count, start date, end date, from/to JID and with additional fields. When archiveAddress is null the
|
||||||
* default, the server will be requested.
|
* default, the server will be requested.
|
||||||
*
|
*
|
||||||
* @param node The Pubsub node name, can be null
|
* @param node The PubSub node name, can be null
|
||||||
* @param max
|
* @param max
|
||||||
* @param start
|
* @param start
|
||||||
* @param end
|
* @param end
|
||||||
|
@ -346,7 +346,7 @@ public final class MamManager extends Manager {
|
||||||
/**
|
/**
|
||||||
* Returns a page of the archive.
|
* Returns a page of the archive.
|
||||||
*
|
*
|
||||||
* @param node The Pubsub node name, can be null
|
* @param node The PubSub node name, can be null
|
||||||
* @param dataForm
|
* @param dataForm
|
||||||
* @param rsmSet
|
* @param rsmSet
|
||||||
* @return the MAM query result
|
* @return the MAM query result
|
||||||
|
@ -498,7 +498,7 @@ public final class MamManager extends Manager {
|
||||||
/**
|
/**
|
||||||
* Get the form fields supported by the server.
|
* Get the form fields supported by the server.
|
||||||
*
|
*
|
||||||
* @param node The Pubsub node name, can be null
|
* @param node The PubSub node name, can be null
|
||||||
* @return the list of form fields.
|
* @return the list of form fields.
|
||||||
* @throws NoResponseException
|
* @throws NoResponseException
|
||||||
* @throws XMPPErrorException
|
* @throws XMPPErrorException
|
||||||
|
@ -521,7 +521,7 @@ public final class MamManager extends Manager {
|
||||||
private MamQueryResult queryArchive(MamQueryIQ mamQueryIq) throws NoResponseException, XMPPErrorException,
|
private MamQueryResult queryArchive(MamQueryIQ mamQueryIq) throws NoResponseException, XMPPErrorException,
|
||||||
NotConnectedException, InterruptedException, NotLoggedInException {
|
NotConnectedException, InterruptedException, NotLoggedInException {
|
||||||
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
|
||||||
MamFinIQ mamFinIQ = null;
|
MamFinIQ mamFinIQ;
|
||||||
|
|
||||||
StanzaCollector mamFinIQCollector = connection.createStanzaCollector(new IQReplyFilter(mamQueryIq, connection));
|
StanzaCollector mamFinIQCollector = connection.createStanzaCollector(new IQReplyFilter(mamQueryIq, connection));
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class MultiUserChatLight {
|
||||||
* Same as {@link #fromRoomFilter} together with
|
* Same as {@link #fromRoomFilter} together with
|
||||||
* {@link MessageTypeFilter#GROUPCHAT}.
|
* {@link MessageTypeFilter#GROUPCHAT}.
|
||||||
*/
|
*/
|
||||||
private final StanzaFilter fromRoomGroupchatFilter;
|
private final StanzaFilter fromRoomGroupChatFilter;
|
||||||
|
|
||||||
private final StanzaListener messageListener;
|
private final StanzaListener messageListener;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class MultiUserChatLight {
|
||||||
this.room = room;
|
this.room = room;
|
||||||
|
|
||||||
fromRoomFilter = FromMatchesFilter.create(room);
|
fromRoomFilter = FromMatchesFilter.create(room);
|
||||||
fromRoomGroupchatFilter = new AndFilter(fromRoomFilter, MessageTypeFilter.GROUPCHAT);
|
fromRoomGroupChatFilter = new AndFilter(fromRoomFilter, MessageTypeFilter.GROUPCHAT);
|
||||||
|
|
||||||
messageListener = new StanzaListener() {
|
messageListener = new StanzaListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,7 +105,7 @@ public class MultiUserChatLight {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
connection.addSyncStanzaListener(messageListener, fromRoomGroupchatFilter);
|
connection.addSyncStanzaListener(messageListener, fromRoomGroupChatFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -265,7 +265,7 @@ public class MultiUserChatLight {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
|
MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants);
|
||||||
|
|
||||||
messageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);
|
messageCollector = connection.createStanzaCollector(fromRoomGroupChatFilter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection.createStanzaCollectorAndSend(createMUCLightIQ).nextResultOrThrow();
|
connection.createStanzaCollectorAndSend(createMUCLightIQ).nextResultOrThrow();
|
||||||
|
|
|
@ -96,7 +96,7 @@ public final class MultiUserChatLightManager extends Manager {
|
||||||
|
|
||||||
private MultiUserChatLight createNewMucLightAndAddToMap(EntityBareJid jid) {
|
private MultiUserChatLight createNewMucLightAndAddToMap(EntityBareJid jid) {
|
||||||
MultiUserChatLight multiUserChatLight = new MultiUserChatLight(connection(), jid);
|
MultiUserChatLight multiUserChatLight = new MultiUserChatLight(connection(), jid);
|
||||||
multiUserChatLights.put(jid, new WeakReference<MultiUserChatLight>(multiUserChatLight));
|
multiUserChatLights.put(jid, new WeakReference<>(multiUserChatLight));
|
||||||
return multiUserChatLight;
|
return multiUserChatLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,11 +193,11 @@ public final class MultiUserChatLightManager extends Manager {
|
||||||
*/
|
*/
|
||||||
public List<Jid> getRoomsBlocked(DomainBareJid mucLightService)
|
public List<Jid> getRoomsBlocked(DomainBareJid mucLightService)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
MUCLightBlockingIQ muclIghtBlockingIQResult = getBlockingList(mucLightService);
|
MUCLightBlockingIQ mucLightBlockingIQResult = getBlockingList(mucLightService);
|
||||||
|
|
||||||
List<Jid> jids = new ArrayList<>();
|
List<Jid> jids = new ArrayList<>();
|
||||||
if (muclIghtBlockingIQResult.getRooms() != null) {
|
if (mucLightBlockingIQResult.getRooms() != null) {
|
||||||
jids.addAll(muclIghtBlockingIQResult.getRooms().keySet());
|
jids.addAll(mucLightBlockingIQResult.getRooms().keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
return jids;
|
return jids;
|
||||||
|
@ -215,11 +215,11 @@ public final class MultiUserChatLightManager extends Manager {
|
||||||
*/
|
*/
|
||||||
public List<Jid> getUsersBlocked(DomainBareJid mucLightService)
|
public List<Jid> getUsersBlocked(DomainBareJid mucLightService)
|
||||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||||
MUCLightBlockingIQ muclIghtBlockingIQResult = getBlockingList(mucLightService);
|
MUCLightBlockingIQ mucLightBlockingIQResult = getBlockingList(mucLightService);
|
||||||
|
|
||||||
List<Jid> jids = new ArrayList<>();
|
List<Jid> jids = new ArrayList<>();
|
||||||
if (muclIghtBlockingIQResult.getUsers() != null) {
|
if (mucLightBlockingIQResult.getUsers() != null) {
|
||||||
jids.addAll(muclIghtBlockingIQResult.getUsers().keySet());
|
jids.addAll(mucLightBlockingIQResult.getUsers().keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
return jids;
|
return jids;
|
||||||
|
@ -234,9 +234,9 @@ public final class MultiUserChatLightManager extends Manager {
|
||||||
StanzaFilter responseFilter = new IQReplyFilter(mucLightBlockingIQ, connection());
|
StanzaFilter responseFilter = new IQReplyFilter(mucLightBlockingIQ, connection());
|
||||||
IQ responseIq = connection().createStanzaCollectorAndSend(responseFilter, mucLightBlockingIQ)
|
IQ responseIq = connection().createStanzaCollectorAndSend(responseFilter, mucLightBlockingIQ)
|
||||||
.nextResultOrThrow();
|
.nextResultOrThrow();
|
||||||
MUCLightBlockingIQ muclIghtBlockingIQResult = (MUCLightBlockingIQ) responseIq;
|
MUCLightBlockingIQ mucLightBlockingIQResult = (MUCLightBlockingIQ) responseIq;
|
||||||
|
|
||||||
return muclIghtBlockingIQResult;
|
return mucLightBlockingIQResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.junit.Test;
|
||||||
public class ExperimentalInitializerTest {
|
public class ExperimentalInitializerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExperimentalInitialzer() {
|
public void testExperimentalInitializer() {
|
||||||
ExperimentalInitializer epi = new ExperimentalInitializer();
|
ExperimentalInitializer epi = new ExperimentalInitializer();
|
||||||
List<Exception> exceptions = epi.initialize();
|
List<Exception> exceptions = epi.initialize();
|
||||||
assertTrue(exceptions.size() == 0);
|
assertTrue(exceptions.size() == 0);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smackx.carbons;
|
package org.jivesoftware.smackx.carbons;
|
||||||
|
|
||||||
import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence;
|
import static org.jivesoftware.smack.test.util.CharSequenceEquals.equalsCharSequence;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class AcknowledgedExtensionTest {
|
||||||
AcknowledgedExtension acknowledgedExtension1 = new AcknowledgedProvider().parse(parser);
|
AcknowledgedExtension acknowledgedExtension1 = new AcknowledgedProvider().parse(parser);
|
||||||
Assert.assertEquals("message-1", acknowledgedExtension1.getId());
|
Assert.assertEquals("message-1", acknowledgedExtension1.getId());
|
||||||
|
|
||||||
Message message = (Message) PacketParserUtils.parseStanza(acknowledgedMessageStanza);
|
Message message = PacketParserUtils.parseStanza(acknowledgedMessageStanza);
|
||||||
AcknowledgedExtension acknowledgedExtension2 = AcknowledgedExtension.from(message);
|
AcknowledgedExtension acknowledgedExtension2 = AcknowledgedExtension.from(message);
|
||||||
Assert.assertEquals("message-1", acknowledgedExtension2.getId());
|
Assert.assertEquals("message-1", acknowledgedExtension2.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class DisplayedExtensionTest {
|
||||||
DisplayedExtension displayedExtension1 = new DisplayedProvider().parse(parser);
|
DisplayedExtension displayedExtension1 = new DisplayedProvider().parse(parser);
|
||||||
Assert.assertEquals("message-1", displayedExtension1.getId());
|
Assert.assertEquals("message-1", displayedExtension1.getId());
|
||||||
|
|
||||||
Message message = (Message) PacketParserUtils.parseStanza(displayedMessageStanza);
|
Message message = PacketParserUtils.parseStanza(displayedMessageStanza);
|
||||||
DisplayedExtension displayedExtension2 = DisplayedExtension.from(message);
|
DisplayedExtension displayedExtension2 = DisplayedExtension.from(message);
|
||||||
Assert.assertEquals("message-1", displayedExtension2.getId());
|
Assert.assertEquals("message-1", displayedExtension2.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class MarkableExtensionTest {
|
||||||
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
MarkableExtension markableExtension1 = new MarkableProvider().parse(parser);
|
||||||
Assert.assertEquals(markableExtension, markableExtension1.toXML().toString());
|
Assert.assertEquals(markableExtension, markableExtension1.toXML().toString());
|
||||||
|
|
||||||
Message message = (Message) PacketParserUtils.parseStanza(markableMessageStanza);
|
Message message = PacketParserUtils.parseStanza(markableMessageStanza);
|
||||||
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
MarkableExtension markableExtension2 = MarkableExtension.from(message);
|
||||||
Assert.assertEquals(markableExtension, markableExtension2.toXML().toString());
|
Assert.assertEquals(markableExtension, markableExtension2.toXML().toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ReceivedExtensionTest {
|
||||||
ReceivedExtension receivedExtension1 = new ReceivedProvider().parse(parser);
|
ReceivedExtension receivedExtension1 = new ReceivedProvider().parse(parser);
|
||||||
Assert.assertEquals("message-1", receivedExtension1.getId());
|
Assert.assertEquals("message-1", receivedExtension1.getId());
|
||||||
|
|
||||||
Message message = (Message) PacketParserUtils.parseStanza(receivedMessageStanza);
|
Message message = PacketParserUtils.parseStanza(receivedMessageStanza);
|
||||||
ReceivedExtension receivedExtension2 = ReceivedExtension.from(message);
|
ReceivedExtension receivedExtension2 = ReceivedExtension.from(message);
|
||||||
Assert.assertEquals("message-1", receivedExtension2.getId());
|
Assert.assertEquals("message-1", receivedExtension2.getId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,6 @@ public class HttpOverXmppReqProviderTest {
|
||||||
XmlPullParser parser = PacketParserUtils.getParserFor(string);
|
XmlPullParser parser = PacketParserUtils.getParserFor(string);
|
||||||
IQ iq = provider.parse(parser);
|
IQ iq = provider.parse(parser);
|
||||||
assertTrue(iq instanceof HttpOverXmppReq);
|
assertTrue(iq instanceof HttpOverXmppReq);
|
||||||
HttpOverXmppReq castedIq = (HttpOverXmppReq) iq;
|
return (HttpOverXmppReq) iq;
|
||||||
return castedIq;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class FileTooLargeErrorCreateTest {
|
public class FileTooLargeErrorCreateTest {
|
||||||
String fileTooLargeErrorExtensionExample
|
private static final String fileTooLargeErrorExtensionExample
|
||||||
= "<file-too-large xmlns='urn:xmpp:http:upload:0'>"
|
= "<file-too-large xmlns='urn:xmpp:http:upload:0'>"
|
||||||
+ "<max-file-size>20000</max-file-size>"
|
+ "<max-file-size>20000</max-file-size>"
|
||||||
+ "</file-too-large>";
|
+ "</file-too-large>";
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.Test;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class SlotCreateTest {
|
public class SlotCreateTest {
|
||||||
String testSlot
|
private static final String testSlot
|
||||||
= "<slot xmlns='urn:xmpp:http:upload:0'>"
|
= "<slot xmlns='urn:xmpp:http:upload:0'>"
|
||||||
+ "<put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></put>"
|
+ "<put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></put>"
|
||||||
+ "<get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></get>"
|
+ "<get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png'></get>"
|
||||||
|
|
|
@ -29,14 +29,14 @@ import org.xml.sax.SAXException;
|
||||||
|
|
||||||
public class SlotRequestCreateTest {
|
public class SlotRequestCreateTest {
|
||||||
|
|
||||||
String testRequest
|
private static final String testRequest
|
||||||
= "<request xmlns='urn:xmpp:http:upload:0'"
|
= "<request xmlns='urn:xmpp:http:upload:0'"
|
||||||
+ " filename='my_juliet.png'"
|
+ " filename='my_juliet.png'"
|
||||||
+ " size='23456'"
|
+ " size='23456'"
|
||||||
+ " content-type='image/jpeg'"
|
+ " content-type='image/jpeg'"
|
||||||
+ "/>";
|
+ "/>";
|
||||||
|
|
||||||
String testRequestWithoutContentType
|
private static final String testRequestWithoutContentType
|
||||||
= "<request xmlns='urn:xmpp:http:upload:0'"
|
= "<request xmlns='urn:xmpp:http:upload:0'"
|
||||||
+ " filename='my_romeo.png'"
|
+ " filename='my_romeo.png'"
|
||||||
+ " size='52523'"
|
+ " size='52523'"
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class FileTooLargeErrorProviderTest {
|
||||||
* Example 7. Alternative response by the upload service if the file size was too large
|
* Example 7. Alternative response by the upload service if the file size was too large
|
||||||
* @see <a href="http://xmpp.org/extensions/xep-0363.html#errors">XEP-0363: HTTP File Upload 5. Error conditions</a>
|
* @see <a href="http://xmpp.org/extensions/xep-0363.html#errors">XEP-0363: HTTP File Upload 5. Error conditions</a>
|
||||||
*/
|
*/
|
||||||
String slotErrorFileToLarge
|
private static final String slotErrorFileToLarge
|
||||||
= "<iq from='upload.montague.tld' "
|
= "<iq from='upload.montague.tld' "
|
||||||
+ "id='step_03' "
|
+ "id='step_03' "
|
||||||
+ "to='romeo@montague.tld/garden' "
|
+ "to='romeo@montague.tld/garden' "
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class MamFinProviderTest extends MamTest {
|
||||||
+ "</iq>";
|
+ "</iq>";
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
IQ iq = (IQ) PacketParserUtils.parseStanza(IQ_LIMITED_RESULTS_EXAMPLE);
|
IQ iq = PacketParserUtils.parseStanza(IQ_LIMITED_RESULTS_EXAMPLE);
|
||||||
|
|
||||||
MamFinIQ mamFinIQ = (MamFinIQ) iq;
|
MamFinIQ mamFinIQ = (MamFinIQ) iq;
|
||||||
Assert.assertEquals(mamFinIQ.getType(), Type.result);
|
Assert.assertEquals(mamFinIQ.getType(), Type.result);
|
||||||
|
|
|
@ -31,18 +31,18 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
public class MamPrefIQProviderTest extends MamTest {
|
public class MamPrefIQProviderTest extends MamTest {
|
||||||
|
|
||||||
String exampleMamPrefsIQ1 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
private static final String exampleMamPrefsIQ1 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||||
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "</always>" + "<never>"
|
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "</always>" + "<never>"
|
||||||
+ "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
+ "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
||||||
|
|
||||||
String exampleMamPrefsIQ2 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
private static final String exampleMamPrefsIQ2 = "<iq type='set' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1' default='roster'>"
|
||||||
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>montague@montague.lit</jid>" + "</always>"
|
+ "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>montague@montague.lit</jid>" + "</always>"
|
||||||
+ "<never>" + "</never>" + "</prefs>" + "</iq>";
|
+ "<never>" + "</never>" + "</prefs>" + "</iq>";
|
||||||
|
|
||||||
String exampleMamPrefsIQ3 = "<iq type='get' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1'>" + "</prefs>"
|
private static final String exampleMamPrefsIQ3 = "<iq type='get' id='juliet3'>" + "<prefs xmlns='urn:xmpp:mam:1'>" + "</prefs>"
|
||||||
+ "</iq>";
|
+ "</iq>";
|
||||||
|
|
||||||
String exampleMamPrefsResultIQ = "<iq type='result' id='juliet3'>"
|
private static final String exampleMamPrefsResultIQ = "<iq type='result' id='juliet3'>"
|
||||||
+ "<prefs xmlns='urn:xmpp:mam:1' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>"
|
+ "<prefs xmlns='urn:xmpp:mam:1' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>"
|
||||||
+ "</always>" + "<never>" + "<jid>sarasa@montague.lit</jid>" + "<jid>montague@montague.lit</jid>"
|
+ "</always>" + "<never>" + "<jid>sarasa@montague.lit</jid>" + "<jid>montague@montague.lit</jid>"
|
||||||
+ "</never>" + "</prefs>" + "</iq>";
|
+ "</never>" + "</prefs>" + "</iq>";
|
||||||
|
@ -53,14 +53,14 @@ public class MamPrefIQProviderTest extends MamTest {
|
||||||
MamPrefsIQ mamPrefIQ1 = new MamPrefsIQProvider().parse(parser1);
|
MamPrefsIQ mamPrefIQ1 = new MamPrefsIQProvider().parse(parser1);
|
||||||
|
|
||||||
Assert.assertEquals(IQ.Type.set, mamPrefIQ1.getType());
|
Assert.assertEquals(IQ.Type.set, mamPrefIQ1.getType());
|
||||||
Assert.assertEquals(mamPrefIQ1.getAlwaysJids().get(0), "romeo@montague.lit");
|
Assert.assertEquals(mamPrefIQ1.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
|
||||||
Assert.assertEquals(mamPrefIQ1.getNeverJids().get(0), "montague@montague.lit");
|
Assert.assertEquals(mamPrefIQ1.getNeverJids().get(0).toString(), "montague@montague.lit");
|
||||||
|
|
||||||
XmlPullParser parser2 = PacketParserUtils.getParserFor(exampleMamPrefsIQ2);
|
XmlPullParser parser2 = PacketParserUtils.getParserFor(exampleMamPrefsIQ2);
|
||||||
MamPrefsIQ mamPrefIQ2 = new MamPrefsIQProvider().parse(parser2);
|
MamPrefsIQ mamPrefIQ2 = new MamPrefsIQProvider().parse(parser2);
|
||||||
Assert.assertEquals(IQ.Type.set, mamPrefIQ2.getType());
|
Assert.assertEquals(IQ.Type.set, mamPrefIQ2.getType());
|
||||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(0), "romeo@montague.lit");
|
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(0).toString(), "romeo@montague.lit");
|
||||||
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(1), "montague@montague.lit");
|
Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(1).toString(), "montague@montague.lit");
|
||||||
Assert.assertTrue(mamPrefIQ2.getNeverJids().isEmpty());
|
Assert.assertTrue(mamPrefIQ2.getNeverJids().isEmpty());
|
||||||
|
|
||||||
XmlPullParser parser3 = PacketParserUtils.getParserFor(exampleMamPrefsIQ3);
|
XmlPullParser parser3 = PacketParserUtils.getParserFor(exampleMamPrefsIQ3);
|
||||||
|
@ -70,7 +70,7 @@ public class MamPrefIQProviderTest extends MamTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkMamPrefResult() throws Exception {
|
public void checkMamPrefResult() throws Exception {
|
||||||
IQ iq = (IQ) PacketParserUtils.parseStanza(exampleMamPrefsResultIQ);
|
IQ iq = PacketParserUtils.parseStanza(exampleMamPrefsResultIQ);
|
||||||
|
|
||||||
MamPrefsIQ mamPrefsIQ = (MamPrefsIQ) iq;
|
MamPrefsIQ mamPrefsIQ = (MamPrefsIQ) iq;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
public class MamQueryIQProviderTest {
|
public class MamQueryIQProviderTest {
|
||||||
|
|
||||||
String exampleMamQueryIQ1 = "<iq type='set' id='query4'>" + "<query xmlns='urn:xmpp:mam:1' queryid='test'>"
|
private static final String exampleMamQueryIQ1 = "<iq type='set' id='query4'>" + "<query xmlns='urn:xmpp:mam:1' queryid='test'>"
|
||||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field type='hidden' var='FORM_TYPE'>"
|
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field type='hidden' var='FORM_TYPE'>"
|
||||||
+ "<value>urn:xmpp:mam:1</value>" + "</field>"
|
+ "<value>urn:xmpp:mam:1</value>" + "</field>"
|
||||||
+ "<field type='text-single' var='urn:example:xmpp:free-text-search'>"
|
+ "<field type='text-single' var='urn:example:xmpp:free-text-search'>"
|
||||||
|
@ -41,7 +41,7 @@ public class MamQueryIQProviderTest {
|
||||||
+ "<value>{http://jabber.org/protocol/mood}mood/lonely</value>" + "</field>" + "</x>" + "</query>"
|
+ "<value>{http://jabber.org/protocol/mood}mood/lonely</value>" + "</field>" + "</x>" + "</query>"
|
||||||
+ "</iq>";
|
+ "</iq>";
|
||||||
|
|
||||||
String exampleMamQueryIQ2 = "<iq type='result' id='form1'>" + "<query xmlns='urn:xmpp:mam:1'>"
|
private static final String exampleMamQueryIQ2 = "<iq type='result' id='form1'>" + "<query xmlns='urn:xmpp:mam:1'>"
|
||||||
+ "<x xmlns='jabber:x:data' type='form'>" + "<field type='hidden' var='FORM_TYPE'>"
|
+ "<x xmlns='jabber:x:data' type='form'>" + "<field type='hidden' var='FORM_TYPE'>"
|
||||||
+ "<value>urn:xmpp:mam:1</value>" + "</field>" + "<field type='jid-single' var='with'/>"
|
+ "<value>urn:xmpp:mam:1</value>" + "</field>" + "<field type='jid-single' var='with'/>"
|
||||||
+ "<field type='text-single' var='start'/>" + "<field type='text-single' var='end'/>"
|
+ "<field type='text-single' var='start'/>" + "<field type='text-single' var='end'/>"
|
||||||
|
@ -51,7 +51,7 @@ public class MamQueryIQProviderTest {
|
||||||
@Test
|
@Test
|
||||||
public void checkMamQueryIQProvider() throws Exception {
|
public void checkMamQueryIQProvider() throws Exception {
|
||||||
// example 1
|
// example 1
|
||||||
IQ iq1 = (IQ) PacketParserUtils.parseStanza(exampleMamQueryIQ1);
|
IQ iq1 = PacketParserUtils.parseStanza(exampleMamQueryIQ1);
|
||||||
MamQueryIQ mamQueryIQ1 = (MamQueryIQ) iq1;
|
MamQueryIQ mamQueryIQ1 = (MamQueryIQ) iq1;
|
||||||
|
|
||||||
Assert.assertEquals(mamQueryIQ1.getType(), Type.set);
|
Assert.assertEquals(mamQueryIQ1.getType(), Type.set);
|
||||||
|
@ -67,7 +67,7 @@ public class MamQueryIQProviderTest {
|
||||||
Assert.assertEquals(fields1.get(2).getValues().get(0), "{http://jabber.org/protocol/mood}mood/lonely");
|
Assert.assertEquals(fields1.get(2).getValues().get(0), "{http://jabber.org/protocol/mood}mood/lonely");
|
||||||
|
|
||||||
// example2
|
// example2
|
||||||
IQ iq2 = (IQ) PacketParserUtils.parseStanza(exampleMamQueryIQ2);
|
IQ iq2 = PacketParserUtils.parseStanza(exampleMamQueryIQ2);
|
||||||
MamQueryIQ mamQueryIQ2 = (MamQueryIQ) iq2;
|
MamQueryIQ mamQueryIQ2 = (MamQueryIQ) iq2;
|
||||||
|
|
||||||
Assert.assertEquals(mamQueryIQ2.getType(), Type.result);
|
Assert.assertEquals(mamQueryIQ2.getType(), Type.result);
|
||||||
|
|
|
@ -33,14 +33,14 @@ import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
public class MamResultProviderTest {
|
public class MamResultProviderTest {
|
||||||
|
|
||||||
String exampleMamResultXml = "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
private static final String exampleMamResultXml = "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
||||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
||||||
+ "<message xmlns='jabber:client'" + "to='juliet@capulet.lit/balcony'" + "from='romeo@montague.lit/orchard'"
|
+ "<message xmlns='jabber:client'" + "to='juliet@capulet.lit/balcony'" + "from='romeo@montague.lit/orchard'"
|
||||||
+ "type='chat'>"
|
+ "type='chat'>"
|
||||||
+ "<body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body>"
|
+ "<body>Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.</body>"
|
||||||
+ "</message>" + "</forwarded>" + "</result>";
|
+ "</message>" + "</forwarded>" + "</result>";
|
||||||
|
|
||||||
String exampleResultMessage = "<message id='aeb213' to='juliet@capulet.lit/chamber'>"
|
private static final String exampleResultMessage = "<message id='aeb213' to='juliet@capulet.lit/chamber'>"
|
||||||
+ "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
+ "<result xmlns='urn:xmpp:mam:1' queryid='f27' id='28482-98726-73623'>"
|
||||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
+ "<forwarded xmlns='urn:xmpp:forward:0'>" + "<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>"
|
||||||
+ "<message xmlns='jabber:client' from='witch@shakespeare.lit' to='macbeth@shakespeare.lit'>"
|
+ "<message xmlns='jabber:client' from='witch@shakespeare.lit' to='macbeth@shakespeare.lit'>"
|
||||||
|
@ -62,15 +62,15 @@ public class MamResultProviderTest {
|
||||||
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
||||||
|
|
||||||
Message message = (Message) forwarded.getForwardedStanza();
|
Message message = (Message) forwarded.getForwardedStanza();
|
||||||
Assert.assertEquals(message.getFrom(), "romeo@montague.lit/orchard");
|
Assert.assertEquals(message.getFrom().toString(), "romeo@montague.lit/orchard");
|
||||||
Assert.assertEquals(message.getTo(), "juliet@capulet.lit/balcony");
|
Assert.assertEquals(message.getTo().toString(), "juliet@capulet.lit/balcony");
|
||||||
Assert.assertEquals(message.getBody(),
|
Assert.assertEquals(message.getBody(),
|
||||||
"Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
|
"Call me but love, and I'll be new baptized; Henceforth I never will be Romeo.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkResultsParse() throws Exception {
|
public void checkResultsParse() throws Exception {
|
||||||
Message message = (Message) PacketParserUtils.parseStanza(exampleResultMessage);
|
Message message = PacketParserUtils.parseStanza(exampleResultMessage);
|
||||||
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
MamResultExtension mamResultExtension = MamResultExtension.from(message);
|
||||||
|
|
||||||
Assert.assertEquals(mamResultExtension.getQueryId(), "f27");
|
Assert.assertEquals(mamResultExtension.getQueryId(), "f27");
|
||||||
|
@ -84,8 +84,8 @@ public class MamResultProviderTest {
|
||||||
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
Assert.assertEquals(forwarded.getDelayInformation().getStamp(), date);
|
||||||
|
|
||||||
Message forwardedMessage = (Message) forwarded.getForwardedStanza();
|
Message forwardedMessage = (Message) forwarded.getForwardedStanza();
|
||||||
Assert.assertEquals(forwardedMessage.getFrom(), "witch@shakespeare.lit");
|
Assert.assertEquals(forwardedMessage.getFrom().toString(), "witch@shakespeare.lit");
|
||||||
Assert.assertEquals(forwardedMessage.getTo(), "macbeth@shakespeare.lit");
|
Assert.assertEquals(forwardedMessage.getTo().toString(), "macbeth@shakespeare.lit");
|
||||||
Assert.assertEquals(forwardedMessage.getBody(), "Hail to thee");
|
Assert.assertEquals(forwardedMessage.getBody(), "Hail to thee");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class PreferencesTest {
|
public class PreferencesTest {
|
||||||
|
|
||||||
String retrievePrefsStanzaExample = "<iq id='sarasa' type='get'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
private static final String retrievePrefsStanzaExample = "<iq id='sarasa' type='get'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||||
+ "'/>" + "</iq>";
|
+ "'/>" + "</iq>";
|
||||||
|
|
||||||
String updatePrefsStanzaExample = "<iq id='sarasa' type='set'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
private static final String updatePrefsStanzaExample = "<iq id='sarasa' type='set'>" + "<prefs xmlns='" + MamElements.NAMESPACE
|
||||||
+ "' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>other@montague.lit</jid>"
|
+ "' default='roster'>" + "<always>" + "<jid>romeo@montague.lit</jid>" + "<jid>other@montague.lit</jid>"
|
||||||
+ "</always>" + "<never>" + "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
+ "</always>" + "<never>" + "<jid>montague@montague.lit</jid>" + "</never>" + "</prefs>" + "</iq>";
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,11 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class QueryArchiveTest extends MamTest {
|
public class QueryArchiveTest extends MamTest {
|
||||||
|
|
||||||
String mamSimpleQueryIQ = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
private static final String mamSimpleQueryIQ = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
||||||
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "</query>" + "</iq>";
|
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String mamQueryResultExample = "<message to='hag66@shakespeare.lit/pda' from='coven@chat.shakespeare.lit' id='iasd207'>"
|
private static final String mamQueryResultExample = "<message to='hag66@shakespeare.lit/pda' from='coven@chat.shakespeare.lit' id='iasd207'>"
|
||||||
+ "<result xmlns='urn:xmpp:mam:1' queryid='g27' id='34482-21985-73620'>"
|
+ "<result xmlns='urn:xmpp:mam:1' queryid='g27' id='34482-21985-73620'>"
|
||||||
+ "<forwarded xmlns='urn:xmpp:forward:0'>"
|
+ "<forwarded xmlns='urn:xmpp:forward:0'>"
|
||||||
+ "<delay xmlns='urn:xmpp:delay' stamp='2002-10-13T23:58:37.000+00:00'></delay>" + "<message "
|
+ "<delay xmlns='urn:xmpp:delay' stamp='2002-10-13T23:58:37.000+00:00'></delay>" + "<message "
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
public class ResultsLimitTest extends MamTest {
|
public class ResultsLimitTest extends MamTest {
|
||||||
|
|
||||||
String resultsLimitStanza = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
private static final String resultsLimitStanza = "<iq id='sarasa' type='set'>" + "<query xmlns='urn:xmpp:mam:1' queryid='testid'>"
|
||||||
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
+ "<x xmlns='jabber:x:data' type='submit'>" + "<field var='FORM_TYPE' type='hidden'>" + "<value>"
|
||||||
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "<set xmlns='http://jabber.org/protocol/rsm'>"
|
+ MamElements.NAMESPACE + "</value>" + "</field>" + "</x>" + "<set xmlns='http://jabber.org/protocol/rsm'>"
|
||||||
+ "<max>10</max>" + "</set>" + "</query>" + "</iq>";
|
+ "<max>10</max>" + "</set>" + "</query>" + "</iq>";
|
||||||
|
|
|
@ -30,19 +30,19 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightAffiliationsChangeExtensionTest {
|
public class MUCLightAffiliationsChangeExtensionTest {
|
||||||
|
|
||||||
String exampleMessageStanza = "<message " + "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
private static final String exampleMessageStanza = "<message " + "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>"
|
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>"
|
||||||
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||||
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "</message>";
|
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "</message>";
|
||||||
|
|
||||||
String exampleMessageStanzaWithVersion = "<message "
|
private static final String exampleMessageStanzaWithVersion = "<message "
|
||||||
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>qwerty</version>"
|
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>qwerty</version>"
|
||||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||||
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "<body></body>" + "</message>";
|
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "<body></body>" + "</message>";
|
||||||
|
|
||||||
String exampleMessageStanzaWithPrevVersion = "<message "
|
private static final String exampleMessageStanzaWithPrevVersion = "<message "
|
||||||
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
|
||||||
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<prev-version>njiokm</prev-version>"
|
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<prev-version>njiokm</prev-version>"
|
||||||
+ "<version>qwerty</version>" + "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
+ "<version>qwerty</version>" + "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||||
|
@ -50,7 +50,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkAffiliationsChangeExtension() throws Exception {
|
public void checkAffiliationsChangeExtension() throws Exception {
|
||||||
Message changeAffiliationsMessage = (Message) PacketParserUtils.parseStanza(exampleMessageStanza);
|
Message changeAffiliationsMessage = PacketParserUtils.parseStanza(exampleMessageStanza);
|
||||||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||||
.from(changeAffiliationsMessage);
|
.from(changeAffiliationsMessage);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkAffiliationsChangeExtensionWithVersion() throws Exception {
|
public void checkAffiliationsChangeExtensionWithVersion() throws Exception {
|
||||||
Message changeAffiliationsMessage = (Message) PacketParserUtils.parseStanza(exampleMessageStanzaWithVersion);
|
Message changeAffiliationsMessage = PacketParserUtils.parseStanza(exampleMessageStanzaWithVersion);
|
||||||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||||
.from(changeAffiliationsMessage);
|
.from(changeAffiliationsMessage);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class MUCLightAffiliationsChangeExtensionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkAffiliationsChangeExtensionWithPrevVersion() throws Exception {
|
public void checkAffiliationsChangeExtensionWithPrevVersion() throws Exception {
|
||||||
Message changeAffiliationsMessage = (Message) PacketParserUtils
|
Message changeAffiliationsMessage = PacketParserUtils
|
||||||
.parseStanza(exampleMessageStanzaWithPrevVersion);
|
.parseStanza(exampleMessageStanzaWithPrevVersion);
|
||||||
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension
|
||||||
.from(changeAffiliationsMessage);
|
.from(changeAffiliationsMessage);
|
||||||
|
|
|
@ -31,25 +31,25 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightBlockingTest {
|
public class MUCLightBlockingTest {
|
||||||
|
|
||||||
String getBlockingListIQExample = "<iq to='muclight.shakespeare.lit' id='getblock1' type='get'>"
|
private static final String getBlockingListIQExample = "<iq to='muclight.shakespeare.lit' id='getblock1' type='get'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>" + "</query>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String getBlockingListIQResponse = "<iq type='result' id='getblock1' to='crone1@shakespeare.lit/desktop' from='muclight.shakespeare.lit'>"
|
private static final String getBlockingListIQResponse = "<iq type='result' id='getblock1' to='crone1@shakespeare.lit/desktop' from='muclight.shakespeare.lit'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
||||||
+ "<room action='deny'>coven@muclight.shakespeare.lit</room>"
|
+ "<room action='deny'>coven@muclight.shakespeare.lit</room>"
|
||||||
+ "<room action='deny'>sarasa@muclight.shakespeare.lit</room>"
|
+ "<room action='deny'>sarasa@muclight.shakespeare.lit</room>"
|
||||||
+ "<user action='deny'>hag77@shakespeare.lit</user>" + "</query>" + "</iq>";
|
+ "<user action='deny'>hag77@shakespeare.lit</user>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String blockingRoomsIQExample = "<iq to='muclight.shakespeare.lit' id='block1' type='set'>"
|
private static final String blockingRoomsIQExample = "<iq to='muclight.shakespeare.lit' id='block1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
||||||
+ "<room action='deny'>coven@muclight.shakespeare.lit</room>"
|
+ "<room action='deny'>coven@muclight.shakespeare.lit</room>"
|
||||||
+ "<room action='deny'>chapel@shakespeare.lit</room>" + "</query>" + "</iq>";
|
+ "<room action='deny'>chapel@shakespeare.lit</room>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String blockingUsersIQExample = "<iq to='muclight.shakespeare.lit' id='block2' type='set'>"
|
private static final String blockingUsersIQExample = "<iq to='muclight.shakespeare.lit' id='block2' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>" + "<user action='deny'>hag77@shakespeare.lit</user>"
|
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>" + "<user action='deny'>hag77@shakespeare.lit</user>"
|
||||||
+ "<user action='deny'>hag66@shakespeare.lit</user>" + "</query>" + "</iq>";
|
+ "<user action='deny'>hag66@shakespeare.lit</user>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String unblockingUsersAndRoomsExample = "<iq to='muclight.shakespeare.lit' id='unblock1' type='set'>"
|
private static final String unblockingUsersAndRoomsExample = "<iq to='muclight.shakespeare.lit' id='unblock1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
+ "<query xmlns='urn:xmpp:muclight:0#blocking'>"
|
||||||
+ "<room action='allow'>coven@muclight.shakespeare.lit</room>"
|
+ "<room action='allow'>coven@muclight.shakespeare.lit</room>"
|
||||||
+ "<user action='allow'>hag66@shakespeare.lit</user>" + "</query>" + "</iq>";
|
+ "<user action='allow'>hag66@shakespeare.lit</user>" + "</query>" + "</iq>";
|
||||||
|
@ -66,7 +66,7 @@ public class MUCLightBlockingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkGetBlockingListResponse() throws Exception {
|
public void checkGetBlockingListResponse() throws Exception {
|
||||||
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getBlockingListIQResponse);
|
IQ iqInfoResult = PacketParserUtils.parseStanza(getBlockingListIQResponse);
|
||||||
MUCLightBlockingIQ mucLightBlockingIQ = (MUCLightBlockingIQ) iqInfoResult;
|
MUCLightBlockingIQ mucLightBlockingIQ = (MUCLightBlockingIQ) iqInfoResult;
|
||||||
|
|
||||||
Assert.assertEquals(2, mucLightBlockingIQ.getRooms().size());
|
Assert.assertEquals(2, mucLightBlockingIQ.getRooms().size());
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightChangeAffiliationsIQTest {
|
public class MUCLightChangeAffiliationsIQTest {
|
||||||
|
|
||||||
String stanza = "<iq " + "to='coven@muclight.shakespeare.lit' id='member1' type='set'>"
|
private static final String stanza = "<iq " + "to='coven@muclight.shakespeare.lit' id='member1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>"
|
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>"
|
||||||
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
|
||||||
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
|
||||||
|
|
|
@ -26,23 +26,23 @@ import org.junit.Test;
|
||||||
|
|
||||||
public class MUCLightConfigurationsChangeExtensionTest {
|
public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
|
|
||||||
String messageWithSubjectChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
private static final String messageWithSubjectChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>"
|
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>"
|
||||||
+ "<prev-version>asdfghj000</prev-version>" + "<version>asdfghj</version>"
|
+ "<prev-version>asdfghj000</prev-version>" + "<version>asdfghj</version>"
|
||||||
+ "<subject>To be or not to be?</subject>" + "</x>" + "</message>";
|
+ "<subject>To be or not to be?</subject>" + "</x>" + "</message>";
|
||||||
|
|
||||||
String messageWithRoomNameChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
private static final String messageWithRoomNameChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
||||||
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "</x>" + "</message>";
|
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "</x>" + "</message>";
|
||||||
|
|
||||||
String messageWithConfigsChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
private static final String messageWithConfigsChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
|
||||||
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
|
||||||
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "<color>blue</color>" + "</x>"
|
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "<color>blue</color>" + "</x>"
|
||||||
+ "</message>";
|
+ "</message>";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkSubjectChangeExtension() throws Exception {
|
public void checkSubjectChangeExtension() throws Exception {
|
||||||
Message configurationsMessage = (Message) PacketParserUtils.parseStanza(messageWithSubjectChangeExample);
|
Message configurationsMessage = PacketParserUtils.parseStanza(messageWithSubjectChangeExample);
|
||||||
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
||||||
.from(configurationsMessage);
|
.from(configurationsMessage);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkRoomNameChangeExtension() throws Exception {
|
public void checkRoomNameChangeExtension() throws Exception {
|
||||||
Message configurationsMessage = (Message) PacketParserUtils.parseStanza(messageWithRoomNameChangeExample);
|
Message configurationsMessage = PacketParserUtils.parseStanza(messageWithRoomNameChangeExample);
|
||||||
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
||||||
.from(configurationsMessage);
|
.from(configurationsMessage);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class MUCLightConfigurationsChangeExtensionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkConfigsChangeExtension() throws Exception {
|
public void checkConfigsChangeExtension() throws Exception {
|
||||||
Message configurationsMessage = (Message) PacketParserUtils.parseStanza(messageWithConfigsChangeExample);
|
Message configurationsMessage = PacketParserUtils.parseStanza(messageWithConfigsChangeExample);
|
||||||
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
ConfigurationsChangeExtension configurationsChangeExtension = ConfigurationsChangeExtension
|
||||||
.from(configurationsMessage);
|
.from(configurationsMessage);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightCreateIQTest {
|
public class MUCLightCreateIQTest {
|
||||||
|
|
||||||
String stanza = "<iq to='ef498f55-5f79-4238-a5ae-4efe19cbe617@muclight.test.com' id='1c72W-50' type='set'>"
|
private static final String stanza = "<iq to='ef498f55-5f79-4238-a5ae-4efe19cbe617@muclight.test.com' id='1c72W-50' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#create'>" + "<configuration>" + "<roomname>test</roomname>"
|
+ "<query xmlns='urn:xmpp:muclight:0#create'>" + "<configuration>" + "<roomname>test</roomname>"
|
||||||
+ "</configuration>" + "<occupants>" + "<user affiliation='member'>charlie@test.com</user>"
|
+ "</configuration>" + "<occupants>" + "<user affiliation='member'>charlie@test.com</user>"
|
||||||
+ "<user affiliation='member'>pep@test.com</user>" + "</occupants>" + "</query>" + "</iq>";
|
+ "<user affiliation='member'>pep@test.com</user>" + "</occupants>" + "</query>" + "</iq>";
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightDestroyTest {
|
public class MUCLightDestroyTest {
|
||||||
|
|
||||||
String stanza = "<iq to='coven@muclight.shakespeare.lit' id='destroy1' type='set'>"
|
private static final String stanza = "<iq to='coven@muclight.shakespeare.lit' id='destroy1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#destroy'/>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#destroy'/>" + "</iq>";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -31,10 +31,10 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightGetAffiliationsTest {
|
public class MUCLightGetAffiliationsTest {
|
||||||
|
|
||||||
String getAffiliationsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='getmembers' type='get'>"
|
private static final String getAffiliationsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='getmembers' type='get'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String getAffiliationsResponseExample = "<iq from='coven@muclight.shakespeare.lit' id='getmembers' to='crone1@shakespeare.lit/desktop' type='result'>"
|
private static final String getAffiliationsResponseExample = "<iq from='coven@muclight.shakespeare.lit' id='getmembers' to='crone1@shakespeare.lit/desktop' type='result'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>123456</version>"
|
+ "<query xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>123456</version>"
|
||||||
+ "<user affiliation='owner'>user1@shakespeare.lit</user>"
|
+ "<user affiliation='owner'>user1@shakespeare.lit</user>"
|
||||||
+ "<user affiliation='member'>user2@shakespeare.lit</user>"
|
+ "<user affiliation='member'>user2@shakespeare.lit</user>"
|
||||||
|
@ -50,7 +50,7 @@ public class MUCLightGetAffiliationsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkGetAffiliationsResponse() throws Exception {
|
public void checkGetAffiliationsResponse() throws Exception {
|
||||||
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getAffiliationsResponseExample);
|
IQ iqInfoResult = PacketParserUtils.parseStanza(getAffiliationsResponseExample);
|
||||||
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) iqInfoResult;
|
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) iqInfoResult;
|
||||||
|
|
||||||
Assert.assertEquals("123456", mucLightAffiliationsIQ.getVersion());
|
Assert.assertEquals("123456", mucLightAffiliationsIQ.getVersion());
|
||||||
|
|
|
@ -30,15 +30,15 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightGetConfigsTest {
|
public class MUCLightGetConfigsTest {
|
||||||
|
|
||||||
String getConfigsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='config0' type='get'>"
|
private static final String getConfigsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='config0' type='get'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String getConfigsResponseExample = "<iq from='coven@muclight.shakespeare.lit' id='getconfig1' "
|
private static final String getConfigsResponseExample = "<iq from='coven@muclight.shakespeare.lit' id='getconfig1' "
|
||||||
+ "to='crone1@shakespeare.lit/desktop' type='result'>" + "<query xmlns='urn:xmpp:muclight:0#configuration'>"
|
+ "to='crone1@shakespeare.lit/desktop' type='result'>" + "<query xmlns='urn:xmpp:muclight:0#configuration'>"
|
||||||
+ "<version>123456</version>" + "<roomname>A Dark Cave</roomname>" + "<subject>A subject</subject>"
|
+ "<version>123456</version>" + "<roomname>A Dark Cave</roomname>" + "<subject>A subject</subject>"
|
||||||
+ "</query>" + "</iq>";
|
+ "</query>" + "</iq>";
|
||||||
|
|
||||||
String getConfigsResponseExampleWithCustomConfigs = "<iq from='coven@muclight.shakespeare.lit' id='getconfig2' "
|
private static final String getConfigsResponseExampleWithCustomConfigs = "<iq from='coven@muclight.shakespeare.lit' id='getconfig2' "
|
||||||
+ "to='crone1@shakespeare.lit/desktop' type='result'>" + "<query xmlns='urn:xmpp:muclight:0#configuration'>"
|
+ "to='crone1@shakespeare.lit/desktop' type='result'>" + "<query xmlns='urn:xmpp:muclight:0#configuration'>"
|
||||||
+ "<version>123456</version>" + "<roomname>A Dark Cave</roomname>" + "<color>blue</color>"
|
+ "<version>123456</version>" + "<roomname>A Dark Cave</roomname>" + "<color>blue</color>"
|
||||||
+ "<size>20</size>" + "</query>" + "</iq>";
|
+ "<size>20</size>" + "</query>" + "</iq>";
|
||||||
|
@ -53,7 +53,7 @@ public class MUCLightGetConfigsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkGetConfigsResponse() throws Exception {
|
public void checkGetConfigsResponse() throws Exception {
|
||||||
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getConfigsResponseExample);
|
IQ iqInfoResult = PacketParserUtils.parseStanza(getConfigsResponseExample);
|
||||||
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) iqInfoResult;
|
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) iqInfoResult;
|
||||||
|
|
||||||
Assert.assertEquals("123456", mucLightConfigurationIQ.getVersion());
|
Assert.assertEquals("123456", mucLightConfigurationIQ.getVersion());
|
||||||
|
@ -64,7 +64,7 @@ public class MUCLightGetConfigsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkGetConfigsResponseWithCustomConfigs() throws Exception {
|
public void checkGetConfigsResponseWithCustomConfigs() throws Exception {
|
||||||
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getConfigsResponseExampleWithCustomConfigs);
|
IQ iqInfoResult = PacketParserUtils.parseStanza(getConfigsResponseExampleWithCustomConfigs);
|
||||||
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) iqInfoResult;
|
MUCLightConfigurationIQ mucLightConfigurationIQ = (MUCLightConfigurationIQ) iqInfoResult;
|
||||||
|
|
||||||
Assert.assertEquals("123456", mucLightConfigurationIQ.getVersion());
|
Assert.assertEquals("123456", mucLightConfigurationIQ.getVersion());
|
||||||
|
|
|
@ -28,13 +28,13 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightInfoTest {
|
public class MUCLightInfoTest {
|
||||||
|
|
||||||
String exampleWithVersion = "<iq to='coven@muclight.shakespeare.lit' id='getinfo1' type='get'>"
|
private static final String exampleWithVersion = "<iq to='coven@muclight.shakespeare.lit' id='getinfo1' type='get'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "<version>abcdefg</version>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String exampleWithoutVersion = "<iq to='coven@muclight.shakespeare.lit' id='getinfo1' type='get'>"
|
private static final String exampleWithoutVersion = "<iq to='coven@muclight.shakespeare.lit' id='getinfo1' type='get'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "</query>" + "</iq>";
|
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String exampleInfoResult = "<iq from='coven@muclight.shakespeare.lit' to='cronel@shakespeare.lit/desktop' id='getinfo1' type='result'>"
|
private static final String exampleInfoResult = "<iq from='coven@muclight.shakespeare.lit' to='cronel@shakespeare.lit/desktop' id='getinfo1' type='result'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "<version>123456</version>" + "<configuration>"
|
+ "<query xmlns='urn:xmpp:muclight:0#info'>" + "<version>123456</version>" + "<configuration>"
|
||||||
+ "<roomname>test</roomname>" + "</configuration>" + "<occupants>"
|
+ "<roomname>test</roomname>" + "</configuration>" + "<occupants>"
|
||||||
+ "<user affiliation='owner'>john@test.com</user>" + "<user affiliation='member'>charlie@test.com</user>"
|
+ "<user affiliation='owner'>john@test.com</user>" + "<user affiliation='member'>charlie@test.com</user>"
|
||||||
|
@ -58,7 +58,7 @@ public class MUCLightInfoTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkMUCLightInfoResult() throws Exception {
|
public void checkMUCLightInfoResult() throws Exception {
|
||||||
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(exampleInfoResult);
|
IQ iqInfoResult = PacketParserUtils.parseStanza(exampleInfoResult);
|
||||||
MUCLightInfoIQ mucLightInfoResponseIQ = (MUCLightInfoIQ) iqInfoResult;
|
MUCLightInfoIQ mucLightInfoResponseIQ = (MUCLightInfoIQ) iqInfoResult;
|
||||||
Assert.assertEquals(mucLightInfoResponseIQ.getVersion(), "123456");
|
Assert.assertEquals(mucLightInfoResponseIQ.getVersion(), "123456");
|
||||||
Assert.assertEquals(mucLightInfoResponseIQ.getConfiguration().getRoomName(), "test");
|
Assert.assertEquals(mucLightInfoResponseIQ.getConfiguration().getRoomName(), "test");
|
||||||
|
|
|
@ -26,15 +26,15 @@ import org.jxmpp.jid.impl.JidCreate;
|
||||||
|
|
||||||
public class MUCLightSetConfigsIQTest {
|
public class MUCLightSetConfigsIQTest {
|
||||||
|
|
||||||
String setConfigsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='conf1' type='set'>"
|
private static final String setConfigsIQExample = "<iq to='coven@muclight.shakespeare.lit' id='conf1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<roomname>A Darker Cave</roomname>"
|
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<roomname>A Darker Cave</roomname>"
|
||||||
+ "<color>blue</color>" + "</query>" + "</iq>";
|
+ "<color>blue</color>" + "</query>" + "</iq>";
|
||||||
|
|
||||||
String changeRoomNameIQExample = "<iq to='coven@muclight.shakespeare.lit' id='roomName1' type='set'>"
|
private static final String changeRoomNameIQExample = "<iq to='coven@muclight.shakespeare.lit' id='roomName1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<roomname>A Darker Cave</roomname>" + "</query>"
|
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<roomname>A Darker Cave</roomname>" + "</query>"
|
||||||
+ "</iq>";
|
+ "</iq>";
|
||||||
|
|
||||||
String changeSubjectIQExample = "<iq to='coven@muclight.shakespeare.lit' id='subject1' type='set'>"
|
private static final String changeSubjectIQExample = "<iq to='coven@muclight.shakespeare.lit' id='subject1' type='set'>"
|
||||||
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<subject>To be or not to be?</subject>"
|
+ "<query xmlns='urn:xmpp:muclight:0#configuration'>" + "<subject>To be or not to be?</subject>"
|
||||||
+ "</query>" + "</iq>";
|
+ "</query>" + "</iq>";
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue