Re: ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
Yep, I'll ping him today on IRC

*Romain Manni-Bucau*
*Twitter: @rmannibucau *
*Blog: **http://rmannibucau.wordpress.com/*
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/26 Jason Porter 

> Bring it up to Aslak. I highly doubt he's watching this list.
>
>
> On Wed, Sep 25, 2013 at 11:02 PM, Romain Manni-Bucau
> wrote:
>
> > I was looking for something more portable, in tomee my test passes as you
> > can guess ;)
> >
> > But ok, you join my thought: this case shows a "limitation" of
> > arquillian...that said not sure why url can be passed as @deployment
> > parameter, it should work in the arq lifecycle imo
> > Le 26 sept. 2013 06:58, "Mark Struberg"  a écrit :
> >
> > > I think a ThreadLocal ConfigSource is kind of an anti-pattern.
> > > Even in your case it looks like this only would work if you start the
> > > container inplace. But it will not work with remote containers.
> > >
> > > But there is nothing which prevents you from registering an own
> > > ThreadLocalTestConfigSource which you add as  to your tomee,
> right?
> > >
> > > LieGrue,
> > > strub
> > >
> > >
> > >
> > >
> > > - Original Message -
> > > > From: Romain Manni-Bucau 
> > > > To: dev@deltaspike.apache.org
> > > > Cc:
> > > > Sent: Wednesday, 25 September 2013, 21:49
> > > > Subject: Re: ConfigSource using ThreadLocal
> > > >
> > > >T he point is my webservice client is part of my app and then need app
> > > > config. The design cant change cause of tests. I can isolate it and
> > mock
> > > ut
> > > > through cdi but using config source is nicer
> > > > Le 25 sept. 2013 20:39, "John D. Ament" 
> > > > a écrit :
> > > >
> > > >>  Yeah... the target path of the deployment isn't available at
> > > >>  deployment creation.  It's only available after.
> > > >>
> > > >>  When I was doing some webservice testing, i simply instantiated
> using
> > > >>  the URL param, not injection of the webservice (I honestly find
> > > >>  webservice injection to be a bit difficult since endpoints will be
> > > >>  different in environments).
> > > >>
> > > >>
> > > >>
> > > >>  On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter
> > > > 
> > > >>  wrote:
> > > >>  > Ah, okay. Now I see.
> > > >>  >
> > > >>  >
> > > >>  > On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
> > > >>  > wrote:
> > > >>  >
> > > >>  >> Yep but the app doesnt know it and arquillian doesnt have it in
> > > >>  packaging
> > > >>  >> phase (@deployment)
> > > >>  >> Le 25 sept. 2013 19:51, "Jason Porter"
> > > >  a
> > > >>  écrit :
> > > >>  >>
> > > >>  >> > In that particular example, in the test, Arquillian knows the
> > > > URL of
> > > >>  the
> > > >>  >> > server, so the port should already be there, right? Maybe
> > > > I'm missing
> > > >>  >> > something.
> > > >>  >> >
> > > >>  >> >
> > > >>  >> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> > > >>  >> > wrote:
> > > >>  >> >
> > > >>  >> > > It would be a contextual config so in the case of
> > > > arquillian you'd
> > > >>  set
> > > >>  >> it
> > > >>  >> > > in the beginning of your  test method.
> > > >>  >> > >
> > > >>  >> > > The point is not if it works but if we can/should
> > > > support it.
> > > >>  >> > >
> > > >>  >> > > typically how to configure a webservice client url when
> > > > the port is
> > > >>  >> > random?
> > > >>  >> > >
> > > >>  >> > > *Romain Manni-Bucau*
> > > >>  >> > > *Twitter: @rmannibucau
> > > > *
> > > >>  >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > >>  >> > > http://rmannibucau.wordpress.com/>
> > > >>  >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > >>  >> > > *Github: https://github.com/rmannibucau*
> > > >>  >> > >
> > > >>  >> > >
> > > >>  >> > >
> > > >>  >> > > 2013/9/25 Jason Porter 
> > > >>  >> > >
> > > >>  >> > > > I'm not sure what good a ThreadLocal is going
> > > > to give you. Unless
> > > >>  >> > you're
> > > >>  >> > > > using @InSequence in your tests you're not
> > > > guaranteed when the
> > > >>  tests
> > > >>  >> > will
> > > >>  >> > > > run and if that ThreadLocal variable will be set.
> > > > Simply having
> > > >>  >> > > Arquillian
> > > >>  >> > > > inject the URL should be fine. Also if depending on
> > > > the forking
> > > >>  >> > parameter
> > > >>  >> > > > with JUnit it may not work anyway.
> > > >>  >> > > >
> > > >>  >> > > >
> > > >>  >> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> > > >>  >> > > > wrote:
> > > >>  >> > > >
> > > >>  >> > > > > Hi,
> > > >>  >> > > > >
> > > >>  >> > > > > I have the following use case: a config is
> > > > dynamic (typically
> > > >>  the
> > > >>  >> url
> > > >>  >> > > of
> > > >>  >> > > > > the server using arquillian -
> > > > @ArquillianResource URL url). I
> > > >>  need
> > > >>  >> > this
> > > >>  >> > > > url
> > > >>  >> > > > > in a config. In prod i use
> > > > apache-delt

Re: ConfigSource using ThreadLocal

2013-09-25 Thread Jason Porter
Bring it up to Aslak. I highly doubt he's watching this list.


On Wed, Sep 25, 2013 at 11:02 PM, Romain Manni-Bucau
wrote:

> I was looking for something more portable, in tomee my test passes as you
> can guess ;)
>
> But ok, you join my thought: this case shows a "limitation" of
> arquillian...that said not sure why url can be passed as @deployment
> parameter, it should work in the arq lifecycle imo
> Le 26 sept. 2013 06:58, "Mark Struberg"  a écrit :
>
> > I think a ThreadLocal ConfigSource is kind of an anti-pattern.
> > Even in your case it looks like this only would work if you start the
> > container inplace. But it will not work with remote containers.
> >
> > But there is nothing which prevents you from registering an own
> > ThreadLocalTestConfigSource which you add as  to your tomee, right?
> >
> > LieGrue,
> > strub
> >
> >
> >
> >
> > - Original Message -
> > > From: Romain Manni-Bucau 
> > > To: dev@deltaspike.apache.org
> > > Cc:
> > > Sent: Wednesday, 25 September 2013, 21:49
> > > Subject: Re: ConfigSource using ThreadLocal
> > >
> > >T he point is my webservice client is part of my app and then need app
> > > config. The design cant change cause of tests. I can isolate it and
> mock
> > ut
> > > through cdi but using config source is nicer
> > > Le 25 sept. 2013 20:39, "John D. Ament" 
> > > a écrit :
> > >
> > >>  Yeah... the target path of the deployment isn't available at
> > >>  deployment creation.  It's only available after.
> > >>
> > >>  When I was doing some webservice testing, i simply instantiated using
> > >>  the URL param, not injection of the webservice (I honestly find
> > >>  webservice injection to be a bit difficult since endpoints will be
> > >>  different in environments).
> > >>
> > >>
> > >>
> > >>  On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter
> > > 
> > >>  wrote:
> > >>  > Ah, okay. Now I see.
> > >>  >
> > >>  >
> > >>  > On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
> > >>  > wrote:
> > >>  >
> > >>  >> Yep but the app doesnt know it and arquillian doesnt have it in
> > >>  packaging
> > >>  >> phase (@deployment)
> > >>  >> Le 25 sept. 2013 19:51, "Jason Porter"
> > >  a
> > >>  écrit :
> > >>  >>
> > >>  >> > In that particular example, in the test, Arquillian knows the
> > > URL of
> > >>  the
> > >>  >> > server, so the port should already be there, right? Maybe
> > > I'm missing
> > >>  >> > something.
> > >>  >> >
> > >>  >> >
> > >>  >> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> > >>  >> > wrote:
> > >>  >> >
> > >>  >> > > It would be a contextual config so in the case of
> > > arquillian you'd
> > >>  set
> > >>  >> it
> > >>  >> > > in the beginning of your  test method.
> > >>  >> > >
> > >>  >> > > The point is not if it works but if we can/should
> > > support it.
> > >>  >> > >
> > >>  >> > > typically how to configure a webservice client url when
> > > the port is
> > >>  >> > random?
> > >>  >> > >
> > >>  >> > > *Romain Manni-Bucau*
> > >>  >> > > *Twitter: @rmannibucau
> > > *
> > >>  >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > >>  >> > > http://rmannibucau.wordpress.com/>
> > >>  >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > >>  >> > > *Github: https://github.com/rmannibucau*
> > >>  >> > >
> > >>  >> > >
> > >>  >> > >
> > >>  >> > > 2013/9/25 Jason Porter 
> > >>  >> > >
> > >>  >> > > > I'm not sure what good a ThreadLocal is going
> > > to give you. Unless
> > >>  >> > you're
> > >>  >> > > > using @InSequence in your tests you're not
> > > guaranteed when the
> > >>  tests
> > >>  >> > will
> > >>  >> > > > run and if that ThreadLocal variable will be set.
> > > Simply having
> > >>  >> > > Arquillian
> > >>  >> > > > inject the URL should be fine. Also if depending on
> > > the forking
> > >>  >> > parameter
> > >>  >> > > > with JUnit it may not work anyway.
> > >>  >> > > >
> > >>  >> > > >
> > >>  >> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> > >>  >> > > > wrote:
> > >>  >> > > >
> > >>  >> > > > > Hi,
> > >>  >> > > > >
> > >>  >> > > > > I have the following use case: a config is
> > > dynamic (typically
> > >>  the
> > >>  >> url
> > >>  >> > > of
> > >>  >> > > > > the server using arquillian -
> > > @ArquillianResource URL url). I
> > >>  need
> > >>  >> > this
> > >>  >> > > > url
> > >>  >> > > > > in a config. In prod i use
> > > apache-deltaspike.properties or a
> > >>  custom
> > >>  >> > > > > ConfigSource. I see an easy solution being a
> > > ThreadLocal (or a
> > >>  >> global
> > >>  >> > > > Map)
> > >>  >> > > > > backing a TestConfigSource.
> > >>  >> > > > >
> > >>  >> > > > > The question now: do we provide a default impl
> > > answering this
> > >>  need?
> > >>  >> > > > (maybe
> > >>  >> > > > > an in memory configuration == map/properties
> > > updatable through a
> > >>  >> > static
> > >>  >> > > > > method)
> > >>  >> > > > >
> > >>  >> > > > > wdyt?
> > >>  >> > > > >
> > >>  >> > > > >
> > >>  >> 

Re: ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
I was looking for something more portable, in tomee my test passes as you
can guess ;)

But ok, you join my thought: this case shows a "limitation" of
arquillian...that said not sure why url can be passed as @deployment
parameter, it should work in the arq lifecycle imo
Le 26 sept. 2013 06:58, "Mark Struberg"  a écrit :

> I think a ThreadLocal ConfigSource is kind of an anti-pattern.
> Even in your case it looks like this only would work if you start the
> container inplace. But it will not work with remote containers.
>
> But there is nothing which prevents you from registering an own
> ThreadLocalTestConfigSource which you add as  to your tomee, right?
>
> LieGrue,
> strub
>
>
>
>
> - Original Message -
> > From: Romain Manni-Bucau 
> > To: dev@deltaspike.apache.org
> > Cc:
> > Sent: Wednesday, 25 September 2013, 21:49
> > Subject: Re: ConfigSource using ThreadLocal
> >
> >T he point is my webservice client is part of my app and then need app
> > config. The design cant change cause of tests. I can isolate it and mock
> ut
> > through cdi but using config source is nicer
> > Le 25 sept. 2013 20:39, "John D. Ament" 
> > a écrit :
> >
> >>  Yeah... the target path of the deployment isn't available at
> >>  deployment creation.  It's only available after.
> >>
> >>  When I was doing some webservice testing, i simply instantiated using
> >>  the URL param, not injection of the webservice (I honestly find
> >>  webservice injection to be a bit difficult since endpoints will be
> >>  different in environments).
> >>
> >>
> >>
> >>  On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter
> > 
> >>  wrote:
> >>  > Ah, okay. Now I see.
> >>  >
> >>  >
> >>  > On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
> >>  > wrote:
> >>  >
> >>  >> Yep but the app doesnt know it and arquillian doesnt have it in
> >>  packaging
> >>  >> phase (@deployment)
> >>  >> Le 25 sept. 2013 19:51, "Jason Porter"
> >  a
> >>  écrit :
> >>  >>
> >>  >> > In that particular example, in the test, Arquillian knows the
> > URL of
> >>  the
> >>  >> > server, so the port should already be there, right? Maybe
> > I'm missing
> >>  >> > something.
> >>  >> >
> >>  >> >
> >>  >> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> >>  >> > wrote:
> >>  >> >
> >>  >> > > It would be a contextual config so in the case of
> > arquillian you'd
> >>  set
> >>  >> it
> >>  >> > > in the beginning of your  test method.
> >>  >> > >
> >>  >> > > The point is not if it works but if we can/should
> > support it.
> >>  >> > >
> >>  >> > > typically how to configure a webservice client url when
> > the port is
> >>  >> > random?
> >>  >> > >
> >>  >> > > *Romain Manni-Bucau*
> >>  >> > > *Twitter: @rmannibucau
> > *
> >>  >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> >>  >> > > http://rmannibucau.wordpress.com/>
> >>  >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >>  >> > > *Github: https://github.com/rmannibucau*
> >>  >> > >
> >>  >> > >
> >>  >> > >
> >>  >> > > 2013/9/25 Jason Porter 
> >>  >> > >
> >>  >> > > > I'm not sure what good a ThreadLocal is going
> > to give you. Unless
> >>  >> > you're
> >>  >> > > > using @InSequence in your tests you're not
> > guaranteed when the
> >>  tests
> >>  >> > will
> >>  >> > > > run and if that ThreadLocal variable will be set.
> > Simply having
> >>  >> > > Arquillian
> >>  >> > > > inject the URL should be fine. Also if depending on
> > the forking
> >>  >> > parameter
> >>  >> > > > with JUnit it may not work anyway.
> >>  >> > > >
> >>  >> > > >
> >>  >> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> >>  >> > > > wrote:
> >>  >> > > >
> >>  >> > > > > Hi,
> >>  >> > > > >
> >>  >> > > > > I have the following use case: a config is
> > dynamic (typically
> >>  the
> >>  >> url
> >>  >> > > of
> >>  >> > > > > the server using arquillian -
> > @ArquillianResource URL url). I
> >>  need
> >>  >> > this
> >>  >> > > > url
> >>  >> > > > > in a config. In prod i use
> > apache-deltaspike.properties or a
> >>  custom
> >>  >> > > > > ConfigSource. I see an easy solution being a
> > ThreadLocal (or a
> >>  >> global
> >>  >> > > > Map)
> >>  >> > > > > backing a TestConfigSource.
> >>  >> > > > >
> >>  >> > > > > The question now: do we provide a default impl
> > answering this
> >>  need?
> >>  >> > > > (maybe
> >>  >> > > > > an in memory configuration == map/properties
> > updatable through a
> >>  >> > static
> >>  >> > > > > method)
> >>  >> > > > >
> >>  >> > > > > wdyt?
> >>  >> > > > >
> >>  >> > > > >
> >>  >> > > > > *Romain Manni-Bucau*
> >>  >> > > > > *Twitter: @rmannibucau
> > *
> >>  >> > > > > *Blog:
> > **http://rmannibucau.wordpress.com/*<
> >>  >> > > > > http://rmannibucau.wordpress.com/>
> >>  >> > > > > *LinkedIn:
> > **http://fr.linkedin.com/in/rmannibucau*
> >>  >> > > > > *Github: https://github.com/rmannibucau*
> >>  >> > > > >
> >>  >> > > >
> >>  >> > > >
> >>  >> > > >
> >>  

Re: ConfigSource using ThreadLocal

2013-09-25 Thread Mark Struberg
I think a ThreadLocal ConfigSource is kind of an anti-pattern. 
Even in your case it looks like this only would work if you start the container 
inplace. But it will not work with remote containers.

But there is nothing which prevents you from registering an own 
ThreadLocalTestConfigSource which you add as  to your tomee, right?

LieGrue,
strub




- Original Message -
> From: Romain Manni-Bucau 
> To: dev@deltaspike.apache.org
> Cc: 
> Sent: Wednesday, 25 September 2013, 21:49
> Subject: Re: ConfigSource using ThreadLocal
> 
>T he point is my webservice client is part of my app and then need app
> config. The design cant change cause of tests. I can isolate it and mock ut
> through cdi but using config source is nicer
> Le 25 sept. 2013 20:39, "John D. Ament"  
> a écrit :
> 
>>  Yeah... the target path of the deployment isn't available at
>>  deployment creation.  It's only available after.
>> 
>>  When I was doing some webservice testing, i simply instantiated using
>>  the URL param, not injection of the webservice (I honestly find
>>  webservice injection to be a bit difficult since endpoints will be
>>  different in environments).
>> 
>> 
>> 
>>  On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter 
> 
>>  wrote:
>>  > Ah, okay. Now I see.
>>  >
>>  >
>>  > On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
>>  > wrote:
>>  >
>>  >> Yep but the app doesnt know it and arquillian doesnt have it in
>>  packaging
>>  >> phase (@deployment)
>>  >> Le 25 sept. 2013 19:51, "Jason Porter" 
>  a
>>  écrit :
>>  >>
>>  >> > In that particular example, in the test, Arquillian knows the 
> URL of
>>  the
>>  >> > server, so the port should already be there, right? Maybe 
> I'm missing
>>  >> > something.
>>  >> >
>>  >> >
>>  >> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
>>  >> > wrote:
>>  >> >
>>  >> > > It would be a contextual config so in the case of 
> arquillian you'd
>>  set
>>  >> it
>>  >> > > in the beginning of your  test method.
>>  >> > >
>>  >> > > The point is not if it works but if we can/should 
> support it.
>>  >> > >
>>  >> > > typically how to configure a webservice client url when 
> the port is
>>  >> > random?
>>  >> > >
>>  >> > > *Romain Manni-Bucau*
>>  >> > > *Twitter: @rmannibucau 
> *
>>  >> > > *Blog: **http://rmannibucau.wordpress.com/*<
>>  >> > > http://rmannibucau.wordpress.com/>
>>  >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>  >> > > *Github: https://github.com/rmannibucau*
>>  >> > >
>>  >> > >
>>  >> > >
>>  >> > > 2013/9/25 Jason Porter 
>>  >> > >
>>  >> > > > I'm not sure what good a ThreadLocal is going 
> to give you. Unless
>>  >> > you're
>>  >> > > > using @InSequence in your tests you're not 
> guaranteed when the
>>  tests
>>  >> > will
>>  >> > > > run and if that ThreadLocal variable will be set. 
> Simply having
>>  >> > > Arquillian
>>  >> > > > inject the URL should be fine. Also if depending on 
> the forking
>>  >> > parameter
>>  >> > > > with JUnit it may not work anyway.
>>  >> > > >
>>  >> > > >
>>  >> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
>>  >> > > > wrote:
>>  >> > > >
>>  >> > > > > Hi,
>>  >> > > > >
>>  >> > > > > I have the following use case: a config is 
> dynamic (typically
>>  the
>>  >> url
>>  >> > > of
>>  >> > > > > the server using arquillian - 
> @ArquillianResource URL url). I
>>  need
>>  >> > this
>>  >> > > > url
>>  >> > > > > in a config. In prod i use 
> apache-deltaspike.properties or a
>>  custom
>>  >> > > > > ConfigSource. I see an easy solution being a 
> ThreadLocal (or a
>>  >> global
>>  >> > > > Map)
>>  >> > > > > backing a TestConfigSource.
>>  >> > > > >
>>  >> > > > > The question now: do we provide a default impl 
> answering this
>>  need?
>>  >> > > > (maybe
>>  >> > > > > an in memory configuration == map/properties 
> updatable through a
>>  >> > static
>>  >> > > > > method)
>>  >> > > > >
>>  >> > > > > wdyt?
>>  >> > > > >
>>  >> > > > >
>>  >> > > > > *Romain Manni-Bucau*
>>  >> > > > > *Twitter: @rmannibucau 
> *
>>  >> > > > > *Blog: 
> **http://rmannibucau.wordpress.com/*<
>>  >> > > > > http://rmannibucau.wordpress.com/>
>>  >> > > > > *LinkedIn: 
> **http://fr.linkedin.com/in/rmannibucau*
>>  >> > > > > *Github: https://github.com/rmannibucau*
>>  >> > > > >
>>  >> > > >
>>  >> > > >
>>  >> > > >
>>  >> > > > --
>>  >> > > > Jason Porter
>>  >> > > > http://en.gravatar.com/lightguardjp
>>  >> > > >
>>  >> > >
>>  >> >
>>  >> >
>>  >> >
>>  >> > --
>>  >> > Jason Porter
>>  >> > http://en.gravatar.com/lightguardjp
>>  >> >
>>  >>
>>  >
>>  >
>>  >
>>  > --
>>  > Jason Porter
>>  > http://en.gravatar.com/lightguardjp
>> 
>


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
The point is my webservice client is part of my app and then need app
config. The design cant change cause of tests. I can isolate it and mock ut
through cdi but using config source is nicer
Le 25 sept. 2013 20:39, "John D. Ament"  a écrit :

> Yeah... the target path of the deployment isn't available at
> deployment creation.  It's only available after.
>
> When I was doing some webservice testing, i simply instantiated using
> the URL param, not injection of the webservice (I honestly find
> webservice injection to be a bit difficult since endpoints will be
> different in environments).
>
>
>
> On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter 
> wrote:
> > Ah, okay. Now I see.
> >
> >
> > On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
> > wrote:
> >
> >> Yep but the app doesnt know it and arquillian doesnt have it in
> packaging
> >> phase (@deployment)
> >> Le 25 sept. 2013 19:51, "Jason Porter"  a
> écrit :
> >>
> >> > In that particular example, in the test, Arquillian knows the URL of
> the
> >> > server, so the port should already be there, right? Maybe I'm missing
> >> > something.
> >> >
> >> >
> >> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> >> > wrote:
> >> >
> >> > > It would be a contextual config so in the case of arquillian you'd
> set
> >> it
> >> > > in the beginning of your  test method.
> >> > >
> >> > > The point is not if it works but if we can/should support it.
> >> > >
> >> > > typically how to configure a webservice client url when the port is
> >> > random?
> >> > >
> >> > > *Romain Manni-Bucau*
> >> > > *Twitter: @rmannibucau *
> >> > > *Blog: **http://rmannibucau.wordpress.com/*<
> >> > > http://rmannibucau.wordpress.com/>
> >> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >> > > *Github: https://github.com/rmannibucau*
> >> > >
> >> > >
> >> > >
> >> > > 2013/9/25 Jason Porter 
> >> > >
> >> > > > I'm not sure what good a ThreadLocal is going to give you. Unless
> >> > you're
> >> > > > using @InSequence in your tests you're not guaranteed when the
> tests
> >> > will
> >> > > > run and if that ThreadLocal variable will be set. Simply having
> >> > > Arquillian
> >> > > > inject the URL should be fine. Also if depending on the forking
> >> > parameter
> >> > > > with JUnit it may not work anyway.
> >> > > >
> >> > > >
> >> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> >> > > > wrote:
> >> > > >
> >> > > > > Hi,
> >> > > > >
> >> > > > > I have the following use case: a config is dynamic (typically
> the
> >> url
> >> > > of
> >> > > > > the server using arquillian - @ArquillianResource URL url). I
> need
> >> > this
> >> > > > url
> >> > > > > in a config. In prod i use apache-deltaspike.properties or a
> custom
> >> > > > > ConfigSource. I see an easy solution being a ThreadLocal (or a
> >> global
> >> > > > Map)
> >> > > > > backing a TestConfigSource.
> >> > > > >
> >> > > > > The question now: do we provide a default impl answering this
> need?
> >> > > > (maybe
> >> > > > > an in memory configuration == map/properties updatable through a
> >> > static
> >> > > > > method)
> >> > > > >
> >> > > > > wdyt?
> >> > > > >
> >> > > > >
> >> > > > > *Romain Manni-Bucau*
> >> > > > > *Twitter: @rmannibucau *
> >> > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> >> > > > > http://rmannibucau.wordpress.com/>
> >> > > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> >> > > > > *Github: https://github.com/rmannibucau*
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > Jason Porter
> >> > > > http://en.gravatar.com/lightguardjp
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > Jason Porter
> >> > http://en.gravatar.com/lightguardjp
> >> >
> >>
> >
> >
> >
> > --
> > Jason Porter
> > http://en.gravatar.com/lightguardjp
>


Re: ConfigSource using ThreadLocal

2013-09-25 Thread John D. Ament
Yeah... the target path of the deployment isn't available at
deployment creation.  It's only available after.

When I was doing some webservice testing, i simply instantiated using
the URL param, not injection of the webservice (I honestly find
webservice injection to be a bit difficult since endpoints will be
different in environments).



On Wed, Sep 25, 2013 at 2:35 PM, Jason Porter  wrote:
> Ah, okay. Now I see.
>
>
> On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
> wrote:
>
>> Yep but the app doesnt know it and arquillian doesnt have it in packaging
>> phase (@deployment)
>> Le 25 sept. 2013 19:51, "Jason Porter"  a écrit :
>>
>> > In that particular example, in the test, Arquillian knows the URL of the
>> > server, so the port should already be there, right? Maybe I'm missing
>> > something.
>> >
>> >
>> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
>> > wrote:
>> >
>> > > It would be a contextual config so in the case of arquillian you'd set
>> it
>> > > in the beginning of your  test method.
>> > >
>> > > The point is not if it works but if we can/should support it.
>> > >
>> > > typically how to configure a webservice client url when the port is
>> > random?
>> > >
>> > > *Romain Manni-Bucau*
>> > > *Twitter: @rmannibucau *
>> > > *Blog: **http://rmannibucau.wordpress.com/*<
>> > > http://rmannibucau.wordpress.com/>
>> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> > > *Github: https://github.com/rmannibucau*
>> > >
>> > >
>> > >
>> > > 2013/9/25 Jason Porter 
>> > >
>> > > > I'm not sure what good a ThreadLocal is going to give you. Unless
>> > you're
>> > > > using @InSequence in your tests you're not guaranteed when the tests
>> > will
>> > > > run and if that ThreadLocal variable will be set. Simply having
>> > > Arquillian
>> > > > inject the URL should be fine. Also if depending on the forking
>> > parameter
>> > > > with JUnit it may not work anyway.
>> > > >
>> > > >
>> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
>> > > > wrote:
>> > > >
>> > > > > Hi,
>> > > > >
>> > > > > I have the following use case: a config is dynamic (typically the
>> url
>> > > of
>> > > > > the server using arquillian - @ArquillianResource URL url). I need
>> > this
>> > > > url
>> > > > > in a config. In prod i use apache-deltaspike.properties or a custom
>> > > > > ConfigSource. I see an easy solution being a ThreadLocal (or a
>> global
>> > > > Map)
>> > > > > backing a TestConfigSource.
>> > > > >
>> > > > > The question now: do we provide a default impl answering this need?
>> > > > (maybe
>> > > > > an in memory configuration == map/properties updatable through a
>> > static
>> > > > > method)
>> > > > >
>> > > > > wdyt?
>> > > > >
>> > > > >
>> > > > > *Romain Manni-Bucau*
>> > > > > *Twitter: @rmannibucau *
>> > > > > *Blog: **http://rmannibucau.wordpress.com/*<
>> > > > > http://rmannibucau.wordpress.com/>
>> > > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> > > > > *Github: https://github.com/rmannibucau*
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Jason Porter
>> > > > http://en.gravatar.com/lightguardjp
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Jason Porter
>> > http://en.gravatar.com/lightguardjp
>> >
>>
>
>
>
> --
> Jason Porter
> http://en.gravatar.com/lightguardjp


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Jason Porter
Ah, okay. Now I see.


On Wed, Sep 25, 2013 at 12:12 PM, Romain Manni-Bucau
wrote:

> Yep but the app doesnt know it and arquillian doesnt have it in packaging
> phase (@deployment)
> Le 25 sept. 2013 19:51, "Jason Porter"  a écrit :
>
> > In that particular example, in the test, Arquillian knows the URL of the
> > server, so the port should already be there, right? Maybe I'm missing
> > something.
> >
> >
> > On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> > wrote:
> >
> > > It would be a contextual config so in the case of arquillian you'd set
> it
> > > in the beginning of your  test method.
> > >
> > > The point is not if it works but if we can/should support it.
> > >
> > > typically how to configure a webservice client url when the port is
> > random?
> > >
> > > *Romain Manni-Bucau*
> > > *Twitter: @rmannibucau *
> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > http://rmannibucau.wordpress.com/>
> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > *Github: https://github.com/rmannibucau*
> > >
> > >
> > >
> > > 2013/9/25 Jason Porter 
> > >
> > > > I'm not sure what good a ThreadLocal is going to give you. Unless
> > you're
> > > > using @InSequence in your tests you're not guaranteed when the tests
> > will
> > > > run and if that ThreadLocal variable will be set. Simply having
> > > Arquillian
> > > > inject the URL should be fine. Also if depending on the forking
> > parameter
> > > > with JUnit it may not work anyway.
> > > >
> > > >
> > > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have the following use case: a config is dynamic (typically the
> url
> > > of
> > > > > the server using arquillian - @ArquillianResource URL url). I need
> > this
> > > > url
> > > > > in a config. In prod i use apache-deltaspike.properties or a custom
> > > > > ConfigSource. I see an easy solution being a ThreadLocal (or a
> global
> > > > Map)
> > > > > backing a TestConfigSource.
> > > > >
> > > > > The question now: do we provide a default impl answering this need?
> > > > (maybe
> > > > > an in memory configuration == map/properties updatable through a
> > static
> > > > > method)
> > > > >
> > > > > wdyt?
> > > > >
> > > > >
> > > > > *Romain Manni-Bucau*
> > > > > *Twitter: @rmannibucau *
> > > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > > http://rmannibucau.wordpress.com/>
> > > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > > > *Github: https://github.com/rmannibucau*
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Jason Porter
> > > > http://en.gravatar.com/lightguardjp
> > > >
> > >
> >
> >
> >
> > --
> > Jason Porter
> > http://en.gravatar.com/lightguardjp
> >
>



-- 
Jason Porter
http://en.gravatar.com/lightguardjp


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
Yep but the app doesnt know it and arquillian doesnt have it in packaging
phase (@deployment)
Le 25 sept. 2013 19:51, "Jason Porter"  a écrit :

> In that particular example, in the test, Arquillian knows the URL of the
> server, so the port should already be there, right? Maybe I'm missing
> something.
>
>
> On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
> wrote:
>
> > It would be a contextual config so in the case of arquillian you'd set it
> > in the beginning of your  test method.
> >
> > The point is not if it works but if we can/should support it.
> >
> > typically how to configure a webservice client url when the port is
> random?
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau *
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/9/25 Jason Porter 
> >
> > > I'm not sure what good a ThreadLocal is going to give you. Unless
> you're
> > > using @InSequence in your tests you're not guaranteed when the tests
> will
> > > run and if that ThreadLocal variable will be set. Simply having
> > Arquillian
> > > inject the URL should be fine. Also if depending on the forking
> parameter
> > > with JUnit it may not work anyway.
> > >
> > >
> > > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I have the following use case: a config is dynamic (typically the url
> > of
> > > > the server using arquillian - @ArquillianResource URL url). I need
> this
> > > url
> > > > in a config. In prod i use apache-deltaspike.properties or a custom
> > > > ConfigSource. I see an easy solution being a ThreadLocal (or a global
> > > Map)
> > > > backing a TestConfigSource.
> > > >
> > > > The question now: do we provide a default impl answering this need?
> > > (maybe
> > > > an in memory configuration == map/properties updatable through a
> static
> > > > method)
> > > >
> > > > wdyt?
> > > >
> > > >
> > > > *Romain Manni-Bucau*
> > > > *Twitter: @rmannibucau *
> > > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > > http://rmannibucau.wordpress.com/>
> > > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > > *Github: https://github.com/rmannibucau*
> > > >
> > >
> > >
> > >
> > > --
> > > Jason Porter
> > > http://en.gravatar.com/lightguardjp
> > >
> >
>
>
>
> --
> Jason Porter
> http://en.gravatar.com/lightguardjp
>


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Jason Porter
In that particular example, in the test, Arquillian knows the URL of the
server, so the port should already be there, right? Maybe I'm missing
something.


On Wed, Sep 25, 2013 at 10:51 AM, Romain Manni-Bucau
wrote:

> It would be a contextual config so in the case of arquillian you'd set it
> in the beginning of your  test method.
>
> The point is not if it works but if we can/should support it.
>
> typically how to configure a webservice client url when the port is random?
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau *
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/9/25 Jason Porter 
>
> > I'm not sure what good a ThreadLocal is going to give you. Unless you're
> > using @InSequence in your tests you're not guaranteed when the tests will
> > run and if that ThreadLocal variable will be set. Simply having
> Arquillian
> > inject the URL should be fine. Also if depending on the forking parameter
> > with JUnit it may not work anyway.
> >
> >
> > On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> > wrote:
> >
> > > Hi,
> > >
> > > I have the following use case: a config is dynamic (typically the url
> of
> > > the server using arquillian - @ArquillianResource URL url). I need this
> > url
> > > in a config. In prod i use apache-deltaspike.properties or a custom
> > > ConfigSource. I see an easy solution being a ThreadLocal (or a global
> > Map)
> > > backing a TestConfigSource.
> > >
> > > The question now: do we provide a default impl answering this need?
> > (maybe
> > > an in memory configuration == map/properties updatable through a static
> > > method)
> > >
> > > wdyt?
> > >
> > >
> > > *Romain Manni-Bucau*
> > > *Twitter: @rmannibucau *
> > > *Blog: **http://rmannibucau.wordpress.com/*<
> > > http://rmannibucau.wordpress.com/>
> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > > *Github: https://github.com/rmannibucau*
> > >
> >
> >
> >
> > --
> > Jason Porter
> > http://en.gravatar.com/lightguardjp
> >
>



-- 
Jason Porter
http://en.gravatar.com/lightguardjp


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
It would be a contextual config so in the case of arquillian you'd set it
in the beginning of your  test method.

The point is not if it works but if we can/should support it.

typically how to configure a webservice client url when the port is random?

*Romain Manni-Bucau*
*Twitter: @rmannibucau *
*Blog: **http://rmannibucau.wordpress.com/*
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/25 Jason Porter 

> I'm not sure what good a ThreadLocal is going to give you. Unless you're
> using @InSequence in your tests you're not guaranteed when the tests will
> run and if that ThreadLocal variable will be set. Simply having Arquillian
> inject the URL should be fine. Also if depending on the forking parameter
> with JUnit it may not work anyway.
>
>
> On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> wrote:
>
> > Hi,
> >
> > I have the following use case: a config is dynamic (typically the url of
> > the server using arquillian - @ArquillianResource URL url). I need this
> url
> > in a config. In prod i use apache-deltaspike.properties or a custom
> > ConfigSource. I see an easy solution being a ThreadLocal (or a global
> Map)
> > backing a TestConfigSource.
> >
> > The question now: do we provide a default impl answering this need?
> (maybe
> > an in memory configuration == map/properties updatable through a static
> > method)
> >
> > wdyt?
> >
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau *
> > *Blog: **http://rmannibucau.wordpress.com/*<
> > http://rmannibucau.wordpress.com/>
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
>
>
>
> --
> Jason Porter
> http://en.gravatar.com/lightguardjp
>


Re: ConfigSource using ThreadLocal

2013-09-25 Thread John D. Ament
Also, couldn't you deploy an application scoped config source, and set
the value (assuming you're InSequence).

Also, you don't need to use @InSequence if you use JUnit ordering Name
Ascending: https://github.com/junit-team/junit/wiki/Test-execution-order

John

On Wed, Sep 25, 2013 at 12:47 PM, Jason Porter  wrote:
> I'm not sure what good a ThreadLocal is going to give you. Unless you're
> using @InSequence in your tests you're not guaranteed when the tests will
> run and if that ThreadLocal variable will be set. Simply having Arquillian
> inject the URL should be fine. Also if depending on the forking parameter
> with JUnit it may not work anyway.
>
>
> On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
> wrote:
>
>> Hi,
>>
>> I have the following use case: a config is dynamic (typically the url of
>> the server using arquillian - @ArquillianResource URL url). I need this url
>> in a config. In prod i use apache-deltaspike.properties or a custom
>> ConfigSource. I see an easy solution being a ThreadLocal (or a global Map)
>> backing a TestConfigSource.
>>
>> The question now: do we provide a default impl answering this need? (maybe
>> an in memory configuration == map/properties updatable through a static
>> method)
>>
>> wdyt?
>>
>>
>> *Romain Manni-Bucau*
>> *Twitter: @rmannibucau *
>> *Blog: **http://rmannibucau.wordpress.com/*<
>> http://rmannibucau.wordpress.com/>
>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> *Github: https://github.com/rmannibucau*
>>
>
>
>
> --
> Jason Porter
> http://en.gravatar.com/lightguardjp


Re: ConfigSource using ThreadLocal

2013-09-25 Thread Jason Porter
I'm not sure what good a ThreadLocal is going to give you. Unless you're
using @InSequence in your tests you're not guaranteed when the tests will
run and if that ThreadLocal variable will be set. Simply having Arquillian
inject the URL should be fine. Also if depending on the forking parameter
with JUnit it may not work anyway.


On Wed, Sep 25, 2013 at 5:01 AM, Romain Manni-Bucau
wrote:

> Hi,
>
> I have the following use case: a config is dynamic (typically the url of
> the server using arquillian - @ArquillianResource URL url). I need this url
> in a config. In prod i use apache-deltaspike.properties or a custom
> ConfigSource. I see an easy solution being a ThreadLocal (or a global Map)
> backing a TestConfigSource.
>
> The question now: do we provide a default impl answering this need? (maybe
> an in memory configuration == map/properties updatable through a static
> method)
>
> wdyt?
>
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau *
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>



-- 
Jason Porter
http://en.gravatar.com/lightguardjp


ConfigSource using ThreadLocal

2013-09-25 Thread Romain Manni-Bucau
Hi,

I have the following use case: a config is dynamic (typically the url of
the server using arquillian - @ArquillianResource URL url). I need this url
in a config. In prod i use apache-deltaspike.properties or a custom
ConfigSource. I see an easy solution being a ThreadLocal (or a global Map)
backing a TestConfigSource.

The question now: do we provide a default impl answering this need? (maybe
an in memory configuration == map/properties updatable through a static
method)

wdyt?


*Romain Manni-Bucau*
*Twitter: @rmannibucau *
*Blog: **http://rmannibucau.wordpress.com/*
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*