mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +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:
parent
0c8199650b
commit
f369a009ac
38 changed files with 116 additions and 104 deletions
|
@ -56,7 +56,7 @@ public class CompressionTest extends SmackTestCase {
|
|||
// Request the version of the server
|
||||
Version version = new Version();
|
||||
version.setType(IQ.Type.get);
|
||||
version.setTo(getServiceName());
|
||||
version.setTo(getXMPPServiceDomain());
|
||||
|
||||
// Create a packet collector to listen for a response.
|
||||
PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(version.getStanzaId()));
|
||||
|
@ -84,7 +84,7 @@ public class CompressionTest extends SmackTestCase {
|
|||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
XMPPTCPConnection setupConnection = new XMPPConnection(getServiceName());
|
||||
XMPPTCPConnection setupConnection = new XMPPConnection(getXMPPServiceDomain());
|
||||
setupConnection.connect();
|
||||
if (!setupConnection.getAccountManager().supportsAccountCreation())
|
||||
fail("Server does not support account creation");
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
|||
public void testDiscoverPublishItemsSupport() {
|
||||
try {
|
||||
boolean canPublish = ServiceDiscoveryManager.getInstanceFor(getConnection(0))
|
||||
.canPublishItems(getServiceName());
|
||||
.canPublishItems(getXMPPServiceDomain());
|
||||
assertFalse("Wildfire does not support publishing...so far!!", canPublish);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -135,7 +135,7 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
|||
itemsToPublish.addItem(itemToPublish);
|
||||
|
||||
try {
|
||||
ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getServiceName(),
|
||||
ServiceDiscoveryManager.getInstanceFor(getConnection(0)).publishItems(getXMPPServiceDomain(),
|
||||
itemsToPublish);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
@ -224,7 +224,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
|||
try {
|
||||
// Anonymous user joins the new room
|
||||
ConnectionConfiguration connectionConfiguration =
|
||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
|
||||
XMPPTCPConnection anonConnection = new XMPPConnection(connectionConfiguration);
|
||||
anonConnection.connect();
|
||||
anonConnection.loginAnonymously();
|
||||
|
@ -405,7 +405,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
|||
|
||||
public void testDiscoverMUCService() {
|
||||
try {
|
||||
Collection<String> services = MultiUserChat.getServiceNames(getConnection(1));
|
||||
Collection<String> services = MultiUserChat.getXMPPServiceDomains(getConnection(1));
|
||||
assertFalse("No MUC service was found", services.isEmpty());
|
||||
|
||||
// Discover the hosted rooms by the chat service.
|
||||
|
@ -1736,7 +1736,7 @@ public class MultiUserChatTest extends SmackTestCase {
|
|||
XMPPTCPConnection[] conns = new XMPPConnection[5];
|
||||
for (int i = 0; i < conns.length; i++) {
|
||||
ConnectionConfiguration connectionConfiguration =
|
||||
new ConnectionConfiguration(getHost(), getPort(), getServiceName());
|
||||
new ConnectionConfiguration(getHost(), getPort(), getXMPPServiceDomain());
|
||||
connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
|
||||
conns[i] = new XMPPTCPConnection(connectionConfiguration);
|
||||
conns[i].connect();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TestEvents extends SmackTestCase
|
|||
|
||||
private String getService()
|
||||
{
|
||||
return "pubsub." + getServiceName();
|
||||
return "pubsub." + getXMPPServiceDomain();
|
||||
}
|
||||
|
||||
public void testCreateAndGetNode() throws Exception
|
||||
|
|
|
@ -87,6 +87,6 @@ abstract public class PubSubTestCase extends SmackTestCase
|
|||
|
||||
protected String getService()
|
||||
{
|
||||
return "pubsub." + getServiceName();
|
||||
return "pubsub." + getXMPPServiceDomain();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class AMPManager {
|
|||
* @return a boolean indicating if the AMP support is enabled for the given connection
|
||||
*/
|
||||
public static boolean isServiceEnabled(XMPPConnection connection) {
|
||||
connection.getServiceName();
|
||||
connection.getXMPPServiceDomain();
|
||||
return ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(AMPExtension.NAMESPACE);
|
||||
}
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
|
|||
List<Jid> proxies = new ArrayList<>();
|
||||
|
||||
// get all items from XMPP server
|
||||
DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getServiceName());
|
||||
DiscoverItems discoverItems = serviceDiscoveryManager.discoverItems(this.connection.getXMPPServiceDomain());
|
||||
|
||||
// query all items if they are SOCKS5 proxies
|
||||
for (Item item : discoverItems.getItems()) {
|
||||
|
|
|
@ -302,7 +302,7 @@ public final class EntityCapsManager extends Manager {
|
|||
if (capsExtension == null) {
|
||||
return;
|
||||
}
|
||||
DomainBareJid from = connection.getServiceName();
|
||||
DomainBareJid from = connection.getXMPPServiceDomain();
|
||||
addCapsExtensionInfo(from, capsExtension);
|
||||
}
|
||||
});
|
||||
|
@ -456,7 +456,7 @@ public final class EntityCapsManager extends Manager {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
public boolean areEntityCapsSupportedByServer() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
return areEntityCapsSupported(connection().getServiceName());
|
||||
return areEntityCapsSupported(connection().getXMPPServiceDomain());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -661,7 +661,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
*/
|
||||
public boolean serverSupportsFeature(String feature) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException, InterruptedException {
|
||||
return supportsFeature(connection().getServiceName(), feature);
|
||||
return supportsFeature(connection().getXMPPServiceDomain(), feature);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -702,7 +702,7 @@ public final class ServiceDiscoveryManager extends Manager {
|
|||
public List<DiscoverInfo> findServicesDiscoverInfo(String feature, boolean stopOnFirst, boolean useCache)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
List<DiscoverInfo> serviceDiscoInfo = null;
|
||||
DomainBareJid serviceName = connection().getServiceName();
|
||||
DomainBareJid serviceName = connection().getXMPPServiceDomain();
|
||||
if (useCache) {
|
||||
serviceDiscoInfo = services.get(feature);
|
||||
if (serviceDiscoInfo != null) {
|
||||
|
|
|
@ -273,7 +273,7 @@ public final class AccountManager extends Manager {
|
|||
attributes.put("password", password);
|
||||
Registration reg = new Registration(attributes);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ public final class AccountManager extends Manager {
|
|||
map.put("password",newPassword);
|
||||
Registration reg = new Registration(map);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ public final class AccountManager extends Manager {
|
|||
attributes.put("remove", "");
|
||||
Registration reg = new Registration(attributes);
|
||||
reg.setType(IQ.Type.set);
|
||||
reg.setTo(connection().getServiceName());
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ public final class AccountManager extends Manager {
|
|||
*/
|
||||
private synchronized void getRegistrationInfo() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
Registration reg = new Registration();
|
||||
reg.setTo(connection().getServiceName());
|
||||
reg.setTo(connection().getXMPPServiceDomain());
|
||||
info = createPacketCollectorAndSend(reg).nextResultOrThrow();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class MultiUserChatException extends SmackException {
|
|||
|
||||
/**
|
||||
* Thrown when trying to enter a MUC room that is not hosted a domain providing a MUC service.
|
||||
* Try {@link MultiUserChatManager#getServiceNames()} for a list of client-local domains
|
||||
* Try {@link MultiUserChatManager#getXMPPServiceDomains()} for a list of client-local domains
|
||||
* providing a MUC service.
|
||||
*/
|
||||
public static class NotAMucServiceException extends MultiUserChatException {
|
||||
|
|
|
@ -256,7 +256,7 @@ public final class MultiUserChatManager extends Manager {
|
|||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<DomainBareJid> getServiceNames() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
public List<DomainBareJid> getXMPPServiceDomains() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
|
||||
return sdm.findServices(MUCInitialPresence.NAMESPACE, false, false);
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public final class PingManager extends Manager {
|
|||
connection.createPacketCollectorAndSend(ping).nextResultOrThrow(pingTimeout);
|
||||
}
|
||||
catch (XMPPException exc) {
|
||||
return jid.equals(connection.getServiceName());
|
||||
return jid.equals(connection.getXMPPServiceDomain());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public final class PingManager extends Manager {
|
|||
public boolean pingMyServer(boolean notifyListeners, long pingTimeout) throws NotConnectedException, InterruptedException {
|
||||
boolean res;
|
||||
try {
|
||||
res = ping(connection().getServiceName(), pingTimeout);
|
||||
res = ping(connection().getXMPPServiceDomain(), pingTimeout);
|
||||
}
|
||||
catch (NoResponseException e) {
|
||||
res = false;
|
||||
|
|
|
@ -96,7 +96,7 @@ public final class PubSubManager extends Manager {
|
|||
if (pubSubService == null) {
|
||||
try {
|
||||
// Perform an educated guess about what the PubSub service's domain bare JID may be
|
||||
pubSubService = JidCreate.domainBareFrom("pubsub." + connection.getServiceName());
|
||||
pubSubService = JidCreate.domainBareFrom("pubsub." + connection.getXMPPServiceDomain());
|
||||
}
|
||||
catch (XmppStringprepException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
@ -160,7 +160,7 @@ public class PingTest extends InitExtensions {
|
|||
ThreadedDummyConnection con = getAuthentiactedDummyConnection();
|
||||
//@formatter:off
|
||||
String reply =
|
||||
"<iq type='error' id='qrzSp-16' to='test@myserver.com' from='" + con.getServiceName() + "'>" +
|
||||
"<iq type='error' id='qrzSp-16' to='test@myserver.com' from='" + con.getXMPPServiceDomain() + "'>" +
|
||||
"<ping xmlns='urn:xmpp:ping'/>" +
|
||||
"<error type='cancel'>" +
|
||||
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" +
|
||||
|
|
|
@ -74,7 +74,7 @@ public class ConnectionUtils {
|
|||
// mock XMPP connection
|
||||
XMPPConnection connection = mock(XMPPConnection.class);
|
||||
when(connection.getUser()).thenReturn(initiatorJID);
|
||||
when(connection.getServiceName()).thenReturn(xmppServer);
|
||||
when(connection.getXMPPServiceDomain()).thenReturn(xmppServer);
|
||||
|
||||
// mock packet collector
|
||||
final PacketCollector collector = mock(PacketCollector.class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue