Package rocks.xmpp.extensions.search.model

Examples of rocks.xmpp.extensions.search.model.Search


                            searchMenuItem.setOnAction(new EventHandler<ActionEvent>() {
                                @Override
                                public void handle(ActionEvent actionEvent) {
                                    SearchManager searchManager = xmppSession.getExtensionManager(SearchManager.class);
                                    try {
                                        Search search = new Search("22*", null, null, null);
                                        searchManager.discoverSearchFields(new Jid("search.dev"));
                                        Search result = searchManager.search(search, new Jid("search.dev"));
                                        for (Search.Item item : result.getItems()) {
                                            System.out.println(item.getJid());
                                        }
                                    } catch (XmppException e) {
                                        e.printStackTrace();
                                    }
View Full Code Here


     * @return The possible search fields and instructions or null, if search is not supported. Search fields are supported if they are not null.
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public Search discoverSearchFields(Jid service) throws XmppException {
        IQ result = xmppSession.query(new IQ(service, IQ.Type.GET, new Search()));
        return result.getExtension(Search.class);
    }
View Full Code Here

                "    id='search1'\n" +
                "    xml:lang='en'>\n" +
                "  <query xmlns='jabber:iq:search'/>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Search search = iq.getExtension(Search.class);
        Assert.assertNotNull(search);
    }
View Full Code Here

                "    <nick/>\n" +
                "    <email/>\n" +
                "  </query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Search search = iq.getExtension(Search.class);
        Assert.assertEquals("\n" +
                "      Fill in one or more fields to search\n" +
                "      for any matching Jabber users.\n" +
                "    ", search.getInstructions());

    }
View Full Code Here

    }

    @Test
    public void marshalSearchRequest() throws JAXBException, XMLStreamException {
        Search search = new Search(null, "Capulet", null, null);
        String xml = marshal(search);
        Assert.assertEquals("<query xmlns=\"jabber:iq:search\"><last>Capulet</last></query>", xml);
    }
View Full Code Here

                "    </item>\n" +
                "  </query>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        Search search = iq.getExtension(Search.class);

        Assert.assertNotNull(search);
        Assert.assertEquals(search.getItems().size(), 2);
        Assert.assertEquals(search.getItems().get(0).getJid(), Jid.valueOf("juliet@capulet.com"));
        Assert.assertEquals(search.getItems().get(0).getFirst(), "Juliet");
        Assert.assertEquals(search.getItems().get(0).getLast(), "Capulet");
        Assert.assertEquals(search.getItems().get(0).getNick(), "JuliC");
        Assert.assertEquals(search.getItems().get(0).getEmail(), "juliet@shakespeare.lit");

        Assert.assertEquals(search.getItems().get(1).getJid(), Jid.valueOf("tybalt@shakespeare.lit"));
        Assert.assertEquals(search.getItems().get(1).getFirst(), "Tybalt");
        Assert.assertEquals(search.getItems().get(1).getLast(), "Capulet");
        Assert.assertEquals(search.getItems().get(1).getNick(), "ty");
        Assert.assertEquals(search.getItems().get(1).getEmail(), "tybalt@shakespeare.lit");
    }
View Full Code Here

                "    </x>\n" +
                "  </query>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        Search search = iq.getExtension(Search.class);

        Assert.assertNotNull(search);
        Assert.assertNotNull(search.getAdditionalInformation());
        Assert.assertEquals("User Directory Search", search.getAdditionalInformation().getTitle());
        // The rest should be covered by data form test.
    }
View Full Code Here

                "      </item>\n" +
                "    </x>\n" +
                "  </query>\n" +
                "</iq>\n";
        IQ iq = unmarshal(xml, IQ.class);
        Search search = iq.getExtension(Search.class);

        Assert.assertNotNull(search);

        DataForm dataForm = search.getAdditionalInformation();
        Assert.assertNotNull(dataForm);
        Assert.assertNotNull(dataForm.getReportedFields());
        Assert.assertEquals(dataForm.getReportedFields().size(), 4);
        Assert.assertEquals(dataForm.getReportedFields().get(0).getVar(), "first");
        Assert.assertEquals(dataForm.getReportedFields().get(0).getLabel(), "Given Name");
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.search.model.Search

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.