mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 16:22:06 +01:00
Adds new test for discovering client's identity. SMACK-149
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2349 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1ce8a33af4
commit
13d1c07741
1 changed files with 31 additions and 0 deletions
|
@ -52,7 +52,11 @@
|
|||
|
||||
package org.jivesoftware.smackx;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.test.SmackTestCase;
|
||||
import org.jivesoftware.smackx.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.packet.DiscoverItems;
|
||||
|
||||
|
||||
|
@ -71,6 +75,33 @@ public class ServiceDiscoveryManagerTest extends SmackTestCase {
|
|||
super(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests info discovery of a Smack client.
|
||||
*/
|
||||
public void testSmackInfo() {
|
||||
|
||||
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager
|
||||
.getInstanceFor(getConnection(0));
|
||||
try {
|
||||
// Discover the information of another Smack client
|
||||
DiscoverInfo info = discoManager.discoverInfo(getFullJID(1));
|
||||
// Check the identity of the Smack client
|
||||
Iterator identities = info.getIdentities();
|
||||
assertTrue("No identities were found", identities.hasNext());
|
||||
DiscoverInfo.Identity identity = (DiscoverInfo.Identity)identities.next();
|
||||
assertEquals("Name in identity is wrong", SmackConfiguration.getIdentityName(),
|
||||
identity.getName());
|
||||
assertEquals("Category in identity is wrong", "client", identity.getCategory());
|
||||
assertEquals("Type in identity is wrong", SmackConfiguration.getIdentityType(),
|
||||
identity.getType());
|
||||
assertFalse("More identities were found", identities.hasNext());
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests service discovery of XHTML support.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue