Package electric.xml

Examples of electric.xml.Document


     * functionality, you may be able to get around the problem by using a filter yourself to manually
     * set the content type for '*.html' files.
     */
    public void testStaticPage() throws Exception {
        WebResponse rs = wc.getResponse( baseUrl + "/simple/static.html" );
    Document doc = getDocument( rs );
    assertEquals( "[:: Simple page ::]", rs.getTitle() );
    assertEquals( "Hello world", doc.getElementWithId( "p" ).getText().toString() );
    assertEquals( "footer", doc.getElementWithId( "footer" ).getText().toString() );
    assertEquals( "Simple page", doc.getElementWithId( "header" ).getText().toString() );
    }
View Full Code Here


    checkPage( "/welcomepage" );
  }

  private void checkPage( String path ) throws Exception {
    WebResponse rs = wc.getResponse( baseUrl + path );
    Document doc = getDocument( rs );
    assertEquals( "[:: Welcome Page ::]", rs.getTitle() );
    assertEquals( "Welcome to the page", doc.getElementWithId( "p1" ).getText().toString() );
    assertEquals( "footer", doc.getElementWithId( "footer" ).getText().toString() );
    assertEquals( "Welcome Page", doc.getElementWithId( "header" ).getText().toString() );
  }
View Full Code Here

    checkPage( "/redirect/simple-include.jsp" );
  }

  private void checkPage(String path) throws Exception {
    WebResponse rs = wc.getResponse( baseUrl + path );
    Document doc = getDocument( rs );
    assertEquals( "[:: Another page ::]", rs.getTitle() );
    assertEquals( "A different page", doc.getElementWithId( "p1" ).getText().toString() );
    assertEquals( "footer", doc.getElementWithId( "footer" ).getText().toString() );
    assertEquals( "Another page", doc.getElementWithId( "header" ).getText().toString() );
  }
View Full Code Here

{

    public void testInlineContentDecoratedInDecorator() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page1.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline1} content 1", rs.getTitle());
        assertEquals("page 1 content", doc.getElementWithId("bod").getText("p").toString());
        assertEquals("Inline internal content 1", doc.getElementWithId("inline1").getText().toString());
        assertEquals("Inline internal content 2", doc.getElementWithId("inline2").getText().toString());
        assertEquals("footer", doc.getElementWithId("footer").getText().toString());
    }
View Full Code Here

    }

    public void testJspIncludedContentedDecoratedInDecorator() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page2.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline2} content 2", rs.getTitle());
        assertEquals("page 2 content", doc.getElementWithId("bod").getText("p").toString());
        assertEquals("Inline external content 1", doc.getElementWithId("inline1").getText().toString());
        assertEquals("panel 2", doc.getElementWithId("inline2").getText().toString());
        assertEquals("footer", doc.getElementWithId("footer").getText().toString());
    }
View Full Code Here

    }

    public void testSitemeshIncludedContentDecoratedInDecorator() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page3.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline3} content 3", rs.getTitle());
        assertEquals("page 3 content", doc.getElementWithId("bod").getText("p").toString());
        assertEquals("Inline external content 1", doc.getElementWithId("inline1").getText().toString());
        assertEquals("panel 2", doc.getElementWithId("inline2").getText().toString());
        assertEquals("footer", doc.getElementWithId("footer").getText().toString());
    }
View Full Code Here

     * @throws Exception
     */
    public void testInlineContentedDecoratedInContent() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page5.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline5} content 5", rs.getTitle());
        assertEquals("page 5 content", doc.getElementWithId("bod").getText("p").toString());
        assertEquals("Inline external content 5", doc.getElementWithId("inline1").getText().toString());
        assertEquals("Some more inline stuff.", doc.getElementWithId("inline-content").getText().toString());
        assertEquals("footer", doc.getElementWithId("footer").getText().toString());
    }
View Full Code Here

     * @throws Exception
     */
    public void testInlineDecoratorWithInternationalizedCharacters() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page6.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline6} content 6", rs.getTitle());
        assertEquals("page 6 content", doc.getElementWithId("bod").getText("p").toString());
        assertEquals("Inline external content 6", doc.getElementWithId("inline1").getText().toString());
        assertEquals("\u0126\u0118\u0139\u0139\u0150", doc.getElementWithId("inline-content").getText().toString());
        assertEquals("footer", doc.getElementWithId("footer").getText().toString());
    }
View Full Code Here

    }

    public void testIncludedContentFromOutputStreamAndWriterOnJspPage() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page7.jsp");
        Document doc = getDocument(rs);
        assertEquals("{inline7} content 7 jsp", rs.getTitle());
        assertEquals("Page 7 jsp content", doc.getElementWithId("bod").getText("p").toString());
        Elements inlineContents = doc.getElements(new XPath("//[@id='inline-content']"));
        assertEquals("This is a servlet using writer to output", inlineContents.next().getText().toString());
        assertEquals("This is a servlet using stream to output", inlineContents.next().getText().toString());
    }
View Full Code Here

     * @see SimpleDecoratorTest#testStaticPage() for more information
     */
    public void testIncludedContentFromOutputStreamAndWriterOnStaticPage() throws Exception
    {
        WebResponse rs = wc.getResponse(baseUrl + "/inline/page7.html");
        Document doc = getDocument(rs);
        assertEquals("{inline7} content 7 static", rs.getTitle());
        assertEquals("Page 7 static content", doc.getElementWithId("bod").getText("p").toString());
        Elements inlineContents = doc.getElements(new XPath("//[@id='inline-content']"));
        assertEquals("This is a servlet using writer to output", inlineContents.next().getText().toString());
        assertEquals("This is a servlet using stream to output", inlineContents.next().getText().toString());
    }
View Full Code Here

TOP

Related Classes of electric.xml.Document

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.