Package org.apache.abdera.ext.opensearch.model

Examples of org.apache.abdera.ext.opensearch.model.IntegerElement


       
        Query query = feed.addExtension(OpenSearchConstants.QUERY);
        query.setRole(Query.Role.REQUEST);
        query.setSearchTerms(QUERY_TERMS);
       
        IntegerElement totalResults = feed.addExtension(OpenSearchConstants.TOTAL_RESULTS);
        totalResults.setValue(TOTAL_RESULTS);
        IntegerElement itemsPerPage = feed.addExtension(OpenSearchConstants.ITEMS_PER_PAGE);
        itemsPerPage.setValue(ITEMS_PER_PAGE);
        IntegerElement startIndex = feed.addExtension(OpenSearchConstants.START_INDEX);
        startIndex.setValue(START_INDEX);
       
        StringWriter writer = new StringWriter();
        feed.writeTo(writer);
       
        String result = writer.toString();
View Full Code Here


        Parser parser = Abdera.getNewParser();

        InputStream stream = OpenSearchAtomTest.class.getResourceAsStream("/atomResponse.xml");
        Document<Element> doc = parser.parse(stream);

        IntegerElement tr = doc.getRoot().getFirstChild(OpenSearchConstants.TOTAL_RESULTS);
        assertNotNull(tr);
        assertEquals(47, tr.getValue());

        IntegerElement ipp = doc.getRoot().getFirstChild(OpenSearchConstants.ITEMS_PER_PAGE);
        assertNotNull(ipp);
        assertEquals(1, ipp.getValue());

        IntegerElement si = doc.getRoot().getFirstChild(OpenSearchConstants.START_INDEX);
        assertNotNull(si);
        assertEquals(1, si.getValue());
       
        Query q = doc.getRoot().getFirstChild(OpenSearchConstants.QUERY);
        assertNotNull(q);
        assertEquals(Query.Role.REQUEST, q.getRole());
        assertEquals(QUERY_TERMS, q.getSearchTerms());
View Full Code Here

public class TestSelectNodes extends Assert{
 
  @Test
  public void testXPath() throws IOException {
    Feed f = Abdera.getInstance().newFeed();
    IntegerElement ext = f.addExtension(OpenSearchConstants.START_INDEX);
    ext.setValue(101);
    XPath path = Abdera.getNewXPath();
    List result = path.selectNodes("node()", ext);
    assertTrue(result.size() > 0);
  }
View Full Code Here

 
  @Test
  public void testJson() throws IOException {
    Abdera abdera = Abdera.getInstance();
    Feed f = abdera.newFeed();
    IntegerElement ext = f.addExtension(OpenSearchConstants.START_INDEX);
    ext.setValue(101);
    Writer json = abdera.getWriterFactory().getWriter("json");
   
    StringWriter stWriter = new StringWriter();
    PrintWriter pWriter = new PrintWriter(stWriter);
    f.writeTo(json, pWriter);
View Full Code Here

public class TestSelectNodes {

    @Test
    public void testXPath() throws IOException {
        Feed f = Abdera.getInstance().newFeed();
        IntegerElement ext = f.addExtension(OpenSearchConstants.START_INDEX);
        ext.setValue(101);
        XPath path = Abdera.getNewXPath();
        List result = path.selectNodes("node()", ext);
        assertTrue(result.size() > 0);
    }
View Full Code Here

    @Test
    public void testJson() throws IOException {
        Abdera abdera = Abdera.getInstance();
        Feed f = abdera.newFeed();
        IntegerElement ext = f.addExtension(OpenSearchConstants.START_INDEX);
        ext.setValue(101);
        Writer json = abdera.getWriterFactory().getWriter("json");

        StringWriter stWriter = new StringWriter();
        PrintWriter pWriter = new PrintWriter(stWriter);
        f.writeTo(json, pWriter);
View Full Code Here

        Query query = feed.addExtension(OpenSearchConstants.QUERY);
        query.setRole(Query.Role.REQUEST);
        query.setSearchTerms(QUERY_TERMS);

        IntegerElement totalResults = feed.addExtension(OpenSearchConstants.TOTAL_RESULTS);
        totalResults.setValue(TOTAL_RESULTS);
        IntegerElement itemsPerPage = feed.addExtension(OpenSearchConstants.ITEMS_PER_PAGE);
        itemsPerPage.setValue(ITEMS_PER_PAGE);
        IntegerElement startIndex = feed.addExtension(OpenSearchConstants.START_INDEX);
        startIndex.setValue(START_INDEX);

        StringWriter writer = new StringWriter();
        feed.writeTo(writer);

        String result = writer.toString();
View Full Code Here

        Parser parser = Abdera.getNewParser();

        InputStream stream = OpenSearchAtomTest.class.getResourceAsStream("/atomResponse.xml");
        Document<Element> doc = parser.parse(stream);

        IntegerElement tr = doc.getRoot().getFirstChild(OpenSearchConstants.TOTAL_RESULTS);
        assertNotNull(tr);
        assertEquals(47, tr.getValue());

        IntegerElement ipp = doc.getRoot().getFirstChild(OpenSearchConstants.ITEMS_PER_PAGE);
        assertNotNull(ipp);
        assertEquals(1, ipp.getValue());

        IntegerElement si = doc.getRoot().getFirstChild(OpenSearchConstants.START_INDEX);
        assertNotNull(si);
        assertEquals(1, si.getValue());

        Query q = doc.getRoot().getFirstChild(OpenSearchConstants.QUERY);
        assertNotNull(q);
        assertEquals(Query.Role.REQUEST, q.getRole());
        assertEquals(QUERY_TERMS, q.getSearchTerms());
View Full Code Here

TOP

Related Classes of org.apache.abdera.ext.opensearch.model.IntegerElement

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.