Examples of LeafNode


Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        // since we have no messages, there should be no items.
        assertEquals(0, inner.size());
    }
   
    public void testNodeItemsSome() throws Exception {
        LeafNode node = new LeafNode(serviceConfiguration, "news", "News", client);
        root.add(node);
       
        XMLElement item1 = new XMLElement("namespace1", "item1", null,(Attribute[])null, (XMLFragment[])null);
        XMLElement item2 = new XMLElement("namespace2", "item2", null,(Attribute[])null, (XMLFragment[])null);
        XMLElement item3 = new XMLElement("namespace3", "item3", null,(Attribute[])null, (XMLFragment[])null);
        node.publish(client, relay, "itemid1", item1);
        Thread.sleep(10);
        node.publish(client, relay, "itemid2", item1); // publish this one with the same id as the next one (overwritten by the next)
        node.publish(client, relay, "itemid2", item2); // overwrite the prev. item (use the same itemid)
        Thread.sleep(10);
        node.publish(client, relay, "itemid3", item3);
       
       
        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator)getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123", "news");
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(),response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match
       
        LeafNode n = root.find(testNode);
        assertEquals(testNode, n.getName());
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        assertEquals(testNode, n.getName());
    }
   
    public void testCreateDuplicate() throws Exception {
        String testNode = "test";
        root.add(new LeafNode(serviceConfiguration, testNode, client));
        assertNotNull(root.find(testNode)); // should be there
       
        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

    protected LeafNode node = null;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        node = new LeafNode(serviceConfiguration, "news", "Node used for testing purposes", client);
        root.add(node);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        // since we have no nodes, there should be no items.
        assertEquals(0, inner.size());
    }

    public void testSomeItems() throws Exception {
        root.add(new LeafNode(serviceConfiguration, "news", "News", client));
        root.add(new LeafNode(serviceConfiguration, "blogs", "Blogs", client));

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123");

        ResponseStanzaContainer result = sendStanza(stanza, true);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        assertNotNull(news);
        assertNotNull(blogs);
    }

    public void testNodeItemsNone() throws Exception {
        root.add(new LeafNode(serviceConfiguration, "news", "News", client));

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123", "news");

        ResponseStanzaContainer result = sendStanza(stanza, true);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        // since we have no messages, there should be no items.
        assertEquals(0, inner.size());
    }

    public void testNodeItemsSome() throws Exception {
        LeafNode node = new LeafNode(serviceConfiguration, "news", "News", client);
        root.add(node);

        XMLElement item1 = new XMLElement("namespace1", "item1", null, (Attribute[]) null, (XMLFragment[]) null);
        XMLElement item2 = new XMLElement("namespace2", "item2", null, (Attribute[]) null, (XMLFragment[]) null);
        XMLElement item3 = new XMLElement("namespace3", "item3", null, (Attribute[]) null, (XMLFragment[]) null);
        node.publish(client, relay, "itemid1", item1);
        Thread.sleep(10);
        node.publish(client, relay, "itemid2", item1); // publish this one with the same id as the next one (overwritten by the next)
        node.publish(client, relay, "itemid2", item2); // overwrite the prev. item (use the same itemid)
        Thread.sleep(10);
        node.publish(client, relay, "itemid3", item3);

        DefaultDiscoInfoStanzaGenerator sg = (DefaultDiscoInfoStanzaGenerator) getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService.getBareJID(), "id123", "news");

        ResponseStanzaContainer result = sendStanza(stanza, true);
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

    public void setUp() throws Exception {
        super.setUp();
        client2 = new EntityImpl("user1", "vysper.org", null);
        client3 = new EntityImpl("user2", "vysper.org", null);

        n1 = new LeafNode(serviceConfiguration, "Node1", "Node 1 used for testing purposes", client);
        n1.setAffiliation(client2, PubSubAffiliation.MEMBER);

        root.add(n1);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

    /**
     * Delete the node specified by nodeName.
     */
    public void deleteNode(String nodeName) {
        LeafNode n = findNode(nodeName);
        n.delete();
        this.nodes.remove(nodeName);
    }
View Full Code Here

Examples of org.apache.vysper.xmpp.modules.extension.xep0060_pubsub.model.LeafNode

        return new PubSubOwnerDeleteNodeHandler(serviceConfiguration);
    }

    public void testDelete() throws Exception {
        String testNode = "test";
        LeafNode node = new LeafNode(serviceConfiguration, testNode, client);
        root.add(node);

        node.subscribe("someid", client); // make the owner subscriber
        node.subscribe("otherid1", new EntityImpl("yoda", "starwars.com", "spaceship"));
        node.subscribe("otherid2", new EntityImpl("r2d2", "starwars.com", "desert"));
        node.subscribe("otherid3", new EntityImpl("anakin", "starwars.com", "deathstar"));

        assertNotNull(root.find(testNode));
        // make sure we have 4 subscribers
        assertEquals(4, node.countSubscriptions());

        AbstractStanzaGenerator sg = getDefaultStanzaGenerator();
        Stanza stanza = sg.getStanza(client, pubsubService, "id123", testNode);
        ResponseStanzaContainer result = sendStanza(stanza, true);
        assertTrue(result.hasResponse());
        IQStanza response = new IQStanza(result.getResponseStanza());
        assertEquals(IQStanzaType.RESULT.value(), response.getType());

        assertEquals("id123", response.getAttributeValue("id")); // IDs must match

        LeafNode n = root.find(testNode);
        assertNull(n);

        // check that the subscribers got a notification
        assertEquals(4, relay.getCountRelayed());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.