/**
   * TestCase for isValidFilePath method
   *
   * <p>Validate current file path
   *
   * <ol>
   *   <li>If INIT_PARAM_DOCUMENT_FOLDER_ACCESS_ONLY is false, returns true.
   *   <li>Else, validate current file if exist in document folder.
   *       <ol>
   */
  public void testIsValidFilePath() {
    String reportFile =
        System.getProperty("java.io.tmpdir") + "/report1.rptdesign"; // $NON-NLS-1$ //$NON-NLS-2$

    // INIT_PARAM_DOCUMENT_FOLDER_ACCESS_ONLY is false
    assertTrue(ParameterAccessor.isValidFilePath(request, reportFile));

    // INIT_PARAM_DOCUMENT_FOLDER_ACCESS_ONLY is true
    ParameterAccessor.reset();
    context.setInitParameter(
        ParameterAccessor.INIT_PARAM_WORKING_FOLDER_ACCESS_ONLY, "true"); // $NON-NLS-1$
    ParameterAccessor.initParameters(context);
    assertFalse(ParameterAccessor.isValidFilePath(request, reportFile));

    reportFile = new File(root, "report1.rptdesign").getAbsolutePath(); // $NON-NLS-1$
    assertTrue(ParameterAccessor.isValidFilePath(request, reportFile));
  }
  /**
   * TestCase for getMaxRows method
   *
   * <p>Returns the maxrows setting
   */
  public void testGetMaxRows() {
    int DEFAULT_MAX_ROWS = 500;

    // Reset
    ParameterAccessor.reset();
    context.setInitParameter(
        ParameterAccessor.INIT_PARAM_VIEWER_MAXROWS, "" + DEFAULT_MAX_ROWS); // $NON-NLS-1$
    ParameterAccessor.initParameters(context);

    // Don't set anything
    assertEquals(DEFAULT_MAX_ROWS, ParameterAccessor.getMaxRows(request));

    // Set in request
    request.addParameter(ParameterAccessor.PARAM_MAXROWS, "WrongNumber"); // $NON-NLS-1$
    assertEquals(DEFAULT_MAX_ROWS, ParameterAccessor.getMaxRows(request));
    request.addParameter(ParameterAccessor.PARAM_MAXROWS, "200"); // $NON-NLS-1$
    assertEquals(200, ParameterAccessor.getMaxRows(request));

    request.removeParameter(ParameterAccessor.PARAM_MAXROWS);
  }