Browse Source

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.
ramabit.avatar
Florian Schmaus 3 months ago
parent
commit
b5f9d4d7a3
51 changed files with 123 additions and 80 deletions
  1. +8
    -5
      build.gradle
  2. +1
    -1
      config/checkstyle/suppressions.xml
  3. +16
    -10
      smack-core/build.gradle
  4. +0
    -1
      smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java
  5. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/ThreadedDummyConnection.java
  6. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java
  7. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
  8. +1
    -3
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java
  9. +4
    -4
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java
  10. +1
    -1
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/NetworkUtil.java
  11. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestSuite.java
  12. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestUtil.java
  13. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/TestUtils.java
  14. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java
  15. +44
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java
  16. +0
    -0
      smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java
  17. +0
    -1
      smack-debug-slf4j/build.gradle
  18. +0
    -1
      smack-debug/build.gradle
  19. +2
    -2
      smack-experimental/build.gradle
  20. +0
    -7
      smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java
  21. +2
    -1
      smack-extensions/build.gradle
  22. +2
    -2
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java
  23. +2
    -2
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java
  24. +4
    -4
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java
  25. +10
    -10
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java
  26. +2
    -2
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java
  27. +2
    -2
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java
  28. +1
    -1
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java
  29. +1
    -1
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java
  30. +1
    -1
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java
  31. +1
    -1
      smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java
  32. +1
    -1
      smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java
  33. +0
    -0
      smack-extensions/src/testFixtures/java/org/jivesoftware/smackx/InitExtensions.java
  34. +0
    -0
      smack-extensions/src/testFixtures/java/org/jivesoftware/util/ConnectionUtils.java
  35. +0
    -0
      smack-extensions/src/testFixtures/java/org/jivesoftware/util/Protocol.java
  36. +0
    -0
      smack-extensions/src/testFixtures/java/org/jivesoftware/util/Verification.java
  37. +1
    -1
      smack-im/build.gradle
  38. +1
    -1
      smack-integration-test/build.gradle
  39. +2
    -1
      smack-java8-full/build.gradle
  40. +0
    -1
      smack-jingle-old/build.gradle
  41. +2
    -1
      smack-legacy/build.gradle
  42. +1
    -1
      smack-omemo-signal/build.gradle
  43. +1
    -1
      smack-omemo/build.gradle
  44. +1
    -1
      smack-openpgp/build.gradle
  45. +0
    -2
      smack-repl/build.gradle
  46. +0
    -1
      smack-resolver-minidns-dox/build.gradle
  47. +2
    -1
      smack-sasl-javax/build.gradle
  48. +2
    -1
      smack-sasl-provided/build.gradle
  49. +2
    -1
      smack-tcp/build.gradle
  50. +1
    -1
      smack-xmlparser-stax/build.gradle
  51. +1
    -1
      smack-xmlparser-xpp3/build.gradle

+ 8
- 5
build.gradle View File

@@ -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"
}
}



+ 1
- 1
config/checkstyle/suppressions.xml View File

@@ -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>

+ 16
- 10
smack-core/build.gradle View File

@@ -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 {


smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java View File

@@ -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;

smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/ThreadedDummyConnection.java View File


smack-core/src/test/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java View File


smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java View File


smack-core/src/test/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java View File

@@ -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);
}

smack-core/src/test/java/org/jivesoftware/smack/util/MemoryLeakTestUtil.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java View File

@@ -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) {

smack-core/src/test/java/org/jivesoftware/smack/util/NetworkUtil.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/NetworkUtil.java View File

@@ -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;

smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestSuite.java View File


smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestUtil.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestUtil.java View File


smack-core/src/test/java/org/jivesoftware/smack/test/util/TestUtils.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/TestUtils.java View File


smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java View File


+ 44
- 0
smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java View File

@@ -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);
}

}

smack-core/src/test/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java → smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java View File


+ 0
- 1
smack-debug-slf4j/build.gradle View File

@@ -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")
}

+ 0
- 1
smack-debug/build.gradle View File

@@ -4,5 +4,4 @@ Inspect the exchanged XMPP stanzas."""

dependencies {
compile project(':smack-core')
testCompile project(path: ":smack-core", configuration: "testRuntime")
}

+ 2
- 2
smack-experimental/build.gradle View File

@@ -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")))
}

+ 0
- 7
smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java View File

@@ -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";


+ 2
- 1
smack-extensions/build.gradle View File

@@ -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")
}

+ 2
- 2
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java View File

@@ -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");


+ 2
- 2
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java View File

@@ -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");


+ 4
- 4
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java View File

@@ -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++) {


+ 10
- 10
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java View File

@@ -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");


+ 2
- 2
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java View File

@@ -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);


+ 2
- 2
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java View File

@@ -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,


+ 1
- 1
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java View File

@@ -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;


+ 1
- 1
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java View File

@@ -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;



+ 1
- 1
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java View File

@@ -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;



+ 1
- 1
smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java View File

@@ -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


+ 1
- 1
smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java View File

@@ -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;


smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java → smack-extensions/src/testFixtures/java/org/jivesoftware/smackx/InitExtensions.java View File


smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java → smack-extensions/src/testFixtures/java/org/jivesoftware/util/ConnectionUtils.java View File


smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java → smack-extensions/src/testFixtures/java/org/jivesoftware/util/Protocol.java View File


smack-extensions/src/test/java/org/jivesoftware/util/Verification.java → smack-extensions/src/testFixtures/java/org/jivesoftware/util/Verification.java View File


+ 1
- 1
smack-im/build.gradle View File

@@ -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")))
}

+ 1
- 1
smack-integration-test/build.gradle View File

@@ -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"
}



+ 2
- 1
smack-java8-full/build.gradle View File

@@ -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) {


+ 0
- 1
smack-jingle-old/build.gradle View File

@@ -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")
}

+ 2
- 1
smack-legacy/build.gradle View File

@@ -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")))
}

+ 1
- 1
smack-omemo-signal/build.gradle View File

@@ -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")
}

+ 1
- 1
smack-omemo/build.gradle View File

@@ -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")))
}

+ 1
- 1
smack-openpgp/build.gradle View File

@@ -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"
}

+ 0
- 2
smack-repl/build.gradle View File

@@ -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 {


+ 0
- 1
smack-resolver-minidns-dox/build.gradle View File

@@ -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")
}

+ 2
- 1
smack-sasl-javax/build.gradle View File

@@ -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")))
}

+ 2
- 1
smack-sasl-provided/build.gradle View File

@@ -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")))
}

+ 2
- 1
smack-tcp/build.gradle View File

@@ -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")))
}

+ 1
- 1
smack-xmlparser-stax/build.gradle View File

@@ -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")
}

+ 1
- 1
smack-xmlparser-xpp3/build.gradle View File

@@ -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…
Cancel
Save