use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class MUCLightCreateIQTest method checkCreateMUCLightStanza.
@Test
public void checkCreateMUCLightStanza() throws Exception {
List<Jid> occupants = new ArrayList<>();
occupants.add(JidCreate.from("charlie@test.com"));
occupants.add(JidCreate.from("pep@test.com"));
MUCLightCreateIQ mucLightCreateIQ = new MUCLightCreateIQ(JidCreate.from("ef498f55-5f79-4238-a5ae-4efe19cbe617@muclight.test.com").asEntityJidIfPossible(), "test", occupants);
mucLightCreateIQ.setStanzaId("1c72W-50");
Assert.assertEquals(mucLightCreateIQ.getConfiguration().getRoomName(), "test");
HashMap<Jid, MUCLightAffiliation> iqOccupants = mucLightCreateIQ.getOccupants();
Assert.assertEquals(iqOccupants.get(JidCreate.from("charlie@test.com")), MUCLightAffiliation.member);
Assert.assertEquals(iqOccupants.get(JidCreate.from("pep@test.com")), MUCLightAffiliation.member);
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class MUCLightGetAffiliationsTest method checkGetAffiliationsResponse.
@Test
public void checkGetAffiliationsResponse() throws Exception {
IQ iqInfoResult = (IQ) PacketParserUtils.parseStanza(getAffiliationsResponseExample);
MUCLightAffiliationsIQ mucLightAffiliationsIQ = (MUCLightAffiliationsIQ) iqInfoResult;
Assert.assertEquals("123456", mucLightAffiliationsIQ.getVersion());
HashMap<Jid, MUCLightAffiliation> affiliations = mucLightAffiliationsIQ.getAffiliations();
Assert.assertEquals(3, affiliations.size());
Assert.assertEquals(MUCLightAffiliation.owner, affiliations.get(JidCreate.from("user1@shakespeare.lit")));
Assert.assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user2@shakespeare.lit")));
Assert.assertEquals(MUCLightAffiliation.member, affiliations.get(JidCreate.from("user3@shakespeare.lit")));
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class PreferencesTest method checkUpdatePrefsStanza.
@Test
public void checkUpdatePrefsStanza() throws Exception {
List<Jid> alwaysJids = new ArrayList<>();
alwaysJids.add(JidCreate.from("romeo@montague.lit"));
alwaysJids.add(JidCreate.from("other@montague.lit"));
List<Jid> neverJids = new ArrayList<>();
neverJids.add(JidCreate.from("montague@montague.lit"));
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, DefaultBehavior.roster);
mamPrefIQ.setStanzaId("sarasa");
Assert.assertEquals(mamPrefIQ.toXML().toString(), updatePrefsStanzaExample);
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class MUCLightAffiliationsChangeExtensionTest method checkAffiliationsChangeExtensionWithPrevVersion.
@Test
public void checkAffiliationsChangeExtensionWithPrevVersion() throws Exception {
Message changeAffiliationsMessage = (Message) PacketParserUtils.parseStanza(exampleMessageStanzaWithPrevVersion);
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension.from(changeAffiliationsMessage);
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
Assert.assertEquals(affiliations.size(), 2);
Assert.assertEquals(affiliations.get(JidCreate.from("sarasa2@shakespeare.lit")), MUCLightAffiliation.owner);
Assert.assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
Assert.assertEquals(affiliationsChangeExtension.getPrevVersion(), "njiokm");
Assert.assertEquals(affiliationsChangeExtension.getVersion(), "qwerty");
}
use of org.jxmpp.jid.Jid in project Smack by igniterealtime.
the class MUCLightAffiliationsChangeExtensionTest method checkAffiliationsChangeExtensionWithVersion.
@Test
public void checkAffiliationsChangeExtensionWithVersion() throws Exception {
Message changeAffiliationsMessage = (Message) PacketParserUtils.parseStanza(exampleMessageStanzaWithVersion);
AffiliationsChangeExtension affiliationsChangeExtension = AffiliationsChangeExtension.from(changeAffiliationsMessage);
HashMap<Jid, MUCLightAffiliation> affiliations = affiliationsChangeExtension.getAffiliations();
Assert.assertEquals(affiliations.size(), 2);
Assert.assertEquals(affiliations.get(JidCreate.from("sarasa1@shakespeare.lit")), MUCLightAffiliation.member);
Assert.assertEquals(affiliations.get(JidCreate.from("sarasa3@shakespeare.lit")), MUCLightAffiliation.none);
Assert.assertEquals(affiliationsChangeExtension.getVersion(), "qwerty");
}
Aggregations