mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-21 19:42:05 +01:00
Introduce test fixtures
This also removes the powermock dependency. Although powermock is a fine library, it currently prevents dropping Junit4. And since we only use the Whitebox API of powermock, this simply replaced powermock's Whitebox with our own.
This commit is contained in:
parent
4a99f7252c
commit
b5f9d4d7a3
51 changed files with 123 additions and 80 deletions
13
build.gradle
13
build.gradle
|
@ -24,6 +24,7 @@ apply from: 'version.gradle'
|
|||
|
||||
allprojects {
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'java-test-fixtures'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'jacoco'
|
||||
|
@ -130,7 +131,6 @@ allprojects {
|
|||
':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()
|
||||
|
@ -266,10 +266,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')
|
||||
}
|
||||
|
@ -282,9 +288,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 {
|
||||
|
|
|
@ -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")))
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -23,6 +23,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.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Close;
|
||||
|
@ -31,7 +32,6 @@ 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.
|
||||
|
@ -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,6 +23,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.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.packet.Data;
|
||||
|
@ -32,7 +33,6 @@ 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.
|
||||
|
@ -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");
|
||||
|
|
|
@ -32,6 +32,7 @@ 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.Whitebox;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -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.
|
||||
|
@ -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,6 +31,7 @@ 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.Whitebox;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.InitExtensions;
|
||||
|
@ -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.
|
||||
|
@ -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,6 +24,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.InitExtensions;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamRequest;
|
||||
|
@ -35,7 +36,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.
|
||||
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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")))
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ dependencies {
|
|||
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")
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ dependencies {
|
|||
api project(':smack-resolver-minidns-dox')
|
||||
api project(':smack-tcp')
|
||||
|
||||
testImplementation project(path: ":smack-core", configuration: "testRuntime")
|
||||
testImplementation 'com.google.guava:guava:28.2-jre'
|
||||
testImplementation 'org.jgrapht:jgrapht-io:1.3.1'
|
||||
}
|
||||
|
||||
task printModularXmppClientToServerConnectionStateGraph(type: JavaExec) {
|
||||
|
|
|
@ -7,5 +7,4 @@ dependencies {
|
|||
compile project(':smack-extensions')
|
||||
compile 'javax.media:jmf:2.1.1e'
|
||||
compile files('libs/jspeex-0.9.7-jfcom.jar', 'libs/jstun.jar', 'libs/Speex.jar')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -6,5 +6,6 @@ Usually XEPs in the state 'retracted', 'rejected', 'deprecated',
|
|||
dependencies {
|
||||
compile project(':smack-core')
|
||||
compile project(':smack-extensions')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ dependencies {
|
|||
compile project(":smack-omemo")
|
||||
compile 'org.whispersystems:signal-protocol-java:2.6.2'
|
||||
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testCompile project(path: ":smack-omemo", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ dependencies {
|
|||
compile project(":smack-extensions")
|
||||
compile project(":smack-experimental")
|
||||
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ dependencies {
|
|||
|
||||
compile 'org.pgpainless:pgpainless-core:0.0.1-alpha7'
|
||||
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testCompile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ dependencies {
|
|||
|
||||
compile "org.scala-lang:scala-library:$scalaVersion"
|
||||
compile "com.lihaoyi:ammonite_$scalaVersion:1.3.2"
|
||||
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
||||
scalaStyle {
|
||||
|
|
|
@ -4,5 +4,4 @@ DNS over XMPP (DoX) support using MiniDNS."""
|
|||
dependencies {
|
||||
compile project(path: ':smack-resolver-minidns')
|
||||
compile project(path: ':smack-experimental')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@ Use javax.security.sasl for SASL."""
|
|||
|
||||
dependencies {
|
||||
compile project(':smack-core')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@ Use Smack provided code for SASL."""
|
|||
|
||||
dependencies {
|
||||
compile project(':smack-core')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@ Smack for standard XMPP connections over TCP."""
|
|||
|
||||
dependencies {
|
||||
compile project(':smack-core')
|
||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@ Smack XML parser using Stax."""
|
|||
|
||||
dependencies {
|
||||
compile project(':smack-xmlparser')
|
||||
testCompile project(path: ":smack-xmlparser", configuration: "testRuntime")
|
||||
//testCompile project(path: ":smack-xmlparser", configuration: "testRuntime")
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ dependencies {
|
|||
api "xpp3:xpp3_min:$xpp3Version"
|
||||
implementation "xpp3:xpp3:$xpp3Version"
|
||||
api project(':smack-xmlparser')
|
||||
testCompile project(path: ":smack-xmlparser", configuration: "testRuntime")
|
||||
//testCompile project(path: ":smack-xmlparser", configuration: "testRuntime")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue