mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +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:
parent
42fd837376
commit
991e958097
6 changed files with 20 additions and 14 deletions
|
@ -107,7 +107,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
// Try now sending huge messages over an SSL connection
|
// Try now sending huge messages over an SSL connection
|
||||||
XMPPConnection conn = null;
|
XMPPConnection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = new SSLXMPPConnection(getHost());
|
conn = new SSLXMPPConnection(getServiceName());
|
||||||
conn.login(getUsername(0), getUsername(0), "Other resource");
|
conn.login(getUsername(0), getUsername(0), "Other resource");
|
||||||
|
|
||||||
// Send the first message
|
// Send the first message
|
||||||
|
|
|
@ -389,7 +389,7 @@ public class RosterTest extends SmackTestCase {
|
||||||
Presence presence = null;
|
Presence presence = null;
|
||||||
|
|
||||||
// Create another connection for the same user of connection 1
|
// Create another connection for the same user of connection 1
|
||||||
XMPPConnection conn4 = new XMPPConnection(getHost());
|
XMPPConnection conn4 = new XMPPConnection(getServiceName());
|
||||||
conn4.login(getUsername(1), getUsername(1), "Home");
|
conn4.login(getUsername(1), getUsername(1), "Home");
|
||||||
|
|
||||||
// Add a new roster entry
|
// Add a new roster entry
|
||||||
|
@ -408,7 +408,7 @@ public class RosterTest extends SmackTestCase {
|
||||||
assertNotNull("Returned a null Presence for an existing user", presence);
|
assertNotNull("Returned a null Presence for an existing user", presence);
|
||||||
|
|
||||||
// Check that the right presence is returned for a user+resource
|
// Check that the right presence is returned for a user+resource
|
||||||
presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getHost() + "/Home");
|
presence = roster.getPresenceResource(getUsername(1) + "@" + conn4.getServiceName() + "/Home");
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Returned the wrong Presence",
|
"Returned the wrong Presence",
|
||||||
StringUtils.parseResource(presence.getFrom()),
|
StringUtils.parseResource(presence.getFrom()),
|
||||||
|
@ -422,7 +422,7 @@ public class RosterTest extends SmackTestCase {
|
||||||
"Smack");
|
"Smack");
|
||||||
|
|
||||||
// Check that the no presence is returned for a non-existent user+resource
|
// Check that the no presence is returned for a non-existent user+resource
|
||||||
presence = roster.getPresenceResource("noname@" + getHost() + "/Smack");
|
presence = roster.getPresenceResource("noname@" + getServiceName() + "/Smack");
|
||||||
assertNull("Returned a Presence for a non-existing user", presence);
|
assertNull("Returned a Presence for a non-existing user", presence);
|
||||||
|
|
||||||
// Check that the returned presences are correct
|
// Check that the returned presences are correct
|
||||||
|
|
|
@ -83,6 +83,7 @@ import junit.framework.TestCase;
|
||||||
public abstract class SmackTestCase extends TestCase {
|
public abstract class SmackTestCase extends TestCase {
|
||||||
|
|
||||||
private String host = "localhost";
|
private String host = "localhost";
|
||||||
|
private String serviceName = "localhost";
|
||||||
private int port = 5222;
|
private int port = 5222;
|
||||||
|
|
||||||
private String chatDomain = "chat.localhost";
|
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).
|
* @return the bare XMPP address of the user (e.g. johndoe@jabber.org).
|
||||||
*/
|
*/
|
||||||
protected String getBareJID(int index) {
|
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;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getServiceName() {
|
||||||
|
return serviceName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default groupchat service domain.
|
* Returns the default groupchat service domain.
|
||||||
*
|
*
|
||||||
|
@ -215,13 +220,14 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
connections[i] = new XMPPConnection(host, port);
|
connections[i] = new XMPPConnection(host, port);
|
||||||
}
|
}
|
||||||
else {
|
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
|
// 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
|
// cases, but could fail if the user set a hostname in their XMPP server
|
||||||
// that will not resolve as a network connection.
|
// that will not resolve as a network connection.
|
||||||
host = connections[0].getHost();
|
host = connections[0].getHost();
|
||||||
|
serviceName = connections[0].getServiceName();
|
||||||
// Create the test accounts
|
// Create the test accounts
|
||||||
if (!getConnection(0).getAccountManager().supportsAccountCreation())
|
if (!getConnection(0).getAccountManager().supportsAccountCreation())
|
||||||
fail("Server does not support account creation");
|
fail("Server does not support account creation");
|
||||||
|
@ -316,7 +322,9 @@ public abstract class SmackTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
else if (parser.getName().equals("port")) {
|
else if (parser.getName().equals("port")) {
|
||||||
port = parseIntProperty(parser, port);
|
port = parseIntProperty(parser, port);
|
||||||
;
|
}
|
||||||
|
else if (parser.getName().equals("serviceName")) {
|
||||||
|
serviceName = parser.nextText();
|
||||||
}
|
}
|
||||||
else if (parser.getName().equals("chat")) {
|
else if (parser.getName().equals("chat")) {
|
||||||
chatDomain = parser.nextText();
|
chatDomain = parser.nextText();
|
||||||
|
|
|
@ -54,11 +54,9 @@ package org.jivesoftware.smackx;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.jivesoftware.smack.SmackConfiguration;
|
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.test.SmackTestCase;
|
import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||||
import org.jivesoftware.smackx.packet.DiscoverItems;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +136,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
||||||
assertFalse(XHTMLManager.isServiceEnabled(getConnection(1), getBareJID(0)));
|
assertFalse(XHTMLManager.isServiceEnabled(getConnection(1), getBareJID(0)));
|
||||||
// Using a full JID check that the other client supports XHTML.
|
// Using a full JID check that the other client supports XHTML.
|
||||||
assertTrue(XHTMLManager.isServiceEnabled(getConnection(1), getFullJID(0)));
|
assertTrue(XHTMLManager.isServiceEnabled(getConnection(1), getFullJID(0)));
|
||||||
|
|
||||||
// Disable the XHTML Message support in connection1
|
// Disable the XHTML Message support in connection1
|
||||||
XHTMLManager.setServiceEnabled(getConnection(0), false);
|
XHTMLManager.setServiceEnabled(getConnection(0), false);
|
||||||
// Check for local XHTML service support
|
// Check for local XHTML service support
|
||||||
|
@ -154,7 +152,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
||||||
public void testDiscoverPublishItemsSupport() {
|
public void testDiscoverPublishItemsSupport() {
|
||||||
try {
|
try {
|
||||||
boolean canPublish = ServiceDiscoveryManager.getInstanceFor(getConnection(0))
|
boolean canPublish = ServiceDiscoveryManager.getInstanceFor(getConnection(0))
|
||||||
.canPublishItems(getHost());
|
.canPublishItems(getServiceName());
|
||||||
assertFalse("Messenger does not support publishing...so far!!", canPublish);
|
assertFalse("Messenger does not support publishing...so far!!", canPublish);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
@ -175,7 +173,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
||||||
itemsToPublish.addItem(itemToPublish);
|
itemsToPublish.addItem(itemToPublish);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getHost(),
|
ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getServiceName(),
|
||||||
itemsToPublish);
|
itemsToPublish);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class VersionTest extends SmackTestCase {
|
||||||
public void testGetServerVersion() {
|
public void testGetServerVersion() {
|
||||||
Version version = new Version();
|
Version version = new Version();
|
||||||
version.setType(IQ.Type.GET);
|
version.setType(IQ.Type.GET);
|
||||||
version.setTo(getHost());
|
version.setTo(getServiceName());
|
||||||
|
|
||||||
// Create a packet collector to listen for a response.
|
// Create a packet collector to listen for a response.
|
||||||
PacketCollector collector = getConnection(0).createPacketCollector(new PacketIDFilter(version.getPacketID()));
|
PacketCollector collector = getConnection(0).createPacketCollector(new PacketIDFilter(version.getPacketID()));
|
||||||
|
|
|
@ -1723,7 +1723,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
||||||
// Create 20 more connections for user2
|
// Create 20 more connections for user2
|
||||||
XMPPConnection[] conns = new XMPPConnection[20];
|
XMPPConnection[] conns = new XMPPConnection[20];
|
||||||
for (int i = 0; i < conns.length; i++) {
|
for (int i = 0; i < conns.length; i++) {
|
||||||
conns[i] = new XMPPConnection(getHost());
|
conns[i] = new XMPPConnection(getServiceName());
|
||||||
conns[i].login(getUsername(1), getUsername(1), "resource-" + i);
|
conns[i].login(getUsername(1), getUsername(1), "resource-" + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue