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

Rename 'serviceName' to 'xmppServiceDomain'

Also use 'null' as default value for the resource, to enforce server
generated resources.

Fixes Smack-665
This commit is contained in:
Florian Schmaus 2015-05-18 16:48:23 +02:00
parent 0c8199650b
commit f369a009ac
38 changed files with 116 additions and 104 deletions

View file

@ -193,7 +193,7 @@ public class MessageTest extends SmackTestCase {
public void testHighestPriority() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration);
conn3.connect();
conn3.login(getUsername(0), getPassword(0), "Home");
@ -242,7 +242,7 @@ public class MessageTest extends SmackTestCase {
public void testHighestShow() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration);
conn3.connect();
conn3.login(getUsername(0), getPassword(0), "Home");
@ -291,7 +291,7 @@ public class MessageTest extends SmackTestCase {
public void testMostRecentActive() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn3 = new XMPPConnection(connectionConfiguration);
conn3.connect();
conn3.login(getUsername(0), getPassword(0), "Home");
@ -307,7 +307,7 @@ public class MessageTest extends SmackTestCase {
getConnection(0).sendStanza(presence);
connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration);
conn4.connect();
conn4.login(getUsername(0), getPassword(0), "Home2");
@ -326,7 +326,7 @@ public class MessageTest extends SmackTestCase {
PacketCollector coll4 = conn4.createPacketCollector(new MessageTypeFilter(Message.Type.chat));
// Send a message from this resource to indicate most recent activity
conn3.sendStanza(new Message("admin@" + getServiceName()));
conn3.sendStanza(new Message("admin@" + getXMPPServiceDomain()));
// User1 sends a message to the bare JID of User0
Chat chat = getConnection(1).getChatManager().createChat(getBareJID(0), null);

View file

@ -168,7 +168,7 @@ public class PresenceTest extends SmackTestCase {
public void testMultipleResources() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration);
conn4.connect();
conn4.login(getUsername(1), getPassword(1), "Home");

View file

@ -434,7 +434,7 @@ public class RosterSmackTest extends SmackTestCase {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration);
conn4.connect();
conn4.login(getUsername(1), getPassword(1), "Home");
@ -455,7 +455,7 @@ public class RosterSmackTest extends SmackTestCase {
assertTrue("Returned a null Presence for an existing user", presence.isAvailable());
// Check that the right presence is returned for a user+resource
presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getServiceName() + "/Home");
presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getXMPPServiceDomain() + "/Home");
assertEquals("Returned the wrong Presence", "Home",
StringUtils.parseResource(presence.getFrom()));
@ -466,7 +466,7 @@ public class RosterSmackTest extends SmackTestCase {
StringUtils.parseResource(presence.getFrom()));
// Check the returned presence for a non-existent user+resource
presence = roster.getPresenceResource("noname@" + getServiceName() + "/Smack");
presence = roster.getPresenceResource("noname@" + getXMPPServiceDomain() + "/Smack");
assertFalse("Available presence was returned for a non-existing user", presence.isAvailable());
assertEquals("Returned Presence for a non-existing user has the incorrect type",
Presence.Type.unavailable, presence.getType());
@ -501,7 +501,7 @@ public class RosterSmackTest extends SmackTestCase {
public void testMultipleResources() throws Exception {
// Create another connection for the same user of connection 1
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn4 = new XMPPConnection(connectionConfiguration);
conn4.connect();
conn4.login(getUsername(1), getPassword(1), "Home");
@ -566,7 +566,7 @@ public class RosterSmackTest extends SmackTestCase {
// Create another connection for the same user of connection 0
ConnectionConfiguration connectionConfiguration =
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
XMPPTCPConnection conn2 = new XMPPConnection(connectionConfiguration);
conn2.connect();
conn2.login(getUsername(0), getPassword(0), "Home");

View file

@ -185,7 +185,7 @@ public abstract class SmackTestCase extends TestCase {
* @return the bare XMPP address of the user (e.g. johndoe@jabber.org).
*/
protected String getBareJID(int index) {
return getUsername(index) + "@" + getConnection(index).getServiceName();
return getUsername(index) + "@" + getConnection(index).getXMPPServiceDomain();
}
/**
@ -207,7 +207,7 @@ public abstract class SmackTestCase extends TestCase {
return port;
}
protected String getServiceName() {
protected String getXMPPServiceDomain() {
return serviceName;
}
@ -259,7 +259,7 @@ public abstract class SmackTestCase extends TestCase {
// cases, but could fail if the user set a hostname in their XMPP server
// that will not resolve as a network connection.
host = connections[0].getHost();
serviceName = connections[0].getServiceName();
serviceName = connections[0].getXMPPServiceDomain();
if (!createOfflineConnections()) {
for (int i = 0; i < getMaxConnections(); i++) {

View file

@ -111,7 +111,7 @@ public class DNSUtilTest {
}
private void xmppClientDomainTest() {
List<HostAddress> hostAddresses = DNSUtil.resolveXMPPDomain(igniterealtimeDomain);
List<HostAddress> hostAddresses = DNSUtil.resolveXMPPServiceDomain(igniterealtimeDomain);
HostAddress ha = hostAddresses.get(0);
assertEquals(ha.getFQDN(), igniterealtimeXMPPServer);
assertEquals(ha.getPort(), igniterealtimeClientPort);