diff --git a/.travis.yml b/.travis.yml index 76b041f70..3bfa93892 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ install: gradle assemble --stacktrace # functional. Which hasn't always be the case in the past, see # 90cbcaebc7a89f4f771f733a33ac9f389df85be2 # Also run javadocAll to ensure it works. -script: gradle check install javadocAll --stacktrace +script: gradle check publishToMavenLocal javadocAll --stacktrace after_success: - JAVAC_VERSION=$((javac -version) 2>&1) diff --git a/build.gradle b/build.gradle index 2c9ba38b2..d705a0cd2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.gradle.plugins.signing.Sign - buildscript { repositories { jcenter() @@ -38,7 +36,8 @@ allprojects { rootConfigDir = new File(rootDir, 'config') sonatypeCredentialsAvailable = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword') isReleaseVersion = !isSnapshot - signingRequired = isReleaseVersion + isContinuousIntegrationEnvironment = Boolean.parseBoolean(System.getenv('CI')) + signingRequired = !(isSnapshot || isContinuousIntegrationEnvironment) sonatypeSnapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots' sonatypeStagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' // Returns only the date in yyyy-MM-dd format, as otherwise, with @@ -132,6 +131,7 @@ allprojects { ].collect { project(it) } junitVersion = '5.4.2' powerMockVersion = '2.0.2' + commonsIoVersion = '2.6' } group = 'org.igniterealtime.smack' sourceCompatibility = JavaVersion.VERSION_1_8 @@ -387,7 +387,7 @@ ${oneLineDesc}.""" evaluationDependsOnChildren() subprojects { - apply plugin: 'maven' + apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'checkstyle' apply plugin: 'org.kordamp.gradle.clirr' @@ -403,89 +403,62 @@ subprojects { classifier = 'javadoc' from javadoc.destinationDir } - task testJar(type: Jar, dependsOn: testClasses) { + task testsJar(type: Jar, dependsOn: testClasses) { classifier = 'tests' from sourceSets.test.output } - // Does install unique snapshosts (and release)s in the local maven - // repository, unlike the 'install' task. - // You can specify the path of the local maven repository using 'maven.repo.local', e.g. - // gradle uploadLocal -Dmaven.repo.local=/var/www/repo - task uploadLocal(type: Upload) { - description "Uploads artifacts into the local maven repositories URL." - configuration = configurations['archives'] - repositories { - mavenDeployer { - repository url: repositories.mavenLocal().url - } - } - } - - configurations { - archivesOutput.extendsFrom (testCompile) - } - artifacts { - archives sourcesJar - archives javadocJar - archives testJar // See http://stackoverflow.com/a/21946676/194894 - testRuntime testJar + testRuntime testsJar } - uploadArchives { - repositories { - mavenDeployer { - if (signingRequired) { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - } - repository(url: project.sonatypeStagingUrl) { - if (sonatypeCredentialsAvailable) { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - } - snapshotRepository(url: project.sonatypeSnapshotUrl) { - if (sonatypeCredentialsAvailable) { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - } - - pom.project { - name 'Smack' - packaging 'jar' - inceptionYear '2003' - url 'http://www.igniterealtime.org/projects/smack/' + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + artifact testsJar + pom { + name = 'Smack' + packaging = 'jar' + inceptionYear = '2003' + url = 'http://www.igniterealtime.org/projects/smack/' description project.description issueManagement { - system 'JIRA' - url 'https://igniterealtime.org/issues/browse/SMACK' - } - - distributionManagement { - snapshotRepository { - id 'smack.snapshot' - url project.sonatypeSnapshotUrl - } + system = 'JIRA' + url = 'https://igniterealtime.org/issues/browse/SMACK' } scm { - url 'https://github.com/igniterealtime/Smack' - connection 'scm:git:https://github.com/igniterealtime/Smack.git' - developerConnection 'scm:git:https://github.com/igniterealtime/Smack.git' + url = 'https://github.com/igniterealtime/Smack' + connection = 'scm:git:https://github.com/igniterealtime/Smack.git' + developerConnection = 'scm:git:https://github.com/igniterealtime/Smack.git' } developers { developer { - id 'flow' - name 'Florian Schmaus' - email 'flow@igniterealtime.org' + id = 'flow' + name = 'Florian Schmaus' + email = 'flow@igniterealtime.org' } } } } } + repositories { + maven { + url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl + if (sonatypeCredentialsAvailable) { + credentials { + username = sonatypeUsername + password = sonatypePassword + } + } + } + } } rootProject.distributionZip { dependsOn build @@ -507,7 +480,7 @@ subprojects { signing { useGpgCmd() required { signingRequired } - sign configurations.archives + sign publishing.publications.mavenJava } clirr { @@ -589,15 +562,15 @@ configure(subprojects - gplLicensedProjects) { checkstyle { configProperties.checkstyleLicenseHeader = "header" } - uploadArchives { - repositories { - mavenDeployer { - pom.project { + publishing { + publications { + mavenJava(MavenPublication) { + pom { licenses { license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' } } } @@ -610,15 +583,16 @@ configure(gplLicensedProjects) { checkstyle { configProperties.checkstyleLicenseHeader = "${project.name}-gplv3-license-header" } - uploadArchives { - repositories { - mavenDeployer { - pom.project { - licenses { - license { - name 'GNU General Public License, version 3 or any later version' - url 'https://www.gnu.org/licenses/gpl.txt' - distribution 'repo' + publishing { + publications { + mavenJava(MavenPublication) { + pom { + licenses { + license { + name = 'GNU General Public License, version 3 or any later version' + url = 'https://www.gnu.org/licenses/gpl.txt' + distribution = 'repo' + } } } } @@ -626,8 +600,6 @@ configure(gplLicensedProjects) { } } -} - configure(androidBootClasspathProjects) { compileJava { options.bootstrapClasspath = files(androidBootClasspath) diff --git a/smack-android/build.gradle b/smack-android/build.gradle index 97fd7c120..46d83633d 100644 --- a/smack-android/build.gradle +++ b/smack-android/build.gradle @@ -24,5 +24,5 @@ dependencies { } // Add the Android jar to the Eclipse .classpath. - compile files(androidBootClasspath) + compileOnly files(androidBootClasspath) } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java index 3b5fe6b0e..4c4fe93d1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java @@ -66,15 +66,23 @@ public class AbstractError { * @return the descriptive text or null. */ public String getDescriptiveText() { - String defaultLocale = Locale.getDefault().getLanguage(); - String descriptiveText = getDescriptiveText(defaultLocale); - if (descriptiveText == null) { - descriptiveText = getDescriptiveText("en"); - if (descriptiveText == null) { - descriptiveText = getDescriptiveText(""); - } + if (descriptiveTexts.isEmpty()) + return null; + // attempt to obtain the text in the user's locale, the English text, or the "" default + Locale l = Locale.getDefault(); + String[] tags = new String[] { + l.getLanguage() + "-" + l.getCountry() + "-" + l.getVariant(), + l.getLanguage() + "-" + l.getCountry(), + l.getLanguage(), + "en", + "" + }; + for (String tag : tags) { + String descriptiveText = getDescriptiveText(tag); + if (descriptiveText != null) + return descriptiveText; } - return descriptiveText; + return descriptiveTexts.values().iterator().next(); } /** diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java index 2ca66515a..752fda1cf 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2017 Florian Schmaus + * Copyright 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,13 +19,9 @@ package org.jivesoftware.smack.util; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; public class LazyStringBuilder implements Appendable, CharSequence { - private static final Logger LOGGER = Logger.getLogger(LazyStringBuilder.class.getName()); - private final List list; private String cache; @@ -80,8 +76,7 @@ public class LazyStringBuilder implements Appendable, CharSequence { } catch (NullPointerException npe) { StringBuilder sb = safeToStringBuilder(); - LOGGER.log(Level.SEVERE, "The following LazyStringBuilder threw a NullPointerException: " + sb, npe); - throw npe; + throw new RuntimeException("The following LazyStringBuilder threw a NullPointerException: " + sb, npe); } return length; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index acf5ac1b4..f8c030501 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -627,8 +627,10 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { } @Override - public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) { - StringBuilder res = new StringBuilder(); + public StringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + // This is only the potential length, since the actual length depends on the given XmlEnvironment. + int potentialLength = length(); + StringBuilder res = new StringBuilder(potentialLength); try { appendXmlTo(res, enclosingXmlEnvironment); } catch (IOException e) { @@ -646,7 +648,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { else if (csq instanceof XmlNsAttribute) { XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq; if (!xmlNsAttribute.value.equals(enclosingXmlEnvironment.getEffectiveNamespace())) { - sb.append(xmlNsAttribute); + appendable.append(xmlNsAttribute); enclosingXmlEnvironment = new XmlEnvironment(xmlNsAttribute.value); } } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/test/util/FileTestUtil.java b/smack-core/src/test/java/org/jivesoftware/smack/test/util/FileTestUtil.java deleted file mode 100644 index fab3fc820..000000000 --- a/smack-core/src/test/java/org/jivesoftware/smack/test/util/FileTestUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright © 2018 Paul Schaub - * - * 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.io.File; -import java.util.Stack; - -public class FileTestUtil { - - /** - * Returns a {@link File} pointing to a temporary directory. On unix like systems this might be {@code /tmp} - * for example. - * If {@code suffix} is not null, the returned file points to {@code /suffix}. - * - * @param suffix optional path suffix - * @return temp directory - */ - public static File getTempDir(String suffix) { - String temp = System.getProperty("java.io.tmpdir"); - if (temp == null) { - temp = "tmp"; - } - - if (suffix == null) { - return new File(temp); - } else { - return new File(temp, suffix); - } - } - - /** - * Recursively delete a directory and its contents. - * - * @param root root directory - */ - public static void deleteDirectory(File root) { - if (!root.exists()) { - return; - } - File[] currList; - Stack stack = new Stack<>(); - stack.push(root); - while (!stack.isEmpty()) { - if (stack.lastElement().isDirectory()) { - currList = stack.lastElement().listFiles(); - if (currList != null && currList.length > 0) { - for (File curr : currList) { - stack.push(curr); - } - } else { - stack.pop().delete(); - } - } else { - stack.pop().delete(); - } - } - } -} diff --git a/smack-experimental/build.gradle b/smack-experimental/build.gradle index f7c057b3e..f1078bcc4 100644 --- a/smack-experimental/build.gradle +++ b/smack-experimental/build.gradle @@ -8,7 +8,6 @@ dependencies { compile project(':smack-core') compile project(':smack-extensions') testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") testCompile project(path: ":smack-extensions", configuration: "testRuntime") compile "org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion" diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java index b43cc6078..fbe507e4e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java @@ -51,6 +51,8 @@ public final class StableUniqueStanzaIdManager extends Manager { private static final Map INSTANCES = new WeakHashMap<>(); + private static boolean enabledByDefault = true; + // Filter for outgoing stanzas. private static final StanzaFilter OUTGOING_FILTER = new AndFilter( MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE, @@ -72,7 +74,9 @@ public final class StableUniqueStanzaIdManager extends Manager { XMPPConnectionRegistry.addConnectionCreationListener(new ConnectionCreationListener() { @Override public void connectionCreated(XMPPConnection connection) { - getInstanceFor(connection); + if (enabledByDefault) { + getInstanceFor(connection).enable(); + } } }); } @@ -83,7 +87,10 @@ public final class StableUniqueStanzaIdManager extends Manager { */ private StableUniqueStanzaIdManager(XMPPConnection connection) { super(connection); - enable(); + } + + public static void setEnabledByDefault(boolean enabled) { + enabledByDefault = enabled; } /** diff --git a/smack-extensions/build.gradle b/smack-extensions/build.gradle index 2ae9f9c19..0083169ae 100644 --- a/smack-extensions/build.gradle +++ b/smack-extensions/build.gradle @@ -11,5 +11,4 @@ dependencies { // e.g. message delivery receipts the roster compile project(':smack-im') testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java index d77602583..4c99a8867 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java @@ -557,6 +557,7 @@ public class ConfigureForm extends Form { * @deprecated use {@link #isSubscribe()} instead */ @Deprecated + // TODO: Remove in Smack 4.5. public boolean isSubscibe() { return isSubscribe(); } diff --git a/smack-im/build.gradle b/smack-im/build.gradle index d1608591b..6c8fd90d1 100644 --- a/smack-im/build.gradle +++ b/smack-im/build.gradle @@ -8,5 +8,4 @@ Roster, Chat and other functionality.""" dependencies { compile project(':smack-core') testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") } diff --git a/smack-integration-test/build.gradle b/smack-integration-test/build.gradle index 9be816aaf..f16e9b76c 100644 --- a/smack-integration-test/build.gradle +++ b/smack-integration-test/build.gradle @@ -14,9 +14,9 @@ dependencies { compile project(':smack-omemo') compile project(':smack-openpgp') compile project(':smack-debug') - compile project(path: ":smack-omemo", configuration: "testRuntime") compile 'org.reflections:reflections:0.9.11' compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1' + compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion" // Note that the junit-vintage-engine runtime dependency is not // directly required, but it declares a dependency to // junit:junit:4.12, which we currently need in sinttest, since it @@ -25,6 +25,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") testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests" } diff --git a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/util/EphemeralTrustCallback.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/EphemeralTrustCallback.java similarity index 97% rename from smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/util/EphemeralTrustCallback.java rename to smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/EphemeralTrustCallback.java index 9b3f393ea..fdc02d1ad 100644 --- a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/util/EphemeralTrustCallback.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/EphemeralTrustCallback.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.jivesoftware.smackx.omemo.util; +package org.jivesoftware.smackx.omemo; import java.util.HashMap; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java index 97fa93820..fba866790 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoManagerSetupHelper.java @@ -33,7 +33,6 @@ import org.jivesoftware.smackx.omemo.exceptions.CorruptedOmemoKeyException; import org.jivesoftware.smackx.omemo.internal.OmemoCachedDeviceList; import org.jivesoftware.smackx.omemo.internal.OmemoDevice; import org.jivesoftware.smackx.omemo.trust.OmemoFingerprint; -import org.jivesoftware.smackx.omemo.util.EphemeralTrustCallback; import org.jivesoftware.smackx.omemo.util.OmemoConstants; import org.jivesoftware.smackx.pubsub.PubSubException; import org.jivesoftware.smackx.pubsub.PubSubManager; diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java index 5137960e4..b72636bc8 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox/OXSecretKeyBackupIntegrationTest.java @@ -32,7 +32,6 @@ import java.util.logging.Level; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.ox.callback.backup.AskForBackupCodeCallback; import org.jivesoftware.smackx.ox.callback.backup.DisplayBackupCodeCallback; @@ -63,8 +62,9 @@ import org.pgpainless.key.protection.UnprotectedKeysProtector; public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegrationTest { private static final String sessionId = StringUtils.randomString(10); - private static final File beforePath = FileTestUtil.getTempDir("ox_backup_" + sessionId); - private static final File afterPath = FileTestUtil.getTempDir("ox_restore_" + sessionId); + private static final File tempDir = org.apache.commons.io.FileUtils.getTempDirectory(); + private static final File beforePath = new File(tempDir, "ox_backup_" + sessionId); + private static final File afterPath = new File(tempDir, "ox_restore_" + sessionId); private String backupCode = null; @@ -108,10 +108,10 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration @AfterClass @BeforeClass - public static void cleanStore() { + public static void cleanStore() throws IOException { LOGGER.log(Level.INFO, "Delete store directories..."); - FileTestUtil.deleteDirectory(afterPath); - FileTestUtil.deleteDirectory(beforePath); + org.apache.commons.io.FileUtils.deleteDirectory(afterPath); + org.apache.commons.io.FileUtils.deleteDirectory(beforePath); } @After diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java index 6a89976fb..1b469953d 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingIntegrationTest.java @@ -20,12 +20,12 @@ import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertTrue; import java.io.File; +import java.io.IOException; import java.util.logging.Level; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smackx.ox.AbstractOpenPgpIntegrationTest; import org.jivesoftware.smackx.ox.OpenPgpContact; @@ -49,8 +49,9 @@ import org.pgpainless.key.protection.UnprotectedKeysProtector; public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegrationTest { private static final String sessionId = StringUtils.randomString(10); - private static final File aliceStorePath = FileTestUtil.getTempDir("basic_ox_messaging_test_alice_" + sessionId); - private static final File bobStorePath = FileTestUtil.getTempDir("basic_ox_messaging_test_bob_" + sessionId); + private static final File tempDir = org.apache.commons.io.FileUtils.getTempDirectory(); + private static final File aliceStorePath = new File(tempDir, "basic_ox_messaging_test_alice_" + sessionId); + private static final File bobStorePath = new File(tempDir, "basic_ox_messaging_test_bob_" + sessionId); private OpenPgpV4Fingerprint aliceFingerprint = null; private OpenPgpV4Fingerprint bobFingerprint = null; @@ -95,10 +96,10 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio @BeforeClass @AfterClass - public static void deleteStore() { + public static void deleteStore() throws IOException { LOGGER.log(Level.INFO, "Deleting storage directories..."); - FileTestUtil.deleteDirectory(aliceStorePath); - FileTestUtil.deleteDirectory(bobStorePath); + org.apache.commons.io.FileUtils.deleteDirectory(aliceStorePath); + org.apache.commons.io.FileUtils.deleteDirectory(bobStorePath); } @SmackIntegrationTest diff --git a/smack-openpgp/build.gradle b/smack-openpgp/build.gradle index 35ef3eae9..5ef546976 100644 --- a/smack-openpgp/build.gradle +++ b/smack-openpgp/build.gradle @@ -15,5 +15,5 @@ dependencies { compile 'org.pgpainless:pgpainless-core:0.0.1-alpha7' testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") + testCompile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion" } diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java index ca11a53b4..5ba6fd0e1 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpStoreTest.java @@ -35,7 +35,6 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smackx.ox.callback.SecretKeyPassphraseCallback; @@ -78,7 +77,7 @@ public class OpenPgpStoreTest extends SmackTestSuite { private final OpenPgpStore openPgpStoreInstance2; static { - storagePath = FileTestUtil.getTempDir("storeTest"); + storagePath = new File(org.apache.commons.io.FileUtils.getTempDirectory(), "storeTest"); } @Parameterized.Parameters @@ -99,8 +98,8 @@ public class OpenPgpStoreTest extends SmackTestSuite { @Before @After - public void deletePath() { - FileTestUtil.deleteDirectory(storagePath); + public void deletePath() throws IOException { + org.apache.commons.io.FileUtils.deleteDirectory(storagePath); } /* diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java index 65c639971..34b0c564b 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PainlessOpenPgpProviderTest.java @@ -32,7 +32,6 @@ import java.util.List; import org.jivesoftware.smack.DummyConnection; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.xml.XmlPullParserException; @@ -63,13 +62,13 @@ public class PainlessOpenPgpProviderTest extends SmackTestSuite { private static final BareJid bob = JidTestUtil.BARE_JID_2; static { - storagePath = FileTestUtil.getTempDir("smack-painlessprovidertest"); + storagePath = new File(org.apache.commons.io.FileUtils.getTempDirectory(), "smack-painlessprovidertest"); } @BeforeClass @AfterClass - public static void deletePath() { - FileTestUtil.deleteDirectory(storagePath); + public static void deletePath() throws IOException { + org.apache.commons.io.FileUtils.deleteDirectory(storagePath); } @Test diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java index 92d8ad92e..9afee2b19 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java @@ -28,7 +28,6 @@ import java.util.Arrays; import java.util.Collections; import org.jivesoftware.smack.DummyConnection; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider; @@ -55,7 +54,7 @@ public class SecretKeyBackupHelperTest extends SmackTestSuite { private static final File basePath; static { - basePath = FileTestUtil.getTempDir("ox_secret_keys"); + basePath = new File(org.apache.commons.io.FileUtils.getTempDirectory(), "ox_secret_keys"); } @Test @@ -98,7 +97,7 @@ public class SecretKeyBackupHelperTest extends SmackTestSuite { @AfterClass @BeforeClass - public static void deleteDirs() { - FileTestUtil.deleteDirectory(basePath); + public static void deleteDirs() throws IOException { + org.apache.commons.io.FileUtils.deleteDirectory(basePath); } } diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java index d5f1571a4..85de7aae0 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManagerTest.java @@ -34,7 +34,6 @@ import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.test.util.FileTestUtil; import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.xml.XmlPullParserException; @@ -63,7 +62,7 @@ public class OXInstantMessagingManagerTest extends SmackTestSuite { private static final File basePath; static { - basePath = FileTestUtil.getTempDir("ox_im_test_" + StringUtils.randomString(10)); + basePath = new File(org.apache.commons.io.FileUtils.getTempDirectory(), "ox_im_test_" + StringUtils.randomString(10)); } @Test @@ -169,7 +168,7 @@ public class OXInstantMessagingManagerTest extends SmackTestSuite { @AfterClass @BeforeClass - public static void deleteDirs() { - FileTestUtil.deleteDirectory(basePath); + public static void deleteDirs() throws IOException { + org.apache.commons.io.FileUtils.deleteDirectory(basePath); } } diff --git a/smack-repl/build.gradle b/smack-repl/build.gradle index 53579773d..f7f246d6d 100644 --- a/smack-repl/build.gradle +++ b/smack-repl/build.gradle @@ -23,7 +23,6 @@ dependencies { compile "org.scala-lang:scala-library:$scalaVersion" compile "com.lihaoyi:ammonite_$scalaVersion:1.3.2" testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") } scalaStyle { diff --git a/smack-sasl-javax/build.gradle b/smack-sasl-javax/build.gradle index da4a818cc..d45511565 100644 --- a/smack-sasl-javax/build.gradle +++ b/smack-sasl-javax/build.gradle @@ -5,5 +5,4 @@ Use javax.security.sasl for SASL.""" dependencies { compile project(':smack-core') testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") } diff --git a/smack-sasl-provided/build.gradle b/smack-sasl-provided/build.gradle index d02277ba8..3e3b2d64f 100644 --- a/smack-sasl-provided/build.gradle +++ b/smack-sasl-provided/build.gradle @@ -5,5 +5,4 @@ Use Smack provided code for SASL.""" dependencies { compile project(':smack-core') testCompile project(path: ":smack-core", configuration: "testRuntime") - testCompile project(path: ":smack-core", configuration: "archives") }