Package com.calclab.emite.core.stanzas

Examples of com.calclab.emite.core.stanzas.Stanza


   *            user to invite
   * @param reasonText
   *            reason for the invitation
   */
  public void sendInvitationTo(final XmppURI userJid, final String reasonText) {
    final Stanza message = new Message();
    message.setTo(roomUri.getJID());
    final XMLPacket invite = message.getXML().addChild("x", XmppNamespaces.MUC_USER).addChild("invite");
    invite.setAttribute("to", userJid.toString());
    invite.setChildText("reason", reasonText);
   
    eventBus.fireEventFromSource(new BeforeRoomInvitationSentEvent(message, invite), this);
    session.send(message);
View Full Code Here


    return "com.calclab.emite.xep.delay.EmiteDelay";
  }

  @Test
  public void testShouldGiveDelay() {
    final Stanza stanza = new Stanza("name", "xmlns");

    final XmppURI uri = uri("name@domain/resource");
    stanza.setTo(uri);
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo((XmppURI) null);
    final XMLPacket delayNode = stanza.getXML().addChild("delay");
    delayNode.setAttribute("xmlns", "urn:xmpp:delay");
    delayNode.setAttribute("from", "name@domain/resource");
    delayNode.setAttribute("stamp", "1980-04-15T17:15:02.159+01:00");
    final Delay delay = DelayHelper.getDelay(stanza);
    assertNotNull(delay);
View Full Code Here

  }

  @SuppressWarnings("deprecation")
  @Test
  public void testShouldGiveDelayLegacyFormat() {
    final Stanza stanza = new Stanza("name", "xmlns");

    final XmppURI uri = uri("name@domain/resource");
    stanza.setTo(uri);
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo(null);
    final XMLPacket delayNode = stanza.getXML().addChild("x");
    delayNode.setAttribute("xmlns", "jabber:x:delay");
    delayNode.setAttribute("from", "name@domain/resource");
    delayNode.setAttribute("stamp", "19800415T15:15:02");
    final Delay delay = DelayHelper.getDelay(stanza);
    assertNotNull(delay);
View Full Code Here

    assertEquals(date, delay.getStamp());
  }

  @Test
  public void testShouldSetTextToChild() {
    final Stanza stanza = new Stanza("name", "xmlns");
    stanza.getXML().setChildText("child", "value");
    assertEquals("value", stanza.getXML().getChildText("child"));
    stanza.getXML().setChildText("child", null);
    assertNull(stanza.getXML().getFirstChild("child"));
  }
View Full Code Here

    assertNull(stanza.getXML().getFirstChild("child"));
  }

  @Test
  public void testShouldSetTo() {
    final Stanza stanza = new Stanza("name", "xmlns");

    stanza.setTo(uri("name@domain/resource"));
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo(null);
    assertNull(stanza.getTo());
  }
View Full Code Here

public class BasicStanzaTest {

  @Test
  public void shouldSetTextToChild() {
    final Stanza stanza = new Stanza("name", "xmlns");
    stanza.getXML().setChildText("child", "value");
    assertEquals("value", stanza.getXML().getFirstChild("child").getText());
    stanza.getXML().setChildText("child", null);
    assertSame(null, stanza.getXML().getFirstChild("child"));
  }
View Full Code Here

    assertSame(null, stanza.getXML().getFirstChild("child"));
  }

  @Test
  public void shouldSetTo() {
    final Stanza stanza = new Stanza("name", "xmlns");

    stanza.setTo(uri("name@domain/resource"));
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo(null);
    assertNull(stanza.getTo());
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.core.stanzas.Stanza

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.