From b5f9d4d7a370bc8f329327e6f3d06484ee1dfaed Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 11 Apr 2020 21:59:21 +0200 Subject: [PATCH] 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. --- build.gradle | 13 +++--- config/checkstyle/suppressions.xml | 2 +- smack-core/build.gradle | 26 ++++++----- .../jivesoftware/smack/DummyConnection.java | 1 - .../smack/ThreadedDummyConnection.java | 0 .../smack/sasl/AbstractSaslTest.java | 0 .../smack/sasl/DigestMd5SaslTest.java | 0 .../smack/test/util/CharSequenceEquals.java | 4 +- .../smack/test}/util/MemoryLeakTestUtil.java | 8 ++-- .../smack/test}/util/NetworkUtil.java | 2 +- .../smack/test/util/SmackTestSuite.java | 0 .../smack/test/util/SmackTestUtil.java | 0 .../smack/test/util/TestUtils.java | 0 .../test/util/WaitForPacketListener.java | 0 .../smack/test/util/Whitebox.java | 44 +++++++++++++++++++ .../smack/test/util/XmlUnitUtils.java | 0 smack-debug-slf4j/build.gradle | 1 - smack-debug/build.gradle | 1 - smack-experimental/build.gradle | 4 +- .../jivesoftware/smackx/hashes/HashTest.java | 7 --- smack-extensions/build.gradle | 3 +- .../bytestreams/ibb/CloseListenerTest.java | 4 +- .../bytestreams/ibb/DataListenerTest.java | 4 +- .../InBandBytestreamSessionMessageTest.java | 8 ++-- .../ibb/InBandBytestreamSessionTest.java | 20 ++++----- .../ibb/InitiationListenerTest.java | 4 +- .../socks5/InitiationListenerTest.java | 4 +- .../socks5/Socks5ByteStreamManagerTest.java | 2 +- .../socks5/Socks5ByteStreamRequestTest.java | 2 +- .../bytestreams/socks5/Socks5ClientTest.java | 2 +- .../bytestreams/socks5/Socks5TestProxy.java | 2 +- .../smackx/muc/MucMemoryLeakTest.java | 2 +- .../jivesoftware/smackx/InitExtensions.java | 0 .../jivesoftware/util/ConnectionUtils.java | 0 .../java/org/jivesoftware/util/Protocol.java | 0 .../org/jivesoftware/util/Verification.java | 0 smack-im/build.gradle | 2 +- smack-integration-test/build.gradle | 2 +- smack-java8-full/build.gradle | 3 +- smack-jingle-old/build.gradle | 1 - smack-legacy/build.gradle | 3 +- smack-omemo-signal/build.gradle | 2 +- smack-omemo/build.gradle | 2 +- smack-openpgp/build.gradle | 2 +- smack-repl/build.gradle | 2 - smack-resolver-minidns-dox/build.gradle | 1 - smack-sasl-javax/build.gradle | 3 +- smack-sasl-provided/build.gradle | 3 +- smack-tcp/build.gradle | 3 +- smack-xmlparser-stax/build.gradle | 2 +- smack-xmlparser-xpp3/build.gradle | 2 +- 51 files changed, 123 insertions(+), 80 deletions(-) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/DummyConnection.java (99%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/ThreadedDummyConnection.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java (94%) rename smack-core/src/{test/java/org/jivesoftware/smack => testFixtures/java/org/jivesoftware/smack/test}/util/MemoryLeakTestUtil.java (96%) rename smack-core/src/{test/java/org/jivesoftware/smack => testFixtures/java/org/jivesoftware/smack/test}/util/NetworkUtil.java (97%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/SmackTestSuite.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/SmackTestUtil.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/TestUtils.java (100%) rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java (100%) create mode 100644 smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java rename smack-core/src/{test => testFixtures}/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java (100%) rename smack-extensions/src/{test => testFixtures}/java/org/jivesoftware/smackx/InitExtensions.java (100%) rename smack-extensions/src/{test => testFixtures}/java/org/jivesoftware/util/ConnectionUtils.java (100%) rename smack-extensions/src/{test => testFixtures}/java/org/jivesoftware/util/Protocol.java (100%) rename smack-extensions/src/{test => testFixtures}/java/org/jivesoftware/util/Verification.java (100%) diff --git a/build.gradle b/build.gradle index 41d2448b6..d43ecc7d5 100644 --- a/build.gradle +++ b/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" } } diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index f638dbbf1..2a22f2881 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -9,5 +9,5 @@ it disabled until gradle uses a checkstyle version where this is fixed - + diff --git a/smack-core/build.gradle b/smack-core/build.gradle index d9da388b1..acbbba065 100644 --- a/smack-core/build.gradle +++ b/smack-core/build.gradle @@ -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 { diff --git a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java similarity index 99% rename from smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java index 3dc30cc76..135fd79d0 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/DummyConnection.java +++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/DummyConnection.java @@ -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; diff --git a/smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/ThreadedDummyConnection.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/ThreadedDummyConnection.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/AbstractSaslTest.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java similarity index 94% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java index 479ba39e7..cefc3e919 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java +++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java @@ -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 { return charSequenceString.equals(itemString); } - @Factory public static Matcher equalsCharSequence(CharSequence charSequence) { return new CharSequenceEquals(charSequence); } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/MemoryLeakTestUtil.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java similarity index 96% rename from smack-core/src/test/java/org/jivesoftware/smack/util/MemoryLeakTestUtil.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java index 1b453979f..6746e8f13 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/util/MemoryLeakTestUtil.java +++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/MemoryLeakTestUtil.java @@ -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) { diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/NetworkUtil.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/NetworkUtil.java similarity index 97% rename from smack-core/src/test/java/org/jivesoftware/smack/util/NetworkUtil.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/NetworkUtil.java index ac58e8790..5b38d9ad0 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/util/NetworkUtil.java +++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/NetworkUtil.java @@ -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; diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestSuite.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestSuite.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestSuite.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestUtil.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestUtil.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/SmackTestUtil.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/SmackTestUtil.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/TestUtils.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/TestUtils.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/TestUtils.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/TestUtils.java diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/WaitForPacketListener.java diff --git a/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java new file mode 100644 index 000000000..6d0cf5814 --- /dev/null +++ b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/Whitebox.java @@ -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 getInternalState(Object object, String fieldName, Class 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); + } + +} diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java b/smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java similarity index 100% rename from smack-core/src/test/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java rename to smack-core/src/testFixtures/java/org/jivesoftware/smack/test/util/XmlUnitUtils.java diff --git a/smack-debug-slf4j/build.gradle b/smack-debug-slf4j/build.gradle index bf1477b6e..fe3456341 100644 --- a/smack-debug-slf4j/build.gradle +++ b/smack-debug-slf4j/build.gradle @@ -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") } diff --git a/smack-debug/build.gradle b/smack-debug/build.gradle index 3cc23ac14..62324392c 100644 --- a/smack-debug/build.gradle +++ b/smack-debug/build.gradle @@ -4,5 +4,4 @@ Inspect the exchanged XMPP stanzas.""" dependencies { compile project(':smack-core') - testCompile project(path: ":smack-core", configuration: "testRuntime") } diff --git a/smack-experimental/build.gradle b/smack-experimental/build.gradle index f64702d10..e3b2d3771 100644 --- a/smack-experimental/build.gradle +++ b/smack-experimental/build.gradle @@ -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"))) } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java index 91a9852e7..355f1a45a 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashTest.java @@ -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"; diff --git a/smack-extensions/build.gradle b/smack-extensions/build.gradle index 0083169ae..6f56016ce 100644 --- a/smack-extensions/build.gradle +++ b/smack-extensions/build.gradle @@ -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") } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java index 4671209fd..ef1ffd75f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/CloseListenerTest.java @@ -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"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java index 7e8d8e34f..f558c3939 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/DataListenerTest.java @@ -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"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java index a327204a8..08a40b344 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionMessageTest.java @@ -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++) { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java index b1cd44c98..f8a6e48b4 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSessionTest.java @@ -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"); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java index 3e8c6212c..5844f3c2f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/InitiationListenerTest.java @@ -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); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java index 5093361b8..3bfe87bca 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/InitiationListenerTest.java @@ -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, diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java index e25dd3d17..c2b748686 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamManagerTest.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java index e8aa92f9f..5b764da5a 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ByteStreamRequestTest.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java index 4f7a2810b..af2623e1d 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5ClientTest.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java index 3d32ebd40..9788fba02 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/socks5/Socks5TestProxy.java @@ -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 diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java index d9e35fefd..602a60aaa 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/muc/MucMemoryLeakTest.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java b/smack-extensions/src/testFixtures/java/org/jivesoftware/smackx/InitExtensions.java similarity index 100% rename from smack-extensions/src/test/java/org/jivesoftware/smackx/InitExtensions.java rename to smack-extensions/src/testFixtures/java/org/jivesoftware/smackx/InitExtensions.java diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java b/smack-extensions/src/testFixtures/java/org/jivesoftware/util/ConnectionUtils.java similarity index 100% rename from smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java rename to smack-extensions/src/testFixtures/java/org/jivesoftware/util/ConnectionUtils.java diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java b/smack-extensions/src/testFixtures/java/org/jivesoftware/util/Protocol.java similarity index 100% rename from smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java rename to smack-extensions/src/testFixtures/java/org/jivesoftware/util/Protocol.java diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/Verification.java b/smack-extensions/src/testFixtures/java/org/jivesoftware/util/Verification.java similarity index 100% rename from smack-extensions/src/test/java/org/jivesoftware/util/Verification.java rename to smack-extensions/src/testFixtures/java/org/jivesoftware/util/Verification.java diff --git a/smack-im/build.gradle b/smack-im/build.gradle index 6c8fd90d1..f89202c2a 100644 --- a/smack-im/build.gradle +++ b/smack-im/build.gradle @@ -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"))) } diff --git a/smack-integration-test/build.gradle b/smack-integration-test/build.gradle index 27e983dd4..b7bc586d0 100644 --- a/smack-integration-test/build.gradle +++ b/smack-integration-test/build.gradle @@ -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" } diff --git a/smack-java8-full/build.gradle b/smack-java8-full/build.gradle index 8bf5dfe6a..5ba426c3b 100644 --- a/smack-java8-full/build.gradle +++ b/smack-java8-full/build.gradle @@ -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) { diff --git a/smack-jingle-old/build.gradle b/smack-jingle-old/build.gradle index f73c62913..7dff7e80e 100644 --- a/smack-jingle-old/build.gradle +++ b/smack-jingle-old/build.gradle @@ -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") } diff --git a/smack-legacy/build.gradle b/smack-legacy/build.gradle index 98c828ea4..b89dbdcc8 100644 --- a/smack-legacy/build.gradle +++ b/smack-legacy/build.gradle @@ -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"))) } diff --git a/smack-omemo-signal/build.gradle b/smack-omemo-signal/build.gradle index 3c81d2c9d..16af5ba86 100644 --- a/smack-omemo-signal/build.gradle +++ b/smack-omemo-signal/build.gradle @@ -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") } diff --git a/smack-omemo/build.gradle b/smack-omemo/build.gradle index 89ec8a473..d1b45b005 100644 --- a/smack-omemo/build.gradle +++ b/smack-omemo/build.gradle @@ -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"))) } diff --git a/smack-openpgp/build.gradle b/smack-openpgp/build.gradle index 665f141d2..4c835f116 100644 --- a/smack-openpgp/build.gradle +++ b/smack-openpgp/build.gradle @@ -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" } diff --git a/smack-repl/build.gradle b/smack-repl/build.gradle index dc691a89c..3176e1985 100644 --- a/smack-repl/build.gradle +++ b/smack-repl/build.gradle @@ -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 { diff --git a/smack-resolver-minidns-dox/build.gradle b/smack-resolver-minidns-dox/build.gradle index 3d070c5bd..62c973774 100644 --- a/smack-resolver-minidns-dox/build.gradle +++ b/smack-resolver-minidns-dox/build.gradle @@ -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") } diff --git a/smack-sasl-javax/build.gradle b/smack-sasl-javax/build.gradle index d45511565..f2275f363 100644 --- a/smack-sasl-javax/build.gradle +++ b/smack-sasl-javax/build.gradle @@ -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"))) } diff --git a/smack-sasl-provided/build.gradle b/smack-sasl-provided/build.gradle index 3e3b2d64f..d7391664c 100644 --- a/smack-sasl-provided/build.gradle +++ b/smack-sasl-provided/build.gradle @@ -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"))) } diff --git a/smack-tcp/build.gradle b/smack-tcp/build.gradle index 1c174288a..74ec76eb8 100644 --- a/smack-tcp/build.gradle +++ b/smack-tcp/build.gradle @@ -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"))) } diff --git a/smack-xmlparser-stax/build.gradle b/smack-xmlparser-stax/build.gradle index 03c727630..d4e21ba8f 100644 --- a/smack-xmlparser-stax/build.gradle +++ b/smack-xmlparser-stax/build.gradle @@ -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") } diff --git a/smack-xmlparser-xpp3/build.gradle b/smack-xmlparser-xpp3/build.gradle index fb647f0bc..a0afd7c4a 100644 --- a/smack-xmlparser-xpp3/build.gradle +++ b/smack-xmlparser-xpp3/build.gradle @@ -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") }