mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-23 21:17:58 +01:00
Added new anonymous test case and improved assertions of existing one.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3493 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
5247fce7ca
commit
eb0c5e282d
1 changed files with 44 additions and 1 deletions
|
@ -56,7 +56,7 @@ public class LoginTest extends SmackTestCase {
|
||||||
/**
|
/**
|
||||||
* Check that the server handles anonymous users correctly.
|
* Check that the server handles anonymous users correctly.
|
||||||
*/
|
*/
|
||||||
public void testAnonymousLogin() {
|
public void testSASLAnonymousLogin() {
|
||||||
try {
|
try {
|
||||||
XMPPConnection conn1 = new XMPPConnection(getHost(), getPort());
|
XMPPConnection conn1 = new XMPPConnection(getHost(), getPort());
|
||||||
XMPPConnection conn2 = new XMPPConnection(getHost(), getPort());
|
XMPPConnection conn2 = new XMPPConnection(getHost(), getPort());
|
||||||
|
@ -64,6 +64,49 @@ public class LoginTest extends SmackTestCase {
|
||||||
// Try to login anonymously
|
// Try to login anonymously
|
||||||
conn1.loginAnonymously();
|
conn1.loginAnonymously();
|
||||||
conn2.loginAnonymously();
|
conn2.loginAnonymously();
|
||||||
|
|
||||||
|
assertNotNull("Resource is null", StringUtils.parseResource(conn1.getUser()));
|
||||||
|
assertNotNull("Resource is null", StringUtils.parseResource(conn2.getUser()));
|
||||||
|
|
||||||
|
assertNotNull("Username is null", StringUtils.parseName(conn1.getUser()));
|
||||||
|
assertNotNull("Username is null", StringUtils.parseName(conn2.getUser()));
|
||||||
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
// Close the connection
|
||||||
|
conn1.close();
|
||||||
|
conn2.close();
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that the server handles anonymous users correctly.
|
||||||
|
*/
|
||||||
|
public void testNonSASLAnonymousLogin() {
|
||||||
|
try {
|
||||||
|
ConnectionConfiguration config = new ConnectionConfiguration(getHost(), getPort());
|
||||||
|
config.setSASLAuthenticationEnabled(false);
|
||||||
|
XMPPConnection conn1 = new XMPPConnection(config);
|
||||||
|
|
||||||
|
config = new ConnectionConfiguration(getHost(), getPort());
|
||||||
|
config.setSASLAuthenticationEnabled(false);
|
||||||
|
XMPPConnection conn2 = new XMPPConnection(config);
|
||||||
|
try {
|
||||||
|
// Try to login anonymously
|
||||||
|
conn1.loginAnonymously();
|
||||||
|
conn2.loginAnonymously();
|
||||||
|
|
||||||
|
assertNotNull("Resource is null", StringUtils.parseResource(conn1.getUser()));
|
||||||
|
assertNotNull("Resource is null", StringUtils.parseResource(conn2.getUser()));
|
||||||
|
|
||||||
|
assertNotNull("Username is null", StringUtils.parseName(conn1.getUser()));
|
||||||
|
assertNotNull("Username is null", StringUtils.parseName(conn2.getUser()));
|
||||||
}
|
}
|
||||||
catch (XMPPException e) {
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in a new issue