1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Merge branch '4.2' into master-paul-merged

This commit is contained in:
Florian Schmaus 2017-12-17 11:16:02 +01:00
commit 431e5b3c67
434 changed files with 1770 additions and 1517 deletions

View file

@ -25,11 +25,9 @@ import static org.junit.Assert.assertTrue;
import java.util.Date;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.chat.ChatManagerListener;
import org.jivesoftware.smack.filter.ThreadFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
@ -37,7 +35,6 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.jxmpp.stringprep.XmppStringprepException;
/**
* Tests for Chat Manager and for Chat Manager Listener.
@ -68,7 +65,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
@SuppressWarnings("deprecation")
@SmackIntegrationTest
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception {
public void testProperties() throws Exception {
org.jivesoftware.smack.chat.Chat newChat = chatManagerOne.createChat(conTwo.getUser());
StanzaCollector collector = conTwo.createStanzaCollector(new ThreadFilter(newChat.getThreadID()));
@ -85,7 +82,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
newChat.sendMessage(msg);
Message msg2 = (Message) collector.nextResult(2000);
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());

View file

@ -60,7 +60,7 @@ public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrat
}
});
// Disconnect conTwo, this should cause an 'unavilable' presence to be send from conTwo to
// Disconnect conTwo, this should cause an 'unavailable' presence to be send from conTwo to
// conOne.
conTwo.disconnect();

View file

@ -73,7 +73,7 @@ public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {
final FileTransferListener receiveListener = new FileTransferListener() {
@Override
public void fileTransferRequest(FileTransferRequest request) {
byte[] dataReceived = null;
byte[] dataReceived;
IncomingFileTransfer ift = request.accept();
try {
InputStream is = ift.receiveFile();
@ -105,9 +105,9 @@ public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {
while (!oft.isDone()) {
switch (oft.getStatus()) {
case error:
throw new Exception("Filetransfer error: " + oft.getError());
throw new Exception("FileTransfer error: " + oft.getError());
default:
LOGGER.info("Filetransfer status: " + oft.getStatus() + ". Progress: " + oft.getProgress());
LOGGER.info("FileTransfer status: " + oft.getStatus() + ". Progress: " + oft.getProgress());
break;
}
Thread.sleep(1000);

View file

@ -21,7 +21,6 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -62,7 +61,7 @@ public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest
}
@SmackIntegrationTest
public void httpFileUploadTest() throws FileNotFoundException, IOException, XMPPErrorException, InterruptedException, SmackException {
public void httpFileUploadTest() throws IOException, XMPPErrorException, InterruptedException, SmackException {
final int fileSize = FILE_SIZE;
File file = createNewTempFile();
FileOutputStream fos = new FileOutputStream(file.getCanonicalPath());

View file

@ -57,7 +57,7 @@ public class IoTControlIntegrationTest extends AbstractSmackIntegrationTest {
*/
@SmackIntegrationTest
// @SmackSerialIntegrationTest
public void controlTest() throws TimeoutException, Exception {
public void controlTest() throws Exception {
final String key = StringUtils.randomString(12);
final String sn = StringUtils.randomString(12);
final SimpleResultSyncPoint syncPoint = new SimpleResultSyncPoint();

View file

@ -58,7 +58,7 @@ public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest {
* @throws TimeoutException
*/
@SmackIntegrationTest
public void dataTest() throws TimeoutException, Exception {
public void dataTest() throws Exception {
final String key = StringUtils.randomString(12);
final String sn = StringUtils.randomString(12);
final int value = INSECURE_RANDOM.nextInt();

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.muc;
import java.util.List;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.SmackException.NoResponseException;
@ -25,7 +24,6 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.muc.MultiUserChat.MucCreateConfigFormHandle;
import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
@ -64,7 +62,7 @@ public class MultiUserChatIntegrationTest extends AbstractSmackIntegrationTest {
}
@SmackIntegrationTest
public void mucTest() throws TimeoutException, Exception {
public void mucTest() throws Exception {
EntityBareJid mucAddress = JidCreate.entityBareFrom(Localpart.from("smack-inttest-" + randomString), mucService.getDomain());
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);

View file

@ -79,7 +79,7 @@ public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelI
connection.connect().login();
// MucBookmarkAutojoinManager is also able to do its task automatically
// after every login, it's not determinstic when this will be finished.
// after every login, it's not deterministic when this will be finished.
// So we trigger it manually here.
MucBookmarkAutojoinManager.getInstanceFor(connection).autojoinBookmarkedConferences();

View file

@ -33,7 +33,7 @@ import org.junit.BeforeClass;
*/
public abstract class AbstractOmemoIntegrationTest extends AbstractSmackIntegrationTest {
static final File storePath;
private static final File storePath;
static {
String userHome = System.getProperty("user.home");

View file

@ -107,7 +107,7 @@ public class OmemoSessionRenegotiationTest extends AbstractOmemoIntegrationTest
@Override
public void onOmemoMessageReceived(String decryptedBody, Message encryptedMessage, Message wrappingMessage, OmemoMessageInformation omemoInformation) {
LOGGER.log(Level.INFO, "Alice received OMEMO message: " + decryptedBody);
assertEquals("Reply must match the messagewe sent.", decryptedBody, m2);
assertEquals("Reply must match the message we sent.", decryptedBody, m2);
sp2.signal();
}

View file

@ -94,12 +94,12 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {
store.getDateOfLastReceivedMessage(alice, bob.getOwnDevice()));
Date now = new Date();
store.setDateOfLastReceivedMessage(alice, bob.getOwnDevice(), now);
assertEquals("Date of last reveived message must match the one we set.",
assertEquals("Date of last received message must match the one we set.",
now, store.getDateOfLastReceivedMessage(alice, bob.getOwnDevice()));
assertNull("Date of last signed prekey renewal must be null.",
assertNull("Date of last signed preKey renewal must be null.",
store.getDateOfLastSignedPreKeyRenewal(alice));
store.setDateOfLastSignedPreKeyRenewal(alice, now);
assertEquals("Date of last signed prekey renewal must match our date.",
assertEquals("Date of last signed preKey renewal must match our date.",
now, store.getDateOfLastSignedPreKeyRenewal(alice));
// Keys

View file

@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.util.Async;
@ -29,7 +28,7 @@ import org.junit.Test;
public class ResultSyncPointTest {
@Test
public void testResultSyncPoint() throws InterruptedException, TimeoutException, Exception {
public void testResultSyncPoint() throws Exception {
final String result = "Hip Hip Hurrary!!111!";
final CyclicBarrier barrier = new CyclicBarrier(2);
final ResultSyncPoint<String, Exception> rsp = new ResultSyncPoint<>();
@ -46,7 +45,7 @@ public class ResultSyncPointTest {
}
@Test(expected = TestException.class)
public void exceptionTestResultSyncPoint() throws InterruptedException, TimeoutException, Exception {
public void exceptionTestResultSyncPoint() throws Exception {
final CyclicBarrier barrier = new CyclicBarrier(2);
final ResultSyncPoint<String, TestException> rsp = new ResultSyncPoint<>();
Async.go(new Async.ThrowingRunnable() {