1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-24 07:12:05 +01:00

Deprecate setServiceName in favor of setXmppDomain

This commit is contained in:
Florian Schmaus 2015-06-08 14:39:05 +02:00
parent 4d7279d036
commit bad52fad21
9 changed files with 22 additions and 10 deletions

View file

@ -32,7 +32,7 @@ Connect and Disconnect
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder(); XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword("username", "password"); configBuilder.setUsernameAndPassword("username", "password");
configBuilder.setResource("SomeResource"); configBuilder.setResource("SomeResource");
configBuilder.setServiceName("jabber.org"); configBuilder.setXmppDomain("jabber.org");
AbstractXMPPConnection connection = new XMPPTCPConnection(configBuilder.build()); AbstractXMPPConnection connection = new XMPPTCPConnection(configBuilder.build());
// Connect to the server // Connect to the server

View file

@ -53,7 +53,7 @@ conn1.connect();
// Create a connection to the jabber.org server on a specific port. // Create a connection to the jabber.org server on a specific port.
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("username", "password") .setUsernameAndPassword("username", "password")
.setServiceName("jabber.org") .setXmppDomain("jabber.org")
.setHost("earl.jabber.org") .setHost("earl.jabber.org")
.setPort("8222") .setPort("8222")
.build(); .build();

View file

@ -118,7 +118,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
*/ */
public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, DomainBareJid xmppServiceDomain) { public XMPPBOSHConnection(String username, String password, boolean https, String host, int port, String filePath, DomainBareJid xmppServiceDomain) {
this(BOSHConfiguration.builder().setUseHttps(https).setHost(host) this(BOSHConfiguration.builder().setUseHttps(https).setHost(host)
.setPort(port).setFile(filePath).setServiceName(xmppServiceDomain) .setPort(port).setFile(filePath).setXmppDomain(xmppServiceDomain)
.setUsernameAndPassword(username, password).build()); .setUsernameAndPassword(username, password).build());
} }

View file

@ -464,9 +464,21 @@ public abstract class ConnectionConfiguration {
* *
* @param serviceName the service name * @param serviceName the service name
* @return a reference to this builder. * @return a reference to this builder.
* @deprecated use {@link #setXmppDomain(DomainBareJid)} instead.
*/ */
@Deprecated
public B setServiceName(DomainBareJid serviceName) { public B setServiceName(DomainBareJid serviceName) {
this.xmppServiceDomain = serviceName; return setXmppDomain(serviceName);
}
/**
* Set the service name of this XMPP service (i.e., the XMPP domain).
*
* @param xmppServiceDomain the service name
* @return a reference to this builder.
*/
public B setXmppDomain(DomainBareJid xmppServiceDomain) {
this.xmppServiceDomain = xmppServiceDomain;
return getThis(); return getThis();
} }

View file

@ -57,7 +57,7 @@ public class DummyConnection extends AbstractXMPPConnection {
private final BlockingQueue<TopLevelStreamElement> queue = new LinkedBlockingQueue<TopLevelStreamElement>(); private final BlockingQueue<TopLevelStreamElement> queue = new LinkedBlockingQueue<TopLevelStreamElement>();
public static ConnectionConfiguration.Builder<?,?> getDummyConfigurationBuilder() { public static ConnectionConfiguration.Builder<?,?> getDummyConfigurationBuilder() {
return DummyConnectionConfiguration.builder().setServiceName(JidTestUtil.EXAMPLE_ORG).setUsernameAndPassword("dummy", return DummyConnectionConfiguration.builder().setXmppDomain(JidTestUtil.EXAMPLE_ORG).setUsernameAndPassword("dummy",
"dummypass"); "dummypass");
} }

View file

@ -51,7 +51,7 @@ public abstract class AbstractSmackLowLevelIntegrationTest extends AbstractSmack
builder.setCustomSSLContext(sc); builder.setCustomSSLContext(sc);
} }
builder.setSecurityMode(configuration.securityMode); builder.setSecurityMode(configuration.securityMode);
builder.setServiceName(service); builder.setXmppDomain(service);
return builder; return builder;
} }

View file

@ -516,7 +516,7 @@ public class SmackIntegrationTestFramework {
} }
// @formatter:off // @formatter:off
Builder builder = XMPPTCPConnectionConfiguration.builder() Builder builder = XMPPTCPConnectionConfiguration.builder()
.setServiceName(config.service) .setXmppDomain(config.service)
.setUsernameAndPassword(accountUsername, accountPassword) .setUsernameAndPassword(accountUsername, accountPassword)
.setResource(middlefix + '-' + testRunResult.testRunId) .setResource(middlefix + '-' + testRunResult.testRunId)
.setSecurityMode(config.securityMode); .setSecurityMode(config.securityMode);
@ -551,7 +551,7 @@ public class SmackIntegrationTestFramework {
builder.setCustomSSLContext(sc); builder.setCustomSSLContext(sc);
} }
builder.setSecurityMode(config.securityMode); builder.setSecurityMode(config.securityMode);
builder.setServiceName(config.service); builder.setXmppDomain(config.service);
XMPPTCPConnection connection = new XMPPTCPConnection(builder.build()); XMPPTCPConnection connection = new XMPPTCPConnection(builder.build());
connection.connect(); connection.connect();
UsernameAndPassword uap = IntTestUtil.registerAccount(connection); UsernameAndPassword uap = IntTestUtil.registerAccount(connection);

View file

@ -337,7 +337,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @throws XmppStringprepException * @throws XmppStringprepException
*/ */
public XMPPTCPConnection(CharSequence username, String password, String serviceName) throws XmppStringprepException { public XMPPTCPConnection(CharSequence username, String password, String serviceName) throws XmppStringprepException {
this(XMPPTCPConnectionConfiguration.builder().setUsernameAndPassword(username, password).setServiceName( this(XMPPTCPConnectionConfiguration.builder().setUsernameAndPassword(username, password).setXmppDomain(
JidCreate.domainBareFrom(serviceName)).build()); JidCreate.domainBareFrom(serviceName)).build());
} }

View file

@ -27,7 +27,7 @@ import org.jivesoftware.smack.ConnectionConfiguration;
* <pre> * <pre>
* {@code * {@code
* XMPPTCPConnectionConfiguration conf = XMPPConnectionConfiguration.builder() * XMPPTCPConnectionConfiguration conf = XMPPConnectionConfiguration.builder()
* .setServiceName("example.org").setUsernameAndPassword("user", "password") * .setXmppDomain("example.org").setUsernameAndPassword("user", "password")
* .setCompressionEnabled(false).build(); * .setCompressionEnabled(false).build();
* XMPPTCPConnection connection = new XMPPTCPConnection(conf); * XMPPTCPConnection connection = new XMPPTCPConnection(conf);
* } * }