1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-07 13:41:08 +01:00

Replaced #getHost with #getServiceName. SMACK-75

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2729 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-08-27 02:21:24 +00:00 committed by gato
parent 42fd837376
commit 991e958097
6 changed files with 20 additions and 14 deletions

View file

@ -83,6 +83,7 @@ import junit.framework.TestCase;
public abstract class SmackTestCase extends TestCase {
private String host = "localhost";
private String serviceName = "localhost";
private int port = 5222;
private String chatDomain = "chat.localhost";
@ -161,7 +162,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).getHost();
return getUsername(index) + "@" + getConnection(index).getServiceName();
}
/**
@ -183,6 +184,10 @@ public abstract class SmackTestCase extends TestCase {
return port;
}
protected String getServiceName() {
return serviceName;
}
/**
* Returns the default groupchat service domain.
*
@ -215,13 +220,14 @@ public abstract class SmackTestCase extends TestCase {
connections[i] = new XMPPConnection(host, port);
}
else {
connections[i] = new XMPPConnection(host, port, getSocketFactory());
connections[i] = new XMPPConnection(host, port, host, getSocketFactory());
}
}
// Use the host name that the server reports. This is a good idea in most
// 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();
// Create the test accounts
if (!getConnection(0).getAccountManager().supportsAccountCreation())
fail("Server does not support account creation");
@ -316,7 +322,9 @@ public abstract class SmackTestCase extends TestCase {
}
else if (parser.getName().equals("port")) {
port = parseIntProperty(parser, port);
;
}
else if (parser.getName().equals("serviceName")) {
serviceName = parser.nextText();
}
else if (parser.getName().equals("chat")) {
chatDomain = parser.nextText();