sebb        2005/03/12 07:30:41

  Modified:    src/core/org/apache/jmeter/control Tag: rel-2_0
                        WhileController.java
  Log:
  Add tests for Bug 33954, but disable the one that fails
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.7   +40 -2     
jakarta-jmeter/src/core/org/apache/jmeter/control/WhileController.java
  
  Index: WhileController.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/control/WhileController.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- WhileController.java      11 Mar 2005 00:00:23 -0000      1.1.2.6
  +++ WhileController.java      12 Mar 2005 15:30:41 -0000      1.1.2.7
  @@ -280,5 +280,43 @@
                        assertNull(nextName(controller));
           }
   
  +             // Tests for Stack Overflow (bug 33954)
  +             public void testAlwaysFailOK() throws Exception
  +         {
  +                     runTestAlwaysFail(true); // Should be OK
  +         }
  +             
  +             // TODO - re-enable when fix found
  +             public void disabletestAlwaysFailBAD() throws Exception
  +         {
  +                     runTestAlwaysFail(false); // Currently fails
  +         }
  +             
  +             public void runTestAlwaysFail(boolean other)
  +             {
  +                     testMode=true;
  +                     testModeResult=false;
  +            LoopController controller = new LoopController();
  +                     controller.setContinueForever(true);
  +                     controller.setLoops(-1);
  +            WhileController while_cont = new WhileController();
  +                     while_cont.setCondition("false");
  +            while_cont.addTestElement(new TestSampler("one"));
  +            while_cont.addTestElement(new TestSampler("two"));
  +            controller.addTestElement(while_cont);                   
  +            if (other) controller.addTestElement(new TestSampler("three"));
  +            controller.initialize();
  +                     try {
  +                             if (other){
  +                         assertEquals("three",nextName(controller));
  +                             } else {
  +                                     assertNull(nextName(controller));
  +                             }
  +                     } catch (StackOverflowError e){
  +                             //e.printStackTrace();
  +                             fail(e.toString());
  +                     }
  +        }
  +
      }
   }
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to