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 rl...@apache.org on 2002/01/29 00:42:25 UTC

cvs commit: jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean ScopeResult.jsp errorPage.jsp negativeClassCastException.jsp negativeClassCastExceptionFwd.jsp negativeDuplicateIDFatalTranslationError.jsp negativeNotFoundAbstractInstantiationException.jsp negativeNotFoundInterfaceInstantiationException.jsp negativeNotFoundNoArgConstructorInstantiationException.jsp negativeNotFoundTypeInstantiationException.jsp negativeSessionScopeFatalTranslationError.jsp positiveApplicationScopedObject.jsp positiveBeanNameSerialized.jsp positiveBeanNameType.jsp positiveBeanNameTypeCast.jsp positiveBodyNew.jsp positiveClassTypeCast.jsp positiveNoBody.jsp positivePageScopedObject.jsp positiveRequestScopedObject.jsp positiveSessionScopedObject.jsp

rlubke      02/01/28 15:42:25

  Added:       src/server/jsp-tests/jsp/core_syntax/actions/useBean
                        ScopeResult.jsp errorPage.jsp
                        negativeClassCastException.jsp
                        negativeClassCastExceptionFwd.jsp
                        negativeDuplicateIDFatalTranslationError.jsp
                        negativeNotFoundAbstractInstantiationException.jsp
                        negativeNotFoundInterfaceInstantiationException.jsp
                        negativeNotFoundNoArgConstructorInstantiationException.jsp
                        negativeNotFoundTypeInstantiationException.jsp
                        negativeSessionScopeFatalTranslationError.jsp
                        positiveApplicationScopedObject.jsp
                        positiveBeanNameSerialized.jsp
                        positiveBeanNameType.jsp
                        positiveBeanNameTypeCast.jsp positiveBodyNew.jsp
                        positiveClassTypeCast.jsp positiveNoBody.jsp
                        positivePageScopedObject.jsp
                        positiveRequestScopedObject.jsp
                        positiveSessionScopedObject.jsp
  Log:
   - reorg of useBean including new/modifed tests.
  
  Revision  Changes    Path
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/ScopeResult.jsp
  
  Index: ScopeResult.jsp
  ===================================================================
  <%@ page contentType="text/plain;charset=ISO-8859-1" %>
  <%--
      Simple JSP to valid scoped objects created with jsp:useBean
  --%>
  
  <%! 
       public void sendPass( HttpServletResponse resp ) {
          resp.addHeader( "status", "Test Status=PASSED" );
          return;
      }
  %>
  
  <%!
      public void sendFail( HttpServletResponse resp, String msg ) {
          resp.addHeader( "status", "Test Status=FAILED - " + msg );
          return;
      }
  %>
  
  <%
      String _scope = request.getParameter( "scope" );
      String _objId = request.getParameter( "objId" );
     
  
      if ( _scope.equals( "application" ) ) {
          if ( ( application.getAttribute( _objId ) ) != null ) {
              sendPass( response );
          } else {
              sendFail( response, "Application scoped object not found in ServletContext" );
          }
      }
  
      if ( _scope.equals( "session" ) ) {
          if ( ( session.getAttribute( _objId ) ) != null ) {
              sendPass( response );
          } else {
              sendFail( response, "Session scoped object not found in HttpSession" );
          }
      }
  
      if ( _scope.equals( "request" ) ) {
          if ( ( request.getAttribute( _objId ) ) != null ) {
              sendPass( response );
          } else {
              sendFail( response, "Request scoped object not found in HttpServletResponse" );
          }
      }
  
      if ( _scope.equals( "page" ) ) {
          if ( ( pageContext.getAttribute( _objId ) ) == null ) {
              sendPass( response );
          } else {
              sendFail( response, "Page scoped object found in current page and should not be" );
          }
      }
  %>
  
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/errorPage.jsp
  
  Index: errorPage.jsp
  ===================================================================
  <html>
  <title>errorPage</title>
  <body>
  <!-- Declaring the bean with out body -->
  <%@ page isErrorPage="true" %>
  <%
   out.println("errorPage");
  %>
  </body>
  </html> 
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeClassCastException.jsp
  
  Index: negativeClassCastException.jsp
  ===================================================================
  <html>
  <title>negativeClassCastException</title>
  <body>
  <% /** 	Name : negativeClassCastException
  	Description : Using a bean of a particular type declared with
                    session scope from another page, attempt to verify
                    that a ClassCastException is thrown if the bean
                    on this page specifies a conflicting type.
  	Result : Catch the ClassCastException and print a message.
  **/ %>
  <% try { %>
  <jsp:useBean id="ncounter" type="core_syntax.actions.useBean.NewCounter" scope="session" />
  <% } catch ( java.lang.ClassCastException cce ) {
      out.println( "ClassCastException successfully caught.\nTest status: PASS" );
     }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeClassCastExceptionFwd.jsp
  
  Index: negativeClassCastExceptionFwd.jsp
  ===================================================================
  <html>
  <title>negativeClassCastExceptionFwd</title>
  <body>
  <% /** 	Name : negativeClassCastFwd
          Description: Declare a bean with session scope
                       and then forward the request to another
                       page.
  	    Result : None.  The interesting stuff will occur in the 
                   negativeClassCastException.jsp page.
  **/ %>
  <jsp:useBean id="ncounter"  class="core_syntax.actions.useBean.Counter" scope="session" />
  <jsp:forward page="negativeClassCastException.jsp" />
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeDuplicateIDFatalTranslationError.jsp
  
  Index: negativeDuplicateIDFatalTranslationError.jsp
  ===================================================================
  <html>
  <title>negativeDuplicateIDFatalTranslation</title>
  <body>
  <% /** 	Name : negativeDuplicateIDFatalTranslation
  	Description : Verify that duplicate useBean id's
                    within the same translation unit yeild
                    a fatal translation error.
  	Result : Fatal translation error
  **/ %>
  <!-- Declare two beans with the same id -->
  <jsp:useBean id="myBean" scope="page" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:useBean id="myBean" scope="page" class="core_syntax.actions.useBean.String_IntBean" />
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeNotFoundAbstractInstantiationException.jsp
  
  Index: negativeNotFoundAbstractInstantiationException.jsp
  ===================================================================
  <html>
  <title>negativeNotFoundAbstractInstantiationException</title>
  <body>
  <% /** 	Name : negativeNotFoundAbstractInstantiationException
  	Description : Declare a bean (no other object will be
                    found in scope) with no beanName or type 
                    attributes, and the class attribute references
                    an abstract object.  Since the object
                    doesn't already exist, useBean will try to
                    create an instance and an InstantiationException
                    will occur.
  	Result : Catch the InstantiationException and print a message.
  **/ %>
  <% try { %>
  <jsp:useBean id="abstractBean" class="core_syntax.actions.useBean.AbstractBean" scope="page" />
  <% } catch ( InstantiationException ie ) {
      out.println( "InstantiationException successfully caught.\nTest status: PASS" );
     }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeNotFoundInterfaceInstantiationException.jsp
  
  Index: negativeNotFoundInterfaceInstantiationException.jsp
  ===================================================================
  <html>
  <title>negativeNotFoundInterfaceInstantiationException</title>
  <body>
  <% /** 	Name : negativeNotFoundInterfaceInstantiationException
  	Description : Declare a bean (no other object will be
                    found in scope) with no beanName or type
                    attributes, and the class attribute references
                    an interface.  Since the object
                    doesn't already exist, useBean will try to
                    create an instance and an InstantiationException
                    will occur.
  	Result : Catch the InstantiationException and print a message.
  **/ %>
  <% try { %>
  <jsp:useBean id="interfaceBean" class="core_syntax.actions.useBean.InterfaceBean" scope="page" />
  <% } catch ( java.lang.InstantiationException ie ) {
      out.println( "InstantiationException successfully caught.\nTest status: PASS" );
     }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeNotFoundNoArgConstructorInstantiationException.jsp
  
  Index: negativeNotFoundNoArgConstructorInstantiationException.jsp
  ===================================================================
  <html>
  <title>negativeNotFoundNoArgConstructorInstantiationException</title>
  <body>
  <% /** 	Name : negativeNotFoundNoArgConstructorInstantiationException
  	Description : Declare a bean (no other object will be
                    found in scope) with no beanName or type
                    attributes, and the class attribute references
                    an object that has no no-arg constructor. 
                    Since the object doesn't already exist, 
                    useBean will try create an instance and
                    an InstantiationException will occur.
  	Result : Catch the InstantiationException and print a message.
  **/ %>
  <% try { %>
  <jsp:useBean id="noarg" class="core_syntax.actions.useBean.OneArgConstructorBean" scope="page" />
  <% } catch ( java.lang.InstantiationException ie ) {
      out.println( "InstantiationException successfully caught.\nTest status: PASS" );
     }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeNotFoundTypeInstantiationException.jsp
  
  Index: negativeNotFoundTypeInstantiationException.jsp
  ===================================================================
  <html>
  <title>negativeNotFoundTypeInstantiationException</title>
  <body>
  <% /** 	Name : negativeNotFoundTypeInstantiationException
  	Description : Declare a bean (no other object will be
                    found in scope) with no beanName or class
                    attributes, only type.  Since the object
                    doesn't already exist, an InstantiationException
                    will occur.
  	Result : Catch the InstantiationException and print a message.
  **/ %>
  <% try { %>
  <jsp:useBean id="ncounter" type="core_syntax.actions.useBean.NewCounter" scope="session" />
  <% } catch ( java.lang.InstantiationException ie ) {
      out.println( "InstantiationException successfully caught.\nTest status: PASS" );
     }
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/negativeSessionScopeFatalTranslationError.jsp
  
  Index: negativeSessionScopeFatalTranslationError.jsp
  ===================================================================
  <%@ page session="false" %>
  <html>
  <title>negativeSessionScopeFatalTranslationError</title>
  <body>
  <% /** 	Name : negativeSessionScopeFatalTranslationError
  	Description : Declare a bean with scope set to session,
                    and configure the page so that it doesn't
                    participate in a session.  This should 
                    cause a fatal translation error.
  	Result : Fatal translation error
  **/ %>
  <!-- Declaring the bean with beanName as a class -->
  <jsp:useBean id="myBean" scope="session"
      class="core_syntax.actions.useBean.NewCounter" />
  <%
   out.println(myBean.getCount());
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveApplicationScopedObject.jsp
  
  Index: positiveApplicationScopedObject.jsp
  ===================================================================
  <html>
  <title>positiveApplicationScopedObject</title>
  <body>
  <jsp:useBean id="myBean" scope="application" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:forward page="/jsp/core_syntax/actions/useBean/ScopeResult.jsp">
      <jsp:param name="scope" value="application"/>
      <jsp:param name="objId" value="myBean"/>
  </jsp:forward>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveBeanNameSerialized.jsp
  
  Index: positiveBeanNameSerialized.jsp
  ===================================================================
  <html>
  <title>positiveBeanNameSerialized</title>
  <body>
  <% /** 	Name : positiveBeanNameRes
  	Description : Declaring the bean using beanName.  
      When using beanName, the bean can either be a serialized
      Object, or a fully qualified class.  When the class is loaded,
      it is cast to the type specified by the "type" attribute.  
      This test uses a fully qualfied class.
  	Result :We should get page output without error
  **/ %>
  <!-- Declaring the bean with beanName as a serialized bean instance -->
  <jsp:useBean id="myBean" scope="request" beanName="Counter" type="core_syntax.actions.useBean.Counter"/>
  <%
      out.println( myBean.getCount() );
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveBeanNameType.jsp
  
  Index: positiveBeanNameType.jsp
  ===================================================================
  <html>
  <title>positiveBeanNameType</title>
  <body>
  <% /** 	Name : positiveBeanNameType
  	Description : Declaring the bean using beanName.  
      When using beanName, the bean can either be a serialized
      Object, or a fully qualified class. 
      This test uses a fully qualfied class with the same type.
  	Result :We should get page output without error
  **/ %>
  <!-- Declaring the bean with beanName as a class -->
  <jsp:useBean id="myBean" scope="request"
  class="core_syntax.actions.useBean.NewCounter" 
  type="core_syntax.actions.useBean.NewCounter" />
  <!-- accessing the bean thru a scriptlet -->
  <%
   out.println(myBean.getCount());
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveBeanNameTypeCast.jsp
  
  Index: positiveBeanNameTypeCast.jsp
  ===================================================================
  <html>
  <title>positiveBeanNameTypeCast</title>
  <body>
  <% /** 	Name : positiveBeanNameTypeCast
  	Description : Declaring the bean using beanName.  
      When using beanName, the bean can either be a serialized
      Object, or a fully qualified class.  When the class is loaded,
      it is cast to the type specified by the "type" attribute.  
      This test uses a fully qualfied class.
  	Result :We should get page output without error
  **/ %>
  <!-- Declaring the bean with beanName as a class -->
  <jsp:useBean id="myBean" scope="request"
  beanName="core_syntax.actions.useBean.NewCounter"
  type="core_syntax.actions.useBean.Counter" />
  <!-- accessing the bean thru a scriptlet -->
  <%
   out.println(myBean.getCount());
  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveBodyNew.jsp
  
  Index: positiveBodyNew.jsp
  ===================================================================
  <html>
  <title>positiveBodyNew</title>
  <body>
  <% /** 	Name : positiveBodyNew
  	Description : Try to create a valid useBean tag in the JSP page with a
                        non-empty body. Ensure that the classname specified
                        does not exist.
  	Result :Should return the contents of the HTML page along with what
                  exists in the body.
  **/ %>
  <!-- Declaring the bean with body -->
  <jsp:useBean id="myBean" scope="request" class="core_syntax.actions.useBean.String_IntBean" >
  <jsp:setProperty name="myBean" property="name" value="APPLE" />
  
  <jsp:getProperty name="myBean" property="name" />
  </jsp:useBean>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveClassTypeCast.jsp
  
  Index: positiveClassTypeCast.jsp
  ===================================================================
  <html>
  <title>positiveClassTypeCast</title>
  <body>
  <% /** 	Name : positiveClassTypeCast
  	Description : we are using 'class' and 'type' together and 'class' 
  		      is assignable to 'type'. 
  	Result :we should get the expected page without an error
  **/ %>
  <!-- we are using 'class' and 'type' together and 'class' is assignable to type-->
  <jsp:useBean id="ncounter"  class="core_syntax.actions.useBean.NewCounter"
  type="core_syntax.actions.useBean.Counter" />
  <% out.println( ncounter.getCount());  %>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveNoBody.jsp
  
  Index: positiveNoBody.jsp
  ===================================================================
  <html>
  <title>positiveNoBody</title>
  <body>
  <% /** 	Name : positiveNoBody
  	Description : Create a new instance of a bean with no body.
                    Access the name property.
  	Result : Returns the default instance value of the name property: hello.
  **/ %>
  <!-- Declaring the bean with out body -->
  <jsp:useBean id="myBean" scope="request" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:getProperty name="myBean" property="name" />
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positivePageScopedObject.jsp
  
  Index: positivePageScopedObject.jsp
  ===================================================================
  <html>
  <title>positivePageScopedObject</title>
  <body>
  <jsp:useBean id="myBean" scope="page" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:forward page="/jsp/core_syntax/actions/useBean/ScopeResult.jsp">
      <jsp:param name="scope" value="page"/>
      <jsp:param name="objId" value="myBean"/>
  </jsp:forward>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveRequestScopedObject.jsp
  
  Index: positiveRequestScopedObject.jsp
  ===================================================================
  <html>
  <title>positiveRequestScopedObject</title>
  <body>
  <jsp:useBean id="myBean" scope="request" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:forward page="/jsp/core_syntax/actions/useBean/ScopeResult.jsp">
      <jsp:param name="scope" value="request"/>
      <jsp:param name="objId" value="myBean"/>
  </jsp:forward>
  </body>
  </html>
  
  
  
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/jsp/core_syntax/actions/useBean/positiveSessionScopedObject.jsp
  
  Index: positiveSessionScopedObject.jsp
  ===================================================================
  <html>
  <title>positiveSessionScopedObject</title>
  <body>
  <jsp:useBean id="myBean" scope="session" class="core_syntax.actions.useBean.String_IntBean" />
  <jsp:forward page="/jsp/core_syntax/actions/useBean/ScopeResult.jsp">
      <jsp:param name="scope" value="session"/>
      <jsp:param name="objId" value="myBean"/>
  </jsp:forward>
  </body>
  </html>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>