Search in sources :

Example 91 with Stanza

use of org.jivesoftware.smack.packet.Stanza in project Smack by igniterealtime.

the class FromMatchesFilterTest method fullCompareMatchingServiceJid.

@Test
public void fullCompareMatchingServiceJid() {
    FromMatchesFilter filter = FromMatchesFilter.createFull(SERVICE_JID1);
    Stanza packet = StanzaBuilder.buildMessage().build();
    packet.setFrom(SERVICE_JID1);
    assertTrue(filter.accept(packet));
    packet.setFrom(SERVICE_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID1);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID1_R1);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) Test(org.junit.Test)

Example 92 with Stanza

use of org.jivesoftware.smack.packet.Stanza in project Smack by igniterealtime.

the class FromMatchesFilterTest method bareCompareMatchingServiceJid.

@Test
public void bareCompareMatchingServiceJid() {
    FromMatchesFilter filter = FromMatchesFilter.createBare(SERVICE_JID1);
    Stanza packet = StanzaBuilder.buildMessage().build();
    packet.setFrom(SERVICE_JID1);
    assertTrue(filter.accept(packet));
    packet.setFrom(SERVICE_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID1);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID1_R1);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) Test(org.junit.Test)

Example 93 with Stanza

use of org.jivesoftware.smack.packet.Stanza in project Smack by igniterealtime.

the class FromMatchesFilterTest method autoCompareMatchingServiceJid.

@Test
public void autoCompareMatchingServiceJid() {
    FromMatchesFilter filter = FromMatchesFilter.create(SERVICE_JID1);
    Stanza packet = StanzaBuilder.buildMessage().build();
    packet.setFrom(SERVICE_JID1);
    assertTrue(filter.accept(packet));
    packet.setFrom(SERVICE_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID1);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID1_R1);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) Test(org.junit.Test)

Example 94 with Stanza

use of org.jivesoftware.smack.packet.Stanza in project Smack by igniterealtime.

the class FromMatchesFilterTest method autoCompareMatchingBaseJid.

@Test
public void autoCompareMatchingBaseJid() {
    FromMatchesFilter filter = FromMatchesFilter.create(BASE_JID1);
    Stanza packet = StanzaBuilder.buildMessage().build();
    packet.setFrom(BASE_JID1);
    assertTrue(filter.accept(packet));
    packet.setFrom(FULL_JID1_R1);
    assertTrue(filter.accept(packet));
    packet.setFrom(FULL_JID1_R2);
    assertTrue(filter.accept(packet));
    packet.setFrom(BASE_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) Test(org.junit.Test)

Example 95 with Stanza

use of org.jivesoftware.smack.packet.Stanza in project Smack by igniterealtime.

the class FromMatchesFilterTest method fullCompareMatchingBaseJid.

@Test
public void fullCompareMatchingBaseJid() {
    FromMatchesFilter filter = FromMatchesFilter.createFull(BASE_JID1);
    Stanza packet = StanzaBuilder.buildMessage().build();
    packet.setFrom(BASE_JID1);
    assertTrue(filter.accept(packet));
    packet.setFrom(FULL_JID1_R1);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID1_R2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(FULL_JID2);
    assertFalse(filter.accept(packet));
    packet.setFrom(BASE_JID3);
    assertFalse(filter.accept(packet));
}
Also used : Stanza(org.jivesoftware.smack.packet.Stanza) Test(org.junit.Test)

Aggregations

Stanza (org.jivesoftware.smack.packet.Stanza)101 StanzaListener (org.jivesoftware.smack.StanzaListener)24 Test (org.junit.Test)22 IQ (org.jivesoftware.smack.packet.IQ)20 Test (org.junit.jupiter.api.Test)18 XMPPConnection (org.jivesoftware.smack.XMPPConnection)14 Message (org.jivesoftware.smack.packet.Message)14 ArrayList (java.util.ArrayList)11 SmackException (org.jivesoftware.smack.SmackException)11 Jid (org.jxmpp.jid.Jid)11 IOException (java.io.IOException)9 NotConnectedException (org.jivesoftware.smack.SmackException.NotConnectedException)8 StanzaFilter (org.jivesoftware.smack.filter.StanzaFilter)8 Bytestream (org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream)7 DelayInformation (org.jivesoftware.smackx.delay.packet.DelayInformation)7 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)6 StanzaTypeFilter (org.jivesoftware.smack.filter.StanzaTypeFilter)6 Protocol (org.jivesoftware.util.Protocol)6 EntityFullJid (org.jxmpp.jid.EntityFullJid)6 LinkedList (java.util.LinkedList)5