1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-12 05:51:08 +01:00

SmackReactor/NIO, Java8/Android19, Pretty print XML, FSM connections

This commit adds
- SmackReactor / NIO
- a framework for finite state machine connections
- support for Java 8
- pretty printed XML debug output

It also
- reworks the integration test framework
- raises the minimum Android API level to 19
- introduces XmppNioTcpConnection

Furthermore fixes SMACK-801 (at least partly). Java 8 language
features are available, but not all runtime library methods. For that
we would need to raise the Android API level to 24 or higher.
This commit is contained in:
Florian Schmaus 2019-02-04 08:59:39 +01:00
parent dba12919d0
commit e98d42790a
144 changed files with 8692 additions and 1455 deletions

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015 Florian Schmaus
* Copyright 2015-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.
@ -48,7 +48,7 @@ public class ChatTest extends AbstractSmackIntegrationTest {
private boolean invoked;
@SuppressWarnings("deprecation")
public ChatTest(SmackIntegrationTestEnvironment environment) {
public ChatTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
chatManagerOne = org.jivesoftware.smack.chat.ChatManager.getInstanceFor(conOne);
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015 Florian Schmaus
* Copyright 2015-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.
@ -25,8 +25,6 @@ import java.security.NoSuchAlgorithmException;
import org.jivesoftware.smack.sasl.SASLError;
import org.jivesoftware.smack.sasl.SASLErrorException;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.util.StringUtils;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
@ -35,7 +33,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
public LoginIntegrationTest(SmackIntegrationTestEnvironment environment) {
public LoginIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}
@ -54,14 +52,13 @@ public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
public void testInvalidLogin() throws SmackException, IOException, XMPPException,
InterruptedException, KeyManagementException, NoSuchAlgorithmException {
final String nonExistentUserString = StringUtils.insecureRandomString(24);
XMPPTCPConnectionConfiguration conf = getConnectionConfiguration().setUsernameAndPassword(
nonExistentUserString, "invalidPassword").build();
final String invalidPassword = "invalidPassword";
XMPPTCPConnection connection = new XMPPTCPConnection(conf);
AbstractXMPPConnection connection = getUnconnectedConnection();
connection.connect();
try {
connection.login();
connection.login(nonExistentUserString, invalidPassword);
fail("Exception expected");
}
catch (SASLErrorException e) {

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015 Florian Schmaus
* Copyright 2015-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.
@ -28,23 +28,20 @@ import org.jivesoftware.smack.filter.MessageWithBodiesFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
public class StreamManagementTest extends AbstractSmackLowLevelIntegrationTest {
public class StreamManagementTest extends AbstractSmackSpecificLowLevelIntegrationTest<XMPPTCPConnection> {
public StreamManagementTest(SmackIntegrationTestEnvironment environment) throws Exception {
super(environment);
performCheck(new ConnectionCallback() {
@Override
public void connectionCallback(XMPPTCPConnection connection) throws Exception {
if (!connection.isSmAvailable()) {
throw new TestNotPossibleException("XEP-198: Stream Mangement not supported by service");
}
}
});
public StreamManagementTest(SmackIntegrationTestEnvironment<?> environment) throws Exception {
super(environment, XMPPTCPConnection.class);
XMPPTCPConnection connection = getSpecificUnconnectedConnection();
connection.connect().login();
if (!connection.isSmAvailable()) {
throw new TestNotPossibleException("XEP-198: Stream Mangement not supported by service");
}
}
@SmackIntegrationTest

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2017 Florian Schmaus
* Copyright 2015-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.
@ -20,25 +20,23 @@ import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest {
public WaitForClosingStreamElementTest(SmackIntegrationTestEnvironment environment) {
public WaitForClosingStreamElementTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}
@SmackIntegrationTest
public void waitForClosingStreamElementTest(XMPPTCPConnection connection)
public void waitForClosingStreamElementTest(AbstractXMPPConnection connection)
throws NoSuchFieldException, SecurityException, IllegalArgumentException,
IllegalAccessException {
connection.disconnect();
Field closingStreamReceivedField = connection.getClass().getDeclaredField("closingStreamReceived");
Field closingStreamReceivedField = AbstractXMPPConnection.class.getDeclaredField("closingStreamReceived");
closingStreamReceivedField.setAccessible(true);
SynchronizationPoint<?> closingStreamReceived = (SynchronizationPoint<?>) closingStreamReceivedField.get(connection);
Exception failureException = closingStreamReceived.getFailureException();

View file

@ -0,0 +1,67 @@
/**
*
* Copyright 2018-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.
* 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;
import java.util.List;
import java.util.logging.Level;
import org.jivesoftware.smack.tcp.XmppNioTcpConnection;
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;
public class XmppConnectionIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
public XmppConnectionIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}
@SmackIntegrationTest(connectionCount = 4)
public void allToAllMessageSendTest(List<AbstractXMPPConnection> connections)
throws InterruptedException, NotAllMessagesReceivedException, ErrorsWhileSendingOrReceivingException {
final long seed = 42;
final int messagesPerConnection = 3; // 100
final int maxPayloadChunkSize = 16; // 512
final int maxPayloadChunks = 4; // 32
final boolean intermixMessages = false; // true
XmppConnectionStressTest.Configuration stressTestConfiguration = new XmppConnectionStressTest.Configuration(
seed, messagesPerConnection, maxPayloadChunkSize, maxPayloadChunks, intermixMessages);
XmppConnectionStressTest stressTest = new XmppConnectionStressTest(stressTestConfiguration);
stressTest.run(connections, timeout);
final Level connectionStatsLogLevel = Level.FINE;
if (LOGGER.isLoggable(connectionStatsLogLevel)) {
if (connections.get(0) instanceof XmppNioTcpConnection) {
for (XMPPConnection connection : connections) {
XmppNioTcpConnection xmppNioTcpConnection = (XmppNioTcpConnection) connection;
XmppNioTcpConnection.Stats stats = xmppNioTcpConnection.getStats();
LOGGER.log(connectionStatsLogLevel,
"Connections stats for " + xmppNioTcpConnection + ":\n{}",
stats);
}
}
}
}
}

View file

@ -25,7 +25,7 @@ public abstract class AbstractChatIntegrationTest extends AbstractSmackIntegrati
protected final ChatManager chatManagerTwo;
protected final ChatManager chatManagerThree;
protected AbstractChatIntegrationTest(SmackIntegrationTestEnvironment environment) {
protected AbstractChatIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
chatManagerOne = ChatManager.getInstanceFor(conOne);
chatManagerTwo = ChatManager.getInstanceFor(conTwo);

View file

@ -26,7 +26,7 @@ import org.jxmpp.jid.EntityBareJid;
public class IncomingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
public IncomingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment environment) {
public IncomingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}

View file

@ -26,7 +26,7 @@ import org.jxmpp.jid.EntityBareJid;
public class OutgoingMessageListenerIntegrationTest extends AbstractChatIntegrationTest {
public OutgoingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment environment) {
public OutgoingMessageListenerIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2016-2018 Florian Schmaus
* Copyright 2016-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.
@ -18,8 +18,8 @@ package org.jivesoftware.smack.roster;
import java.util.concurrent.TimeoutException;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
@ -30,12 +30,13 @@ import org.jxmpp.jid.FullJid;
public class LowLevelRosterIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
public LowLevelRosterIntegrationTest(SmackIntegrationTestEnvironment environment) {
public LowLevelRosterIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}
@SmackIntegrationTest
public void testPresenceEventListenersOffline(final XMPPTCPConnection conOne, final XMPPTCPConnection conTwo) throws TimeoutException, Exception {
public void testPresenceEventListenersOffline(final AbstractXMPPConnection conOne,
final AbstractXMPPConnection conTwo) throws TimeoutException, Exception {
IntegrationTestRosterUtil.ensureBothAccountsAreNotInEachOthersRoster(conOne, conTwo);
final Roster rosterOne = Roster.getInstanceFor(conOne);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2018 Florian Schmaus
* Copyright 2015-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.
@ -38,7 +38,7 @@ public class RosterIntegrationTest extends AbstractSmackIntegrationTest {
private final Roster rosterOne;
private final Roster rosterTwo;
public RosterIntegrationTest(SmackIntegrationTestEnvironment environment) {
public RosterIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
rosterOne = Roster.getInstanceFor(conOne);
rosterTwo = Roster.getInstanceFor(conTwo);

View file

@ -0,0 +1,46 @@
/**
*
* Copyright 2018-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.
* 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.tcp;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.igniterealtime.smack.inttest.AbstractSmackSpecificLowLevelIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
public class XmppNioTcpConnectionLowLevelIntegrationTest extends AbstractSmackSpecificLowLevelIntegrationTest<XmppNioTcpConnection> {
public XmppNioTcpConnectionLowLevelIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment, XmppNioTcpConnection.class);
}
@SmackIntegrationTest
public void testDisconnectAfterConnect() throws KeyManagementException, NoSuchAlgorithmException, SmackException,
IOException, XMPPException, InterruptedException {
XmppNioTcpConnection connection = getSpecificUnconnectedConnection();
connection.connect();
connection.disconnect();
}
}

View file

@ -0,0 +1,21 @@
/**
*
* Copyright 2015 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.
*/
/**
* TCP-IP related classes for Smack.
*/
package org.jivesoftware.smack.tcp;

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2013-2018 Florian Schmaus
* Copyright 2013-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.
@ -57,7 +57,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {
private final ServiceDiscoveryManager sdmOne;
private final ServiceDiscoveryManager sdmTwo;
public EntityCapsTest(SmackIntegrationTestEnvironment environment) {
public EntityCapsTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
ecmTwo = EntityCapsManager.getInstanceFor(environment.conTwo);
sdmOne = ServiceDiscoveryManager.getInstanceFor(environment.conOne);

View file

@ -54,7 +54,7 @@ public class ChatStateIntegrationTest extends AbstractSmackIntegrationTest {
};
public ChatStateIntegrationTest(SmackIntegrationTestEnvironment environment) {
public ChatStateIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015 Florian Schmaus
* Copyright 2015-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.
@ -39,7 +39,7 @@ public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {
private final FileTransferManager ftManagerOne;
private final FileTransferManager ftManagerTwo;
public FileTransferIntegrationTest(SmackIntegrationTestEnvironment environment) {
public FileTransferIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
ftManagerOne = FileTransferManager.getInstanceFor(conOne);
ftManagerTwo = FileTransferManager.getInstanceFor(conTwo);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Florian Schmaus
* Copyright 2017-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.
@ -43,7 +43,7 @@ public class HttpFileUploadIntegrationTest extends AbstractSmackIntegrationTest
private final HttpFileUploadManager hfumOne;
public HttpFileUploadIntegrationTest(SmackIntegrationTestEnvironment environment) throws XMPPErrorException,
public HttpFileUploadIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws XMPPErrorException,
NotConnectedException, NoResponseException, InterruptedException, TestNotPossibleException {
super(environment);
hfumOne = HttpFileUploadManager.getInstanceFor(conOne);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2016-2018 Florian Schmaus
* Copyright 2016-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.
@ -43,7 +43,7 @@ public class IoTControlIntegrationTest extends AbstractSmackIntegrationTest {
private final IoTControlManager IoTControlManagerTwo;
public IoTControlIntegrationTest(SmackIntegrationTestEnvironment environment) {
public IoTControlIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
IoTControlManagerOne = IoTControlManager.getInstanceFor(conOne);
IoTControlManagerTwo = IoTControlManager.getInstanceFor(conTwo);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2016-2018 Florian Schmaus
* Copyright 2016-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.
@ -45,7 +45,7 @@ public class IoTDataIntegrationTest extends AbstractSmackIntegrationTest {
private final IoTDataManager iotDataManagerTwo;
public IoTDataIntegrationTest(SmackIntegrationTestEnvironment environment) {
public IoTDataIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
iotDataManagerOne = IoTDataManager.getInstanceFor(conOne);
iotDataManagerTwo = IoTDataManager.getInstanceFor(conTwo);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2016 Florian Schmaus
* Copyright 2016-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.
@ -41,7 +41,7 @@ public class IoTDiscoveryIntegrationTest extends AbstractSmackIntegrationTest {
private final IoTDiscoveryManager discoveryManagerOne;
private final IoTDiscoveryManager discoveryManagerTwo;
public IoTDiscoveryIntegrationTest(SmackIntegrationTestEnvironment environment) throws NoResponseException,
public IoTDiscoveryIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
super(environment);
discoveryManagerOne = IoTDiscoveryManager.getInstanceFor(conOne);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015 Florian Schmaus
* Copyright 2015-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.
@ -31,7 +31,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
public class VersionIntegrationTest extends AbstractSmackIntegrationTest {
public VersionIntegrationTest(SmackIntegrationTestEnvironment environment) {
public VersionIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2016 Fernando Ramirez, 2018 Florian Schmaus
* Copyright 2016 Fernando Ramirez, 2018-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.
@ -47,7 +47,7 @@ public class MamIntegrationTest extends AbstractSmackIntegrationTest {
private final MamManager mamManagerConTwo;
public MamIntegrationTest(SmackIntegrationTestEnvironment environment) throws NoResponseException,
public MamIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException, NotLoggedInException {
super(environment);

View file

@ -35,7 +35,7 @@ public class MoodIntegrationTest extends AbstractSmackIntegrationTest {
private final MoodManager mm1;
private final MoodManager mm2;
public MoodIntegrationTest(SmackIntegrationTestEnvironment environment) {
public MoodIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
mm1 = MoodManager.getInstanceFor(conOne);
mm2 = MoodManager.getInstanceFor(conTwo);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2018 Florian Schmaus
* Copyright 2015-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.
@ -53,7 +53,7 @@ public class MultiUserChatIntegrationTest extends AbstractSmackIntegrationTest {
private final MultiUserChatManager mucManagerTwo;
private final DomainBareJid mucService;
public MultiUserChatIntegrationTest(SmackIntegrationTestEnvironment environment)
public MultiUserChatIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws NoResponseException, XMPPErrorException, NotConnectedException,
InterruptedException, TestNotPossibleException {
super(environment);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2018 Florian Schmaus
* Copyright 2015-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.
@ -20,9 +20,9 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.bookmarks.BookmarkManager;
@ -40,20 +40,20 @@ import org.jxmpp.jid.parts.Resourcepart;
public class MultiUserChatLowLevelIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
public MultiUserChatLowLevelIntegrationTest(SmackIntegrationTestEnvironment environment) throws Exception {
public MultiUserChatLowLevelIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws Exception {
super(environment);
performCheck(new ConnectionCallback() {
@Override
public void connectionCallback(XMPPTCPConnection connection) throws Exception {
if (MultiUserChatManager.getInstanceFor(connection).getMucServiceDomains().isEmpty()) {
throw new TestNotPossibleException("MUC component not offered by service");
}
AbstractXMPPConnection connection = getConnectedConnection();
try {
if (MultiUserChatManager.getInstanceFor(connection).getMucServiceDomains().isEmpty()) {
throw new TestNotPossibleException("MUC component not offered by service");
}
});
} finally {
recycle(connection);
}
}
@SmackIntegrationTest
public void testMucBookmarksAutojoin(XMPPTCPConnection connection) throws InterruptedException,
public void testMucBookmarksAutojoin(AbstractXMPPConnection connection) throws InterruptedException,
TestNotPossibleException, XMPPException, SmackException, IOException {
final BookmarkManager bookmarkManager = BookmarkManager.getBookmarkManager(connection);
if (!bookmarkManager.isSupported()) {

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Florian Schmaus, Paul Schaub
* Copyright 2017-2018 Florian Schmaus, Paul Schaub
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
*/
public abstract class AbstractOmemoIntegrationTest extends AbstractSmackIntegrationTest {
public AbstractOmemoIntegrationTest(SmackIntegrationTestEnvironment environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, TestNotPossibleException {
public AbstractOmemoIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, TestNotPossibleException {
super(environment);
// Test for server support

View file

@ -39,7 +39,7 @@ public abstract class AbstractTwoUsersOmemoIntegrationTest extends AbstractOmemo
protected OmemoManager alice, bob;
public AbstractTwoUsersOmemoIntegrationTest(SmackIntegrationTestEnvironment environment)
public AbstractTwoUsersOmemoIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, TestNotPossibleException {
super(environment);

View file

@ -34,7 +34,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
*/
public class MessageEncryptionIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {
public MessageEncryptionIntegrationTest(SmackIntegrationTestEnvironment environment)
public MessageEncryptionIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, TestNotPossibleException {
super(environment);

View file

@ -37,7 +37,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
* Then Bob fetches his Mam archive and decrypts the result.
*/
public class OmemoMamDecryptionTest extends AbstractTwoUsersOmemoIntegrationTest {
public OmemoMamDecryptionTest(SmackIntegrationTestEnvironment environment)
public OmemoMamDecryptionTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, TestNotPossibleException {
super(environment);

View file

@ -32,7 +32,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {
public ReadOnlyDeviceIntegrationTest(SmackIntegrationTestEnvironment environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, TestNotPossibleException {
public ReadOnlyDeviceIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException, TestNotPossibleException {
super(environment);
}

View file

@ -25,7 +25,7 @@ import org.igniterealtime.smack.inttest.TestNotPossibleException;
public class SessionRenegotiationIntegrationTest extends AbstractTwoUsersOmemoIntegrationTest {
public SessionRenegotiationIntegrationTest(SmackIntegrationTestEnvironment environment)
public SessionRenegotiationIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException, TestNotPossibleException {
super(environment);

View file

@ -41,7 +41,7 @@ public abstract class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegr
protected final PepManager bobPepManager;
protected final PepManager chloePepManager;
protected AbstractOpenPgpIntegrationTest(SmackIntegrationTestEnvironment environment)
protected AbstractOpenPgpIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
InterruptedException, SmackException.NoResponseException {
super(environment);

View file

@ -97,7 +97,7 @@ public class OXSecretKeyBackupIntegrationTest extends AbstractOpenPgpIntegration
* @throws InterruptedException
* @throws SmackException.NoResponseException
*/
public OXSecretKeyBackupIntegrationTest(SmackIntegrationTestEnvironment environment)
public OXSecretKeyBackupIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
InterruptedException, SmackException.NoResponseException {
super(environment);

View file

@ -87,7 +87,7 @@ public class OXInstantMessagingIntegrationTest extends AbstractOpenPgpIntegratio
* @throws TestNotPossibleException if the test is not possible due to lacking server support for PEP.
* @throws SmackException.NoResponseException
*/
public OXInstantMessagingIntegrationTest(SmackIntegrationTestEnvironment environment)
public OXInstantMessagingIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws XMPPException.XMPPErrorException, InterruptedException, SmackException.NotConnectedException,
TestNotPossibleException, SmackException.NoResponseException {
super(environment);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2017 Florian Schmaus
* Copyright 2015-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.
@ -39,7 +39,7 @@ import org.jxmpp.jid.Jid;
public class PingIntegrationTest extends AbstractSmackIntegrationTest {
public PingIntegrationTest(SmackIntegrationTestEnvironment environment) {
public PingIntegrationTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2018 Florian Schmaus
* Copyright 2015-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.
@ -34,7 +34,7 @@ public class PubSubIntegrationTest extends AbstractSmackIntegrationTest {
private final PubSubManager pubSubManagerOne;
public PubSubIntegrationTest(SmackIntegrationTestEnvironment environment)
public PubSubIntegrationTest(SmackIntegrationTestEnvironment<?> environment)
throws TestNotPossibleException, NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException {
super(environment);

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2004 Jive Software, 2017 Florian Schmaus.
* Copyright 2004 Jive Software, 2017-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.
@ -39,7 +39,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
*/
public class FormTest extends AbstractSmackIntegrationTest {
public FormTest(SmackIntegrationTestEnvironment environment) {
public FormTest(SmackIntegrationTestEnvironment<?> environment) {
super(environment);
}