Search in sources :

Example 6 with DummyConnection

use of org.jivesoftware.smack.DummyConnection in project Smack by igniterealtime.

the class ChatConnectionTest method validateDefaultSetNormalIncludedTrue.

@Test
public void validateDefaultSetNormalIncludedTrue() {
    ChatManager.setDefaultIsNormalIncluded(true);
    assertTrue(ChatManager.getInstanceFor(new DummyConnection()).isNormalIncluded());
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Example 7 with DummyConnection

use of org.jivesoftware.smack.DummyConnection in project Smack by igniterealtime.

the class ChatConnectionTest method validateDefaultSetMatchModeEntityBareJid.

@Test
public void validateDefaultSetMatchModeEntityBareJid() {
    ChatManager.setDefaultMatchMode(ChatManager.MatchMode.BARE_JID);
    assertEquals(ChatManager.MatchMode.BARE_JID, ChatManager.getInstanceFor(new DummyConnection()).getMatchMode());
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Example 8 with DummyConnection

use of org.jivesoftware.smack.DummyConnection in project Smack by igniterealtime.

the class ChatConnectionTest method validateDefaultSetMatchModeNone.

@Test
public void validateDefaultSetMatchModeNone() {
    ChatManager.setDefaultMatchMode(ChatManager.MatchMode.NONE);
    assertEquals(ChatManager.MatchMode.NONE, ChatManager.getInstanceFor(new DummyConnection()).getMatchMode());
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Example 9 with DummyConnection

use of org.jivesoftware.smack.DummyConnection in project Smack by igniterealtime.

the class DeliveryReceiptTest method receiptManagerListenerTest.

@Test
public void receiptManagerListenerTest() throws Exception {
    DummyConnection c = new DummyConnection();
    c.connect();
    DeliveryReceiptManager drm = DeliveryReceiptManager.getInstanceFor(c);
    TestReceiptReceivedListener rrl = new TestReceiptReceivedListener();
    drm.addReceiptReceivedListener(rrl);
    Message m = new Message(JidCreate.from("romeo@montague.com"), Message.Type.normal);
    m.setFrom(JidCreate.from("julia@capulet.com"));
    m.setStanzaId("reply-id");
    m.addExtension(new DeliveryReceipt("original-test-id"));
    c.processStanza(m);
    rrl.waitUntilInvocationOrTimeout();
}
Also used : Message(org.jivesoftware.smack.packet.Message) DummyConnection(org.jivesoftware.smack.DummyConnection) Test(org.junit.Test)

Example 10 with DummyConnection

use of org.jivesoftware.smack.DummyConnection in project Smack by igniterealtime.

the class MamTest method setup.

@Before
public void setup() {
    // mock connection
    connection = new DummyConnection();
    // test query id
    queryId = "testid";
    // MamManager instance
    mamManager = MamManager.getInstanceFor(connection);
}
Also used : DummyConnection(org.jivesoftware.smack.DummyConnection) Before(org.junit.Before)

Aggregations

DummyConnection (org.jivesoftware.smack.DummyConnection)20 Test (org.junit.Test)13 Before (org.junit.Before)6 ThreadedDummyConnection (org.jivesoftware.smack.ThreadedDummyConnection)5 Stanza (org.jivesoftware.smack.packet.Stanza)5 IQ (org.jivesoftware.smack.packet.IQ)3 Message (org.jivesoftware.smack.packet.Message)2 TestRosterListener (org.jivesoftware.smack.roster.RosterTest.TestRosterListener)2 Ping (org.jivesoftware.smackx.ping.packet.Ping)2 XMLBuilder (com.jamesmurty.utils.XMLBuilder)1 SmackException (org.jivesoftware.smack.SmackException)1 NoResponseException (org.jivesoftware.smack.SmackException.NoResponseException)1 DirectoryRosterStore (org.jivesoftware.smack.roster.rosterstore.DirectoryRosterStore)1 AuthMechanism (org.jivesoftware.smack.sasl.packet.SaslStreamElements.AuthMechanism)1 Response (org.jivesoftware.smack.sasl.packet.SaslStreamElements.Response)1 LastActivity (org.jivesoftware.smackx.iqlast.packet.LastActivity)1 Version (org.jivesoftware.smackx.iqversion.packet.Version)1