You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2017/10/02 03:37:53 UTC

Question regarding WebSocketTester

Hello All,

I have started to use WebSocketTester in my tests
And have noticed weird behavior

This class calls "webApplication.getWicketFilter().setFilterPath("");" in
constructor
FilterPath can be set only once per application :(
So it is impossible to re-use application in case WebSocketTester.

Can I propose PR to create separate protected I can override and
conditionally set filter path?
Or maybe I'm trying to use WebSocketTester incorrectly?

-- 
WBR
Maxim aka solomax

Re: Question regarding WebSocketTester

Posted by Maxim Solodovnik <so...@gmail.com>.
https://github.com/apache/wicket/pull/236

On Tue, Oct 3, 2017 at 12:54 PM, Martin Grigorov <ma...@gmail.com>
wrote:

> +1
>
> On Oct 2, 2017 14:53, "Maxim Solodovnik" <so...@gmail.com> wrote:
>
> > I'll change the list and the question :)))
> >
> > WebSocketTester seems to be not usable in case Application is not
> destroyed
> > after it was used once
> > due to call to "webApplication.getWicketFilter().setFilterPath("");" in
> > constructor
> >
> > I'm going to create PR against `master` to improve this situation.
> >
> > What do you think what would be better option to change constructor
> > https://github.com/apache/wicket/blob/master/wicket-
> > native-websocket/wicket-native-websocket-core/src/
> > main/java/org/apache/wicket/protocol/ws/util/tester/
> > WebSocketTester.java#L54
> >
> > from:
> > webApplication.getWicketFilter().setFilterPath("");
> > to
> > -webApplication.getWicketFilter().setFilterPath("");
> > +if (webApplication.getWicketFilter().getFilterPath() == null)
> > +{
> > + webApplication.getWicketFilter().setFilterPath("");
> > +}
> > or to
> > -webApplication.getWicketFilter().setFilterPath("");
> > +setFilterPath();
> >
> > ...............
> >
> > // can be overriden in sub-classes
> > +protected void setFilterPath()
> > +{
> > + webApplication.getWicketFilter().setFilterPath("");
> > +}
> >
> >
> > Thanks in advance :)
> >
> >
> > On Mon, Oct 2, 2017 at 10:37 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Hello All,
> > >
> > > I have started to use WebSocketTester in my tests
> > > And have noticed weird behavior
> > >
> > > This class calls "webApplication.getWicketFilter().setFilterPath("");"
> > in
> > > constructor
> > > FilterPath can be set only once per application :(
> > > So it is impossible to re-use application in case WebSocketTester.
> > >
> > > Can I propose PR to create separate protected I can override and
> > > conditionally set filter path?
> > > Or maybe I'm trying to use WebSocketTester incorrectly?
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: Question regarding WebSocketTester

Posted by Martin Grigorov <ma...@gmail.com>.
+1

On Oct 2, 2017 14:53, "Maxim Solodovnik" <so...@gmail.com> wrote:

> I'll change the list and the question :)))
>
> WebSocketTester seems to be not usable in case Application is not destroyed
> after it was used once
> due to call to "webApplication.getWicketFilter().setFilterPath("");" in
> constructor
>
> I'm going to create PR against `master` to improve this situation.
>
> What do you think what would be better option to change constructor
> https://github.com/apache/wicket/blob/master/wicket-
> native-websocket/wicket-native-websocket-core/src/
> main/java/org/apache/wicket/protocol/ws/util/tester/
> WebSocketTester.java#L54
>
> from:
> webApplication.getWicketFilter().setFilterPath("");
> to
> -webApplication.getWicketFilter().setFilterPath("");
> +if (webApplication.getWicketFilter().getFilterPath() == null)
> +{
> + webApplication.getWicketFilter().setFilterPath("");
> +}
> or to
> -webApplication.getWicketFilter().setFilterPath("");
> +setFilterPath();
>
> ...............
>
> // can be overriden in sub-classes
> +protected void setFilterPath()
> +{
> + webApplication.getWicketFilter().setFilterPath("");
> +}
>
>
> Thanks in advance :)
>
>
> On Mon, Oct 2, 2017 at 10:37 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello All,
> >
> > I have started to use WebSocketTester in my tests
> > And have noticed weird behavior
> >
> > This class calls "webApplication.getWicketFilter().setFilterPath("");"
> in
> > constructor
> > FilterPath can be set only once per application :(
> > So it is impossible to re-use application in case WebSocketTester.
> >
> > Can I propose PR to create separate protected I can override and
> > conditionally set filter path?
> > Or maybe I'm trying to use WebSocketTester incorrectly?
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Question regarding WebSocketTester

Posted by Maxim Solodovnik <so...@gmail.com>.
I'll change the list and the question :)))

WebSocketTester seems to be not usable in case Application is not destroyed
after it was used once
due to call to "webApplication.getWicketFilter().setFilterPath("");" in
constructor

I'm going to create PR against `master` to improve this situation.

What do you think what would be better option to change constructor
https://github.com/apache/wicket/blob/master/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/util/tester/WebSocketTester.java#L54

from:
webApplication.getWicketFilter().setFilterPath("");
to
-webApplication.getWicketFilter().setFilterPath("");
+if (webApplication.getWicketFilter().getFilterPath() == null)
+{
+ webApplication.getWicketFilter().setFilterPath("");
+}
or to
-webApplication.getWicketFilter().setFilterPath("");
+setFilterPath();

...............

// can be overriden in sub-classes
+protected void setFilterPath()
+{
+ webApplication.getWicketFilter().setFilterPath("");
+}


Thanks in advance :)


On Mon, Oct 2, 2017 at 10:37 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> I have started to use WebSocketTester in my tests
> And have noticed weird behavior
>
> This class calls "webApplication.getWicketFilter().setFilterPath("");" in
> constructor
> FilterPath can be set only once per application :(
> So it is impossible to re-use application in case WebSocketTester.
>
> Can I propose PR to create separate protected I can override and
> conditionally set filter path?
> Or maybe I'm trying to use WebSocketTester incorrectly?
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax