mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-21 19:42:05 +01:00
sinttest: migrate to JUnit5, drop JUnit4
The before/after class annotations are now no longer borrowed from JUnit. Also some integration tests used @After and/or @Before from JUnit, which was never supported nor had any effected. Those methods got deleted. But since there appears to be a desire for such a functionality in sinttest, we should consider adding one.
This commit is contained in:
parent
fdeaaf368e
commit
e8fef260e6
47 changed files with 248 additions and 221 deletions
|
@ -124,7 +124,6 @@ allprojects {
|
|||
junit4Projects = [
|
||||
':smack-core',
|
||||
':smack-im',
|
||||
':smack-integration-test',
|
||||
':smack-omemo',
|
||||
':smack-omemo-signal',
|
||||
':smack-openpgp',
|
||||
|
|
|
@ -12,14 +12,7 @@ dependencies {
|
|||
compile 'org.reflections:reflections:0.9.11'
|
||||
compile 'eu.geekplace.javapinning:java-pinning-java7:1.1.0-alpha1'
|
||||
compile group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
||||
// Note that the junit-vintage-engine runtime dependency is not
|
||||
// directly required, but it declares a dependency to
|
||||
// junit:junit:4.12, which we currently need in sinttest, since it
|
||||
// (ab)uses @Before from org.junit
|
||||
compile "org.junit.vintage:junit-vintage-engine:$junitVersion"
|
||||
compile 'junit:junit:4.12'
|
||||
// Add Junit 5 API for e.g. assertThrows()
|
||||
implementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
api "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
|
||||
}
|
||||
|
|
|
@ -65,8 +65,9 @@ import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
|||
import org.jivesoftware.smackx.iqregister.AccountManager;
|
||||
|
||||
import org.igniterealtime.smack.inttest.Configuration.AccountRegistration;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.MethodAnnotationsScanner;
|
||||
import org.reflections.scanners.MethodParameterScanner;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* 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.igniterealtime.smack.inttest.annotations;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface AfterClass {
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
* 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.igniterealtime.smack.inttest.annotations;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface BeforeClass {
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.igniterealtime.smack.inttest;
|
||||
package org.igniterealtime.smack.inttest.annotations;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Java annotations for Smack's Integration Test Framework.
|
||||
*/
|
||||
package org.igniterealtime.smack.inttest.annotations;
|
|
@ -19,9 +19,9 @@ package org.jivesoftware.smack;
|
|||
|
||||
import static org.jivesoftware.smackx.jiveproperties.JivePropertiesManager.addProperty;
|
||||
import static org.jivesoftware.smackx.jiveproperties.JivePropertiesManager.getProperty;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -34,10 +34,10 @@ import org.jivesoftware.smack.packet.StanzaBuilder;
|
|||
import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
/**
|
||||
* Tests for Chat Manager and for Chat Manager Listener.
|
||||
|
@ -87,33 +87,33 @@ public class ChatTest extends AbstractSmackIntegrationTest {
|
|||
newChat.sendMessage(msg);
|
||||
|
||||
Message msg2 = collector.nextResult(2000);
|
||||
assertNotNull("No message was received", msg2);
|
||||
assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject());
|
||||
assertEquals("Bodies are different", msg.getBody(), msg2.getBody());
|
||||
assertNotNull(msg2, "No message was received");
|
||||
assertEquals(msg.getSubject(), msg2.getSubject(), "Subjects are different");
|
||||
assertEquals(msg.getBody(), msg2.getBody(), "Bodies are different");
|
||||
assertEquals(
|
||||
"favoriteColors are different",
|
||||
getProperty(msg, "favoriteColor"),
|
||||
getProperty(msg2, "favoriteColor"));
|
||||
getProperty(msg2, "favoriteColor"),
|
||||
"favoriteColors are different");
|
||||
assertEquals(
|
||||
"ages are different",
|
||||
getProperty(msg, "age"),
|
||||
getProperty(msg2, "age"));
|
||||
getProperty(msg2, "age"),
|
||||
"ages are different");
|
||||
assertEquals(
|
||||
"distances are different",
|
||||
getProperty(msg, "distance"),
|
||||
getProperty(msg2, "distance"));
|
||||
getProperty(msg2, "distance"),
|
||||
"distances are different");
|
||||
assertEquals(
|
||||
"weights are different",
|
||||
getProperty(msg, "weight"),
|
||||
getProperty(msg2, "weight"));
|
||||
getProperty(msg2, "weight"),
|
||||
"weights are different");
|
||||
assertEquals(
|
||||
"males are different",
|
||||
getProperty(msg, "male"),
|
||||
getProperty(msg2, "male"));
|
||||
getProperty(msg2, "male"),
|
||||
"males are different");
|
||||
assertEquals(
|
||||
"birthdates are different",
|
||||
getProperty(msg, "birthdate"),
|
||||
getProperty(msg2, "birthdate"));
|
||||
getProperty(msg2, "birthdate"),
|
||||
"birthdates are different");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -131,7 +131,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
|
|||
chatManagerOne.addChatListener(listener);
|
||||
chatManagerOne.createChat(conTwo.getUser());
|
||||
|
||||
assertTrue("TestChatManagerListener wasn't invoked", invoked);
|
||||
assertTrue(invoked, "TestChatManagerListener wasn't invoked");
|
||||
}
|
||||
finally {
|
||||
chatManagerOne.removeChatListener(listener);
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.jivesoftware.smack.sasl.packet.SaslNonza;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smack;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -29,9 +29,9 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> {
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
*/
|
||||
package org.jivesoftware.smack;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.igniterealtime.smack.XmppConnectionStressTest;
|
|||
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.ErrorsWhileSendingOrReceivingException;
|
||||
import org.igniterealtime.smack.XmppConnectionStressTest.StressTestFailedException.NotAllMessagesReceivedException;
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class ModularXmppClientToServerConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<ModularXmppClientToServerConnection> {
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smack.chat2;
|
|||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.jivesoftware.smack.AbstractXMPPConnection;
|
|||
import org.jivesoftware.smack.packet.Presence;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.FullJid;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smack.roster;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -26,8 +26,8 @@ import org.jivesoftware.smack.roster.packet.RosterPacket.ItemType;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.caps;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -45,11 +45,11 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
|||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
||||
|
||||
|
@ -169,7 +169,8 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
|
|||
DiscoverInfo info = sdmOne.discoverInfo(conTwo.getUser());
|
||||
// that discovery should cause a disco#info
|
||||
assertTrue(discoInfoSend.get());
|
||||
assertTrue("The info response '" + info + "' does not contain the expected feature '" + dummyFeature + '\'', info.containsFeature(dummyFeature));
|
||||
assertTrue(info.containsFeature(dummyFeature),
|
||||
"The info response '" + info + "' does not contain the expected feature '" + dummyFeature + '\'');
|
||||
discoInfoSend.set(false);
|
||||
|
||||
// discover that
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.jivesoftware.smackx.chatstates.ChatStateListener;
|
|||
import org.jivesoftware.smackx.chatstates.ChatStateManager;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.junit.After;
|
||||
|
||||
public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
|
|||
activeSyncPoint.waitForResult(timeout);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterClass
|
||||
public void cleanup() {
|
||||
ChatStateManager manTwo = ChatStateManager.getInstance(conTwo);
|
||||
manTwo.removeChatStateListener(composingListener);
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
|
||||
|
||||
public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -24,18 +24,17 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.SmackException.NotLoggedInException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
|
||||
import org.jivesoftware.smackx.geoloc.GeoLocationListener;
|
||||
import org.jivesoftware.smackx.geoloc.GeoLocationManager;
|
||||
import org.jivesoftware.smackx.geoloc.packet.GeoLocation;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.util.XmppDateTime;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.httpfileupload;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -33,9 +33,9 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.iot;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -31,8 +31,8 @@ import org.jivesoftware.smackx.iot.control.element.SetBoolData;
|
|||
import org.jivesoftware.smackx.iot.control.element.SetData;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.iot;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -35,8 +35,8 @@ import org.jivesoftware.smackx.iot.data.element.NodeElement;
|
|||
import org.jivesoftware.smackx.iot.data.element.TimestampElement;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
|
||||
public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.iot;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
|
@ -31,9 +31,9 @@ import org.jivesoftware.smackx.iot.discovery.ThingState;
|
|||
import org.jivesoftware.smackx.iot.discovery.element.IoTClaimed;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.iqversion;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
|
@ -26,8 +26,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
|||
import org.jivesoftware.smackx.iqversion.packet.Version;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class VersionIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.mam;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -38,9 +38,9 @@ import org.jivesoftware.smackx.mam.MamManager.MamQuery;
|
|||
import org.jivesoftware.smackx.mam.MamManager.MamQueryArgs;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.junit.AfterClass;
|
||||
|
||||
public class MoodIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muc;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -35,9 +35,9 @@ import org.jivesoftware.smackx.muc.MultiUserChatException.NotAMucServiceExceptio
|
|||
import org.jivesoftware.smackx.muc.packet.MUCUser;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.ResultSyncPoint;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.EntityBareJid;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.muc;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -30,9 +30,9 @@ import org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle;
|
|||
import org.jivesoftware.smackx.muc.bookmarkautojoin.MucBookmarkAutojoinManager;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.jid.parts.Localpart;
|
||||
|
|
|
@ -16,20 +16,19 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.omemo;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
* Abstract OMEMO integration test framing, which creates and initializes two OmemoManagers (for conOne and conTwo).
|
||||
|
@ -51,7 +50,6 @@ public abstract class AbstractTwoUsersOmemoIntegrationTest extends AbstractOmemo
|
|||
alice = OmemoManagerSetupHelper.prepareOmemoManager(conOne);
|
||||
bob = OmemoManagerSetupHelper.prepareOmemoManager(conTwo);
|
||||
|
||||
LOGGER.log(Level.FINE, "Alice: " + alice.getOwnDevice() + " Bob: " + bob.getOwnDevice());
|
||||
assertFalse(alice.getDeviceId().equals(bob.getDeviceId()));
|
||||
|
||||
// Subscribe presences
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.omemo;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
@ -26,9 +26,9 @@ import org.jivesoftware.smack.packet.MessageBuilder;
|
|||
|
||||
import org.jivesoftware.smackx.omemo.element.OmemoBundleElement;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
/**
|
||||
* Simple OMEMO message encryption integration test.
|
||||
|
@ -85,8 +85,8 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
|
|||
b2 = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice());
|
||||
}
|
||||
|
||||
assertEquals("Alice sent bob a preKeyMessage, so her bundle MUST still be the same.", a1, a1_);
|
||||
assertNotEquals("Bob just received a preKeyMessage from alice, so his bundle must have changed.", b1, b2);
|
||||
assertEquals(a1, a1_, "Alice sent bob a preKeyMessage, so her bundle MUST still be the same.");
|
||||
assertNotEquals(b1, b2, "Bob just received a preKeyMessage from alice, so his bundle must have changed.");
|
||||
|
||||
// Message B -> A
|
||||
final String body3 = "The german words for 'leek' and 'wimp' are the same.";
|
||||
|
@ -103,9 +103,9 @@ public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoInteg
|
|||
OmemoBundleElement a1__ = alice.getOmemoService().getOmemoStoreBackend().packOmemoBundle(alice.getOwnDevice());
|
||||
OmemoBundleElement b2_ = bob.getOmemoService().getOmemoStoreBackend().packOmemoBundle(bob.getOwnDevice());
|
||||
|
||||
assertEquals("Since alice initiated the session with bob, at no time he sent a preKeyMessage, " +
|
||||
"so her bundle MUST still be the same.", a1_, a1__);
|
||||
assertEquals("Bob changed his bundle earlier, but at this point his bundle must be equal to " +
|
||||
"after the first change.", b2, b2_);
|
||||
assertEquals(a1_, a1__, "Since alice initiated the session with bob, at no time he sent a preKeyMessage, " +
|
||||
"so her bundle MUST still be the same.");
|
||||
assertEquals(b2, b2_, "Bob changed his bundle earlier, but at this point his bundle must be equal to " +
|
||||
"after the first change.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.omemo;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -32,9 +32,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
|
|||
import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException;
|
||||
import org.jivesoftware.smackx.omemo.util.MessageOrOmemoMessage;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
/**
|
||||
* This test sends a message from Alice to Bob, while Bob has automatic decryption disabled.
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.omemo;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
@ -40,7 +40,6 @@ import org.jivesoftware.smackx.pubsub.PubSubManager;
|
|||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
||||
public class OmemoManagerSetupHelper {
|
||||
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.omemo;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -29,9 +29,9 @@ import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
|
|||
import org.jivesoftware.smackx.omemo.exceptions.ReadOnlyDeviceException;
|
||||
import org.jivesoftware.smackx.omemo.exceptions.UndecidedOmemoIdentityException;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.ox;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -44,19 +44,16 @@ import org.jivesoftware.smackx.ox.exception.MissingUserIdOnKeyException;
|
|||
import org.jivesoftware.smackx.ox.exception.NoBackupFoundException;
|
||||
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubException;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
||||
|
||||
|
@ -115,18 +112,6 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration
|
|||
org.apache.commons.io.FileUtils.deleteDirectory(beforePath);
|
||||
}
|
||||
|
||||
@After
|
||||
@Before
|
||||
public void cleanUp()
|
||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||
SmackException.NoResponseException {
|
||||
OpenPgpPubSubUtil.deleteSecretKeyNode(alicePepManager);
|
||||
|
||||
if (openPgpManager != null) {
|
||||
openPgpManager.stopMetadataListener();
|
||||
}
|
||||
}
|
||||
|
||||
@SmackIntegrationTest
|
||||
public void test() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException,
|
||||
NoSuchProviderException, IOException, InterruptedException, PubSubException.NotALeafNodeException,
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.ox_im;
|
||||
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -34,15 +34,13 @@ import org.jivesoftware.smackx.ox.OpenPgpManager;
|
|||
import org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider;
|
||||
import org.jivesoftware.smackx.ox.element.SigncryptElement;
|
||||
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
||||
import org.jivesoftware.smackx.ox.util.OpenPgpPubSubUtil;
|
||||
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.pgpainless.decryption_verification.OpenPgpMetadata;
|
||||
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
||||
|
@ -98,7 +96,6 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
|
|||
@BeforeClass
|
||||
@AfterClass
|
||||
public static void deleteStore() throws IOException {
|
||||
LOGGER.log(Level.INFO, "Deleting storage directories...");
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(aliceStorePath);
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(bobStorePath);
|
||||
}
|
||||
|
@ -165,26 +162,4 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
|
|||
bobReceivedMessage.waitForResult(timeout);
|
||||
}
|
||||
|
||||
@After
|
||||
public void deleteKeyMetadata()
|
||||
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
|
||||
SmackException.NoResponseException {
|
||||
OpenPgpPubSubUtil.deletePubkeysListNode(alicePepManager);
|
||||
OpenPgpPubSubUtil.deletePubkeysListNode(bobPepManager);
|
||||
|
||||
if (aliceFingerprint != null) {
|
||||
OpenPgpPubSubUtil.deletePublicKeyNode(alicePepManager, aliceFingerprint);
|
||||
}
|
||||
if (bobFingerprint != null) {
|
||||
OpenPgpPubSubUtil.deletePublicKeyNode(bobPepManager, bobFingerprint);
|
||||
}
|
||||
|
||||
if (aliceOpenPgp != null) {
|
||||
aliceOpenPgp.stopMetadataListener();
|
||||
}
|
||||
|
||||
if (bobOpenPgp != null) {
|
||||
bobOpenPgp.stopMetadataListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.ping;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -33,8 +33,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.jxmpp.jid.Jid;
|
||||
|
||||
public class PingIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
|
@ -28,9 +28,9 @@ import org.jivesoftware.smack.packet.StandardExtensionElement;
|
|||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.TestNotPossibleException;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
|
||||
public class PubSubIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -26,11 +26,11 @@ import org.jivesoftware.smack.packet.Message;
|
|||
import org.jivesoftware.smackx.usertune.element.UserTuneElement;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;
|
||||
import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
|
||||
import org.junit.AfterClass;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
|
||||
public class UserTuneIntegrationTest extends AbstractSmackIntegrationTest {
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jivesoftware.smackx.xdata;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NotConnectedException;
|
||||
import org.jivesoftware.smack.StanzaCollector;
|
||||
|
@ -31,8 +30,8 @@ import org.jivesoftware.smackx.xdata.FormField.Type;
|
|||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
|
||||
/**
|
||||
* Tests the DataForms extensions.
|
||||
|
@ -109,23 +108,17 @@ public class FormTest extends AbstractSmackIntegrationTest {
|
|||
|
||||
// Get the message with the form to fill out
|
||||
Message msg2 = collector2.nextResult();
|
||||
assertNotNull("Message not found", msg2);
|
||||
assertNotNull(msg2, "Message not found");
|
||||
// Retrieve the form to fill out
|
||||
Form formToRespond = Form.getFormFrom(msg2);
|
||||
assertNotNull(formToRespond);
|
||||
assertNotNull(formToRespond.getField("name"));
|
||||
assertNotNull(formToRespond.getField("description"));
|
||||
// Obtain the form to send with the replies
|
||||
Form completedForm = formToRespond.createAnswerForm();
|
||||
final Form completedForm = formToRespond.createAnswerForm();
|
||||
assertNotNull(completedForm.getField("hidden_var"));
|
||||
// Check that a field of type String does not accept booleans
|
||||
try {
|
||||
completedForm.setAnswer("name", true);
|
||||
fail("A boolean value was set to a field of type String");
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
// This exception is expected.
|
||||
}
|
||||
assertThrows(IllegalArgumentException.class, () -> completedForm.setAnswer("name", true));
|
||||
completedForm.setAnswer("name", "Credit card number invalid");
|
||||
completedForm.setAnswer(
|
||||
"description",
|
||||
|
@ -146,18 +139,18 @@ public class FormTest extends AbstractSmackIntegrationTest {
|
|||
|
||||
// Get the message with the completed form
|
||||
Message msg3 = collector.nextResult();
|
||||
assertNotNull("Message not found", msg3);
|
||||
assertNotNull(msg3, "Message not found");
|
||||
// Retrieve the completed form
|
||||
completedForm = Form.getFormFrom(msg3);
|
||||
assertNotNull(completedForm);
|
||||
assertNotNull(completedForm.getField("name"));
|
||||
assertNotNull(completedForm.getField("description"));
|
||||
final Form completedForm2 = Form.getFormFrom(msg3);
|
||||
assertNotNull(completedForm2);
|
||||
assertNotNull(completedForm2.getField("name"));
|
||||
assertNotNull(completedForm2.getField("description"));
|
||||
assertEquals(
|
||||
completedForm.getField("name").getValues().get(0).toString(),
|
||||
completedForm2.getField("name").getValues().get(0).toString(),
|
||||
"Credit card number invalid");
|
||||
assertNotNull(completedForm.getField("time"));
|
||||
assertNotNull(completedForm.getField("age"));
|
||||
assertEquals("The age is bad", "20", completedForm.getField("age").getValues().get(0).toString());
|
||||
assertNotNull(completedForm2.getField("time"));
|
||||
assertNotNull(completedForm2.getField("age"));
|
||||
assertEquals("20", completedForm2.getField("age").getValues().get(0).toString(), "The age is bad");
|
||||
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -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.
|
||||
|
@ -16,15 +16,15 @@
|
|||
*/
|
||||
package org.igniterealtime.smack.inttest;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.AbstractXMPPConnection;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SmackIntegrationTestFrameWorkTest {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.igniterealtime.smack.inttest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.KeyManagementException;
|
||||
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection;
|
|||
import org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionConfiguration;
|
||||
import org.jivesoftware.smack.tcp.XmppTcpTransportModuleDescriptor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
public class SmackIntegrationTestXmppConnectionManagerTest {
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
package org.igniterealtime.smack.inttest.unittest;
|
||||
|
||||
import static org.igniterealtime.smack.inttest.SmackIntegrationTestUnitTestUtil.getFrameworkForUnitTest;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
@ -38,25 +38,27 @@ import org.jivesoftware.smack.packet.StanzaError;
|
|||
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.DummySmackIntegrationTestFramework;
|
||||
import org.igniterealtime.smack.inttest.FailedTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework;
|
||||
import org.igniterealtime.smack.inttest.SmackIntegrationTestFramework.TestRunResult;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.igniterealtime.smack.inttest.annotations.AfterClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.BeforeClass;
|
||||
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SmackIntegrationTestFrameworkUnitTest {
|
||||
|
||||
private static boolean beforeClassInvoked;
|
||||
private static boolean afterClassInvoked;
|
||||
|
||||
@BeforeClass
|
||||
@BeforeAll
|
||||
public static void prepareSinttestUnitTest() {
|
||||
SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = true;
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void disallowSinntestUnitTest() {
|
||||
SmackIntegrationTestFramework.SINTTEST_UNIT_TEST = false;
|
||||
}
|
||||
|
@ -125,8 +127,8 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
|||
DummySmackIntegrationTestFramework sinttest = getFrameworkForUnitTest(BeforeAfterClassTest.class);
|
||||
sinttest.run();
|
||||
|
||||
assertTrue("A before class method should have been executed to this time", beforeClassInvoked);
|
||||
assertTrue("A after class method should have been executed to this time", afterClassInvoked);
|
||||
assertTrue(beforeClassInvoked, "A before class method should have been executed to this time");
|
||||
assertTrue(afterClassInvoked, "A after class method should have been executed to this time");
|
||||
}
|
||||
|
||||
public static class BeforeAfterClassTest extends AbstractSmackIntegrationTest {
|
||||
|
@ -147,8 +149,8 @@ public class SmackIntegrationTestFrameworkUnitTest {
|
|||
|
||||
@SmackIntegrationTest
|
||||
public void test() {
|
||||
assertTrue("A before class method should have been executed to this time", beforeClassInvoked);
|
||||
assertFalse("A after class method shouldn't have been executed to this time", afterClassInvoked);
|
||||
assertTrue(beforeClassInvoked, "A before class method should have been executed to this time");
|
||||
assertFalse(afterClassInvoked, "A after class method shouldn't have been executed to this time");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2015 Florian Schmaus
|
||||
* Copyright 2015-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.
|
||||
|
@ -16,14 +16,15 @@
|
|||
*/
|
||||
package org.igniterealtime.smack.inttest.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
|
||||
import org.jivesoftware.smack.util.Async;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ResultSyncPointTest {
|
||||
|
||||
|
@ -44,7 +45,7 @@ public class ResultSyncPointTest {
|
|||
assertEquals(result, receivedResult);
|
||||
}
|
||||
|
||||
@Test(expected = TestException.class)
|
||||
@Test
|
||||
public void exceptionTestResultSyncPoint() throws Exception {
|
||||
final CyclicBarrier barrier = new CyclicBarrier(2);
|
||||
final ResultSyncPoint<String, TestException> rsp = new ResultSyncPoint<>();
|
||||
|
@ -56,7 +57,7 @@ public class ResultSyncPointTest {
|
|||
}
|
||||
});
|
||||
barrier.await();
|
||||
rsp.waitForResult(60 * 1000);
|
||||
assertThrows(TestException.class, () -> rsp.waitForResult(60 * 1000));
|
||||
}
|
||||
|
||||
private static class TestException extends Exception {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2016 Florian Schmaus
|
||||
* Copyright 2016-2020 Florian Schmaus
|
||||
*
|
||||
* This file is part of smack-repl.
|
||||
*
|
||||
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
package org.igniterealtime.smack.smackrepl;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SmackReplTest {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue