Re: svn commit: r1142187 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/corelib/mixins/ main/resources/org/apache/tapestry5/corelib/mi

2011-07-02 Thread Taha Hafeez
Hi Francois

I found a better way

Tapestry.Initializer.zoneRefresh = function(params)
{
   //  Ensure a valid period. Not required as PeriodicalUpdater already
takes care of it
   // but will will skip unnecessary steps
   if(params.period <= 0)
   {
  return;
   }

   // Function to be called for each refresh
   var keepUpdatingZone = function(e)
   {
  var zoneObject = Tapestry.findZoneManagerForZone($(params.id));
  Tapestry.purgeChildren($(params.id));

  if (!zoneObject)
 return;

  zoneObject.updateFromURL(params.URL);
  e.stop();
   };

   // Create and store the executor
   timer = new PeriodicalExecuter(keepUpdatingZone, params.period);
};

Will send you the full patch with new tests. Thanks for your patience

regards
Taha


2011/7/3 françois facon 

> Thank you Taha,
>
> I would be fine to check the current state of the client pool of ajax
> connections.
> But I'am afraid the condition depend on the way Prototype manage his pool.
> I guess it will failed when T5.ajax (TAP5-999) will be ready to call.
> Gasp!
>
>
> 2011/7/2 Taha Hafeez :
> > Hi Francois
> > I googled about waitFor... methods and found
> > this http://agilesoftwaretesting.com/?p=111
> > The waitFor methods get messed up as the page that three zones which were
> > refreshing. So, I created two separate tests
> > also i replaced the checkZoneValues() method to
> >private void checkZoneValues(String zone, int times) throws Exception
> >{
> >   for(int i = 1; i <= times; ++i)
> >   {
> >  //Wait for ajax call to begin
> >
> >
>  
> waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> > != 0", "2");
> >
> >  //Wait for ajax call from end
> >
> >
>  
> waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> > == 0", "2");
> >
> >  //Check the value changed
> >  assertText(zone, String.valueOf(i));
> >   }
> >}
> > It first waits for a ajax call to begin and then waits for it to end and
> > then checks the value. So it will be good enough for even a slow server
> (20
> > seconds wait)
> > Thanks Igor for pointing it out and very very thanks Francois for adding
> > this patch
> > regards
> > Taha
> >
> > 2011/7/2 françois facon 
> >>
> >> Thanks for your advise Igor.
> >> I will change that test.
> >> Regards
> >> François
> >>
> >> 2011/7/2 Igor Drobiazko :
> >> > It's highly likely that this wait condition will break the build once
> >> > the
> >> > build machine is busy. You should make use of Selenium's wait
> >> > conditions.
> >> > Check out the wait methods like waitForElementToAppear, etc.
> >> >
> >> > On Sat, Jul 2, 2011 at 12:14 PM,  wrote:
> >> >>
> >> >> +
> >> >> +
> >> >> +   private void checkZoneValues(String zone, int times) throws
> >> >> Exception
> >> >> +   {
> >> >> +  Thread.sleep(300);
> >> >> +  for(int i = 0; i < times; ++i)
> >> >> +  {
> >> >> + assertText(zone, String.valueOf(i));
> >> >> + Thread.sleep(1000);
> >> >> +  }
> >> >> +   }
> >> >> +
> >> >> +}
> >> >
> >> >
> >> >
> >> > --
> >> > Best regards,
> >> >
> >> > Igor Drobiazko
> >> > http://tapestry5.de
> >> >
> >>
> >> -
> >> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> >> For additional commands, e-mail: dev-h...@tapestry.apache.org
> >>
> >
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: dev-h...@tapestry.apache.org
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: dev-h...@tapestry.apache.org
>
>


Re: svn commit: r1142187 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/corelib/mixins/ main/resources/org/apache/tapestry5/corelib/mi

2011-07-02 Thread françois facon
Thank you Taha,

I would be fine to check the current state of the client pool of ajax
connections.
But I'am afraid the condition depend on the way Prototype manage his pool.
I guess it will failed when T5.ajax (TAP5-999) will be ready to call.
Gasp!


2011/7/2 Taha Hafeez :
> Hi Francois
> I googled about waitFor... methods and found
> this http://agilesoftwaretesting.com/?p=111
> The waitFor methods get messed up as the page that three zones which were
> refreshing. So, I created two separate tests
> also i replaced the checkZoneValues() method to
>    private void checkZoneValues(String zone, int times) throws Exception
>    {
>       for(int i = 1; i <= times; ++i)
>       {
>          //Wait for ajax call to begin
>
>  waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> != 0", "2");
>
>          //Wait for ajax call from end
>
>  waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
> == 0", "2");
>
>          //Check the value changed
>          assertText(zone, String.valueOf(i));
>       }
>    }
> It first waits for a ajax call to begin and then waits for it to end and
> then checks the value. So it will be good enough for even a slow server (20
> seconds wait)
> Thanks Igor for pointing it out and very very thanks Francois for adding
> this patch
> regards
> Taha
>
> 2011/7/2 françois facon 
>>
>> Thanks for your advise Igor.
>> I will change that test.
>> Regards
>> François
>>
>> 2011/7/2 Igor Drobiazko :
>> > It's highly likely that this wait condition will break the build once
>> > the
>> > build machine is busy. You should make use of Selenium's wait
>> > conditions.
>> > Check out the wait methods like waitForElementToAppear, etc.
>> >
>> > On Sat, Jul 2, 2011 at 12:14 PM,  wrote:
>> >>
>> >> +
>> >> +
>> >> +   private void checkZoneValues(String zone, int times) throws
>> >> Exception
>> >> +   {
>> >> +      Thread.sleep(300);
>> >> +      for(int i = 0; i < times; ++i)
>> >> +      {
>> >> +         assertText(zone, String.valueOf(i));
>> >> +         Thread.sleep(1000);
>> >> +      }
>> >> +   }
>> >> +
>> >> +}
>> >
>> >
>> >
>> > --
>> > Best regards,
>> >
>> > Igor Drobiazko
>> > http://tapestry5.de
>> >
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: dev-h...@tapestry.apache.org
>>
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: dev-h...@tapestry.apache.org
>

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: svn commit: r1142187 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/corelib/mixins/ main/resources/org/apache/tapestry5/corelib/mi

2011-07-02 Thread Taha Hafeez
Hi Francois

I googled about waitFor... methods and found this
http://agilesoftwaretesting.com/?p=111

The waitFor methods get messed up as the page that three zones which were
refreshing. So, I created two separate tests

also i replaced the checkZoneValues() method to

   private void checkZoneValues(String zone, int times) throws Exception
   {
  for(int i = 1; i <= times; ++i)
  {
 //Wait for ajax call to begin

 
waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
!= 0", "2");

 //Wait for ajax call from end

 
waitForCondition("selenium.browserbot.getCurrentWindow().Ajax.activeRequestCount
== 0", "2");

 //Check the value changed
 assertText(zone, String.valueOf(i));
  }
   }

It first waits for a ajax call to begin and then waits for it to end and
then checks the value. So it will be good enough for even a slow server (20
seconds wait)

Thanks Igor for pointing it out and very very thanks Francois for adding
this patch

regards
Taha


2011/7/2 françois facon 

> Thanks for your advise Igor.
> I will change that test.
> Regards
> François
>
> 2011/7/2 Igor Drobiazko :
> > It's highly likely that this wait condition will break the build once the
> > build machine is busy. You should make use of Selenium's wait conditions.
> > Check out the wait methods like waitForElementToAppear, etc.
> >
> > On Sat, Jul 2, 2011 at 12:14 PM,  wrote:
> >>
> >> +
> >> +
> >> +   private void checkZoneValues(String zone, int times) throws
> Exception
> >> +   {
> >> +  Thread.sleep(300);
> >> +  for(int i = 0; i < times; ++i)
> >> +  {
> >> + assertText(zone, String.valueOf(i));
> >> + Thread.sleep(1000);
> >> +  }
> >> +   }
> >> +
> >> +}
> >
> >
> >
> > --
> > Best regards,
> >
> > Igor Drobiazko
> > http://tapestry5.de
> >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: dev-h...@tapestry.apache.org
>
>
Index: src/test/app1/ZoneRefreshWithHandlerReturningVoid.tml
===
--- src/test/app1/ZoneRefreshWithHandlerReturningVoid.tml	(revision 1142235)
+++ src/test/app1/ZoneRefreshWithHandlerReturningVoid.tml	(working copy)
@@ -1,20 +1,12 @@
 


-
+   

-  Counter 1:
-  
+  Using zone with event handler returning void : 
+  
  ${counter}
   
-
-  
-  Counter 2 :
-  ${counter2}
-  
-  Counter 3 :
-  ${counter3}
-  and
-  ${counter3}

+   
 
\ No newline at end of file
Index: src/test/app1/ZoneRefreshWithHandlerReturningZone.tml
===
--- src/test/app1/ZoneRefreshWithHandlerReturningZone.tml	(revision 0)
+++ src/test/app1/ZoneRefreshWithHandlerReturningZone.tml	(revision 0)
@@ -0,0 +1,15 @@
+
+   
+   
+
+   
+  Using zone with event handler returning zone :
+  
+ ${counter}
+  
+  
+  
+ and another zone ${counter}
+  
+   
+
\ No newline at end of file
Index: src/test/app1/Index.tml
===
--- src/test/app1/Index.tml	(revision 1142235)
+++ src/test/app1/Index.tml	(working copy)
@@ -130,9 +130,13 @@
   -- error reporting for adding a duplicate mixin to a component
 
 
-   Zone Refresh Demo
-   -- refreshes zone after 5 seconds
+   Zone Refresh With Event Handler Returning Void
+   -- refreshes zone with an event handler returning void
 
+
+   Zone Refresh With Event Handler Returning Zone
+   -- refreshes zone with an event handler returning zone
+
 
   Unsupported Parameter Block Demo
   -- informal block parameter to a component that does not support informal parameters
Index: src/test/app1/ZoneRefreshDemo.tml
===
--- src/test/app1/ZoneRefreshDemo.tml	(revision 1142235)
+++ src/test/app1/ZoneRefreshDemo.tml	(working copy)
@@ -1,20 +0,0 @@
-
-   
-   
-
-   
-  Counter 1:
-  
- ${counter}
-  
-
-  
-  Counter 2 :
-  ${counter2}
-  
-  Counter 3 :
-  ${counter3}
-  and
-  ${counter3}
-   
-
\ No newline at end of file
Index: src/test/java/org/apache/tapestry5/integration/app1/pages/CopyOfZoneRefreshWithHandlerReturningVoid.java
===
--- src/test/java/org/apache/tapestry5/integration/app1/pages/CopyOfZoneRefreshWithHandlerReturningVoid.java	(revision 0)
+++ src/test/java/org/apache/tapestry5/integration/app1/pages/CopyOfZoneRefreshWithHandlerReturningVoid.java	(revision 0)
@@ -0,0 +1,46 @@
+// Copyright 2011 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance wi

Re: svn commit: r1142187 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/corelib/mixins/ main/resources/org/apache/tapestry5/corelib/mi

2011-07-02 Thread françois facon
Thanks for your advise Igor.
I will change that test.
Regards
François

2011/7/2 Igor Drobiazko :
> It's highly likely that this wait condition will break the build once the
> build machine is busy. You should make use of Selenium's wait conditions.
> Check out the wait methods like waitForElementToAppear, etc.
>
> On Sat, Jul 2, 2011 at 12:14 PM,  wrote:
>>
>> +
>> +
>> +   private void checkZoneValues(String zone, int times) throws Exception
>> +   {
>> +      Thread.sleep(300);
>> +      for(int i = 0; i < times; ++i)
>> +      {
>> +         assertText(zone, String.valueOf(i));
>> +         Thread.sleep(1000);
>> +      }
>> +   }
>> +
>> +}
>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
>

-
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org



Re: svn commit: r1142187 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/corelib/mixins/ main/resources/org/apache/tapestry5/corelib/mi

2011-07-02 Thread Igor Drobiazko
It's highly likely that this wait condition will break the build once the
build machine is busy. You should make use of Selenium's wait conditions.
Check out the wait methods like waitForElementToAppear, etc.

On Sat, Jul 2, 2011 at 12:14 PM,  wrote:
>
> +
> +
> +   private void checkZoneValues(String zone, int times) throws Exception
> +   {
> +  Thread.sleep(300);
> +  for(int i = 0; i < times; ++i)
> +  {
> + assertText(zone, String.valueOf(i));
> + Thread.sleep(1000);
> +  }
> +   }
> +
> +}



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de