Пример #1
0
  /**
   * Copy constructor.
   *
   * @param d
   */
  public DiscoverInfo(DiscoverInfo d) {
    super(d);

    // Set node
    setNode(d.getNode());

    // Copy features
    for (Feature f : d.features) {
      addFeature(f.clone());
    }

    // Copy identities
    for (Identity i : d.identities) {
      addIdentity(i.clone());
    }
  }
Пример #2
0
  @Test(expected = SmackException.class)
  public void getConfigFormWithTimeout() throws XMPPException, SmackException {
    ThreadedDummyConnection con = new ThreadedDummyConnection();
    PubSubManager mgr = new PubSubManager(con);
    DiscoverInfo info = new DiscoverInfo();
    Identity ident = new Identity("pubsub", null, "leaf");
    info.addIdentity(ident);
    con.addIQReply(info);

    Node node = mgr.getNode("princely_musings");

    SmackConfiguration.setDefaultPacketReplyTimeout(100);
    con.setTimeout();

    node.getNodeConfiguration();
  }
Пример #3
0
  @Test
  public void getConfigFormWithInsufficientPriviliges()
      throws XMPPException, SmackException, IOException, InterruptedException {
    ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
    PubSubManager mgr = new PubSubManager(con, PubSubManagerTest.DUMMY_PUBSUB_SERVICE);
    DiscoverInfo info = new DiscoverInfo();
    Identity ident = new Identity("pubsub", null, "leaf");
    info.addIdentity(ident);
    con.addIQReply(info);

    Node node = mgr.getNode("princely_musings");

    PubSub errorIq = new PubSub();
    XMPPError error = new XMPPError(Condition.forbidden);
    errorIq.setError(error);
    con.addIQReply(errorIq);

    try {
      node.getNodeConfiguration();
    } catch (XMPPErrorException e) {
      Assert.assertEquals(XMPPError.Type.AUTH, e.getXMPPError().getType());
    }
  }
Пример #4
0
 /**
  * Adds identities to the DiscoverInfo stanza.
  *
  * @param identitiesToAdd
  */
 public void addIdentities(Collection<Identity> identitiesToAdd) {
   if (identitiesToAdd == null) return;
   for (Identity identity : identitiesToAdd) {
     addIdentity(identity);
   }
 }