mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-22 20:47:57 +01:00
Remove unnecessary argument from createMockedConnection()
The server address can be infered from the user JID.
This commit is contained in:
parent
2050845289
commit
acc64ffc2d
7 changed files with 10 additions and 18 deletions
|
@ -38,7 +38,6 @@ import org.jivesoftware.util.Protocol;
|
|||
import org.jivesoftware.util.Verification;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
|
||||
|
@ -52,7 +51,6 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
String sessionID = "session_id";
|
||||
|
||||
// protocol verifier
|
||||
|
@ -74,8 +72,7 @@ public class InBandBytestreamManagerTest extends InitExtensions {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID,
|
||||
xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.jivesoftware.util.Protocol;
|
|||
import org.jivesoftware.util.Verification;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
@ -60,7 +59,6 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
private static final String sessionID = "session_id";
|
||||
|
||||
private static final int blockSize = 10;
|
||||
|
@ -90,7 +88,7 @@ public class InBandBytestreamSessionMessageTest extends InitExtensions {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID, xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
|
||||
// initialize InBandBytestreamManager to get the InitiationListener
|
||||
byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.jivesoftware.util.Protocol;
|
|||
import org.jivesoftware.util.Verification;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.jid.DomainBareJid;
|
||||
import org.jxmpp.jid.EntityFullJid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
@ -61,7 +60,6 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
private static final String sessionID = "session_id";
|
||||
|
||||
private static final int blockSize = 10;
|
||||
|
@ -91,7 +89,7 @@ public class InBandBytestreamSessionTest extends InitExtensions {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID, xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
|
||||
// initialize InBandBytestreamManager to get the InitiationListener
|
||||
byteStreamManager = InBandBytestreamManager.getByteStreamManager(connection);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
private static final DomainBareJid xmppServer = initiatorJID.asDomainBareJid();
|
||||
private static final DomainBareJid proxyJID = JidTestUtil.MUC_EXAMPLE_ORG;
|
||||
private static final String proxyAddress = "127.0.0.1";
|
||||
private static final String sessionID = "session_id";
|
||||
|
@ -92,7 +92,7 @@ public class Socks5ByteStreamManagerTest {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID, xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ public class Socks5ByteStreamRequestTest {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
private static final DomainBareJid proxyJID = JidTestUtil.MUC_EXAMPLE_ORG;
|
||||
private static final String proxyAddress = "127.0.0.1";
|
||||
private static final String sessionID = "session_id";
|
||||
|
@ -79,7 +78,7 @@ public class Socks5ByteStreamRequestTest {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, targetJID, xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, targetJID);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ public class Socks5ClientForInitiatorTest {
|
|||
// settings
|
||||
private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;
|
||||
private static final EntityFullJid targetJID = JidTestUtil.FULL_JID_1_RESOURCE_1;
|
||||
private static final DomainBareJid xmppServer = JidTestUtil.DOMAIN_BARE_JID_1;
|
||||
private static final DomainBareJid proxyJID = JidTestUtil.MUC_EXAMPLE_ORG;
|
||||
private static final String loopbackAddress = InetAddress.getLoopbackAddress().getHostAddress();
|
||||
|
||||
|
@ -86,7 +85,7 @@ public class Socks5ClientForInitiatorTest {
|
|||
protocol = new Protocol();
|
||||
|
||||
// create mocked XMPP connection
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID, xmppServer);
|
||||
connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,14 +63,15 @@ public class ConnectionUtils {
|
|||
*
|
||||
* @param protocol protocol helper containing answer packets
|
||||
* @param initiatorJID the user associated to the XMPP connection
|
||||
* @param xmppServer the XMPP server associated to the XMPP connection
|
||||
* @return a mocked XMPP connection
|
||||
* @throws SmackException
|
||||
* @throws XMPPErrorException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public static XMPPConnection createMockedConnection(final Protocol protocol,
|
||||
EntityFullJid initiatorJID, DomainBareJid xmppServer) throws SmackException, XMPPErrorException, InterruptedException {
|
||||
EntityFullJid initiatorJID) throws SmackException, XMPPErrorException, InterruptedException {
|
||||
|
||||
DomainBareJid xmppServer = initiatorJID.asDomainBareJid();
|
||||
|
||||
// mock XMPP connection
|
||||
XMPPConnection connection = mock(XMPPConnection.class);
|
||||
|
|
Loading…
Reference in a new issue