craigmcc    01/06/23 17:08:25

  Modified:    tester/src/tester/org/apache/tester Context02.java
  Log:
  Check attribute lifecycle on the beans stored by Context00 and
  ContextListener01 as well.
  
  Revision  Changes    Path
  1.2       +37 -1     
jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Context02.java
  
  Index: Context02.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Context02.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Context02.java    2001/06/23 19:27:24     1.1
  +++ Context02.java    2001/06/24 00:08:24     1.2
  @@ -74,7 +74,7 @@
    * be cleaned up during a restart.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/06/23 19:27:24 $
  + * @version $Revision: 1.2 $ $Date: 2001/06/24 00:08:24 $
    */
   
   public class Context02 extends HttpServlet {
  @@ -114,6 +114,42 @@
                       writer.println("Context02 FAILED - context00 value " +
                                      value);
                       ok = false;
  +                } else {
  +                    String lifecycle = ((ContextBean) bean).getLifecycle();
  +                    if (!"/add".equals(lifecycle)) {
  +                        writer.println("Context02 FAILED -" +
  +                                       " context00 lifecycle " +
  +                                       lifecycle);
  +                        ok = false;
  +                    }
  +                }
  +            }
  +        }
  +
  +        // Check for the attribute from ContextListener01
  +        if (ok) {
  +            Object bean = context.getAttribute("contextListener01");
  +            if (bean == null) {
  +                writer.println("Context02 FAILED - contextListener01 missing");
  +                ok = false;
  +            } else if (!(bean instanceof ContextBean)) {
  +                writer.println("Context02 FAILED - contextListener01 class " +
  +                               bean.getClass().getName());
  +                ok = false;
  +            } else {
  +                String value = ((ContextBean) bean).getStringProperty();
  +                if (!"ContextListener01".equals(value)) {
  +                    writer.println("Context02 FAILED - contextListener01 " +
  +                                   "value " + value);
  +                    ok = false;
  +                } else {
  +                    String lifecycle = ((ContextBean) bean).getLifecycle();
  +                    if (!"/add".equals(lifecycle)) {
  +                        writer.println("Context02 FAILED -" +
  +                                       " contextListener01 lifecycle " +
  +                                       lifecycle);
  +                        ok = false;
  +                    }
                   }
               }
           }
  
  
  

Reply via email to