Exemplo n.º 1
0
  @Test
  public void checkProvider() throws Exception {
    // @formatter:off
    String control =
        "<iq from='capulet.lit' to='[email protected]/balcony' id='s2c1' type='get'>"
            + "<query xmlns='jabber:iq:version'/>"
            + "</iq>";
    // @formatter:on
    DummyConnection con = new DummyConnection();
    con.connect();

    // Enable version replys for this connection
    VersionManager.setAutoAppendSmackVersion(false);
    VersionManager.getInstanceFor(con).setVersion("Test", "0.23", "DummyOS");
    IQ versionRequest = (IQ) PacketParserUtils.parseStanza(control);

    assertTrue(versionRequest instanceof Version);

    con.processPacket(versionRequest);

    Stanza replyPacket = con.getSentPacket();
    assertTrue(replyPacket instanceof Version);

    Version reply = (Version) replyPacket;
    // getFrom check is pending for SMACK-547
    // assertEquals("[email protected]/balcony", reply.getFrom());
    assertEquals("capulet.lit", reply.getTo());
    assertEquals("s2c1", reply.getStanzaId());
    assertEquals(IQ.Type.result, reply.getType());
    assertEquals("Test", reply.getName());
    assertEquals("0.23", reply.getVersion());
    assertEquals("DummyOS", reply.getOs());
  }
Exemplo n.º 2
0
  @Before
  public void setUp() throws Exception {
    // Uncomment this to enable debug output
    // XMPPConnection.DEBUG_ENABLED = true;

    connection = new DummyConnection();
    connection.connect();
    connection.login("me", "secret");
    ServiceDiscoveryManager.getInstanceFor(connection);
  }