RE: 60% waste

2009-05-12 Thread Douglas Ferguson
I thought that selenium recorded your browser activity and referenced ids to 
replay that activity.
Are you editing the generated scripts to use names instead or is that a setting 
in selenium?

Also, I just ran across this. Is anybody using it this? Also it mentions 
selenium at the end.. 
http://www.laughingpanda.org/~inhuman/wicket-bench/docs/features-0.5.html


-Original Message-
From: Marko Sibakov [mailto:marko.siba...@ri.fi] 
Sent: Monday, May 11, 2009 11:22 AM
To: users@wicket.apache.org
Subject: Re: 60% waste

Martin Grigorov wrote:
 I'm using quite successfully WebDriver (a.k.a. Selenium 2).
   
We have also used WebDriver in our current project and i am quite satisfied 
with the results.
I have also written with my colleagues a small framework that makes easier to 
integrate webdriver to wicket with bdd way. If someone is interested, plz check 
this = http://www.jdave.org/bdd-wicket/

MSi

 El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
   
 On a side note, does Selenium even work with wicket?

 Douglas

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Monday, May 11, 2009 12:13 AM
 To: users@wicket.apache.org
 Subject: Re: 60% waste

 unit testing is about testing small isolated bits of functionality in 
 isolation

 lets say that you want to test foo(p) { return a(b(c(p))); }

 what martin is trying to do is to test that foo(q) yields the desired 
 value w, what he should do instead is

 test a() in isolation to make sure it works test b() in isolation to 
 make sure it works test c() in isolation to make sure it works test 
 that foo() calls a,b,c.

 if all small tests above pass you are guaranteed that foo() works.

 -igor

 On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
 
 Ben Tilford wrote:
   
 Have you looked at selenium? Your not really unit testing here.

 
 Hi Ben,

 What do you mean Your not really unit testing here. ?

 MSi
   
 On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:


 
 Like Martijn said i also strongly recommend to take a look at the 
 jdave-wicket's selectors (http://www.jdave.org/).

 examples =

 http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test
 /jdave/wicket/PageWithItemsSpec.java


 with form tester it goes like this =

  form = wicket.newFormTester(selectFirst(Form.class,
 form).from(panel).getPageRelativePath());
  form.setValue(name, wicket);
  form.setValue(address, jdave);
  form.submit();

 MSi

 Martijn Dashorst wrote:


   
 See jdave-wicket for better test support. Slated to come to you 
 in Wicket
 1.5

 Martijn

 On Fri, May 8, 2009 at 5:48 PM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:



 
 Hi!

 I use TDD: I spend 60% of my time type-checking and 
 path-checking my wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate 
 to get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into 
 component hierarchies?

 Can this be done?

 **
 Martin

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





   


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


   
 


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

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


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


 


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

   




RE: 60% waste

2009-05-11 Thread Douglas Ferguson
On a side note, does Selenium even work with wicket?

Douglas

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Monday, May 11, 2009 12:13 AM
To: users@wicket.apache.org
Subject: Re: 60% waste

unit testing is about testing small isolated bits of functionality in isolation

lets say that you want to test foo(p) { return a(b(c(p))); }

what martin is trying to do is to test that foo(q) yields the desired
value w, what he should do instead is

test a() in isolation to make sure it works
test b() in isolation to make sure it works
test c() in isolation to make sure it works
test that foo() calls a,b,c.

if all small tests above pass you are guaranteed that foo() works.

-igor

On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
 Ben Tilford wrote:

 Have you looked at selenium? Your not really unit testing here.


 Hi Ben,

 What do you mean Your not really unit testing here. ?

 MSi

 On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:



 Like Martijn said i also strongly recommend to take a look at the
 jdave-wicket's selectors (http://www.jdave.org/).

 examples =

 http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java


 with form tester it goes like this =

          form = wicket.newFormTester(selectFirst(Form.class,
 form).from(panel).getPageRelativePath());
          form.setValue(name, wicket);
          form.setValue(address, jdave);
          form.submit();

 MSi

 Martijn Dashorst wrote:



 See jdave-wicket for better test support. Slated to come to you in
 Wicket
 1.5

 Martijn

 On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:




 Hi!

 I use TDD: I spend 60% of my time type-checking and path-checking my
 wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate to
 get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into
 component hierarchies?

 Can this be done?

 **
 Martin

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











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








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


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


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



RE: 60% waste

2009-05-11 Thread Martin Grigorov
I'm using quite successfully WebDriver (a.k.a. Selenium 2).

El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
 On a side note, does Selenium even work with wicket?
 
 Douglas
 
 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
 Sent: Monday, May 11, 2009 12:13 AM
 To: users@wicket.apache.org
 Subject: Re: 60% waste
 
 unit testing is about testing small isolated bits of functionality in 
 isolation
 
 lets say that you want to test foo(p) { return a(b(c(p))); }
 
 what martin is trying to do is to test that foo(q) yields the desired
 value w, what he should do instead is
 
 test a() in isolation to make sure it works
 test b() in isolation to make sure it works
 test c() in isolation to make sure it works
 test that foo() calls a,b,c.
 
 if all small tests above pass you are guaranteed that foo() works.
 
 -igor
 
 On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
  Ben Tilford wrote:
 
  Have you looked at selenium? Your not really unit testing here.
 
 
  Hi Ben,
 
  What do you mean Your not really unit testing here. ?
 
  MSi
 
  On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:
 
 
 
  Like Martijn said i also strongly recommend to take a look at the
  jdave-wicket's selectors (http://www.jdave.org/).
 
  examples =
 
  http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
 
 
  with form tester it goes like this =
 
   form = wicket.newFormTester(selectFirst(Form.class,
  form).from(panel).getPageRelativePath());
   form.setValue(name, wicket);
   form.setValue(address, jdave);
   form.submit();
 
  MSi
 
  Martijn Dashorst wrote:
 
 
 
  See jdave-wicket for better test support. Slated to come to you in
  Wicket
  1.5
 
  Martijn
 
  On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
  martin.maku...@koodaripalvelut.com wrote:
 
 
 
 
  Hi!
 
  I use TDD: I spend 60% of my time type-checking and path-checking my
  wicketTests and components.
 
  I always have the wrong path and I must prinDocument and iterate to
  get it right
 
  Anybody have the same experience?
 
  How about introducing type-safety and path-safety/identity into
  component hierarchies?
 
  Can this be done?
 
  **
  Martin
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


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



Re: 60% waste

2009-05-11 Thread Krzysztof Jelski
Hi Martin!

I also found using paths to identify components really cumbersome in
test-driving wicket. I took a look at jdave-wicket and really liked its
approach. However, I didn't want to use jdave libs with my current project.
Inspired with this lib, I wrote this little snippet of code, which i find
really helpful:

  @SuppressWarnings(unchecked)
  public static T extends WebMarkupContainer T findComponent(WicketTester
tester, ClassT componentClass,
  final String id) {
return (T) tester.getLastRenderedPage().visitChildren(componentClass,
new IVisitorT() {

  @Override
  public Object component(T component) {
if (component.getId().equals(id)) {
  return component;
}
return CONTINUE_TRAVERSAL;
  }
});
  }

I also created similar method without the id parameter - useful when you
have only one component of a class on the tested page. Only difference in
the method body is that there's just a single return component statement,
no if.

Hope it helps.

Chris


Re: 60% waste

2009-05-11 Thread Martin Makundi
Tnx. But I am verry happy with my new beanz design ;)

**
Martin

2009/5/11 Krzysztof Jelski kjel...@gmail.com:
 Hi Martin!

 I also found using paths to identify components really cumbersome in
 test-driving wicket. I took a look at jdave-wicket and really liked its
 approach. However, I didn't want to use jdave libs with my current project.
 Inspired with this lib, I wrote this little snippet of code, which i find
 really helpful:

  @SuppressWarnings(unchecked)
  public static T extends WebMarkupContainer T findComponent(WicketTester
 tester, ClassT componentClass,
  final String id) {
return (T) tester.getLastRenderedPage().visitChildren(componentClass,
 new IVisitorT() {

  @Override
  public Object component(T component) {
if (component.getId().equals(id)) {
  return component;
}
return CONTINUE_TRAVERSAL;
  }
});
  }

 I also created similar method without the id parameter - useful when you
 have only one component of a class on the tested page. Only difference in
 the method body is that there's just a single return component statement,
 no if.

 Hope it helps.

 Chris


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



RE: 60% waste

2009-05-11 Thread Douglas Ferguson
I thought there was a problem with wicket's random generation of ids.

D./

-Original Message-
From: Martin Grigorov [mailto:mcgreg...@e-card.bg]
Sent: Monday, May 11, 2009 7:15 AM
To: users@wicket.apache.org
Subject: RE: 60% waste

I'm using quite successfully WebDriver (a.k.a. Selenium 2).

El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
 On a side note, does Selenium even work with wicket?

 Douglas

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Monday, May 11, 2009 12:13 AM
 To: users@wicket.apache.org
 Subject: Re: 60% waste

 unit testing is about testing small isolated bits of functionality in 
 isolation

 lets say that you want to test foo(p) { return a(b(c(p))); }

 what martin is trying to do is to test that foo(q) yields the desired
 value w, what he should do instead is

 test a() in isolation to make sure it works
 test b() in isolation to make sure it works
 test c() in isolation to make sure it works
 test that foo() calls a,b,c.

 if all small tests above pass you are guaranteed that foo() works.

 -igor

 On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
  Ben Tilford wrote:
 
  Have you looked at selenium? Your not really unit testing here.
 
 
  Hi Ben,
 
  What do you mean Your not really unit testing here. ?
 
  MSi
 
  On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:
 
 
 
  Like Martijn said i also strongly recommend to take a look at the
  jdave-wicket's selectors (http://www.jdave.org/).
 
  examples =
 
  http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
 
 
  with form tester it goes like this =
 
   form = wicket.newFormTester(selectFirst(Form.class,
  form).from(panel).getPageRelativePath());
   form.setValue(name, wicket);
   form.setValue(address, jdave);
   form.submit();
 
  MSi
 
  Martijn Dashorst wrote:
 
 
 
  See jdave-wicket for better test support. Slated to come to you in
  Wicket
  1.5
 
  Martijn
 
  On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
  martin.maku...@koodaripalvelut.com wrote:
 
 
 
 
  Hi!
 
  I use TDD: I spend 60% of my time type-checking and path-checking my
  wicketTests and components.
 
  I always have the wrong path and I must prinDocument and iterate to
  get it right
 
  Anybody have the same experience?
 
  How about introducing type-safety and path-safety/identity into
  component hierarchies?
 
  Can this be done?
 
  **
  Martin
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

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


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




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



RE: 60% waste

2009-05-11 Thread Douglas Ferguson
I should be more clear. Has anybody had problems with wicket ids and using 
Selenium?
Was this fixed in v2 (WebDriver)?

D/

-Original Message-
From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
Sent: Monday, May 11, 2009 9:38 AM
To: users@wicket.apache.org; mcgreg...@e-card.bg
Subject: RE: 60% waste

I thought there was a problem with wicket's random generation of ids.

D./

-Original Message-
From: Martin Grigorov [mailto:mcgreg...@e-card.bg]
Sent: Monday, May 11, 2009 7:15 AM
To: users@wicket.apache.org
Subject: RE: 60% waste

I'm using quite successfully WebDriver (a.k.a. Selenium 2).

El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
 On a side note, does Selenium even work with wicket?

 Douglas

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Monday, May 11, 2009 12:13 AM
 To: users@wicket.apache.org
 Subject: Re: 60% waste

 unit testing is about testing small isolated bits of functionality in 
 isolation

 lets say that you want to test foo(p) { return a(b(c(p))); }

 what martin is trying to do is to test that foo(q) yields the desired
 value w, what he should do instead is

 test a() in isolation to make sure it works
 test b() in isolation to make sure it works
 test c() in isolation to make sure it works
 test that foo() calls a,b,c.

 if all small tests above pass you are guaranteed that foo() works.

 -igor

 On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
  Ben Tilford wrote:
 
  Have you looked at selenium? Your not really unit testing here.
 
 
  Hi Ben,
 
  What do you mean Your not really unit testing here. ?
 
  MSi
 
  On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:
 
 
 
  Like Martijn said i also strongly recommend to take a look at the
  jdave-wicket's selectors (http://www.jdave.org/).
 
  examples =
 
  http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
 
 
  with form tester it goes like this =
 
   form = wicket.newFormTester(selectFirst(Form.class,
  form).from(panel).getPageRelativePath());
   form.setValue(name, wicket);
   form.setValue(address, jdave);
   form.submit();
 
  MSi
 
  Martijn Dashorst wrote:
 
 
 
  See jdave-wicket for better test support. Slated to come to you in
  Wicket
  1.5
 
  Martijn
 
  On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
  martin.maku...@koodaripalvelut.com wrote:
 
 
 
 
  Hi!
 
  I use TDD: I spend 60% of my time type-checking and path-checking my
  wicketTests and components.
 
  I always have the wrong path and I must prinDocument and iterate to
  get it right
 
  Anybody have the same experience?
 
  How about introducing type-safety and path-safety/identity into
  component hierarchies?
 
  Can this be done?
 
  **
  Martin
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

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


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




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



Re: 60% waste

2009-05-11 Thread Martin Makundi
 I thought there was a problem with wicket's random generation of ids.

The beanz overcomes that ;)

**
Martin


 D./


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



Re: 60% waste

2009-05-11 Thread John Krasnay
I just use names for form components and css or xpath for non-form
components instead of IDs. Sometimes requires rework if the page
structure changes but otherwise works OK.

jk

On Mon, May 11, 2009 at 08:22:40AM -0700, Douglas Ferguson wrote:
 I should be more clear. Has anybody had problems with wicket ids and using 
 Selenium?
 Was this fixed in v2 (WebDriver)?
 
 D/
 
 -Original Message-
 From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
 Sent: Monday, May 11, 2009 9:38 AM
 To: users@wicket.apache.org; mcgreg...@e-card.bg
 Subject: RE: 60% waste
 
 I thought there was a problem with wicket's random generation of ids.
 
 D./
 
 -Original Message-
 From: Martin Grigorov [mailto:mcgreg...@e-card.bg]
 Sent: Monday, May 11, 2009 7:15 AM
 To: users@wicket.apache.org
 Subject: RE: 60% waste
 
 I'm using quite successfully WebDriver (a.k.a. Selenium 2).
 
 El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
  On a side note, does Selenium even work with wicket?
 
  Douglas
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Monday, May 11, 2009 12:13 AM
  To: users@wicket.apache.org
  Subject: Re: 60% waste
 
  unit testing is about testing small isolated bits of functionality in 
  isolation
 
  lets say that you want to test foo(p) { return a(b(c(p))); }
 
  what martin is trying to do is to test that foo(q) yields the desired
  value w, what he should do instead is
 
  test a() in isolation to make sure it works
  test b() in isolation to make sure it works
  test c() in isolation to make sure it works
  test that foo() calls a,b,c.
 
  if all small tests above pass you are guaranteed that foo() works.
 
  -igor
 
  On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
   Ben Tilford wrote:
  
   Have you looked at selenium? Your not really unit testing here.
  
  
   Hi Ben,
  
   What do you mean Your not really unit testing here. ?
  
   MSi
  
   On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi 
   wrote:
  
  
  
   Like Martijn said i also strongly recommend to take a look at the
   jdave-wicket's selectors (http://www.jdave.org/).
  
   examples =
  
   http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
  
  
   with form tester it goes like this =
  
form = wicket.newFormTester(selectFirst(Form.class,
   form).from(panel).getPageRelativePath());
form.setValue(name, wicket);
form.setValue(address, jdave);
form.submit();
  
   MSi
  
   Martijn Dashorst wrote:
  
  
  
   See jdave-wicket for better test support. Slated to come to you in
   Wicket
   1.5
  
   Martijn
  
   On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
   martin.maku...@koodaripalvelut.com wrote:
  
  
  
  
   Hi!
  
   I use TDD: I spend 60% of my time type-checking and path-checking my
   wicketTests and components.
  
   I always have the wrong path and I must prinDocument and iterate to
   get it right
  
   Anybody have the same experience?
  
   How about introducing type-safety and path-safety/identity into
   component hierarchies?
  
   Can this be done?
  
   **
   Martin
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
  
  
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

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



Re: 60% waste

2009-05-11 Thread Igor Vaynberg
you can use idebugsettings.setoutputcomponentpath(true) to make using
selenium easier, this will append a wicket:path attribute with
page-relative path to the component which should be a lot more stable
then the auto-generated markup ids.

-igor

On Mon, May 11, 2009 at 8:57 AM, John Krasnay j...@krasnay.ca wrote:
 I just use names for form components and css or xpath for non-form
 components instead of IDs. Sometimes requires rework if the page
 structure changes but otherwise works OK.

 jk

 On Mon, May 11, 2009 at 08:22:40AM -0700, Douglas Ferguson wrote:
 I should be more clear. Has anybody had problems with wicket ids and using 
 Selenium?
 Was this fixed in v2 (WebDriver)?

 D/

 -Original Message-
 From: Douglas Ferguson [mailto:doug...@douglasferguson.us]
 Sent: Monday, May 11, 2009 9:38 AM
 To: users@wicket.apache.org; mcgreg...@e-card.bg
 Subject: RE: 60% waste

 I thought there was a problem with wicket's random generation of ids.

 D./

 -Original Message-
 From: Martin Grigorov [mailto:mcgreg...@e-card.bg]
 Sent: Monday, May 11, 2009 7:15 AM
 To: users@wicket.apache.org
 Subject: RE: 60% waste

 I'm using quite successfully WebDriver (a.k.a. Selenium 2).

 El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
  On a side note, does Selenium even work with wicket?
 
  Douglas
 
  -Original Message-
  From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
  Sent: Monday, May 11, 2009 12:13 AM
  To: users@wicket.apache.org
  Subject: Re: 60% waste
 
  unit testing is about testing small isolated bits of functionality in 
  isolation
 
  lets say that you want to test foo(p) { return a(b(c(p))); }
 
  what martin is trying to do is to test that foo(q) yields the desired
  value w, what he should do instead is
 
  test a() in isolation to make sure it works
  test b() in isolation to make sure it works
  test c() in isolation to make sure it works
  test that foo() calls a,b,c.
 
  if all small tests above pass you are guaranteed that foo() works.
 
  -igor
 
  On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
   Ben Tilford wrote:
  
   Have you looked at selenium? Your not really unit testing here.
  
  
   Hi Ben,
  
   What do you mean Your not really unit testing here. ?
  
   MSi
  
   On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi 
   wrote:
  
  
  
   Like Martijn said i also strongly recommend to take a look at the
   jdave-wicket's selectors (http://www.jdave.org/).
  
   examples =
  
   http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java
  
  
   with form tester it goes like this =
  
            form = wicket.newFormTester(selectFirst(Form.class,
   form).from(panel).getPageRelativePath());
            form.setValue(name, wicket);
            form.setValue(address, jdave);
            form.submit();
  
   MSi
  
   Martijn Dashorst wrote:
  
  
  
   See jdave-wicket for better test support. Slated to come to you in
   Wicket
   1.5
  
   Martijn
  
   On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
   martin.maku...@koodaripalvelut.com wrote:
  
  
  
  
   Hi!
  
   I use TDD: I spend 60% of my time type-checking and path-checking my
   wicketTests and components.
  
   I always have the wrong path and I must prinDocument and iterate to
   get it right
  
   Anybody have the same experience?
  
   How about introducing type-safety and path-safety/identity into
   component hierarchies?
  
   Can this be done?
  
   **
   Martin
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
  
  
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
  
  
  
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 


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


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

Re: 60% waste

2009-05-11 Thread Marko Sibakov

Martin Grigorov wrote:

I'm using quite successfully WebDriver (a.k.a. Selenium 2).
  
We have also used WebDriver in our current project and i am quite 
satisfied with the results.
I have also written with my colleagues a small framework that makes 
easier to integrate webdriver to wicket with bdd way. If someone is 
interested, plz check this = http://www.jdave.org/bdd-wicket/


MSi


El lun, 11-05-2009 a las 04:35 -0700, Douglas Ferguson escribió:
  

On a side note, does Selenium even work with wicket?

Douglas

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Monday, May 11, 2009 12:13 AM

To: users@wicket.apache.org
Subject: Re: 60% waste

unit testing is about testing small isolated bits of functionality in isolation

lets say that you want to test foo(p) { return a(b(c(p))); }

what martin is trying to do is to test that foo(q) yields the desired
value w, what he should do instead is

test a() in isolation to make sure it works
test b() in isolation to make sure it works
test c() in isolation to make sure it works
test that foo() calls a,b,c.

if all small tests above pass you are guaranteed that foo() works.

-igor

On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:


Ben Tilford wrote:
  

Have you looked at selenium? Your not really unit testing here.



Hi Ben,

What do you mean Your not really unit testing here. ?

MSi
  

On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:




Like Martijn said i also strongly recommend to take a look at the
jdave-wicket's selectors (http://www.jdave.org/).

examples =

http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java


with form tester it goes like this =

 form = wicket.newFormTester(selectFirst(Form.class,
form).from(panel).getPageRelativePath());
 form.setValue(name, wicket);
 form.setValue(address, jdave);
 form.submit();

MSi

Martijn Dashorst wrote:


  

See jdave-wicket for better test support. Slated to come to you in
Wicket
1.5

Martijn

On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:





Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right

Anybody have the same experience?

How about introducing type-safety and path-safety/identity into
component hierarchies?

Can this be done?

**
Martin

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





  





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


  




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

  

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


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






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

  




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

Re: 60% waste

2009-05-10 Thread Martin Makundi
Related wiki entry
http://cwiki.apache.org/confluence/display/WICKET/Type-safe+testing+in+wicket

**
Martin

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



Re: 60% waste

2009-05-10 Thread Marko Sibakov

Ben Tilford wrote:

Have you looked at selenium? Your not really unit testing here.
  

Hi Ben,

What do you mean Your not really unit testing here. ?

MSi

On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:

  

Like Martijn said i also strongly recommend to take a look at the
jdave-wicket's selectors (http://www.jdave.org/).

examples =
http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java


with form tester it goes like this =

  form = wicket.newFormTester(selectFirst(Form.class,
form).from(panel).getPageRelativePath());
  form.setValue(name, wicket);
  form.setValue(address, jdave);
  form.submit();

MSi

Martijn Dashorst wrote:



See jdave-wicket for better test support. Slated to come to you in Wicket
1.5

Martijn

On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:


  

Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right

Anybody have the same experience?

How about introducing type-safety and path-safety/identity into
component hierarchies?

Can this be done?

**
Martin

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









  



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




  




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

Re: 60% waste

2009-05-10 Thread Igor Vaynberg
unit testing is about testing small isolated bits of functionality in isolation

lets say that you want to test foo(p) { return a(b(c(p))); }

what martin is trying to do is to test that foo(q) yields the desired
value w, what he should do instead is

test a() in isolation to make sure it works
test b() in isolation to make sure it works
test c() in isolation to make sure it works
test that foo() calls a,b,c.

if all small tests above pass you are guaranteed that foo() works.

-igor

On Sun, May 10, 2009 at 9:55 PM, Marko Sibakov marko.siba...@ri.fi wrote:
 Ben Tilford wrote:

 Have you looked at selenium? Your not really unit testing here.


 Hi Ben,

 What do you mean Your not really unit testing here. ?

 MSi

 On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:



 Like Martijn said i also strongly recommend to take a look at the
 jdave-wicket's selectors (http://www.jdave.org/).

 examples =

 http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java


 with form tester it goes like this =

          form = wicket.newFormTester(selectFirst(Form.class,
 form).from(panel).getPageRelativePath());
          form.setValue(name, wicket);
          form.setValue(address, jdave);
          form.submit();

 MSi

 Martijn Dashorst wrote:



 See jdave-wicket for better test support. Slated to come to you in
 Wicket
 1.5

 Martijn

 On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:




 Hi!

 I use TDD: I spend 60% of my time type-checking and path-checking my
 wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate to
 get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into
 component hierarchies?

 Can this be done?

 **
 Martin

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











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








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


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



Re: 60% waste

2009-05-09 Thread Martin Makundi
Hi!

What about if the MarkupContainer was used in a more bean-like manner:

public abstract class ListItemT extends WebMarkupContainer ...

new ListViewMyData(id, ..., MyListItem.class);

public class MyListItem extends ListItemMyData {
  private TextField myTextField;

  public MyListItem(MyData myData) {
myTextField = TextField(...);
  }
}


This way we would have type safety and you could navigate the
components via the getters.

The question remains how this fits into the rendering and element
reuse etc. logic.

**
Martin

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



Re: 60% waste

2009-05-09 Thread Martin Makundi
Ofcourse I forgot the getter...

public class MyListItem extends ListItemMyData {
  private TextField myTextField;

  public MyListItem(MyData myData) {
myTextField = TextField(...);
  }

  /**
   * @return the myTextField
   */
  public TextField getMyTextField() {
return myTextField;
  }
}


2009/5/9 Martin Makundi martin.maku...@koodaripalvelut.com:
 Hi!

 What about if the MarkupContainer was used in a more bean-like manner:

 public abstract class ListItemT extends WebMarkupContainer ...

 new ListViewMyData(id, ..., MyListItem.class);

 public class MyListItem extends ListItemMyData {
  private TextField myTextField;

  public MyListItem(MyData myData) {
myTextField = TextField(...);
  }
 }


 This way we would have type safety and you could navigate the
 components via the getters.

 The question remains how this fits into the rendering and element
 reuse etc. logic.

 **
 Martin


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



Re: 60% waste

2009-05-09 Thread Per Newgro

Martin Makundi schrieb:

Interesting. I googled for printDoc Wicket but did not find anything.
Where is that utility?



  public void printDocument() {
System.out.println(tester.getServletResponse().getDocument());
  }

**
Martin

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

  

WicketTester.debugComponentTree() ?

Cheers
Per

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



Re: 60% waste

2009-05-09 Thread Marko Sibakov
Like Martijn said i also strongly recommend to take a look at the 
jdave-wicket's selectors (http://www.jdave.org/).


examples = 
http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java



with form tester it goes like this =

   form = wicket.newFormTester(selectFirst(Form.class, 
form).from(panel).getPageRelativePath());

   form.setValue(name, wicket);
   form.setValue(address, jdave);
   form.submit();

MSi

Martijn Dashorst wrote:

See jdave-wicket for better test support. Slated to come to you in Wicket 1.5

Martijn

On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
  

Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right

Anybody have the same experience?

How about introducing type-safety and path-safety/identity into
component hierarchies?

Can this be done?

**
Martin

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







  




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

Re: 60% waste

2009-05-09 Thread Ben Tilford
Have you looked at selenium? Your not really unit testing here.

On Sat, May 9, 2009 at 7:41 AM, Marko Sibakov marko.siba...@ri.fi wrote:

 Like Martijn said i also strongly recommend to take a look at the
 jdave-wicket's selectors (http://www.jdave.org/).

 examples =
 http://svn.laughingpanda.org/svn/jdave/trunk/jdave-wicket/src/test/jdave/wicket/PageWithItemsSpec.java


 with form tester it goes like this =

   form = wicket.newFormTester(selectFirst(Form.class,
 form).from(panel).getPageRelativePath());
   form.setValue(name, wicket);
   form.setValue(address, jdave);
   form.submit();

 MSi

 Martijn Dashorst wrote:

 See jdave-wicket for better test support. Slated to come to you in Wicket
 1.5

 Martijn

 On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:


 Hi!

 I use TDD: I spend 60% of my time type-checking and path-checking my
 wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate to
 get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into
 component hierarchies?

 Can this be done?

 **
 Martin

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













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



Re: 60% waste

2009-05-09 Thread Martin Makundi
Hi!

I have now better formalized my intentions (couldn't get sleep because
of this ;). You can see the benefits for yourself. However, I found
out that most of it can be done with existing wicket. Maybe some part
of the philosophy could be adapted into wicket in general. I submitted
a quickstart with two feature requests as
https://issues.apache.org/jira/browse/WICKET-2267

In my opinnion, this results in very clean code. I hope you like it too ;)


/**
 * Homepage
 */
public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;
private final BookForm form;

/**
 *
 */
@SuppressWarnings(serial)
public HomePage() {
add(new Label(message,
If you see this message wicket is properly 
configured and running));
add(form = new BookForm(form));
}

/**
 * @return the form
 */
public BookForm getForm() {
return form;
}
}

class BookForm extends FormVoid {
private final BookListView bookListView;
private final Button submitButton;

public BookForm(String id) {
super(id);
ListBook books = Arrays.asList(new Book(first), new
Book(second), new Book(third));
add(bookListView = new BookListView(book_list, books));
add(submitButton = new Button(submit));
}

/**
 * @return the bookListView
 */
public BookListView getBookListView() {
return bookListView;
}

/**
 * @return the submitButton
 */
public Button getSubmitButton() {
return submitButton;
}
}

class Book implements Serializable {
/** Field name (reflection property expression) */
public static final String NAME = name;
/** Field name (reflection property expression) */
public static final String AUTHOR = author;
/** Field name (reflection property expression) */
public static final String TYPE = type;
private String name;
private String author;
private Type type;

/** @param name */
public Book(String name) {
this.name = name;
}

public enum Type {
OLD, NEW;
}   
}

class BookListView extends TestableListViewBookListItem, Book {
public BookListView(String id, ListBook list) {
super(id, list);
}

@Override
protected BookListItem newItem(int index) {
return new BookListItem(index, getListItemModel(getModel(), 
index));
}
}

class BookListItem extends ListItemBook {
private final TextFieldString nameField;
private final TextFieldString authorField;
private final DropDownChoiceType typeChoice;

public BookListItem(int index, IModelBook model) {
super(index, model);
Book book = model.getObject();
add(nameField = new TextFieldString(name, new
PropertyModelString(book, Book.NAME)));
add(authorField = new TextFieldString(author, new
PropertyModelString(book, Book.AUTHOR)));
add(typeChoice = new DropDownChoiceType(type, new
PropertyModelType(book, Book.TYPE), Arrays.asList(Type.values(;
}

/**
 * @return the nameField
 */
public TextFieldString getNameField() {
return nameField;
}

/**
 * @return the authorField
 */
public TextFieldString getAuthorField() {
return authorField;
}

/**
 * @return the typeChoice
 */
public DropDownChoiceType getTypeChoice() {
return typeChoice;
}
}


public abstract class TestableListViewListItemType extends
ListItemItemType, ItemType extends ListViewItemType {
public TestableListView(String id, IModelListItemType model) {
super(id, model);
}

public TestableListView(String id, ListItemType list) {
super(id, list);
}

public TestableListView(String id) {
super(id);
}

@Override
protected final void populateItem(ListItemItemType item) {
// do nothing here
}

@Override
protected abstract ListItemType newItem(int index);

@Override
public IteratorListItemType iterator() {
return (IteratorListItemType) super.iterator();
}
}


html
head
titleWicket Quickstart Archetype Homepage/title
/head
body
strongWicket Quickstart Archetype Homepage/strong
br/br/
span wicket:id=messagemessage will be here/span

form wicket:id=form
  table border=1
tr wicket:id=book_list
  

60% waste

2009-05-08 Thread Martin Makundi
Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right

Anybody have the same experience?

How about introducing type-safety and path-safety/identity into
component hierarchies?

Can this be done?

**
Martin

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



Re: 60% waste

2009-05-08 Thread Martijn Dashorst
See jdave-wicket for better test support. Slated to come to you in Wicket 1.5

Martijn

On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 Hi!

 I use TDD: I spend 60% of my time type-checking and path-checking my
 wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate to
 get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into
 component hierarchies?

 Can this be done?

 **
 Martin

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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: 60% waste

2009-05-08 Thread Andrea Aime

Martin Makundi ha scritto:

Hi!

I use TDD: I spend 60% of my time type-checking and path-checking my
wicketTests and components.

I always have the wrong path and I must prinDocument and iterate to
get it right


I don't know if this is of any help, but I've written the attached
utility class that, given a component, can print its containment
structure, along with the eventual component classes and
model values (toString-ed).

I find it useful to quickly visualize the current component hierarchy
while writing tests and debugging.

Hope this helps

Cheers
Andrea




import java.io.PrintStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.regex.Pattern;

import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;

/**
 * Dumps a wicket component/page hierarchy to text, eventually writing 
down the class and the model

 * value as a string.
 * p
 * Each line in the dump follow the codecomponentId(class) 
'value'/code format.

 * /p
 * p
 * The class can be reused for multiple prints, but it's not thread safe
 * /p
 */
public class WicketHierarchyPrinter {
static final Pattern NEWLINE = Pattern.compile(\\n, 
Pattern.MULTILINE);


PrintStream out;

boolean valueDumpEnabled;

boolean classDumpEnabled;

/**
 * Utility method to dump a single component/page to standard output
 * @param c
 * @param dumpClass
 * @param dumpValue
 */
public static void print(Component c, boolean dumpClass, boolean 
dumpValue) {

WicketHierarchyPrinter printer = new WicketHierarchyPrinter();
printer.setClassDumpEnabled(dumpClass);
printer.setValueDumpEnabled(dumpValue);
if(c instanceof Page) {
printer.print((Page) c);
} else {
printer.print(c);
}
}

/**
 * Creates a printer that will dump to standard output
 */
public WicketHierarchyPrinter() {
out = System.out;
}

/**
 * Creates a printer that will dump to the specified print stream
 */
public WicketHierarchyPrinter(PrintStream out) {
this.out = out;
}

/**
 * Set to true if you want to see the model values in the dump
 *
 * @param valueDumpEnabled
 */
public void setValueDumpEnabled(boolean valueDumpEnabled) {
this.valueDumpEnabled = valueDumpEnabled;
}

/**
 * Set to true if you want to see the component classes in the dump
 *
 * @param classDumpEnabled
 */
public void setClassDumpEnabled(boolean classDumpEnabled) {
this.classDumpEnabled = classDumpEnabled;
}

/**
 * Prints the component containment hierarchy
 *
 * @param c
 */
public void print(Component c) {
walkHierarchy(c, 0);
}

/**
 * Walks down the containment hierarchy depth first and prints each 
component found

 */
private void walkHierarchy(Component c, int level) {
printComponent(c, level);
if (c instanceof MarkupContainer) {
MarkupContainer mc = (MarkupContainer) c;
for (Iterator it = mc.iterator(); it.hasNext();) {
walkHierarchy((Component) it.next(), level + 1);
}
}
}

/**
 * Prints a single component
 */
private void printComponent(Component c, int level) {
if(c instanceof Page)
out.print(tab(level) + PAGE_ROOT);
else
out.print(tab(level) + c.getId());

if (classDumpEnabled) {
String className;
if(c.getClass().isAnonymousClass()) {
className = c.getClass().getSuperclass().getName();
} else {
className = c.getClass().getName();
}

out.print(( + className + ));
}

if (valueDumpEnabled) {
try {
String value = 
NEWLINE.matcher(c.getModelObjectAsString()).replaceAll(n);

out.print( ' + value + ');
} catch(Exception e) {
out.print( 'ERROR_RETRIEVING_MODEL  + e.getMessage() 
+ ');

}
}
out.println();
}

/**
 * Generates three spaces per level
 */
String tab(int level) {
char[] spaces = new char[level * 3];
Arrays.fill(spaces, ' ');
return new String(spaces);
}

}

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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

Well... printDoc and wicket
getDebugSettings().setOutputComponentPath(true); does pretty much the
same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 1.5

How can this help me? For example the following is HELL with wicket:

  Integer round = 1;
  String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
  TabbedPanel.TAB_PANEL_ID,
  AbstractInnerPanel.INNER_TABS,
  MyWizardPanel.WIZARD_FORM);
  String rowPath =
MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
  MyPeriodPanel.HISTORY_CONTAINER,
  MyPeriodPanel.HISTORY_TABLE,
  MyPeriodPanel.PERIODS,
  round.toString());

  // Add row
  tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
  MyWizardPanel.FANCY_PANEL_ID,
  MyPeriodPanel.HISTORY_CONTAINER,
  MyPeriodPanel.BUTTON_CONTAINER,
  MyPeriodPanel.NEW_BUTTON), onclick);

  // Fill entry
  FormTester formTester =
tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
  formTester.setValue(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.START_DATE), 26.1.2008);
  formTester.setValue(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.DAYS), 5);
  formTester.select(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.SETTING), 1);


**
Martin

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



Re: 60% waste

2009-05-08 Thread Igor Vaynberg
you should really use visitors for this kind of thing...something like
this may work very well for you

TestUtils.attachTestId(Component c, String id) {
  if (application.get().getconfigurationtype()!=production) {
  c.setmatadata(testkey, id);
  }
}

then in your code

Form form=new Form(..);
TestUtils.attachTestId(form, some_unique_form_id);

then in your tests

Page pageundertest=
Form form=TestUtils.findComponentByTestId(pageundertest, some_unique_form_id);

you have a potential problem of having collissions for components that
are inside repeaters, but you can set up test harnesses where you test
them in isolation.

-igor


On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



Re: 60% waste

2009-05-08 Thread Igor Vaynberg
you can also create a test panel that contains just your form and test
that instead of creating the entire complex page just to test the
form. break your tests into small units and test in isolaton. your
test harness panel can have a getter that gives you direct access the
the form you are testing.

-igor

On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



Re: 60% waste

2009-05-08 Thread Per Lundholm
Well, strings all over the place, if I get what you mean.

But I write the tests first and they define what the paths and ids
should be and Wicket is really quick about discovering when the
implementation doesn't follow spec (i.e. tests).

Doing a small step at a time takes you there faster.

Let's see there should be a label here, let's write a test for it and
run it. Oh, it failed. Guess I add a label to the code. Oh it throw an
exception, guess I add it to the markup as well. Green bar. Perhaps
another label...

if you do this in steps instead of doing a page at the time, you don't
need chasing typos so much since you immediatley discovers any
mistakes much more quickly.

/Per

On Fri, May 8, 2009 at 5:48 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 Hi!

 I use TDD: I spend 60% of my time type-checking and path-checking my
 wicketTests and components.

 I always have the wrong path and I must prinDocument and iterate to
 get it right

 Anybody have the same experience?

 How about introducing type-safety and path-safety/identity into
 component hierarchies?

 Can this be done?

 **
 Martin

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





-- 
FaceBush, min insamling i Mustaschkampen:
http://www.cancerfonden.se//sv/Mustaschkampen/Kampa/Insamlingar/?collection=243

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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 you should really use visitors for this kind of thing...something like
 this may work very well for you

I know that with more work I can make ... more work.

What I am looking for is a solution that makes it possible to have
intellisense while coding and compile-time type checking. Visitors
etc. don't work (they do not save my time).

I know it must be possible... somehow. I just don't know what would be
the best way to make it happen.

**
Martin



 On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 
 1.5

 How can this help me? For example the following is HELL with wicket:

  Integer round = 1;
  String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
  TabbedPanel.TAB_PANEL_ID,
  AbstractInnerPanel.INNER_TABS,
  MyWizardPanel.WIZARD_FORM);
  String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
  MyPeriodPanel.HISTORY_CONTAINER,
  MyPeriodPanel.HISTORY_TABLE,
  MyPeriodPanel.PERIODS,
  round.toString());

  // Add row
  tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
  MyWizardPanel.FANCY_PANEL_ID,
  MyPeriodPanel.HISTORY_CONTAINER,
  MyPeriodPanel.BUTTON_CONTAINER,
  MyPeriodPanel.NEW_BUTTON), onclick);

  // Fill entry
  FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
  formTester.setValue(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.START_DATE), 26.1.2008);
  formTester.setValue(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.DAYS), 5);
  formTester.select(MarkupUtils.getComponentPath(rowPath,
  HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



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



Re: 60% waste

2009-05-08 Thread James Carman
Use an IDE plugin?

On Fri, May 8, 2009 at 2:39 PM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 you should really use visitors for this kind of thing...something like
 this may work very well for you

 I know that with more work I can make ... more work.

 What I am looking for is a solution that makes it possible to have
 intellisense while coding and compile-time type checking. Visitors
 etc. don't work (they do not save my time).

 I know it must be possible... somehow. I just don't know what would be
 the best way to make it happen.

 **
 Martin



 On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 
 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



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



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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 But I write the tests first and they define what the paths and ids
 should be and Wicket is really quick about discovering when the
 implementation doesn't follow spec (i.e. tests).

I concentrate on coding.. sometimes I write the implementation,
sometimes the tests, whichever goes faster until it hangs and then I
switch over... but working with the tests is like working with some
prehistorical programming language without type and compile time
safety ... it just wastes a lot of my time, that's the problem.

Furthermore, I would like that when I refactor the component hierarcy,
the tests would follow. This means that maybe wicket component
hierarcy should be derived from package structure, maybe? Or something
more native to java.

**
Martin

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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 Use an IDE plugin?

That's a hack, not a design.

**
Martin

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



Re: 60% waste

2009-05-08 Thread Igor Vaynberg
so what you are saying is that adding one line of code to mark the
component you want to test, and then being able to find that component
easily in your test - independent of its place in hierarchy and
without relying on strings - is more work?

-igor

On Fri, May 8, 2009 at 11:39 AM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 you should really use visitors for this kind of thing...something like
 this may work very well for you

 I know that with more work I can make ... more work.

 What I am looking for is a solution that makes it possible to have
 intellisense while coding and compile-time type checking. Visitors
 etc. don't work (they do not save my time).

 I know it must be possible... somehow. I just don't know what would be
 the best way to make it happen.

 **
 Martin



 On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 
 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



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



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



Re: 60% waste

2009-05-08 Thread Igor Vaynberg
wicket component hierarchy is dynamic, so there is no predicting it at
compile time. this is one of the most powerful features of wicket.

-igor

On Fri, May 8, 2009 at 11:39 AM, Martin Makundi
martin.maku...@koodaripalvelut.com wrote:
 you should really use visitors for this kind of thing...something like
 this may work very well for you

 I know that with more work I can make ... more work.

 What I am looking for is a solution that makes it possible to have
 intellisense while coding and compile-time type checking. Visitors
 etc. don't work (they do not save my time).

 I know it must be possible... somehow. I just don't know what would be
 the best way to make it happen.

 **
 Martin



 On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 
 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



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



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



Re: 60% waste

2009-05-08 Thread James Carman
What about introducing an xpath-ish like expression API that could
help you search for components within the hierarchy?

On Fri, May 8, 2009 at 3:07 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 wicket component hierarchy is dynamic, so there is no predicting it at
 compile time. this is one of the most powerful features of wicket.

 -igor

 On Fri, May 8, 2009 at 11:39 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 you should really use visitors for this kind of thing...something like
 this may work very well for you

 I know that with more work I can make ... more work.

 What I am looking for is a solution that makes it possible to have
 intellisense while coding and compile-time type checking. Visitors
 etc. don't work (they do not save my time).

 I know it must be possible... somehow. I just don't know what would be
 the best way to make it happen.

 **
 Martin



 On Fri, May 8, 2009 at 11:23 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com wrote:
 I don't know if this is of any help, but I've written the attached
 utility class that, given a component, can print its containment
 structure, along with the eventual component classes and
 model values (toString-ed).

 Well... printDoc and wicket
 getDebugSettings().setOutputComponentPath(true); does pretty much the
 same thing.

 See jdave-wicket for better test support. Slated to come to you in Wicket 
 1.5

 How can this help me? For example the following is HELL with wicket:

      Integer round = 1;
      String mainFormPath = MarkupUtils.getComponentPath(MainPage.MAIN_TABS,
          TabbedPanel.TAB_PANEL_ID,
          AbstractInnerPanel.INNER_TABS,
          MyWizardPanel.WIZARD_FORM);
      String rowPath =
 MarkupUtils.getComponentPath(MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.HISTORY_TABLE,
          MyPeriodPanel.PERIODS,
          round.toString());

      // Add row
      tester.executeAjaxEvent(MarkupUtils.getComponentPath(mainFormPath,
          MyWizardPanel.FANCY_PANEL_ID,
          MyPeriodPanel.HISTORY_CONTAINER,
          MyPeriodPanel.BUTTON_CONTAINER,
          MyPeriodPanel.NEW_BUTTON), onclick);

      // Fill entry
      FormTester formTester =
 tester.newFormTester(MarkupUtils.getComponentPath(mainFormPath));
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.START_DATE), 26.1.2008);
      formTester.setValue(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.DAYS), 5);
      formTester.select(MarkupUtils.getComponentPath(rowPath,
          HistoryEditorTable.SETTING), 1);


 **
 Martin

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



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



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



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



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



Re: 60% waste

2009-05-08 Thread Christopher L Merrill

Martin Makundi wrote:

Use an IDE plugin?


That's a hack, not a design.


Wow...I'm new to this list, but I doubt you can expect much help with
that attitude.  I suggest you request a refund for your Wicket license
and support subscription and go find a tool that better fits your needs.

Oh, wait, Wicket is free and so is all the support you are receiving
here.   ;)


--
 -
Chris Merrill   |  Web Performance, Inc.
ch...@webperformance.com|  http://webperformance.com
919-433-1762|  919-845-7601

Website Load Testing and Stress Testing Software  Services
 -

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



Re: 60% waste

2009-05-08 Thread Andrea Aime

Martin Makundi ha scritto:

I don't know if this is of any help, but I've written the attached
utility class that, given a component, can print its containment
structure, along with the eventual component classes and
model values (toString-ed).


Well... printDoc and wicket
getDebugSettings().setOutputComponentPath(true); does pretty much the
same thing.


Interesting. I googled for printDoc Wicket but did not find anything.
Where is that utility?

Cheers
Andrea

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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 Interesting. I googled for printDoc Wicket but did not find anything.
 Where is that utility?

  public void printDocument() {
System.out.println(tester.getServletResponse().getDocument());
  }

**
Martin

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



Re: 60% waste

2009-05-08 Thread Martin Makundi
 wicket component hierarchy is dynamic, so there is no predicting it at
 compile time. this is one of the most powerful features of wicket.

Yes but each component is always fixed relative to its parent. The
html markup fixes the hierarcy, so something might be devised here.

 What about introducing an xpath-ish like expression API that could
 help you search for components within the hierarchy?

I am not familiar with this but sounds good, anybody have a suitable
example for this?

**
Martin



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