Package org.displaytag.util

Examples of org.displaytag.util.ParamEncoder


     */
    @Override
    @Test
    public void doTest() throws Exception
    {
        ParamEncoder encoder = new ParamEncoder("table");
        String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE);

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        request.setParameter(mediaParameter, "2");

        WebResponse response = runner.getResponse(request);
View Full Code Here


    public void doTest() throws Exception
    {

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

        ParamEncoder p2 = new ParamEncoder("table2");
        ParamEncoder p3 = new ParamEncoder("table3");

        request.setParameter(p2.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2"); // table 2 start page 2
        request.setParameter(p3.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0"); // table 3 sort 0
        request.setParameter(p3.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "1"); // table 3 order desc

        WebResponse response = runner.getResponse(request);

        if (log.isDebugEnabled())
        {
View Full Code Here

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

        WebResponse response = runner.getResponse(request);
        Assert.assertEquals("Wrong encoding", "UTF8", response.getCharacterSet());

        ParamEncoder encoder = new ParamEncoder("table");
        String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);
        request = new GetMethodWebRequest(getJspUrl(getJspName()));
        request.setParameter(mediaParameter, Integer.toString(MediaTypeEnum.CSV.getCode()));

        response = runner.getResponse(request);
        checkContent(response);
View Full Code Here

    @Override
    @Test
    public void doTest() throws Exception
    {

        ParamEncoder encoder = new ParamEncoder("table");
        String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        request.setParameter(mediaParameter, "" + MediaTypeEnum.XML.getCode());

        WebResponse response = runner.getResponse(request);
View Full Code Here

    @Override
    @Test
    public void doTest() throws Exception
    {

        ParamEncoder encoder = new ParamEncoder("table");
        String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);
        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

        // this will force media type initialization
        MediaTypeEnum.registerMediaType("wpdf");
        ExportViewFactory factory = ExportViewFactory.getInstance();
View Full Code Here

     */
    @Override
    @Test
    public void doTest() throws Exception
    {
        ParamEncoder encoder = new ParamEncoder("table");
        String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        request.setParameter(mediaParameter, Integer.toString(this.getCode()));

        WebResponse response = runner.getResponse(request);
View Full Code Here

    @Override
    @Test
    public void doTest() throws Exception
    {
        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        ParamEncoder encoder = new ParamEncoder("table");
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "3");

        WebResponse response = runner.getResponse(request);

        if (log.isDebugEnabled())
        {
            log.debug(response.getText());
        }

        HTMLElement pagination = response.getElementWithID("pagination");
        Assert.assertNotNull("Paging banner not found.", pagination);
        Assert.assertEquals("Total number of pages is not displayted properly.", "[10]", pagination.getText());

        request = new GetMethodWebRequest(getJspUrl(getJspName()));
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "10");
        response = runner.getResponse(request);

        if (log.isDebugEnabled())
        {
            log.debug(response.getText());
View Full Code Here

    @Override
    @Test
    public void doTest() throws Exception
    {
        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        ParamEncoder encoder = new ParamEncoder("table");
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2");
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0");

        WebResponse response = runner.getResponse(request);

        if (log.isDebugEnabled())
        {
View Full Code Here

        String lastLink = links[links.length - 1].getURLString();

        // remove prefix
        lastLink = lastLink.substring(lastLink.indexOf(getJspName()), lastLink.length());

        String encodedParam = new ParamEncoder("table2").encodeParameterName(TableTagParameters.PARAMETER_PAGE);

        String expected = "pagination-links.jsp?initiator=AVINASH&wfid=&approvedTDate=&initiatedFDate=&status=default"
            + "&initiatedTDate=04%2F28%2F2004&approvedFDate=&method=search&approver=&"
            + encodedParam
            + "=12";
View Full Code Here

    @Test
    public void doTest() throws Exception
    {

        WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
        ParamEncoder encoder = new ParamEncoder("table");

        // page 1, not sorted
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");
        checkNumberOfIterations(runner.getResponse(request), 1);

        // page 2, not sorted
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
        checkNumberOfIterations(runner.getResponse(request), 1);

        // page 1, sorted (only current page)
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "1");
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");
        checkNumberOfIterations(runner.getResponse(request), 1);

        // page 2, sorted (only current page)
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "1");
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
        checkNumberOfIterations(runner.getResponse(request), 1);

        // page 1, export single page
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
        request.setParameter(
            encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE),
            Integer.toString(MediaTypeEnum.CSV.getCode()));
        request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "1");

        WebResponse response = runner.getResponse(request);
        String csvExport = response.getText();
        if (log.isDebugEnabled())
        {
View Full Code Here

TOP

Related Classes of org.displaytag.util.ParamEncoder

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.