Re: WicketStuff JSR-303 validation breaks in WicketTester

2011-11-15 Thread Igor Vaynberg
i just pushed version 1.1 into the maven repo. this one should fix
dependencies (it depends on wicket-1.5.3). it should be synced within a
couple of hours. if you want to try it sooner you can clone the repo,
checkout the 'release/1.1' tag and mvn install it locally.

-igor


On Tue, Nov 15, 2011 at 2:13 PM, Jablow, Eric R wrote:

> I took your advice and I am trying to use this project. I have some
> teething pains.
>
> >See https://github.com/42Lines/wicket-bean-validation
> >http://repo1.maven.org/maven2/net/ftlines/wicket-bean-validation/
> >
>
> I removed the wicketstuff.org jsr303 repository and added the ftlines
> one. I also noticed on the github site that it requires Wicket 1.5.2 and so
> I switched to that. When I checked the dependencies, I saw that the ftlines
> library depends on Wicket 1.4.18, which surprises me a little, especially
> because its parent depends on 1.5-SNAPSHOT. I set the test class by
> configuring its validation in a @Before method:
>
>@BeforeClass
>public static void initValidation() {
>conf = new ValidationConfiguration();
> }
>
>@Before
>public void initTester() {
>tester = new WicketTester();
> conf.configure(tester.getApplication());
>
>tester.startPanel(CategoryTestPanel.class);
>formTester = tester.newFormTester("form");
>}
>
> In the CategoryTestPanel, I created the Form as a ValidationForm. I
> received the following stack trace:
>
> java.lang.NoSuchMethodError:
> net.ftlines.wicket.validation.bean.ValidationForm.visitChildren(Ljava/lang/Class;Lorg/apache/wicket/Component$IVisitor;)Ljava/lang/Object;
>at
> net.ftlines.wicket.validation.bean.ValidationForm.addPropertyValidators(ValidationForm.java:160)
>at
> net.ftlines.wicket.validation.bean.ValidationForm.onBeforeRender(ValidationForm.java:153)
>at
> org.apache.wicket.Component.internalBeforeRender(Component.java:980)
>
> I think the method may have disappeared between 1.4.18 and 1.5.
>
> Then, I excluded the Wicket dependency from the ftlines library:
>
> 
>net.ftlines.wicket-bean-validation
>core
>1.0
>compile
>
>
>wicket
>org.apache.wicket
>
>
> 
> Now, I get this stack trace:
>
> categoryStartsNull(gov.ic.dodiis.capco.wicket.components.category.CategoryPanelTest)
>  Time elapsed: 0 sec  <<< FAILURE!
> junit.framework.AssertionFailedError
>at junit.framework.Assert.fail(Assert.java:48)
>at
> org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1291)
>at
> org.apache.wicket.util.tester.BaseWicketTester.startPanel(BaseWicketTester.java:1242)
>at gov.ic.dodiis.capco.wicket.components.
> category.CategoryPanelTest.initTester(NonUSClassificationPanelTest.java:37)
>***REDACTED***
>
> I debugged to find that the fail comes from a NoClassDefFoundError:
>java.lang.NoClassDefFoundError: org/apache/wicket/Component$IVisitor
>
> In fact, I Visitor is an independent interface in 1.5. What is the proper
> way to set up my application?
>
> >Martin Grigorov
> >jWeekend
> >Training, Consulting, Development
> >http://jWeekend.com
> This communication, along with any attachments, is covered by federal and
> state law governing electronic communications and may contain company
> proprietary and legally privileged information.  If the reader of this
> message is not the intended recipient, you are hereby notified that any
> dissemination, distribution, use or copying of this message is strictly
> prohibited.  If you have received this in error, please reply immediately
> to the sender and delete this message.  Thank you.
>


RE: WicketStuff JSR-303 validation breaks in WicketTester

2011-11-15 Thread Jablow, Eric R
I took your advice and I am trying to use this project. I have some teething 
pains.

>See https://github.com/42Lines/wicket-bean-validation
>http://repo1.maven.org/maven2/net/ftlines/wicket-bean-validation/
>

I removed the wicketstuff.org jsr303 repository and added the ftlines one. I 
also noticed on the github site that it requires Wicket 1.5.2 and so I switched 
to that. When I checked the dependencies, I saw that the ftlines library 
depends on Wicket 1.4.18, which surprises me a little, especially because its 
parent depends on 1.5-SNAPSHOT. I set the test class by configuring its 
validation in a @Before method:

@BeforeClass
public static void initValidation() {
conf = new ValidationConfiguration();
}

@Before
public void initTester() {
tester = new WicketTester();
conf.configure(tester.getApplication());

tester.startPanel(CategoryTestPanel.class);
formTester = tester.newFormTester("form");
}

In the CategoryTestPanel, I created the Form as a ValidationForm. I received 
the following stack trace:

java.lang.NoSuchMethodError: 
net.ftlines.wicket.validation.bean.ValidationForm.visitChildren(Ljava/lang/Class;Lorg/apache/wicket/Component$IVisitor;)Ljava/lang/Object;
at 
net.ftlines.wicket.validation.bean.ValidationForm.addPropertyValidators(ValidationForm.java:160)
at 
net.ftlines.wicket.validation.bean.ValidationForm.onBeforeRender(ValidationForm.java:153)
at org.apache.wicket.Component.internalBeforeRender(Component.java:980)

I think the method may have disappeared between 1.4.18 and 1.5.

Then, I excluded the Wicket dependency from the ftlines library:


net.ftlines.wicket-bean-validation
core
1.0
compile


wicket
org.apache.wicket



Now, I get this stack trace:

categoryStartsNull(gov.ic.dodiis.capco.wicket.components.category.CategoryPanelTest)
  Time elapsed: 0 sec  <<< FAILURE!
junit.framework.AssertionFailedError
at junit.framework.Assert.fail(Assert.java:48)
at 
org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1291)
at 
org.apache.wicket.util.tester.BaseWicketTester.startPanel(BaseWicketTester.java:1242)
at gov.ic.dodiis.capco.wicket.components. 
category.CategoryPanelTest.initTester(NonUSClassificationPanelTest.java:37)
***REDACTED***

I debugged to find that the fail comes from a NoClassDefFoundError:
java.lang.NoClassDefFoundError: org/apache/wicket/Component$IVisitor

In fact, I Visitor is an independent interface in 1.5. What is the proper way 
to set up my application?

>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com
This communication, along with any attachments, is covered by federal and state 
law governing electronic communications and may contain company proprietary and 
legally privileged information.  If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, 
distribution, use or copying of this message is strictly prohibited.  If you 
have received this in error, please reply immediately to the sender and delete 
this message.  Thank you.


Re: WicketStuff JSR-303 validation breaks in WicketTester

2011-11-15 Thread Martin Grigorov
Hi,

On Tue, Nov 15, 2011 at 8:09 PM, Jablow, Eric R  wrote:
> I'm trying to use the wicketstuff.org JSR-303 validation project to use 
> Hibernate Validator in my
> newish Wicket project.
>
> I have a FormComponentPanel with a model object set up for JSR-303 
> validation, but we are
> using vanilla Wicket Validators for it.  To test the FormComponentPanel, I 
> wrote a test panel
> which includes a form, which includes the FormComponentPanel.  When I add the 
> WicketStuff
> PropertyValidation behavior to the test panel (which I then use with a 
> WicketTester
> based JUnit test class):
>
> //CategoryTestPanel
> Form form = new Form("form", new 
> CompoundPropertyModel(marking));
> form.add(new PropertyValidation());
> add(form);
> form.add(new CategoryPanel("category"));
> form.add(new Button("submit"));
>
> and
>
> //CategoryPanelTest
> @Before
> public void initTester() {
>      tester = new WicketTester();
>      tester.startPanel(CategoryTestPanel.class);
>      formTester = tester.newFormTester("form");
> }
>
> I get this exception:
>
> org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy 
> after render phase has started (page version cant change then anymore)
>                at 
> org.apache.wicket.Component.checkHierarchyChange(Component.java:3521)
>                at 
> org.apache.wicket.Component.addStateChange(Component.java:3450)
>                at org.apache.wicket.Behaviors.add(Behaviors.java:62)
>                at org.apache.wicket.Component.add(Component.java:4431)
>                at 
> org.apache.wicket.markup.html.form.FormComponent.add(FormComponent.java:490)
>                at 
> org.wicketstuff.jsr303.PropertyValidation.addValidator(PropertyValidation.java:76)
>                at 
> org.wicketstuff.jsr303.PropertyValidation.access$000(PropertyValidation.java:17)
>                at 
> org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:32)
>                at 
> org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:22)
>                ***redacted***

You cut the interesting part of the stack trace.

>
> Note that vlaidators are already being added to the FormComponentPanel 
> object, and they work fine. Where should I add the validation behavior? Is 
> there a better JSR303 library to use (inside a public Maven repository)?

See https://github.com/42Lines/wicket-bean-validation
http://repo1.maven.org/maven2/net/ftlines/wicket-bean-validation/
>
> Respectfully,
> Eric Jablow
>
> This communication, along with any attachments, is covered by federal and 
> state law governing electronic communications and may contain company 
> proprietary and legally privileged information.  If the reader of this 
> message is not the intended recipient, you are hereby notified that any 
> dissemination, distribution, use or copying of this message is strictly 
> prohibited.  If you have received this in error, please reply immediately to 
> the sender and delete this message.  Thank you.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



WicketStuff JSR-303 validation breaks in WicketTester

2011-11-15 Thread Jablow, Eric R
I'm trying to use the wicketstuff.org JSR-303 validation project to use 
Hibernate Validator in my
newish Wicket project.

I have a FormComponentPanel with a model object set up for JSR-303 validation, 
but we are
using vanilla Wicket Validators for it.  To test the FormComponentPanel, I 
wrote a test panel
which includes a form, which includes the FormComponentPanel.  When I add the 
WicketStuff
PropertyValidation behavior to the test panel (which I then use with a 
WicketTester
based JUnit test class):

//CategoryTestPanel
Form form = new Form("form", new 
CompoundPropertyModel(marking));
form.add(new PropertyValidation());
add(form);
form.add(new CategoryPanel("category"));
form.add(new Button("submit"));

and

//CategoryPanelTest
@Before
public void initTester() {
  tester = new WicketTester();
  tester.startPanel(CategoryTestPanel.class);
  formTester = tester.newFormTester("form");
}

I get this exception:

org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy 
after render phase has started (page version cant change then anymore)
at 
org.apache.wicket.Component.checkHierarchyChange(Component.java:3521)
at 
org.apache.wicket.Component.addStateChange(Component.java:3450)
at org.apache.wicket.Behaviors.add(Behaviors.java:62)
at org.apache.wicket.Component.add(Component.java:4431)
at 
org.apache.wicket.markup.html.form.FormComponent.add(FormComponent.java:490)
at 
org.wicketstuff.jsr303.PropertyValidation.addValidator(PropertyValidation.java:76)
at 
org.wicketstuff.jsr303.PropertyValidation.access$000(PropertyValidation.java:17)
at 
org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:32)
at 
org.wicketstuff.jsr303.PropertyValidation$JSR303ValidatorFormComponentVisitor.component(PropertyValidation.java:22)
***redacted***

Note that vlaidators are already being added to the FormComponentPanel object, 
and they work fine. Where should I add the validation behavior? Is there a 
better JSR303 library to use (inside a public Maven repository)?

Respectfully,
Eric Jablow

This communication, along with any attachments, is covered by federal and state 
law governing electronic communications and may contain company proprietary and 
legally privileged information.  If the reader of this message is not the 
intended recipient, you are hereby notified that any dissemination, 
distribution, use or copying of this message is strictly prohibited.  If you 
have received this in error, please reply immediately to the sender and delete 
this message.  Thank you.