Package org.apache.vysper.xmpp.addressing

Examples of org.apache.vysper.xmpp.addressing.Entity


        assertTrue(node.isSubscribed(me));
        assertTrue(node.isSubscribed("id1"));
    }

    public void testCount() throws Exception {
        Entity me = EntityImpl.parse("me@vysper.org");

        assertEquals(0, node.countSubscriptions(me));

        node.subscribe("id1", me);
        assertEquals(1, node.countSubscriptions(me));
View Full Code Here


        node.subscribe("id2", me);
        assertEquals(2, node.countSubscriptions(me));
    }

    public void testUnsubscribe() throws Exception {
        Entity me = EntityImpl.parse("me@vysper.org");
        node.subscribe("id1", me);
        assertTrue(node.isSubscribed(me));
        boolean result = node.unsubscribe(me);
        assertTrue(result);
    }
View Full Code Here

        boolean result = node.unsubscribe(me);
        assertTrue(result);
    }

    public void testUnsubscribeMultiSubscription() throws Exception {
        Entity me = EntityImpl.parse("me@vysper.org");
        node.subscribe("id1", me);
        node.subscribe("id2", me);
        assertEquals(2, node.countSubscriptions(me));

        assertTrue(node.isSubscribed(me));
View Full Code Here

        assertTrue(result);
        assertEquals(0, node.countSubscriptions(me));
    }

    public void testUnsubscribeNonMatchingEntity() throws Exception {
        Entity me = EntityImpl.parse("me@vysper.org");
        node.subscribe("id1", me);

        boolean result = node.unsubscribe("someotherid", me);
        assertFalse(result);
        assertTrue(node.isSubscribed(me));
View Full Code Here

        assertTrue(node.isSubscribed(me));
        assertTrue(node.isSubscribed("id1"));
    }

    public void testSubscriptionCount() throws Exception {
        Entity me = EntityImpl.parse("me@vysper.org");
        node.subscribe("id1", me);
        node.subscribe("id2", me);
        Entity you = EntityImpl.parse("you@vysper.org");
        node.subscribe("id3", you);

        assertEquals(3, node.countSubscriptions());
    }
View Full Code Here

    public void testPublishWithSubscriber() throws BindException {
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();

        // create two subscriber for the node
        Entity francisco = createUser("francisco@denmark.lit");
        Entity bernardo = createUser("bernardo@denmark.lit/somewhere");

        // subscribe them
        node.subscribe("franid", francisco);
        node.subscribe("bernid", bernardo);
View Full Code Here

        assertEquals(3, relay.getCountRelayed()); // three subscribers
    }

    public void testPublishNoSuchNode() throws Exception {
        DefaultPublishStanzaGenerator sg = new DefaultPublishStanzaGenerator();
        Entity pubsubWrongNode = EntityImpl.parse("pubsub.vysper.org");

        ResponseStanzaContainer result = sendStanza(sg.getStanza(client, pubsubWrongNode, "id123", "doesnotexist"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
View Full Code Here

    }
   

    public void testPublishForbidden() throws Exception {
        DefaultPublishStanzaGenerator sg = new DefaultPublishStanzaGenerator();
        Entity yodaNotSubscribed = new EntityImpl("yoda","vysper.org","dagobah"); // yoda@vysper.org/dagobah

        ResponseStanzaContainer result = sendStanza(sg.getStanza(yodaNotSubscribed, pubsubService, "id123", "news"), true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.ERROR.value(),response.getType());
View Full Code Here

        assertEquals(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_STANZAS, errorContent.get(0).getNamespaceURI());
    }

    protected Entity createUser(String jid) throws BindException {
        String boundResourceId = sessionContext.bindResource();
        Entity usr = new EntityImpl(clientBare, boundResourceId);
        return usr;
    }
View Full Code Here

        presenceCache.put(getEntity(), getPresenceStanza(initiatingUser));
        assertNotNull(presenceCache.get(getEntity()));
    }

    public void testRemove() {
        Entity entity = getEntity();
        presenceCache.put(entity, getPresenceStanza(initiatingUser));
        presenceCache.remove(entity);

        // It should return null
        assertNull("Entry should be null", presenceCache.get(entity));
View Full Code Here

TOP

Related Classes of org.apache.vysper.xmpp.addressing.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.