Class JspTestUtil

java.lang.Object
ee.jakarta.tck.pages.common.util.JspTestUtil

public class JspTestUtil extends Object
JSP TCK Utility class.
  • Field Details

    • DEBUG

      public static boolean DEBUG
      Flag to enabled the printing of debug statements.
  • Method Details

    • invokeTest

      public static void invokeTest(Object testObject, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, jakarta.servlet.jsp.JspWriter out) throws jakarta.servlet.ServletException
      Utility method to invoke JSP API Tests.
      Parameters:
      testObject - - the JSP test object
      req - - the incoming client request
      res - - response to the client
      out - - used to write the response
      Throws:
      jakarta.servlet.ServletException - - if an error occurs
    • handleThrowable

      public static void handleThrowable(Throwable t, jakarta.servlet.jsp.JspWriter out, String identifier) throws IOException
      Utility method to handle exceptions from tests in a generic fashion.
      Parameters:
      t - - offending Throwable instance
      out - - JspWriter to write the error info to
      identifier - - a test name or other logical identifier
      Throws:
      IOException - if an I/O error occurs when writing to the stream.
    • checkEnumeration

      public static boolean checkEnumeration(Enumeration e, String[] values)
      Compares the String values in an Enumeration against the provides String array of values. The number of elements in the enumeration must be the same as the size of the array, or false will be returned. False will also be returned if the provided Enumeration or String array is null. If all values are found, true will be returned. The comparison is performed in a case sensitive manner.
      Parameters:
      e - - Enumeration to validate
      values - - the values expected to be found in the Enumeration
      Returns:
      true if all the expected values are found, otherwise false.
    • getAsString

      public static String getAsString(String[] sArray)
      Returns the provided String array in the following format: [n1,n2,n...]
      Parameters:
      sArray - - an array of String values
      Returns:
      - a String based off the values in the array
    • getAsString

      public static String getAsString(Enumeration e)
      Returns the provided Enumeration as a String in the following format: [n1,n2,n...]
      Parameters:
      e - - an Enumeration
      Returns:
      - a printable version of the contents of the Enumeration
    • getAsStringArray

      public static String[] getAsStringArray(Enumeration e)
      Returnes the provides Enumeration as an Array of String Arguments.
      Parameters:
      e - - an Enumeration
      Returns:
      - the elements of the Enumeration as an array of Strings
    • getAsStringArray

      public static String[] getAsStringArray(Iterator i)
    • getAsStringArray

      public static String[] getAsStringArray(String s)
    • debug

      public static void debug(String message)
      Writes the provided message to System.out when the debug is set.
      Parameters:
      message - - the message to write to System.out
    • getValidationMessage

      public static jakarta.servlet.jsp.tagext.ValidationMessage[] getValidationMessage(String id, String message)
      Creates an array of ValidationMessages.
      Parameters:
      id - - the jsp:id
      message - - the error message
      Returns:
      an arrary of ValidationMessages, or null if message is null.
    • getAsString

      public static String getAsString(Map map)

      Returns a String representation of the Map provided.

      Parameters:
      map - input map
      Returns:
      String representation of the Map
    • getTagStatusAsString

      public static String getTagStatusAsString(String method, String type, int status)
      Utility class to get a String version of a Tag return value based on the int value, the type, and the method it was returned from.
      Parameters:
      method - - the Tag method returning the int status
      type - - the tag interface type (i.e. Tag, IterationTag)
      status - - the return value from the method
      Returns:
      a String representation of the information provided
    • getScopeName

      public static String getScopeName(int scope)