コード例 #1
0
  public void testCreatePubSub() {
    PubSub pubSub = new PubSub();
    pubSub.setFrom("[email protected]/test");
    pubSub.setTo("pubsub.cdr.su.se");
    pubSub.setType(IQ.Type.SET);
    pubSub.addChild(new CreateElement("test/a/node"));
    System.err.println(pubSub.toXML());

    assertEquals(pubSub.getChild().toXML().startsWith("<create"), true);
  }
コード例 #2
0
  public void testCreatePublish() {
    PubSub pubSub = new PubSub();
    pubSub.setFrom("[email protected]/test");
    pubSub.setTo("pubsub.cdr.su.se");
    pubSub.setType(IQ.Type.SET);
    PublishElement publish = new PublishElement("test/a/node");
    pubSub.addChild(publish);
    publish.addChild(new ItemElement(null, "<a><kaka foo=\"plupp\"/></a>"));
    ItemElement item = (ItemElement) publish.getChild();
    assertNotNull(item);
    System.err.println("ITEM: " + item.toXML());
    assertEquals(item.toXML().startsWith("<item"), true);

    assertEquals(pubSub.getChild().toXML().startsWith("<publish"), true);
    System.err.println(pubSub.toXML());
  }