Package rocks.xmpp.extensions.pubsub.model

Examples of rocks.xmpp.extensions.pubsub.model.PubSub$Subscribe


                "      <affiliation node='node6' affiliation='owner'/>\n" +
                "    </affiliations>\n" +
                "  </pubsub>\n" +
                "</iq>";
        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Assert.assertNotNull(pubSub.getAffiliations());
        Assert.assertEquals(pubSub.getAffiliations().size(), 4);
        Assert.assertEquals(pubSub.getAffiliations().get(0).getNode(), "node1");
        Assert.assertEquals(pubSub.getAffiliations().get(0).getAffiliationState(), AffiliationState.OWNER);

        Assert.assertEquals(pubSub.getAffiliations().get(1).getAffiliationState(), AffiliationState.PUBLISHER);
        Assert.assertEquals(pubSub.getAffiliations().get(2).getAffiliationState(), AffiliationState.OUTCAST);
    }
View Full Code Here


                "  <pubsub xmlns='http://jabber.org/protocol/pubsub'>\n" +
                "    <affiliations/>\n" +
                "  </pubsub>\n" +
                "</iq>";
        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Assert.assertNotNull(pubSub.getAffiliations());
        Assert.assertTrue(pubSub.getAffiliations().isEmpty());
    }
View Full Code Here

        super(IQ.class, PubSub.class, PubSubOwner.class);
    }

    @Test
    public void marshalCreate() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withCreate("princely_musings");
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><create node=\"princely_musings\"></create></pubsub>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><create node=\"princely_musings\"></create></pubsub>");
    }

    @Test
    public void marshalCreateInstantNode() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withCreate(null);
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><create></create></pubsub>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><create></create></pubsub>");
    }

    @Test
    public void marshalConfigure() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withConfigure("princely_musings", null);
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><configure node=\"princely_musings\"></configure></pubsub>");
    }
View Full Code Here

        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><configure node=\"princely_musings\"></configure></pubsub>");
    }

    @Test
    public void marshalDefault() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withDefault();
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><default></default></pubsub>");
    }
View Full Code Here

                "      <item id='ae890ac52d0df67ed7cfdf51b644e901'/>\n" +
                "    </publish>\n" +
                "  </pubsub>\n" +
                "</iq>";
        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Assert.assertNotNull(pubSub.getPublish());
        Assert.assertEquals(pubSub.getPublish().getNode(), "princely_musings");
        Assert.assertNotNull(pubSub.getPublish().getItem());
    }
View Full Code Here

        Assert.assertNotNull(pubSub.getPublish().getItem());
    }

    @Test
    public void marshalDeleteItem() throws JAXBException, XMLStreamException {
        PubSub pubSub = PubSub.withRetract("princely_musings", "ae890ac52d0df67ed7cfdf51b644e901", false);
        String xml = marshal(pubSub);
        Assert.assertEquals(xml, "<pubsub xmlns=\"http://jabber.org/protocol/pubsub\"><retract notify=\"false\" node=\"princely_musings\"><item id=\"ae890ac52d0df67ed7cfdf51b644e901\"></item></retract></pubsub>");
    }
View Full Code Here

                "      </item>\n" +
                "    </publish>\n" +
                "  </pubsub>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Item item = pubSub.getPublish().getItem();
        Assert.assertTrue(item.getPayload() instanceof AvatarMetadata);
        AvatarMetadata avatarMetadata = (AvatarMetadata) item.getPayload();
        Assert.assertEquals(avatarMetadata.getInfoList().size(), 4);
        Assert.assertEquals(avatarMetadata.getInfoList().get(1).getBytes(), Integer.valueOf(12345));
        Assert.assertEquals(avatarMetadata.getInfoList().get(1).getHeight(), Integer.valueOf(64));
View Full Code Here

                "      </item>\n" +
                "    </publish>\n" +
                "  </pubsub>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        PubSub pubSub = iq.getExtension(PubSub.class);
        Assert.assertNotNull(pubSub);
        Item item = pubSub.getPublish().getItem();
        Assert.assertTrue(item.getPayload() instanceof AvatarData);
        AvatarData avatarData = (AvatarData) item.getPayload();
        Assert.assertTrue(avatarData.getData().length > 0);
    }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.pubsub.model.PubSub$Subscribe

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.