Search in sources :

Example 1 with Identity

use of org.jivesoftware.smackx.packet.DiscoverInfo.Identity in project Smack by igniterealtime.

the class ServiceDiscoveryManagerTest method testSmackInfo.

/**
     * 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<Identity> identities = info.getIdentities();
        assertTrue("No identities were found", identities.hasNext());
        Identity identity = identities.next();
        assertEquals("Name in identity is wrong", discoManager.getIdentityName(), identity.getName());
        assertEquals("Category in identity is wrong", "client", identity.getCategory());
        assertEquals("Type in identity is wrong", discoManager.getIdentityType(), identity.getType());
        assertFalse("More identities were found", identities.hasNext());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : DiscoverInfo(org.jivesoftware.smackx.packet.DiscoverInfo) Identity(org.jivesoftware.smackx.packet.DiscoverInfo.Identity) XMPPException(org.jivesoftware.smack.XMPPException)

Example 2 with Identity

use of org.jivesoftware.smackx.packet.DiscoverInfo.Identity in project Smack by igniterealtime.

the class EntityUseCases method testDiscoverNodeInfo.

public void testDiscoverNodeInfo() throws Exception {
    LeafNode myNode = getManager().createNode("DiscoNode" + System.currentTimeMillis());
    DiscoverInfo info = myNode.discoverInfo();
    assertTrue(info.getIdentities().hasNext());
    Identity ident = info.getIdentities().next();
    assertEquals("leaf", ident.getType());
}
Also used : DiscoverInfo(org.jivesoftware.smackx.packet.DiscoverInfo) Identity(org.jivesoftware.smackx.packet.DiscoverInfo.Identity)

Aggregations

DiscoverInfo (org.jivesoftware.smackx.packet.DiscoverInfo)2 Identity (org.jivesoftware.smackx.packet.DiscoverInfo.Identity)2 XMPPException (org.jivesoftware.smack.XMPPException)1