Package com.calclab.emite.xep.dataforms

Examples of com.calclab.emite.xep.dataforms.Form


    assertEquals("http://www.veronafiere.it/", fields4.get(1).getValues().get(0));
  }

  @Test
  public void parseSearchWithoutForm() {
    final Form form = parse(XEP_0055_2_1_SAMPLE_1);
    assertEquals(form.x(), NoPacket.INSTANCE);
  }
View Full Code Here


    assertEquals(form.x(), NoPacket.INSTANCE);
  }

  @Test
  public void parseTitle() {
    final Form result1 = parse(XEP_0004_5_1_SAMPLE_2);
    final Form result2 = parse(XEP_0004_5_1_SAMPLE_3);
    final Form result3 = parse(XEP_0004_5_1_SAMPLE_4);
    final Form result4 = parse(XEP_0004_5_2_SAMPLE_6);
    final Form result5 = parse(XEP_0004_5_2_SAMPLE_7);
    final Form result6 = parse(XEP_0004_5_2_SAMPLE_8);
    assertEquals("Bot Configuration", result1.getTitle());
    assertEquals(null, result2.getTitle());
    assertEquals(null, result3.getTitle());
    assertEquals("Joogle Search", result4.getTitle());
    assertEquals(null, result5.getTitle());
    assertEquals("Joogle Search: verona", result6.getTitle());
  }
View Full Code Here

    assertEquals("Joogle Search: verona", result6.getTitle());
  }

  @Test
  public void parseType() {
    final Form result1 = parse(XEP_0004_5_1_SAMPLE_2);
    final Form result2 = parse(XEP_0004_5_1_SAMPLE_3);
    final Form result3 = parse(XEP_0004_5_1_SAMPLE_4);
    final Form result4 = parse(XEP_0004_5_2_SAMPLE_6);
    final Form result5 = parse(XEP_0004_5_2_SAMPLE_7);
    final Form result6 = parse(XEP_0004_5_2_SAMPLE_8);
    final Form result7 = parse(XEP_0154_5_3_SAMPLE_13);
    assertEquals(Form.Type.form, result1.getType());
    assertEquals(Form.Type.submit, result2.getType());
    assertEquals(Form.Type.result, result3.getType());
    assertEquals(Form.Type.form, result4.getType());
    assertEquals(Form.Type.submit, result5.getType());
    assertEquals(Form.Type.result, result6.getType());
    assertEquals(Form.Type.result, result7.getType());
  }
View Full Code Here

    session.setReady();
  }

  @Test
  public void testFormReportedAndItems() {
    final Form form = new Form(Form.Type.result);
    form.setTitle("Joogle Search: verona");
    form.addToReported(new Field().Var("name"));
    form.addToReported(new Field().Var("url"));
    form.addItem(new Item().WithField(new Field().Var("name").Value("Comune di Verona - Benvenuti nel sito ufficiale")).WithField(
        new Field().Var("url").Value("http://www.comune.verona.it/")));
    form.addItem(new Item().WithField(new Field().Var("name").Value("benvenuto!")).WithField(new Field().Var("url").Value("http://www.hellasverona.it/")));
    form.addItem(new Item().WithField(new Field().Var("name").Value("Universita degli Studi di Verona - Home Page")).WithField(
        new Field().Var("url").Value("http://www.univr.it/")));
    form.addItem(new Item().WithField(new Field().Var("name").Value("Aeroporti del Garda")).WithField(
        new Field().Var("url").Value("http://www.aeroportoverona.it/")));
    form.addItem(new Item().WithField(new Field().Var("name").Value("Veronafiere - fiera di Verona")).WithField(
        new Field().Var("url").Value("http://www.veronafiere.it/")));
    session.send(form);
    session.verifySent(parse(XEP_0004_5_2_SAMPLE_8).x());
  }
View Full Code Here

    session.verifySent(parse(XEP_0004_5_2_SAMPLE_8).x());
  }

  @Test
  public void testFormResult() {
    final Form form = new Form(Form.Type.result);
    form.WithField(new Field(FieldType.HIDDEN).Var("FORM_TYPE").Value("jabber:bot"));
    form.WithField(new Field(FieldType.TEXT_SINGLE).Var("botname").Value("The Jabber Google Bot"));
    form.WithField(new Field(FieldType.BOOLEAN).Var("public").Value("0"));
    form.WithField(new Field(FieldType.TEXT_PRIVATE).Var("password").Value("v3r0na"));
    form.WithField(new Field(FieldType.LIST_MULTI).Var("features").Value("news").Value("search"));
    form.WithField(new Field(FieldType.LIST_SINGLE).Var("maxsubs").Value("50"));
    form.WithField(new Field(FieldType.JID_MULTI).Var("invitelist").Value("juliet@capulet.com").Value("benvolio@montague.net"));
    session.send(form);
    session.verifySent(parse(XEP_0004_5_1_SAMPLE_4).x());
  }
View Full Code Here

    session.verifySent(parse(XEP_0004_5_1_SAMPLE_4).x());
  }

  @Test
  public void testFormSearch() {
    final Form form = new Form(Form.Type.submit).WithField(new Field(FieldType.TEXT_SINGLE).Var("search_request").Value("verona"));
    session.send(form);
    session.verifySent(parse(XEP_0004_5_2_SAMPLE_7).x());
  }
View Full Code Here

   * presentation in a user interface) is unspecified herein; however,
   * multiple instances of the <instructions/> element MAY be included.
   */
  @Test
  public void testMultipleInstructions() {
    final Form result = parse(SEVERAL_INSTRUCTIONS);
    assertEquals("First", result.getInstructions().get(0));
    assertEquals("Second", result.getInstructions().get(1));
    assertEquals(2, result.getInstructions().size());
  }
View Full Code Here

    assertEquals(2, result.getInstructions().size());
  }

  @Test
  public void testTypeForm() {
    final Form form = new Form(Form.Type.form).WithField(new Field(FieldType.TEXT_SINGLE).Var("search_request").Required(true));
    form.setTitle("Joogle Search");
    form.addInstruction("Fill out this form to search for information!");
    session.send(form);
    session.verifySent(parse(XEP_0004_5_2_SAMPLE_6).x());
  }
View Full Code Here

    session.send(form);
    session.verifySent(parse(XEP_0004_5_2_SAMPLE_6).x());
  }

  private Form parse(final String xml) {
    return new Form(XMLBuilder.fromXML(xml));
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.xep.dataforms.Form

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.