mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-02-18 06:39:23 +01:00
Compare commits
32 commits
adfca965b5
...
32ae0d8826
Author | SHA1 | Date | |
---|---|---|---|
|
32ae0d8826 | ||
|
5d5fd1a964 | ||
|
2b41a67028 | ||
|
268425854a | ||
|
5d10afbb11 | ||
|
e8fef260e6 | ||
|
fdeaaf368e | ||
|
31d69b07f9 | ||
|
5438fb7b33 | ||
|
d498cd8499 | ||
|
7bc2ebb731 | ||
|
7a57bb7c09 | ||
|
9879dea0bf | ||
|
0479a75d1d | ||
|
de0f3cd06c | ||
|
e63ba07e5c | ||
|
8c4513a618 | ||
|
c10a56dc84 | ||
|
516c68bdb4 | ||
|
28e763f938 | ||
|
463dfac48d | ||
|
4ccced906e | ||
|
b5f9d4d7a3 | ||
|
4a99f7252c | ||
|
2c83c73005 | ||
|
594d2f5238 | ||
48d5ef9522 | |||
6d0bf04c1e | |||
85ff749d89 | |||
2391cffa97 | |||
a8b2446042 | |||
|
340e186cf6 |
194 changed files with 1229 additions and 616 deletions
16
build.gradle
16
build.gradle
|
@ -23,8 +23,8 @@ apply plugin: 'org.kordamp.gradle.markdown'
|
|||
apply from: 'version.gradle'
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'java-test-fixtures'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'jacoco'
|
||||
|
@ -123,15 +123,12 @@ allprojects {
|
|||
androidJavadocOffline = { getAndroidJavadocOffline() }
|
||||
junit4Projects = [
|
||||
':smack-core',
|
||||
':smack-extensions',
|
||||
':smack-im',
|
||||
':smack-integration-test',
|
||||
':smack-omemo',
|
||||
':smack-omemo-signal',
|
||||
':smack-openpgp',
|
||||
].collect { project(it) }
|
||||
junitVersion = '5.6.0'
|
||||
powerMockVersion = '2.0.2'
|
||||
commonsIoVersion = '2.6'
|
||||
if (project.hasProperty("useSonatype")) {
|
||||
useSonatype = project.getProperty("useSonatype").toBoolean()
|
||||
|
@ -267,10 +264,16 @@ allprojects {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testFixturesApi "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||
|
||||
// The smack-extensions subproject uses mockito in its fest
|
||||
// fixtures, and we want to have mockito also available in
|
||||
// test, so we use API here.
|
||||
testFixturesApi "org.mockito:mockito-core:3.3.3"
|
||||
testImplementation 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
||||
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
|
||||
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
|
||||
}
|
||||
|
@ -283,9 +286,6 @@ allprojects {
|
|||
configure (junit4Projects) {
|
||||
dependencies {
|
||||
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||
testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion"
|
||||
testImplementation "org.powermock:powermock-module-junit4-rule:$powerMockVersion"
|
||||
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,5 +9,5 @@ it disabled until gradle uses a checkstyle version where this is fixed
|
|||
<suppress checks="GenericWhitespace"
|
||||
files="Protocol.java" />
|
||||
<!-- Suppress JavadocPackage in the test packages -->
|
||||
<suppress checks="JavadocPackage" files="[\\/]test[\\/]"/>
|
||||
<suppress checks="JavadocPackage" files="[\\/]test(Fixtures)?[\\/]"/>
|
||||
</suppressions>
|
||||
|
|
|
@ -10,10 +10,19 @@ dependencies {
|
|||
compile "org.jxmpp:jxmpp-core:$jxmppVersion"
|
||||
compile "org.jxmpp:jxmpp-jid:$jxmppVersion"
|
||||
compile "org.minidns:minidns-core:$miniDnsVersion"
|
||||
testCompile project(':smack-xmlparser-stax')
|
||||
testCompile project(':smack-xmlparser-xpp3')
|
||||
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||
testCompile "org.xmlunit:xmlunit-core:$xmlUnitVersion"
|
||||
|
||||
testFixturesImplementation project(':smack-xmlparser-stax')
|
||||
testFixturesImplementation project(':smack-xmlparser-xpp3')
|
||||
|
||||
// Bouncy Castle is setup by SmackTestSuite. We deliberately use
|
||||
// 'implementation' here since there is no need to shadow it
|
||||
// outside of the fixtures compilation classpath. That is, no test
|
||||
// should ever setup Bouncy Castle as security provider explicitly.
|
||||
testFixturesImplementation 'org.bouncycastle:bcprov-jdk15on:1.64'
|
||||
testFixturesImplementation 'org.apache.commons:commons-lang3:3.10'
|
||||
|
||||
testFixturesApi "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||
testFixturesApi "org.xmlunit:xmlunit-core:$xmlUnitVersion"
|
||||
// Explictily add assertj-core which is a dependency of
|
||||
// xmlunit-assertj, but gradle fails to resolves it with:
|
||||
// Execution failed for task ':smack-core:compileTestJava'.
|
||||
|
@ -21,12 +30,9 @@ dependencies {
|
|||
// > Could not find org.assertj:assertj-core:.
|
||||
// Required by:
|
||||
// project :smack-core > org.xmlunit:xmlunit-assertj:2.6.2
|
||||
testCompile "org.assertj:assertj-core:3.11.1"
|
||||
testCompile "org.xmlunit:xmlunit-assertj:$xmlUnitVersion"
|
||||
testCompile 'com.jamesmurty.utils:java-xmlbuilder:1.2'
|
||||
testCompile 'org.bouncycastle:bcprov-jdk15on:1.64'
|
||||
testCompile 'com.google.guava:guava:28.2-jre'
|
||||
testCompile 'org.jgrapht:jgrapht-io:1.3.1'
|
||||
testFixturesApi "org.assertj:assertj-core:3.11.1"
|
||||
testFixturesApi "org.xmlunit:xmlunit-assertj:$xmlUnitVersion"
|
||||
testFixturesApi 'org.hamcrest:hamcrest-library:2.2'
|
||||
}
|
||||
|
||||
class CreateFileTask extends DefaultTask {
|
||||
|
|
|
@ -2154,6 +2154,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
CACHED_EXECUTOR_SERVICE.execute(runnable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
protected final SmackReactor getReactor() {
|
||||
return SMACK_REACTOR;
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
|||
/**
|
||||
* Returns the first extension of this stanza that has the given namespace.
|
||||
* <p>
|
||||
* When possible, use {@link #getExtension(String, String)} instead.
|
||||
* When possible, use {@link #getExtensionElement(String, String)} instead.
|
||||
* </p>
|
||||
*
|
||||
* @param namespace the namespace of the extension that is desired.
|
||||
|
@ -350,15 +350,18 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
|||
|
||||
/**
|
||||
* Returns the first extension that matches the specified element name and
|
||||
* namespace, or <code>null</code> if it doesn't exist. If the provided elementName is null,
|
||||
* only the namespace is matched. Extensions are
|
||||
* namespace, or <code>null</code> if it doesn't exist. Extensions are
|
||||
* are arbitrary XML elements in standard XMPP stanzas.
|
||||
* <p>
|
||||
* Note that it is recommended to use {@link #getExtension(Class)} instead of this method.
|
||||
* The {@link #getExtension(Class)} is more robust, as it is type safe.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName the XML element name of the extension. (May be null)
|
||||
* @param elementName the XML element name of the extension.
|
||||
* @param namespace the XML element namespace of the extension.
|
||||
* @return the extension, or <code>null</code> if it doesn't exist.
|
||||
*/
|
||||
public final ExtensionElement getExtension(String elementName, String namespace) {
|
||||
public final ExtensionElement getExtensionElement(String elementName, String namespace) {
|
||||
if (namespace == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -370,6 +373,22 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
|
|||
return packetExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is deprecated. Use preferably {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)}.
|
||||
*
|
||||
* @param <E> the type to cast to.
|
||||
* @param elementName the XML element name of the extension. (May be null)
|
||||
* @param namespace the XML element namespace of the extension.
|
||||
* @return the extension, or <code>null</code> if it doesn't exist.
|
||||
* @deprecated use {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)} isntead.
|
||||
*/
|
||||
// TODO: Remove in Smack 4.5.
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public final <E extends ExtensionElement> E getExtension(String elementName, String namespace) {
|
||||
return (E) getExtensionElement(elementName, namespace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ExtensionElement getExtension(QName qname) {
|
||||
synchronized (extensionElements) {
|
||||
|
|
|
@ -87,10 +87,14 @@ public interface StanzaView extends XmlLangElement {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default <E extends ExtensionElement> E getExtension(Class<E> extensionElementClass) {
|
||||
QName qname = XmppElementUtil.getQNameFor(extensionElementClass);
|
||||
return (E) getExtension(qname);
|
||||
ExtensionElement extensionElement = getExtension(qname);
|
||||
if (!extensionElementClass.isInstance(extensionElement)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return extensionElementClass.cast(extensionElement);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.smack;
|
||||
|
||||
import java.io.IOException;
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014 Florian Schmaus
|
||||
* Copyright © 2014-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -17,7 +17,6 @@
|
|||
package org.jivesoftware.smack.test.util;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class CharSequenceEquals extends TypeSafeMatcher<CharSequence> {
|
|||
return charSequenceString.equals(itemString);
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<CharSequence> equalsCharSequence(CharSequence charSequence) {
|
||||
return new CharSequenceEquals(charSequence);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2019 Florian Schmaus
|
||||
* Copyright 2019-2020 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -14,9 +14,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.util;
|
||||
package org.jivesoftware.smack.test.util;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.lang.ref.PhantomReference;
|
||||
|
@ -129,7 +129,7 @@ public class MemoryLeakTestUtil {
|
|||
}
|
||||
|
||||
Reference<?> reference = referenceQueue.poll();
|
||||
assertNull("Reference queue is not empty when it should be", reference);
|
||||
assertNull(reference, "Reference queue is not empty when it should be");
|
||||
}
|
||||
|
||||
private static void assertReferencesQueueIsEmpty(ReferenceQueue<?> referenceQueue) {
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smack.util;
|
||||
package org.jivesoftware.smack.test.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.BindException;
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2020 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 java.lang.reflect.Field;
|
||||
|
||||
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||
|
||||
public class Whitebox {
|
||||
|
||||
public static <T> T getInternalState(Object object, String fieldName, Class<T> fieldType) {
|
||||
Class<?> objectClass = object.getClass();
|
||||
|
||||
Field field = FieldUtils.getField(objectClass, fieldName, true);
|
||||
|
||||
Object res;
|
||||
try {
|
||||
res = field.get(object);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
if (!fieldType.isInstance(res)) {
|
||||
throw new AssertionError(res + " is not a (sub)type of " + fieldType);
|
||||
}
|
||||
|
||||
return fieldType.cast(res);
|
||||
}
|
||||
|
||||
}
|
|
@ -6,5 +6,4 @@ Connect your favourite slf4j backend of choice to get output inside of it"""
|
|||
dependencies {
|
||||
compile project(':smack-core')
|
||||
compile 'org.slf4j:slf4j-api:[1.7,1.8)'
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -4,5 +4,4 @@ Inspect the exchanged XMPP stanzas."""
|
|||
|
||||
dependencies {
|
||||
compile project(':smack-core')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ between patch versions."""
|
|||
dependencies {
|
||||
compile project(':smack-core')
|
||||
compile project(':smack-extensions')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testCompile project(path: ":smack-extensions", configuration: "testRuntime")
|
||||
|
||||
compile "org.hsluv:hsluv:0.2"
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-extensions")))
|
||||
}
|
||||
|
|
|
@ -114,9 +114,9 @@ public class CarbonExtension implements ExtensionElement {
|
|||
* @return a Carbon if available, null otherwise.
|
||||
*/
|
||||
public static CarbonExtension from(Message msg) {
|
||||
CarbonExtension cc = (CarbonExtension) msg.getExtension(Direction.received.name(), NAMESPACE);
|
||||
CarbonExtension cc = (CarbonExtension) msg.getExtensionElement(Direction.received.name(), NAMESPACE);
|
||||
if (cc == null)
|
||||
cc = (CarbonExtension) msg.getExtension(Direction.sent.name(), NAMESPACE);
|
||||
cc = (CarbonExtension) msg.getExtensionElement(Direction.sent.name(), NAMESPACE);
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class DnsOverXmppManager extends Manager {
|
|||
|
||||
private static DnsOverXmppResolver defaultResolver;
|
||||
|
||||
public void setDefaultDnsOverXmppResolver(DnsOverXmppResolver resolver) {
|
||||
public static void setDefaultDnsOverXmppResolver(DnsOverXmppResolver resolver) {
|
||||
defaultResolver = resolver;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NoCopyHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
public static NoCopyHint from(Message message) {
|
||||
return (NoCopyHint) message.getExtension(ELEMENT, NAMESPACE);
|
||||
return (NoCopyHint) message.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
public static boolean hasHint(Message message) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NoPermanentStoreHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
public static NoPermanentStoreHint from(Message message) {
|
||||
return (NoPermanentStoreHint) message.getExtension(ELEMENT, NAMESPACE);
|
||||
return (NoPermanentStoreHint) message.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
public static boolean hasHint(Message message) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NoStoreHint extends MessageProcessingHint {
|
|||
}
|
||||
|
||||
public static NoStoreHint from(Message message) {
|
||||
return (NoStoreHint) message.getExtension(ELEMENT, NAMESPACE);
|
||||
return (NoStoreHint) message.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
public static boolean hasHint(Message message) {
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.httpfileupload.UploadService.Version;
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
|
|||
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
|
||||
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
|
||||
|
@ -101,7 +102,7 @@ public class JingleFileTransferProvider
|
|||
builder = JingleFileTransferChild.getBuilder();
|
||||
break;
|
||||
|
||||
case JingleFileTransfer.ELEMENT:
|
||||
case JingleContentDescription.ELEMENT:
|
||||
return new JingleFileTransfer(payloads);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.jivesoftware.smackx.commands.AdHocCommandManager;
|
||||
import org.jivesoftware.smackx.commands.RemoteCommand;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
|
|
|
@ -140,7 +140,7 @@ public class MamElements {
|
|||
}
|
||||
|
||||
public static MamResultExtension from(Message message) {
|
||||
return (MamResultExtension) message.getExtension(ELEMENT, NAMESPACE);
|
||||
return (MamResultExtension) message.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement;
|
|||
import org.jivesoftware.smackx.message_markup.element.CodeBlockElement;
|
||||
import org.jivesoftware.smackx.message_markup.element.ListElement;
|
||||
import org.jivesoftware.smackx.message_markup.element.MarkupElement;
|
||||
import org.jivesoftware.smackx.message_markup.element.MarkupElement.MarkupChildElement;
|
||||
import org.jivesoftware.smackx.message_markup.element.SpanElement;
|
||||
|
||||
public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> {
|
||||
|
@ -55,26 +56,26 @@ public class MarkupElementProvider extends ExtensionElementProvider<MarkupElemen
|
|||
case START_ELEMENT:
|
||||
switch (name) {
|
||||
case BlockQuoteElement.ELEMENT:
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, BlockQuoteElement.ATTR_START,
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||
"Message Markup BlockQuoteElement MUST contain a 'start' attribute.");
|
||||
end = ParserUtils.getIntegerAttributeOrThrow(parser, BlockQuoteElement.ATTR_END,
|
||||
end = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
|
||||
"Message Markup BlockQuoteElement MUST contain a 'end' attribute.");
|
||||
markup.setBlockQuote(start, end);
|
||||
break;
|
||||
|
||||
case CodeBlockElement.ELEMENT:
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, CodeBlockElement.ATTR_START,
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||
"Message Markup CodeBlockElement MUST contain a 'start' attribute.");
|
||||
end = ParserUtils.getIntegerAttributeOrThrow(parser, CodeBlockElement.ATTR_END,
|
||||
end = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
|
||||
"Message Markup CodeBlockElement MUST contain a 'end' attribute.");
|
||||
markup.setCodeBlock(start, end);
|
||||
break;
|
||||
|
||||
case SpanElement.ELEMENT:
|
||||
spanStyles = new HashSet<>();
|
||||
spanStart = ParserUtils.getIntegerAttributeOrThrow(parser, SpanElement.ATTR_START,
|
||||
spanStart = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||
"Message Markup SpanElement MUST contain a 'start' attribute.");
|
||||
spanEnd = ParserUtils.getIntegerAttributeOrThrow(parser, SpanElement.ATTR_END,
|
||||
spanEnd = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
|
||||
"Message Markup SpanElement MUST contain a 'end' attribute.");
|
||||
break;
|
||||
|
||||
|
@ -92,14 +93,14 @@ public class MarkupElementProvider extends ExtensionElementProvider<MarkupElemen
|
|||
|
||||
case ListElement.ELEMENT:
|
||||
lis = new ArrayList<>();
|
||||
listStart = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_START,
|
||||
listStart = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||
"Message Markup ListElement MUST contain a 'start' attribute.");
|
||||
listEnd = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_END,
|
||||
listEnd = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
|
||||
"Message Markup ListElement MUST contain a 'end' attribute.");
|
||||
break;
|
||||
|
||||
case ListElement.ELEM_LI:
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_START,
|
||||
start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
|
||||
"Message Markup ListElement 'li' MUST contain a 'start' attribute.");
|
||||
lis.add(new ListElement.ListEntryElement(start));
|
||||
break;
|
||||
|
|
|
@ -147,7 +147,6 @@ public class MultiUserChatLight {
|
|||
* for the newly created chat.
|
||||
* @return new Chat for sending private messages to a given room occupant.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
// Do not re-use Chat API, which was designed for XMPP-IM 1:1 chats and not MUClight private chats.
|
||||
public org.jivesoftware.smack.chat.Chat createPrivateChat(EntityJid occupant, ChatMessageListener listener) {
|
||||
|
|
|
@ -233,7 +233,7 @@ public abstract class MUCLightElements {
|
|||
}
|
||||
|
||||
public static ConfigurationsChangeExtension from(Message message) {
|
||||
return (ConfigurationsChangeExtension) message.getExtension(ConfigurationsChangeExtension.ELEMENT, ConfigurationsChangeExtension.NAMESPACE);
|
||||
return (ConfigurationsChangeExtension) message.getExtensionElement(ConfigurationsChangeExtension.ELEMENT, ConfigurationsChangeExtension.NAMESPACE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class OriginIdElement extends StableAndUniqueIdElement {
|
|||
* @return origin-id element
|
||||
*/
|
||||
public static OriginIdElement getOriginId(Message message) {
|
||||
return (OriginIdElement) message.getExtension(OriginIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE);
|
||||
return (OriginIdElement) message.getExtensionElement(OriginIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
|||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.sid.element.OriginIdElement;
|
||||
import org.jivesoftware.smackx.sid.element.StableAndUniqueIdElement;
|
||||
|
||||
public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement> {
|
||||
|
||||
|
@ -32,6 +33,6 @@ public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement>
|
|||
|
||||
@Override
|
||||
public OriginIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
|
||||
return new OriginIdElement(parser.getAttributeValue(null, OriginIdElement.ATTR_ID));
|
||||
return new OriginIdElement(parser.getAttributeValue(null, StableAndUniqueIdElement.ATTR_ID));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
|
|||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.sid.element.StableAndUniqueIdElement;
|
||||
import org.jivesoftware.smackx.sid.element.StanzaIdElement;
|
||||
|
||||
public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement> {
|
||||
|
@ -28,7 +29,7 @@ public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement>
|
|||
|
||||
@Override
|
||||
public StanzaIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
|
||||
String id = parser.getAttributeValue(null, StanzaIdElement.ATTR_ID);
|
||||
String id = parser.getAttributeValue(null, StableAndUniqueIdElement.ATTR_ID);
|
||||
String by = parser.getAttributeValue(null, StanzaIdElement.ATTR_BY);
|
||||
return new StanzaIdElement(id, by);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,9 @@ package org.jivesoftware.smackx.hashes;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.security.Security;
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
|
@ -33,10 +30,6 @@ import org.junit.jupiter.api.Test;
|
|||
*/
|
||||
public class HashTest extends SmackTestSuite {
|
||||
|
||||
static {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
private static final String testString = "Hello World!";
|
||||
private static final String md5sum = "ed076287532e86365e841e92bfc50d8c";
|
||||
private static final String sha1sum = "2ef7bde608ce5404e97d5f042f95f89f1c232871";
|
||||
|
|
|
@ -21,13 +21,13 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
public class MamTest extends InitExtensions {
|
||||
public class MamTest extends SmackTestSuite {
|
||||
|
||||
protected static XMPPConnection connection;
|
||||
protected static String queryId;
|
||||
|
|
|
@ -44,7 +44,7 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
Message message = StanzaBuilder.buildMessage().build();
|
||||
SpoilerElement.addSpoiler(message);
|
||||
|
||||
SpoilerElement empty = (SpoilerElement) message.getExtension(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
SpoilerElement empty = (SpoilerElement) message.getExtensionElement(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
|
||||
assertNull(empty.getHint());
|
||||
assertNull(empty.getLanguage());
|
||||
|
@ -63,7 +63,7 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
Message message = StanzaBuilder.buildMessage().build();
|
||||
SpoilerElement.addSpoiler(message, "Love story end");
|
||||
|
||||
SpoilerElement withHint = (SpoilerElement) message.getExtension(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
SpoilerElement withHint = (SpoilerElement) message.getExtensionElement(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
|
||||
assertEquals("Love story end", withHint.getHint());
|
||||
assertNull(withHint.getLanguage());
|
||||
|
@ -83,7 +83,7 @@ public class SpoilerTest extends SmackTestSuite {
|
|||
Message message = StanzaBuilder.buildMessage().build();
|
||||
SpoilerElement.addSpoiler(message, "de", "Der Kuchen ist eine Lüge!");
|
||||
|
||||
SpoilerElement i18nHint = (SpoilerElement) message.getExtension(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
SpoilerElement i18nHint = (SpoilerElement) message.getExtensionElement(SpoilerElement.ELEMENT, SpoilerManager.NAMESPACE_0);
|
||||
|
||||
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
|
||||
assertEquals("de", i18nHint.getLanguage());
|
||||
|
|
|
@ -10,5 +10,6 @@ dependencies {
|
|||
// Some implementations need APIs provided by smack-im,
|
||||
// e.g. message delivery receipts the roster
|
||||
compile project(':smack-im')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
//testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class BoBExtension extends XHTMLExtension {
|
|||
}
|
||||
|
||||
public static BoBExtension from(Message message) {
|
||||
return (BoBExtension) message.getExtension(ELEMENT, NAMESPACE);
|
||||
return (BoBExtension) message.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2020 Aditya Borikar.
|
||||
*
|
||||
* 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.smackx.geoloc;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
|
||||
|
||||
import org.jxmpp.jid.BareJid;
|
||||
|
||||
public interface GeoLocationListener {
|
||||
void onGeoLocationUpdated(BareJid jid, GeoLocation geoLocation, Message message);
|
||||
}
|
|
@ -16,9 +16,13 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.geoloc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.jivesoftware.smack.AsyncButOrdered;
|
||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||
import org.jivesoftware.smack.Manager;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
|
@ -26,22 +30,53 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPConnectionRegistry;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
|
||||
import org.jivesoftware.smackx.geoloc.provider.GeoLocationProvider;
|
||||
import org.jivesoftware.smackx.pubsub.LeafNode;
|
||||
import org.jivesoftware.smackx.pep.PepListener;
|
||||
import org.jivesoftware.smackx.pep.PepManager;
|
||||
import org.jivesoftware.smackx.pubsub.EventElement;
|
||||
import org.jivesoftware.smackx.pubsub.ItemsExtension;
|
||||
import org.jivesoftware.smackx.pubsub.PayloadItem;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
||||
import org.jivesoftware.smackx.xdata.provider.FormFieldChildElementProviderManager;
|
||||
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
/**
|
||||
* Entry point for Smacks API for XEP-0080: User Location.
|
||||
* <br>
|
||||
* To publish a UserLocation, please use {@link #sendGeolocation(GeoLocation)} method. This will publish the node.
|
||||
* <br>
|
||||
* To stop publishing a UserLocation, please use {@link #stopPublishingGeolocation()} method. This will send a disble publishing signal.
|
||||
* <br>
|
||||
* To add a {@link GeoLocationListener} in order to remain updated with other users GeoLocation, use {@link #addGeoLocationListener(GeoLocationListener)} method.
|
||||
* <br>
|
||||
* To link a GeoLocation with {@link Message}, use `message.addExtension(geoLocation)`.
|
||||
* <br>
|
||||
* An example for illustration is provided inside GeoLocationTest inside the test package.
|
||||
* <br>
|
||||
* @see <a href="https://xmpp.org/extensions/xep-0080.html">
|
||||
* XEP-0080: User Location</a>
|
||||
*/
|
||||
public final class GeoLocationManager extends Manager {
|
||||
|
||||
public static final String GEOLOCATION_NODE = "http://jabber.org/protocol/geoloc";
|
||||
public static final String GEOLOCATION_NOTIFY = GEOLOCATION_NODE + "+notify";
|
||||
|
||||
private static final Map<XMPPConnection, GeoLocationManager> INSTANCES = new WeakHashMap<>();
|
||||
|
||||
private static boolean ENABLE_USER_LOCATION_NOTIFICATIONS_BY_DEFAULT = true;
|
||||
|
||||
private final Set<GeoLocationListener> geoLocationListeners = new CopyOnWriteArraySet<>();
|
||||
private final AsyncButOrdered<BareJid> asyncButOrdered = new AsyncButOrdered<BareJid>();
|
||||
private final ServiceDiscoveryManager serviceDiscoveryManager;
|
||||
private final PepManager pepManager;
|
||||
|
||||
static {
|
||||
FormFieldChildElementProviderManager.addFormFieldChildElementProvider(
|
||||
GeoLocationProvider.GeoLocationFormFieldChildElementProvider.INSTANCE);
|
||||
|
@ -54,11 +89,6 @@ public final class GeoLocationManager extends Manager {
|
|||
});
|
||||
}
|
||||
|
||||
public GeoLocationManager(XMPPConnection connection) {
|
||||
super(connection);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@link GeoLocationManager} for the specified {@link XMPPConnection}, creating one if it doesn't
|
||||
* already exist.
|
||||
|
@ -75,6 +105,36 @@ public final class GeoLocationManager extends Manager {
|
|||
return geoLocationManager;
|
||||
}
|
||||
|
||||
private GeoLocationManager(XMPPConnection connection) {
|
||||
super(connection);
|
||||
pepManager = PepManager.getInstanceFor(connection);
|
||||
pepManager.addPepListener(new PepListener() {
|
||||
|
||||
@Override
|
||||
public void eventReceived(EntityBareJid from, EventElement event, Message message) {
|
||||
if (!GEOLOCATION_NODE.equals(event.getEvent().getNode())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final BareJid contact = from.asBareJid();
|
||||
asyncButOrdered.performAsyncButOrdered(contact, () -> {
|
||||
ItemsExtension itemsExtension = (ItemsExtension) event.getEvent();
|
||||
List<ExtensionElement> items = itemsExtension.getExtensions();
|
||||
@SuppressWarnings("unchecked")
|
||||
PayloadItem<GeoLocation> payload = (PayloadItem<GeoLocation>) items.get(0);
|
||||
GeoLocation geoLocation = payload.getPayload();
|
||||
for (GeoLocationListener listener : geoLocationListeners) {
|
||||
listener.onGeoLocationUpdated(contact, geoLocation, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
if (ENABLE_USER_LOCATION_NOTIFICATIONS_BY_DEFAULT) {
|
||||
enableUserLocationNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGeoLocationToJid(GeoLocation geoLocation, Jid jid) throws InterruptedException,
|
||||
NotConnectedException {
|
||||
|
||||
|
@ -111,7 +171,7 @@ public final class GeoLocationManager extends Manager {
|
|||
*/
|
||||
public void sendGeolocation(GeoLocation geoLocation)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
|
||||
getNode().publish(new PayloadItem<GeoLocation>(geoLocation));
|
||||
pepManager.publish(GeoLocation.NAMESPACE, new PayloadItem<GeoLocation>(geoLocation));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,13 +185,25 @@ public final class GeoLocationManager extends Manager {
|
|||
*/
|
||||
public void stopPublishingGeolocation()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
|
||||
GeoLocation emptyGeolocation = new GeoLocation.Builder().build();
|
||||
getNode().publish(new PayloadItem<GeoLocation>(emptyGeolocation));
|
||||
pepManager.publish(GeoLocation.NAMESPACE, new PayloadItem<GeoLocation>(GeoLocation.EMPTY_GEO_LOCATION));
|
||||
}
|
||||
|
||||
private LeafNode getNode()
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {
|
||||
return PubSubManager.getInstanceFor(connection()).getOrCreateLeafNode(GeoLocation.NAMESPACE);
|
||||
public static void setGeoLocationNotificationsEnabledByDefault(boolean bool) {
|
||||
ENABLE_USER_LOCATION_NOTIFICATIONS_BY_DEFAULT = bool;
|
||||
}
|
||||
|
||||
public void enableUserLocationNotifications() {
|
||||
serviceDiscoveryManager.addFeature(GEOLOCATION_NOTIFY);
|
||||
}
|
||||
|
||||
public void disableGeoLocationNotifications() {
|
||||
serviceDiscoveryManager.removeFeature(GEOLOCATION_NOTIFY);
|
||||
}
|
||||
|
||||
public boolean addGeoLocationListener(GeoLocationListener geoLocationListener) {
|
||||
return geoLocationListeners.add(geoLocationListener);
|
||||
}
|
||||
public boolean removeGeoLocationListener(GeoLocationListener geoLocationListener) {
|
||||
return geoLocationListeners.remove(geoLocationListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public final class GeoLocation implements Serializable, ExtensionElement, FormFi
|
|||
|
||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||
|
||||
public static final GeoLocation EMPTY_GEO_LOCATION = GeoLocation.builder().build();
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GeoLocation.class.getName());
|
||||
|
||||
private final Double accuracy;
|
||||
|
@ -264,6 +266,10 @@ public final class GeoLocation implements Serializable, ExtensionElement, FormFi
|
|||
return NAMESPACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of {@link Builder}.
|
||||
* @return Builder
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new GeoLocation.Builder();
|
||||
}
|
||||
|
@ -273,14 +279,35 @@ public final class GeoLocation implements Serializable, ExtensionElement, FormFi
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first GeoLocation, or <code>null</code> if it doesn't exist in {@link Message}.
|
||||
* <br>
|
||||
* @param message The Message stanza containing GeoLocation
|
||||
* @return GeoLocation
|
||||
*/
|
||||
public static GeoLocation from(Message message) {
|
||||
return message.getExtension(GeoLocation.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first GeoLocation, or <code>null</code> if it doesn't exist in {@link FormField}.
|
||||
* <br>
|
||||
* @param formField the Formfield containing GeoLocation
|
||||
* @return GeoLocation
|
||||
*/
|
||||
public static GeoLocation from(FormField formField) {
|
||||
return (GeoLocation) formField.getFormFieldChildElement(QNAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* This class defines a builder class for {@link GeoLocation}.
|
||||
* <br>
|
||||
* {@link GeoLocation} instance can be obtained using {@link #build()} method as follows.<br><br>
|
||||
* <code>GeoLocation.Builder builder = GeoLocation.builder(); <br>
|
||||
* GeoLocation geoLocation = builder.build();</code>
|
||||
* <br><br>
|
||||
* To set GeoLocation parameters, use their respective setters.
|
||||
*/
|
||||
public static class Builder {
|
||||
|
||||
private Double accuracy;
|
||||
|
@ -308,133 +335,285 @@ public final class GeoLocation implements Serializable, ExtensionElement, FormFi
|
|||
private String tzo;
|
||||
private URI uri;
|
||||
|
||||
/**
|
||||
* Sets accuracy of horizontal GPS error in meters.
|
||||
*
|
||||
* @param accuracy accuracy in meters
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setAccuracy(Double accuracy) {
|
||||
this.accuracy = accuracy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Altitude in meters above or below sea level.
|
||||
*
|
||||
* @param alt altitude in meters
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setAlt(Double alt) {
|
||||
this.alt = alt;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Vertical GPS error in meters.
|
||||
*
|
||||
* @param altAccuracy altAccuracy in meters
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setAltAccuracy(Double altAccuracy) {
|
||||
this.altAccuracy = altAccuracy;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a named area such as a campus or neighborhood.
|
||||
*
|
||||
* @param area the named area
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setArea(String area) {
|
||||
this.area = area;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets GPS bearing (direction in which the entity is heading<br>
|
||||
* to reach its next waypoint), measured in decimal degrees,<br>
|
||||
* relative to true north.
|
||||
*
|
||||
* @param bearing bearing in decimal degrees
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setBearing(Double bearing) {
|
||||
this.bearing = bearing;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a specific building on a street or in an area.
|
||||
*
|
||||
* @param building name of the building
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setBuilding(String building) {
|
||||
this.building = building;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the nation where the user is located.
|
||||
*
|
||||
* @param country user's country of location
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setCountry(String country) {
|
||||
this.country = country;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets The ISO 3166 two-letter country code.
|
||||
*
|
||||
* @param countryCode two-letter country code
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setCountryCode(String countryCode) {
|
||||
this.countryCode = countryCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets GPS Datum.
|
||||
*
|
||||
* @param datum GPS datum
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setDatum(String datum) {
|
||||
this.datum = datum;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets A natural-language name for or description of the location.
|
||||
*
|
||||
* @param description description of the location
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Horizontal GPS error in arc minutes;<br>
|
||||
* this element is deprecated in favor of accuracy.
|
||||
*
|
||||
* @param error error in arc minutes
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setError(Double error) {
|
||||
this.error = error;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a particular floor in a building.
|
||||
*
|
||||
* @param floor floor in a building
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setFloor(String floor) {
|
||||
this.floor = floor;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Latitude in decimal degrees North.
|
||||
*
|
||||
* @param lat latitude in decimal degrees
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Locality within the administrative region,<br>
|
||||
* such as a town or city.
|
||||
*
|
||||
* @param locality locality in a region
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setLocality(String locality) {
|
||||
this.locality = locality;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Longitude in decimal degrees East.
|
||||
*
|
||||
* @param lon longitude in decimal degrees
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setLon(Double lon) {
|
||||
this.lon = lon;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets PostalCode used for postal delivery.
|
||||
*
|
||||
* @param postalcode code for postal delivery
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setPostalcode(String postalcode) {
|
||||
this.postalcode = postalcode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an administrative region of the nation,<br>
|
||||
* such as a state or province.
|
||||
*
|
||||
* @param region an administrative region
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setRegion(String region) {
|
||||
this.region = region;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a particular room in a building.
|
||||
*
|
||||
* @param room room inside a building
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setRoom(String room) {
|
||||
this.room = room;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Speed at which the entity is moving, in meters per second.
|
||||
*
|
||||
* @param speed speed in meters per second
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setSpeed(Double speed) {
|
||||
this.speed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a thoroughfare within the locality, or a crossing of two thoroughfares.
|
||||
*
|
||||
* @param street name of the street
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setStreet(String street) {
|
||||
this.street = street;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a catch-all element that captures any other information about the location.
|
||||
*
|
||||
* @param text distinctive feature about the location
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setText(String text) {
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets UTC timestamp specifying the moment when the reading was taken.
|
||||
*
|
||||
* @param timestamp timestamp of the reading
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setTimestamp(Date timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time zone offset from UTC for the current location.
|
||||
*
|
||||
* @param tzo time zone offset
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setTzo(String tzo) {
|
||||
this.tzo = tzo;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets URI or URL pointing to information about the location.
|
||||
*
|
||||
* @param uri uri to the location
|
||||
* @return Builder
|
||||
*/
|
||||
public Builder setUri(URI uri) {
|
||||
this.uri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called to build {@link GeoLocation} from the Builder.
|
||||
*
|
||||
* @return GeoLocation
|
||||
*/
|
||||
public GeoLocation build() {
|
||||
|
||||
return new GeoLocation(accuracy, alt, altAccuracy, area, bearing, building, country, countryCode, datum, description,
|
||||
error, floor, lat, locality, lon, postalcode, region, room, speed, street, text, timestamp,
|
||||
tzo, uri);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.jivesoftware.smack.xml.XmlPullParser;
|
|||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;
|
||||
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
|
||||
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate;
|
||||
|
@ -66,7 +67,7 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
|
|||
case START_ELEMENT: {
|
||||
switch (name) {
|
||||
|
||||
case JingleS5BTransportCandidate.ELEMENT:
|
||||
case JingleContentTransportCandidate.ELEMENT:
|
||||
cb = JingleS5BTransportCandidate.getBuilder();
|
||||
cb.setCandidateId(parser.getAttributeValue(null, ATTR_CID));
|
||||
cb.setHost(parser.getAttributeValue(null, ATTR_HOST));
|
||||
|
|
|
@ -91,7 +91,7 @@ public final class MoodManager extends Manager {
|
|||
@Override
|
||||
public void run() {
|
||||
ItemsExtension items = (ItemsExtension) event.getExtensions().get(0);
|
||||
PayloadItem<?> payload = (PayloadItem) items.getItems().get(0);
|
||||
PayloadItem<?> payload = (PayloadItem<?>) items.getItems().get(0);
|
||||
MoodElement mood = (MoodElement) payload.getPayload();
|
||||
|
||||
for (MoodListener listener : moodListeners) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MoodProvider extends ExtensionElementProvider<MoodElement> {
|
|||
|
||||
if (!MoodElement.NAMESPACE.equals(namespace)) {
|
||||
LOGGER.log(Level.FINE, "Foreign namespace " + namespace + " detected. Try to find suitable MoodConcretisationProvider.");
|
||||
MoodConcretisationProvider<?> provider = (MoodConcretisationProvider) ProviderManager.getExtensionProvider(name, namespace);
|
||||
MoodConcretisationProvider<?> provider = (MoodConcretisationProvider<?>) ProviderManager.getExtensionProvider(name, namespace);
|
||||
if (provider != null) {
|
||||
concretisation = provider.parse(parser);
|
||||
} else {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Occupant {
|
|||
}
|
||||
|
||||
Occupant(Presence presence) {
|
||||
MUCUser mucUser = (MUCUser) presence.getExtension("x",
|
||||
MUCUser mucUser = (MUCUser) presence.getExtensionElement("x",
|
||||
"http://jabber.org/protocol/muc#user");
|
||||
MUCItem item = mucUser.getItem();
|
||||
this.jid = item.getJid();
|
||||
|
|
|
@ -236,7 +236,6 @@ public class LeafNode extends Node {
|
|||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
* @deprecated use {@link #publish(Item)} instead.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public <T extends Item> void send(T item) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
|
||||
publish(item);
|
||||
|
|
|
@ -686,7 +686,7 @@ public abstract class Node {
|
|||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void processStanza(Stanza packet) {
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.event.getXmlns());
|
||||
EventElement event = (EventElement) packet.getExtensionElement("event", PubSubNamespace.event.getXmlns());
|
||||
ItemsExtension itemsElem = (ItemsExtension) event.getEvent();
|
||||
ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet));
|
||||
// TODO: Use AsyncButOrdered (with Node as Key?)
|
||||
|
@ -710,7 +710,7 @@ public abstract class Node {
|
|||
@Override
|
||||
public void processStanza(Stanza packet) {
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.event.getXmlns());
|
||||
EventElement event = (EventElement) packet.getExtensionElement("event", PubSubNamespace.event.getXmlns());
|
||||
|
||||
List<ExtensionElement> extList = event.getExtensions();
|
||||
|
||||
|
@ -749,7 +749,7 @@ public abstract class Node {
|
|||
|
||||
@Override
|
||||
public void processStanza(Stanza packet) {
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.event.getXmlns());
|
||||
EventElement event = (EventElement) packet.getExtensionElement("event", PubSubNamespace.event.getXmlns());
|
||||
ConfigurationEvent config = (ConfigurationEvent) event.getEvent();
|
||||
|
||||
// TODO: Use AsyncButOrdered (with Node as Key?)
|
||||
|
|
|
@ -503,7 +503,7 @@ public final class PubSubManager extends Manager {
|
|||
*/
|
||||
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null);
|
||||
SubscriptionsExtension subElem = (SubscriptionsExtension) reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
|
||||
SubscriptionsExtension subElem = (SubscriptionsExtension) reply.getExtensionElement(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
|
||||
return subElem.getSubscriptions();
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class PubSub extends IQ {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <PE extends ExtensionElement> PE getExtension(PubSubElementType elem) {
|
||||
return (PE) getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||
return (PE) getExtensionElement(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ public class NodeUtils {
|
|||
* @return The configuration form
|
||||
*/
|
||||
public static ConfigureForm getFormFromPacket(Stanza packet, PubSubElementType elem) {
|
||||
FormNode config = (FormNode) packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||
FormNode config = (FormNode) packet.getExtensionElement(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||
Form formReply = config.getForm();
|
||||
return new ConfigureForm(formReply);
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class RSMSet implements ExtensionElement {
|
|||
}
|
||||
|
||||
public static RSMSet from(Stanza packet) {
|
||||
return (RSMSet) packet.getExtension(ELEMENT, NAMESPACE);
|
||||
return (RSMSet) packet.getExtensionElement(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
public static RSMSet newAfter(String after) {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class XHTMLManager {
|
|||
* @return a boolean indicating whether the message is an XHTML message
|
||||
*/
|
||||
public static boolean isXHTMLMessage(Message message) {
|
||||
return message.getExtension(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null;
|
||||
return message.getExtensionElement(XHTMLExtension.ELEMENT, XHTMLExtension.NAMESPACE) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
|
|||
|
||||
import org.jivesoftware.smackx.attention.packet.AttentionExtension;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class AttentionElementTest {
|
||||
|
||||
|
|
|
@ -23,22 +23,22 @@ import static org.mockito.Mockito.verify;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for the CloseListener class.
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class CloseListenerTest extends InitExtensions {
|
||||
public class CloseListenerTest extends SmackTestSuite {
|
||||
|
||||
private static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
|
@ -59,7 +59,7 @@ public class CloseListenerTest extends InitExtensions {
|
|||
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
||||
// get the CloseListener from InBandByteStreamManager
|
||||
CloseListener closeListener = Whitebox.getInternalState(byteStreamManager,
|
||||
CloseListener closeListener = Whitebox.getInternalState(byteStreamManager, "closeListener",
|
||||
CloseListener.class);
|
||||
|
||||
Close close = new Close("unknownSessionId");
|
||||
|
|
|
@ -23,8 +23,9 @@ import static org.mockito.Mockito.verify;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
||||
|
||||
|
@ -32,14 +33,13 @@ import org.junit.jupiter.api.Test;
|
|||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for the CloseListener class.
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class DataListenerTest extends InitExtensions {
|
||||
public class DataListenerTest extends SmackTestSuite {
|
||||
|
||||
private static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
|
@ -60,7 +60,7 @@ public class DataListenerTest extends InitExtensions {
|
|||
InBandBytestreamManager byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
||||
// get the DataListener from InBandByteStreamManager
|
||||
DataListener dataListener = Whitebox.getInternalState(byteStreamManager,
|
||||
DataListener dataListener = Whitebox.getInternalState(byteStreamManager, "dataListener",
|
||||
DataListener.class);
|
||||
|
||||
DataPacketExtension dpe = new DataPacketExtension("unknownSessionID", 0, "Data");
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
||||
|
@ -47,7 +47,7 @@ import org.jxmpp.jid.JidTestUtil;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamManagerTest extends InitExtensions {
|
||||
public class InBandBytestreamManagerTest extends SmackTestSuite {
|
||||
|
||||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
@ -40,7 +40,7 @@ import org.mockito.ArgumentCaptor;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamRequestTest extends InitExtensions {
|
||||
public class InBandBytestreamRequestTest extends SmackTestSuite {
|
||||
|
||||
private static final Jid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final Jid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
|
|
|
@ -32,9 +32,10 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.StanzaBuilder;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
@ -46,7 +47,6 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for InBandBytestreamSession.
|
||||
|
@ -55,7 +55,7 @@ import org.powermock.reflect.Whitebox;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
||||
public class InBandBytestreamSessionMessageTest extends SmackTestSuite {
|
||||
|
||||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
|
@ -262,7 +262,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build invalid packet with out of order sequence
|
||||
String base64Data = Base64.encode("Data");
|
||||
|
@ -303,7 +303,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// verify data packet and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
|
@ -349,7 +349,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// verify data packet and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
|
|
|
@ -31,9 +31,10 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.DataPacketExtension;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
@ -45,7 +46,6 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for InBandBytestreamSession.
|
||||
|
@ -55,7 +55,7 @@ import org.powermock.reflect.Whitebox;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InBandBytestreamSessionTest extends InitExtensions {
|
||||
public class InBandBytestreamSessionTest extends SmackTestSuite {
|
||||
|
||||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
|
@ -309,7 +309,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
|
||||
// insert data to read
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
String base64Data = Base64.encode("Data");
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
|
||||
Data data = new Data(dpe);
|
||||
|
@ -343,7 +343,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
String base64Data = Base64.encode("Data");
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, base64Data);
|
||||
|
@ -381,7 +381,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build data packets
|
||||
String base64Data = Base64.encode("Data");
|
||||
|
@ -420,7 +420,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build data packets
|
||||
DataPacketExtension dpe = new DataPacketExtension(sessionID, 0, "AA=BB");
|
||||
|
@ -454,7 +454,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build invalid packet with out of order sequence
|
||||
String base64Data = Base64.encode("Data");
|
||||
|
@ -495,7 +495,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// set data packet acknowledgment and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
|
@ -542,7 +542,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// set data packet acknowledgment and notify listener
|
||||
for (int i = 0; i < controlData.length / blockSize; i++) {
|
||||
|
@ -583,7 +583,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build data packet
|
||||
String base64Data = Base64.encode("Data");
|
||||
|
@ -626,7 +626,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
InBandBytestreamSession session = new InBandBytestreamSession(connection, initBytestream,
|
||||
initiatorJID);
|
||||
final InputStream inputStream = session.getInputStream();
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, StanzaListener.class);
|
||||
StanzaListener listener = Whitebox.getInternalState(inputStream, "dataPacketListener", StanzaListener.class);
|
||||
|
||||
// build data packet
|
||||
String base64Data = Base64.encode("Data");
|
||||
|
|
|
@ -24,8 +24,9 @@ import static org.mockito.Mockito.verify;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
||||
|
@ -35,14 +36,13 @@ import org.jxmpp.jid.EntityFullJid;
|
|||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for the InitiationListener class.
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class InitiationListenerTest extends InitExtensions {
|
||||
public class InitiationListenerTest extends SmackTestSuite {
|
||||
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
|
@ -66,7 +66,7 @@ public class InitiationListenerTest extends InitExtensions {
|
|||
byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
||||
// get the InitiationListener from InBandByteStreamManager
|
||||
initiationListener = Whitebox.getInternalState(byteStreamManager, InitiationListener.class);
|
||||
initiationListener = Whitebox.getInternalState(byteStreamManager, "initiationListener", InitiationListener.class);
|
||||
|
||||
// create a In-Band Bytestream open packet
|
||||
initBytestream = new Open(sessionID, 4096);
|
||||
|
|
|
@ -24,8 +24,7 @@ import java.util.Properties;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -36,7 +35,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class CloseTest extends InitExtensions {
|
||||
public class CloseTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void shouldNotInstantiateWithInvalidArguments1() {
|
||||
|
|
|
@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class DataPacketExtensionTest extends InitExtensions {
|
||||
public class DataPacketExtensionTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void shouldNotInstantiateWithInvalidArgument1() {
|
||||
|
|
|
@ -25,10 +25,9 @@ import java.util.Properties;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
|
@ -38,7 +37,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class DataTest extends InitExtensions {
|
||||
public class DataTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void shouldNotInstantiateWithInvalidArgument() {
|
||||
|
|
|
@ -24,12 +24,11 @@ import java.util.Properties;
|
|||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
|
||||
|
@ -38,7 +37,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class OpenTest extends InitExtensions {
|
||||
public class OpenTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void shouldNotInstantiateWithInvalidArguments1() {
|
||||
|
|
|
@ -20,10 +20,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager.StanzaType;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Open;
|
||||
|
||||
|
@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test;
|
|||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class OpenIQProviderTest extends InitExtensions {
|
||||
public class OpenIQProviderTest extends SmackTestSuite {
|
||||
|
||||
private static final Properties outputProperties = new Properties();
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.mockito.Mockito.verify;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.Whitebox;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
|
@ -37,7 +38,6 @@ import org.jxmpp.jid.EntityFullJid;
|
|||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
/**
|
||||
* Test for the InitiationListener class.
|
||||
|
@ -75,7 +75,7 @@ public class InitiationListenerTest {
|
|||
byteStreamManager = Socks5BytestreamManager.getBytestreamManager(connection);
|
||||
|
||||
// get the InitiationListener from Socks5ByteStreamManager
|
||||
initiationListener = Whitebox.getInternalState(byteStreamManager, InitiationListener.class);
|
||||
initiationListener = Whitebox.getInternalState(byteStreamManager, "initiationListener", InitiationListener.class);
|
||||
|
||||
// create a SOCKS5 Bytestream initiation packet
|
||||
initBytestream = Socks5PacketUtils.createBytestreamInitiation(initiatorJID, targetJID,
|
||||
|
|
|
@ -41,8 +41,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.test.util.NetworkUtil;
|
||||
import org.jivesoftware.smack.util.ExceptionUtil;
|
||||
import org.jivesoftware.smack.util.NetworkUtil;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.util.NetworkUtil;
|
||||
import org.jivesoftware.smack.test.util.NetworkUtil;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.net.Socket;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.util.NetworkUtil;
|
||||
import org.jivesoftware.smack.test.util.NetworkUtil;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.StreamHost;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.bytestreams.socks5;
|
|||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
import org.jivesoftware.smack.util.NetworkUtil;
|
||||
import org.jivesoftware.smack.test.util.NetworkUtil;
|
||||
|
||||
/**
|
||||
* Simple SOCKS5 proxy for testing purposes. It is almost the same as the Socks5Proxy class but the
|
||||
|
|
|
@ -26,11 +26,11 @@ import java.util.Collection;
|
|||
import java.util.LinkedList;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base32;
|
||||
import org.jivesoftware.smack.util.stringencoder.StringEncoder;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache;
|
||||
import org.jivesoftware.smackx.caps.cache.SimpleDirectoryPersistentCache;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
|
@ -43,7 +43,7 @@ import org.jxmpp.jid.impl.JidCreate;
|
|||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
|
||||
public class EntityCapsManagerTest extends InitExtensions {
|
||||
public class EntityCapsManagerTest extends SmackTestSuite {
|
||||
|
||||
/**
|
||||
* <a href="http://xmpp.org/extensions/xep-0115.html#ver-gen-complex">XEP-
|
||||
|
|
|
@ -18,15 +18,15 @@ package org.jivesoftware.smackx.caps.provider;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.caps.packet.CapsExtension;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
|
||||
public class CapsExtensionProviderTest extends InitExtensions {
|
||||
public class CapsExtensionProviderTest extends SmackTestSuite {
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource(SmackTestUtil.XmlPullParserKind.class)
|
||||
|
|
|
@ -31,11 +31,11 @@ import java.util.TimeZone;
|
|||
import javax.xml.parsers.FactoryConfigurationError;
|
||||
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
||||
import org.jivesoftware.smackx.delay.packet.DelayInformation;
|
||||
|
||||
|
@ -43,7 +43,7 @@ import com.jamesmurty.utils.XMLBuilder;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.util.XmppDateTime;
|
||||
|
||||
public class DelayInformationTest extends InitExtensions {
|
||||
public class DelayInformationTest extends SmackTestSuite {
|
||||
|
||||
private static final Calendar calendar = new GregorianCalendar(2002, 9 - 1, 10, 23, 8, 25);
|
||||
private static Properties outputProperties = new Properties();
|
||||
|
|
|
@ -21,8 +21,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
|
||||
public class FileTransferNegotiatorTest extends InitExtensions {
|
||||
public class FileTransferNegotiatorTest extends SmackTestSuite {
|
||||
private DummyConnection connection;
|
||||
|
||||
@BeforeEach
|
||||
|
|
|
@ -24,9 +24,9 @@ import java.util.Calendar;
|
|||
import java.util.TimeZone;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.time.packet.Time;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -37,7 +37,7 @@ import org.jxmpp.util.XmppDateTime;
|
|||
*
|
||||
* @author Ishan Khanna
|
||||
*/
|
||||
public class GeoLocationTest extends InitExtensions {
|
||||
public class GeoLocationTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void negativeTimezoneTest() {
|
||||
|
|
|
@ -23,15 +23,15 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.util.XmppDateTime;
|
||||
|
||||
public class GeoLocationProviderTest extends InitExtensions {
|
||||
public class GeoLocationProviderTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void testGeoLocationProviderWithNoDatumSet() throws Exception {
|
||||
|
|
|
@ -22,15 +22,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LastActivityTest extends InitExtensions {
|
||||
public class LastActivityTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void checkProvider() throws Exception {
|
||||
|
|
|
@ -24,14 +24,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.iqversion.packet.Version;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class VersionTest extends InitExtensions {
|
||||
public class VersionTest extends SmackTestSuite {
|
||||
@Test
|
||||
public void checkProvider() throws Exception {
|
||||
// @formatter:off
|
||||
|
|
|
@ -16,24 +16,16 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingle;
|
||||
|
||||
import org.jivesoftware.smack.DummyConnection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.element.Jingle;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContent;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.FullJid;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
/**
|
||||
* Test the JingleUtil class.
|
||||
*/
|
||||
public class JingleUtilTest extends SmackTestSuite {
|
||||
|
||||
// TODO: Finish the test.
|
||||
|
||||
/*
|
||||
private XMPPConnection connection;
|
||||
private JingleUtil jutil;
|
||||
|
||||
|
@ -102,4 +94,5 @@ public class JingleUtilTest extends SmackTestSuite {
|
|||
"</iq>";
|
||||
// TODO: Finish test
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -20,16 +20,16 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JivePropertiesExtensionTest extends InitExtensions {
|
||||
public class JivePropertiesExtensionTest extends SmackTestSuite {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muc;
|
||||
|
||||
import org.jivesoftware.smack.test.util.MemoryLeakTestUtil;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.MemoryLeakTestUtil;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
|
@ -17,19 +17,20 @@
|
|||
package org.jivesoftware.smackx.nick;
|
||||
|
||||
import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
import org.jivesoftware.smack.test.util.SmackTestUtil;
|
||||
import org.jivesoftware.smack.xml.XmlPullParserException;
|
||||
|
||||
import org.jivesoftware.smackx.nick.packet.Nick;
|
||||
import org.jivesoftware.smackx.nick.provider.NickProvider;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
|
||||
|
@ -41,14 +42,16 @@ public class NickTest {
|
|||
|
||||
@Test
|
||||
public void disallowEmptyNickTest() {
|
||||
assertThrows("Empty String as argument MUST cause IllegalArgumentException.",
|
||||
IllegalArgumentException.class, () -> new Nick(""));
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> new Nick(""),
|
||||
"Empty String as argument MUST cause IllegalArgumentException.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void disallowNullNickTest() {
|
||||
assertThrows("Null argument MUST cause IllegalArgumentException.",
|
||||
IllegalArgumentException.class, () -> new Nick(null));
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> new Nick(null),
|
||||
"Null argument MUST cause IllegalArgumentException.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,14 +33,14 @@ import org.jivesoftware.smack.ThreadedDummyConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.ping.packet.Ping;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PingTest extends InitExtensions {
|
||||
public class PingTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void checkProvider() throws Exception {
|
||||
|
|
|
@ -23,15 +23,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.privacy.packet.Privacy;
|
||||
import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PrivacyProviderTest extends InitExtensions {
|
||||
public class PrivacyProviderTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void parsePrivacyList() throws Exception {
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
import org.jivesoftware.smack.packet.StanzaError.Condition;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfoBuilder;
|
||||
|
@ -46,7 +46,7 @@ import org.junit.jupiter.api.Test;
|
|||
* @author Robin Collier
|
||||
*
|
||||
*/
|
||||
public class ConfigureFormTest extends InitExtensions {
|
||||
public class ConfigureFormTest extends SmackTestSuite {
|
||||
@Test
|
||||
public void checkChildrenAssocPolicy() {
|
||||
ConfigureForm form = new ConfigureForm(DataForm.Type.submit);
|
||||
|
|
|
@ -24,10 +24,10 @@ import org.jivesoftware.smack.ThreadedDummyConnection;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.NamedElement;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test;
|
|||
* @author Robin Collier
|
||||
*
|
||||
*/
|
||||
public class ItemValidationTest extends InitExtensions {
|
||||
public class ItemValidationTest extends SmackTestSuite {
|
||||
private ThreadedDummyConnection connection;
|
||||
|
||||
@BeforeEach
|
||||
|
|
|
@ -30,18 +30,18 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StanzaBuilder;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.WaitForPacketListener;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.xml.XmlPullParser;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.receipts.DeliveryReceiptManager.AutoReceiptMode;
|
||||
|
||||
import com.jamesmurty.utils.XMLBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
public class DeliveryReceiptTest extends InitExtensions {
|
||||
public class DeliveryReceiptTest extends SmackTestSuite {
|
||||
|
||||
private static Properties outputProperties = new Properties();
|
||||
static {
|
||||
|
|
|
@ -20,14 +20,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.rsm.packet.RSMSet;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RSMSetProviderTest extends InitExtensions {
|
||||
public class RSMSetProviderTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void testRsmSetProvider() throws Exception {
|
||||
|
|
|
@ -22,11 +22,11 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TimeTest extends InitExtensions {
|
||||
public class TimeTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void parseCurrentTimeTest() {
|
||||
|
|
|
@ -21,15 +21,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
import org.jivesoftware.smackx.vcardtemp.packet.VCard;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class VCardTest extends InitExtensions {
|
||||
public class VCardTest extends SmackTestSuite {
|
||||
|
||||
@Test
|
||||
public void testParseFullVCardIQStanza() throws Throwable {
|
||||
|
|
|
@ -7,5 +7,5 @@ Roster, Chat and other functionality."""
|
|||
// sourceSet.test of the core subproject
|
||||
dependencies {
|
||||
compile project(':smack-core')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testImplementation(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -12,15 +12,8 @@ dependencies {
|
|||
compile 'org.reflections:reflections:0.9.11'
|
||||
compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
|
||||
compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
||||
// Note that the junit-vintage-engine runtime dependency is not
|
||||
// directly required, but it declares a dependency to
|
||||
// junit:junit:4.12, which we currently need in sinttest, since it
|
||||
// (ab)uses @Before from org.junit
|
||||
compile "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||
compile 'junit:junit:4.12'
|
||||
// Add Junit 5 API for e.g. assertThrows()
|
||||
implementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
api "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,9 @@ import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
|||
import org.jivesoftware.smackx.iqregister.AccountManager;
|
||||
|
||||
import org.igniterealtime.smack.inttest.Configuration.AccountRegistration;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.MethodAnnotationsScanner;
|
||||
import org.reflections.scanners.MethodParameterScanner;
|
||||
|
@ -745,8 +746,10 @@ public class SmackIntegrationTestFramework {
|
|||
.append(method.getName())
|
||||
.append(" (")
|
||||
.append(testType.name());
|
||||
sb.append(", ");
|
||||
StringUtils.appendTo(Arrays.asList(subdescriptons), sb);
|
||||
if (subdescriptons != null) {
|
||||
sb.append(", ");
|
||||
StringUtils.appendTo(Arrays.asList(subdescriptons), sb);
|
||||
}
|
||||
sb.append(')');
|
||||
|
||||
stringCache = sb.toString();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue