Package com.canoo.webtest.plugins.pdftest

Source Code of com.canoo.webtest.plugins.pdftest.AbstractPdfStep

// Copyright � 2002-2007 Canoo Engineering AG, Switzerland.
package com.canoo.webtest.plugins.pdftest;

import com.canoo.webtest.engine.StepExecutionException;
import com.canoo.webtest.plugins.pdftest.htmlunit.PDFPage;
import com.canoo.webtest.steps.Step;
import com.gargoylesoftware.htmlunit.Page;

/**
* Base class for PDF steps.
* @author Paul King
* @author Etienne Studer
* @author Marc Guillemot
*/
public abstract class AbstractPdfStep extends Step
{
    /**
     * Value indicating that a no page restriction occurs for the step
     */
    protected static final int ANY_PAGE = -1;

    protected PDFPage getPdfPage()
    {
        nullResponseCheck();
      final Page page = getContext().getCurrentResponse();
      if (page instanceof PDFPage)
        return (PDFPage) page;
     
      throw new StepExecutionException("Current response is not a PDF page but has following mime type "
          + page.getWebResponse().getContentType() + " (" + page + ")", this);
    }
   
   
}
TOP

Related Classes of com.canoo.webtest.plugins.pdftest.AbstractPdfStep

TOP
Copyright © 2018 www.massapi.com. 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.