You are viewing a plain text version of this content. The canonical link for it is here.
Posted to watchdog-dev@jakarta.apache.org by sa...@locus.apache.org on 2000/10/04 02:21:32 UTC

cvs commit: jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext checkGetException.jsp checkGetOut.jsp checkGetRequest.jsp checkGetResponse.jsp checkGetServlet.jsp checkGetServletConfig.jsp checkGetServletContext.jsp checkGetSession.jsp forGetException.jsp forward.jsp negativeForwardIllegalArg.jsp negativeForwardIllegalState.jsp negativeInclude.jsp negativeRemoveAttribute.jsp positiveForward.jsp positiveGetAttributeAvbl.jsp positiveGetAttributeNamesInScope.jsp positiveGetAttributeNotAvbl.jsp positiveGetAttributeScope.jsp positiveInclude.jsp positivePopBody.jsp positivePushBody.jsp positiveRemoveAttribute.jsp positiveSetAttribute.jsp positiveSetAttributeInScope.jsp

santosh     00/10/03 17:21:32

  Added:       src/server/jsp-tests/jsp/engine/PageContext
                        checkGetException.jsp checkGetOut.jsp
                        checkGetRequest.jsp checkGetResponse.jsp
                        checkGetServlet.jsp checkGetServletConfig.jsp
                        checkGetServletContext.jsp checkGetSession.jsp
                        forGetException.jsp forward.jsp
                        negativeForwardIllegalArg.jsp
                        negativeForwardIllegalState.jsp negativeInclude.jsp
                        negativeRemoveAttribute.jsp positiveForward.jsp
                        positiveGetAttributeAvbl.jsp
                        positiveGetAttributeNamesInScope.jsp
                        positiveGetAttributeNotAvbl.jsp
                        positiveGetAttributeScope.jsp positiveInclude.jsp
                        positivePopBody.jsp positivePushBody.jsp
                        positiveRemoveAttribute.jsp
                        positiveSetAttribute.jsp
                        positiveSetAttributeInScope.jsp
  Log:
  watchdog 4.0
  
  Revision  Changes    Path
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetException.jsp
  
  Index: checkGetException.jsp
  ===================================================================
  <html>
  <title>checkGetException</title>
  <body>
  <%
   /*
    Name : checkGetException
   */
  %> 
  
  
  <!-- checking for getException method -->
  
  <%= (pageContext.getException()) instanceof java.lang.Exception %>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetOut.jsp
  
  Index: checkGetOut.jsp
  ===================================================================
  <html>
  <title>checkGetOut</title>
  <body>
  <%
  /*
   Name : checkGetOut
  */
  %>
  <!-- checking for getOut method -->
  
  <%= (pageContext.getOut()) instanceof javax.servlet.jsp.JspWriter %>
  
  
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetRequest.jsp
  
  Index: checkGetRequest.jsp
  ===================================================================
  <html>
  <title>checkGetRequest</title>
  <body>
  <%
  /*
   Name : checkGetRequest
  */
  %>
  <!-- checking for getRequest method -->
  
  
  
  <%= pageContext.getRequest() instanceof javax.servlet.ServletRequest %>
  
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetResponse.jsp
  
  Index: checkGetResponse.jsp
  ===================================================================
  <html>
  <title>checkGetResponse</title>
  <body>
  <%
  /*
   Name : checkGetResponse
  */
  %>
  <!-- checking for getResponse method -->
  
  <%= (pageContext.getResponse()) instanceof javax.servlet.ServletResponse %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetServlet.jsp
  
  Index: checkGetServlet.jsp
  ===================================================================
  <html>
  <title>checkGetServlet</title>
  <body>
  <%
  /*
   Name : checkGetServlet
  */
  %>
  <!-- checking for getServlet method -->
  
  <%= (pageContext.getServlet()) instanceof javax.servlet.Servlet %>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetServletConfig.jsp
  
  Index: checkGetServletConfig.jsp
  ===================================================================
  <html>
  <title>checkGetServletConfig</title>
  <body>
  <%
  /*
   Name : checkGetServletConfig
  */
  %>
  <!-- checking for getServletConfig method -->
  
  <%= (pageContext.getServletConfig()) instanceof javax.servlet.ServletConfig %>
  
  </body>
  </html>
  
  
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetServletContext.jsp
  
  Index: checkGetServletContext.jsp
  ===================================================================
  <html>
  <title>checkGetServletContext</title>
  <body>
  <%
  /*
   Name : checkGetServletContext
  */
  %>
  <!-- checking for getServletContext method -->
  
  <%= (pageContext.getServletContext()) instanceof javax.servlet.ServletContext %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/checkGetSession.jsp
  
  Index: checkGetSession.jsp
  ===================================================================
  <html>
  <title>checkGetSession</title>
  <body>
  <%
  /*
   Name : checkGetSession
  */
  %>
  <!-- checking for getSession method -->
  
  <%=(pageContext.getSession()) instanceof javax.servlet.http.HttpSession %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/forGetException.jsp
  
  Index: forGetException.jsp
  ===================================================================
  <html>
  <title>forGetException</title>
  <body>
  <%
  /**
   Name : checkGetException
   Description : An exception is generated and the output is sent to an errorpage
   where the check for the getException() method is done.Here, it is checked for 
   the return type.
   Result : true
  **/
  %>
  <%@ page errorPage="checkGetException.jsp" %>
  <%
  int i=2;
  int j=0;
  int k=i/j;
  
  out.println(k);
  %>
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/forward.jsp
  
  Index: forward.jsp
  ===================================================================
  <html>
  <title>forward</title>
  <body>
  <%
  out.println("SUCCESS");
  %>
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/negativeForwardIllegalArg.jsp
  
  Index: negativeForwardIllegalArg.jsp
  ===================================================================
  <html>
  <title>negativeForwardIllegalArg</title>
  <body>
  <%
  /*
   Name : negativeForwardIllegalArg
   Description : Checking for the IllegalArgumentException.Here, the buffer is set to none and then the forward method is called with a mis argument, to generate this exception.
  */
  %>
  <%
  try{
      pageContext.forward("/tests/engine/PageContext/Missing.jsp");
     }catch(Exception e){
         out.println(e);
     }
  %>
  </body>
  </title>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/negativeForwardIllegalState.jsp
  
  Index: negativeForwardIllegalState.jsp
  ===================================================================
  <html>
  <title>negativeForwardIllegalState</title>
  <body>
  <%
  /*
   Name : negativeForwardIllegalState
   Description : Checking for the IllegalArgumentException.Here, the buffer is set to none
   and then the forward method is called , to generate this exception.
  */
  %>
  <%@ page buffer="none" %>
  <%
  try{
      pageContext.forward("/tests/engine/PageContext/forward.jsp");
     }catch(IllegalStateException e){
         out.println(e);
     }
  %>
  </body>
  </title>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/negativeInclude.jsp
  
  Index: negativeInclude.jsp
  ===================================================================
  <html>
  <title>negativeInclude</title>
  <body>
  <%
  /*
   Name : negativeInclude
  */
  %>
  <!-- this is to test if include() method works -->
  <!-- using pageContext object to include -->
  <!-- we trying call a non extisting file by include method, 
  should throw IOException -->
  <%
  try{
      pageContext.include("/tests/engine/PageContext/Back.jsp");
      }catch(Exception e){
      out.println(e);
      
  }
  %>
  
  
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/negativeRemoveAttribute.jsp
  
  Index: negativeRemoveAttribute.jsp
  ===================================================================
  <html>
  <title>negativeRemoveAttribute</title>
  <body>
  <%
  /*
   Name : negativeRemoveAttribute
   Description : Trying to remove an unavailable attribute.
   Expected to get null.
  */
  %>
  <!-- this is to test if removetAttribute() method works -->
  <!-- using pageContext object to setAttribute -->
  
  <% pageContext.setAttribute("Country","india"); %>
  
  <!-- using pageContext object to removeAttribute unavailable attruibute -->
  <% pageContext.removeAttribute("State"); %>
  
  <!-- Trying to access removed  attribute by getAttribute() method-->
  <% out.println(pageContext.getAttribute("State")); %>
  
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveForward.jsp
  
  Index: positiveForward.jsp
  ===================================================================
  <html>
  <title>positiveForward</title>
  <body>
  <%
  /*
   Name : positiveForward
   Description : Call the method forward() with the pageContext
   object, and pass a valid jsp page as an argument in
   the method.
  */
  %>
  <%
  try{
          pageContext.forward("forward.jsp");
  	return;
      }catch(Exception e){
          out.println(e);
      }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveGetAttributeAvbl.jsp
  
  Index: positiveGetAttributeAvbl.jsp
  ===================================================================
  <html>
  <title>positiveGetAttributeAvbl</title>
  <body>
  <%
  /*
   Name : positiveGetAttributeAvbl
   Description : Set an attribute(like useBean), 
   and then call the method getAttribute() to get it.
  */
  %>
  <jsp:useBean id="beans" class="engine.PageContext.TestBean" />
  <!-- calling the getAttribute method in a scriptlet -->
  <%
  try{
       Object o=pageContext.getAttribute("beans");
       out.println(o.getClass().getName());
   }catch(Exception e){
       out.println(e);
   }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveGetAttributeNamesInScope.jsp
  
  Index: positiveGetAttributeNamesInScope.jsp
  ===================================================================
  <html>
  <title>positiveGetAttributeNamesInScope</title>
  <body>
  <%
  /*
   Name : positiveGetAttributeNamesInScope
    */
  %>  
  
  
  <!-- declaring a bean in page scope -->
  
  <jsp:useBean id="mybean" scope="page" class="engine.PageContext.TestBean" />
  
  
  <!-- calling the getAttributeNamesInScope method in a scriptlet.Here we are checking for the 
  return type of the method.Then checking for the name of an object, bean in this case, in the 
  output.-->
  
  
  <%
  try{
      
      if((pageContext.getAttributeNamesInScope(pageContext.PAGE_SCOPE)) instanceof java.util.Enumeration)
       {
           java.util.Enumeration enm=pageContext.getAttributeNamesInScope(pageContext.PAGE_SCOPE);
           String s=" ";
           while(enm.hasMoreElements()) {
               Object o=enm.nextElement();
               s=s+(o.toString());
                         
           }
           
                int i=s.indexOf("mybean");
                if(i != -1){
                    out.println("SUCCESS");
                }else {
                    out.println("FAIL.Unable to identify the declared bean under page scope.");
                }
           
       }else{
           out.println("FAIL.The return type is not of type java.util.Enumeration");
       }
           
       
       
   }catch(Exception e){
       out.println(e);
   }
  %>
  
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveGetAttributeNotAvbl.jsp
  
  Index: positiveGetAttributeNotAvbl.jsp
  ===================================================================
  <html>
  <title>positiveGetAttributeNotAvbl</title>
  <body>
  <jsp:useBean id="beans" class="engine.PageContext.TestBean" />
  <!-- calling the getAttribute method in a scriptlet -->
  <%
  try{
       Object o=pageContext.getAttribute("rm");
       if(o == null)
         out.println("SUCCESS");
       else
         out.println("FAIL");
     }catch(Exception e){
         out.println(e);
     }
   
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveGetAttributeScope.jsp
  
  Index: positiveGetAttributeScope.jsp
  ===================================================================
  <html>
  <title>positiveGetAttributeScope</title>
  <body>
  <%
  /*
   Name : positiveGetAttributeScope
  */
  %>
  <!-- this is to test if getAttributeScope() method works -->
  <!-- using pageContext object to getAttributeScope -->
  <% pageContext.setAttribute("Country","india",1); %>
  <!-- using pageContext object to getAttribute, to obtain value of "Country"-->
  <% pageContext.getAttributesScope("Country"); %>
  <% out.println(pageContext.getAttributesScope("Country")); %>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveInclude.jsp
  
  Index: positiveInclude.jsp
  ===================================================================
  <html>
  <title>positiveInclude</title>
  <body>
  <%
  /*
   Name : positiveInclude
  */
  %>
  <!-- this is to test if include() method works -->
  <!-- using pageContext object to include -->
  <%
  try{
      pageContext.include("forward.jsp");
      }catch(Exception e){
      out.println(e);
  }
  %>
  
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positivePopBody.jsp
  
  Index: positivePopBody.jsp
  ===================================================================
  <html>
  <title>positivePopBody</title>
  <body>
  
  <%
  /*
       Name: positvePopBody
       Description:Call the pushBody() method which returns a
                   new BodyJspWriter object, saves the current "out" JspWriter,
                   and updates the value of the "out" attribute in the
                   page scope attribute namespace of the PageContext.Then call 
                   the popBody() which returns the previous JspWriter "out" saved
                   by the matching pushBody() and updates the value of the "out" 
                   attribute in the page scope attribute namespace of the PageConxtext
                   Invoke some method on the JspWriter object.
                   
        Result:    Should return the expected return type (depends on the method invoked).            
  */
  %>
  
  <%	
  	BodyContent bc = pageContext.pushBody();
  	JspWriter jw = pageContext.popBody();
  	jw.println("sun");
  %>
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positivePushBody.jsp
  
  Index: positivePushBody.jsp
  ===================================================================
  <html>
  <title>positivePushBody</title>
  <body>
  <%
  /*
         Name: positivePushBody
         Description:Call the pushBody() method which returns a
                   new BodyJspWriter object, saves the current "out" 
                   JspWriter,and updates the value of the "out" attribute 
                   in the page scope attribute namespace of the PageContext.
                   Print the contents of the BodyContent object using the "out"
                   object.
         Result:   Should print the contents of the BodyContent Object
         
  */
  %>                 
  
  
  
  <%	
  	BodyContent bc = pageContext.pushBody();
  	bc.println(".com");
  	out.println(bc.getString());
  %>
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveRemoveAttribute.jsp
  
  Index: positiveRemoveAttribute.jsp
  ===================================================================
  <html>
  <title>positiveRemoveAttribute</title>
  <body>
  <%
  /*
   Name : positiveRemoveAttribute
  */
  %>
  <!-- this is to test if removetAttribute() method works -->
  <!-- using pageContext object to setAttribute -->
  
  <% pageContext.setAttribute("Country","india"); %>
  
  <!-- using pageContext object to removeAttribute "Name" attruibute -->
  <% pageContext.removeAttribute("Country"); %>
  
  <!-- Trying to access removed "Name" attribute by getAttribute() method-->
  <% out.println(pageContext.getAttribute("Country")); %>
  
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveSetAttribute.jsp
  
  Index: positiveSetAttribute.jsp
  ===================================================================
  <html>
  <title>positiveSetAttribute</title>
  <body>
  <%
  /*
   Name : positiveSetAttribute
  */
  %>
  <!-- this is to test if setAttribute() method works -->
  <!-- using pageContext object to setAttribute -->
  <% pageContext.setAttribute("Country","india"); %>
  <!-- using pageContext object to getAttribute, to obtain value of "Country"-->
  <% pageContext.getAttribute("Country"); %>
  <% out.println(pageContext.getAttribute("Country")); %>
  
  </body>
  </html>
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/PageContext/positiveSetAttributeInScope.jsp
  
  Index: positiveSetAttributeInScope.jsp
  ===================================================================
  <html>
  <title>positiveSetAttributeInScope</title>
  <body>
  <%
  /*
   Name : positiveSetAttributeInScope
  */
  %>
  <!-- this is to test if setAttribute() method works -->
  <!-- using pageContext object to setAttribute -->
  <% pageContext.setAttribute("Country","india",1); %>
  <!-- using pageContext object to getAttributeScope, 
  to obtain value of "Country"-->
  <% pageContext.getAttributesScope("Country"); %>
  <% out.println(pageContext.getAttributesScope("Country")); %>
  </body>
  </html>