You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ilya Obshadko <il...@gmail.com> on 2014/08/06 06:44:29 UTC

injecting symbols in QA mode

I'm trying to set up QA execution mode for unit & integration tests with
TestNG, using PageTester.

Upon test launch, I receive the following error:

[2014-08-06 08:37:56,272] [ERROR] [Registry] Symbol 'my.custom.symbol' is
not defined.

Not sure what's wrong here: this symbol is defined in both web.xml (as
context parameter) and pom.xml (as a system property
in maven-surefire-plugin configuration).

Thanks for any suggestions.

-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Ilya Obshadko <il...@gmail.com>.
The situation is even more weird: <systemProperties> are not supported by
surefire plugin, while <systemPropertyVariables> are not supported by jetty
plugin.

Maybe this is going to be useful for someone else - I spent a lot of time
to figure it out.


On Thu, Aug 7, 2014 at 9:51 PM, Ilya Obshadko <il...@gmail.com>
wrote:

> I finally found the answer.
>
> In fact, deprecated maven <systemProperties> tag is not just deprecated,
> it's now ignored. When I've changed that to <systemPropertyVariables>
> everything started to work as expected.
>
>
> On Fri, Aug 8, 2014 at 2:00 AM, Ilya Obshadko <il...@gmail.com>
> wrote:
>
>> I don't have any problems with module classes (yet). The problem is only
>> with injected configuration symbols.
>>
>> When I'm running 'mvn test', I can see that module binding works fine,
>> but when it comes to service contribution methods, I receive an error.
>>
>> So I have a method in my main application module:
>>
>> public static void contributeMyCustomService (
>>     @Inject @Symbol("my.custom.symbol") String mySymbol ) {
>>     // something here
>> }
>>
>> The error I receive is:
>>
>> [2014-08-07 18:42:57,176] [ERROR] [Registry] Symbol 'my.custom.symbol' is
>> not defined.
>>
>> So, you suggest me to add QaModule.class as a last argument to PageTester
>> constructor, and contribute all missing configuration symbols from there.
>> I've tried that, but still have the same result.
>> QaModule contributeApplicationDefaults is never being called.
>>
>> I can't understand what to do next, because configuration symbol does
>> present in maven-surefire-plugin configuration section.
>>
>>
>>
>> On Thu, Aug 7, 2014 at 6:36 PM, Lance Java <la...@googlemail.com>
>> wrote:
>>
>>> As I mentioned, there's a PageTester constructor which accepts module
>>> classes. You can explicitly pass the modules you want to test.
>>>
>>> Please ignore my earlier comments regarding pom.xml. I was assuming you
>>> were talking about the jar manifest when you were discussing maven
>>> surefire
>>> properties.
>>>
>>> It's best to keep your test config out of maven IMHO. This way it's
>>> easier
>>> to run tests in your ide.
>>>
>>
>>
>>
>> --
>> Ilya Obshadko
>>
>>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Ilya Obshadko <il...@gmail.com>.
I finally found the answer.

In fact, deprecated maven <systemProperties> tag is not just deprecated,
it's now ignored. When I've changed that to <systemPropertyVariables>
everything started to work as expected.


On Fri, Aug 8, 2014 at 2:00 AM, Ilya Obshadko <il...@gmail.com>
wrote:

> I don't have any problems with module classes (yet). The problem is only
> with injected configuration symbols.
>
> When I'm running 'mvn test', I can see that module binding works fine, but
> when it comes to service contribution methods, I receive an error.
>
> So I have a method in my main application module:
>
> public static void contributeMyCustomService (
>     @Inject @Symbol("my.custom.symbol") String mySymbol ) {
>     // something here
> }
>
> The error I receive is:
>
> [2014-08-07 18:42:57,176] [ERROR] [Registry] Symbol 'my.custom.symbol' is
> not defined.
>
> So, you suggest me to add QaModule.class as a last argument to PageTester
> constructor, and contribute all missing configuration symbols from there.
> I've tried that, but still have the same result.
> QaModule contributeApplicationDefaults is never being called.
>
> I can't understand what to do next, because configuration symbol does
> present in maven-surefire-plugin configuration section.
>
>
>
> On Thu, Aug 7, 2014 at 6:36 PM, Lance Java <la...@googlemail.com>
> wrote:
>
>> As I mentioned, there's a PageTester constructor which accepts module
>> classes. You can explicitly pass the modules you want to test.
>>
>> Please ignore my earlier comments regarding pom.xml. I was assuming you
>> were talking about the jar manifest when you were discussing maven
>> surefire
>> properties.
>>
>> It's best to keep your test config out of maven IMHO. This way it's easier
>> to run tests in your ide.
>>
>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Ilya Obshadko <il...@gmail.com>.
I don't have any problems with module classes (yet). The problem is only
with injected configuration symbols.

When I'm running 'mvn test', I can see that module binding works fine, but
when it comes to service contribution methods, I receive an error.

So I have a method in my main application module:

public static void contributeMyCustomService (
    @Inject @Symbol("my.custom.symbol") String mySymbol ) {
    // something here
}

The error I receive is:

[2014-08-07 18:42:57,176] [ERROR] [Registry] Symbol 'my.custom.symbol' is
not defined.

So, you suggest me to add QaModule.class as a last argument to PageTester
constructor, and contribute all missing configuration symbols from there.
I've tried that, but still have the same result.
QaModule contributeApplicationDefaults is never being called.

I can't understand what to do next, because configuration symbol does
present in maven-surefire-plugin configuration section.



On Thu, Aug 7, 2014 at 6:36 PM, Lance Java <la...@googlemail.com>
wrote:

> As I mentioned, there's a PageTester constructor which accepts module
> classes. You can explicitly pass the modules you want to test.
>
> Please ignore my earlier comments regarding pom.xml. I was assuming you
> were talking about the jar manifest when you were discussing maven surefire
> properties.
>
> It's best to keep your test config out of maven IMHO. This way it's easier
> to run tests in your ide.
>



-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Lance Java <la...@googlemail.com>.
As I mentioned, there's a PageTester constructor which accepts module
classes. You can explicitly pass the modules you want to test.

Please ignore my earlier comments regarding pom.xml. I was assuming you
were talking about the jar manifest when you were discussing maven surefire
properties.

It's best to keep your test config out of maven IMHO. This way it's easier
to run tests in your ide.

Re: injecting symbols in QA mode

Posted by Ilya Obshadko <il...@gmail.com>.
Unfortunately that didn't work either. Probably I'm missing something
important.
QaModule doesn't even seem to be loaded on startup.


On Wed, Aug 6, 2014 at 9:44 PM, Ilya Obshadko <il...@gmail.com>
wrote:

> I'm running the test using 'mvn test'. That's why I expect all system
> properties defined in the maven-surefire-plugin section to be available
> at runtime.
>
> But contributing them using QaModule makes sense, I'll try that.
>
>
> On Wed, Aug 6, 2014 at 6:19 PM, Lance Java <la...@googlemail.com>
> wrote:
>
>> AFAIK the page tester does not reference web.xml. Depending how you are
>> running your test, it might not "see" the jar manifest generated by
>> pom.xml
>> either (if the classes are on the classpath rather than the jar).
>>
>> You might need to use the second PageTester constructor where you
>> explicitly pass an array of Module classes rather than relying on the jar
>> manifest / web.xml. You could create an extra TestModule for your symbols
>> (or use System properties).
>> On 6 Aug 2014 05:45, "Ilya Obshadko" <il...@gmail.com> wrote:
>>
>> > I'm trying to set up QA execution mode for unit & integration tests with
>> > TestNG, using PageTester.
>> >
>> > Upon test launch, I receive the following error:
>> >
>> > [2014-08-06 08:37:56,272] [ERROR] [Registry] Symbol 'my.custom.symbol'
>> is
>> > not defined.
>> >
>> > Not sure what's wrong here: this symbol is defined in both web.xml (as
>> > context parameter) and pom.xml (as a system property
>> > in maven-surefire-plugin configuration).
>> >
>> > Thanks for any suggestions.
>> >
>> > --
>> > Ilya Obshadko
>> >
>>
>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Ilya Obshadko <il...@gmail.com>.
I'm running the test using 'mvn test'. That's why I expect all system
properties defined in the maven-surefire-plugin section to be available at
runtime.

But contributing them using QaModule makes sense, I'll try that.


On Wed, Aug 6, 2014 at 6:19 PM, Lance Java <la...@googlemail.com>
wrote:

> AFAIK the page tester does not reference web.xml. Depending how you are
> running your test, it might not "see" the jar manifest generated by pom.xml
> either (if the classes are on the classpath rather than the jar).
>
> You might need to use the second PageTester constructor where you
> explicitly pass an array of Module classes rather than relying on the jar
> manifest / web.xml. You could create an extra TestModule for your symbols
> (or use System properties).
> On 6 Aug 2014 05:45, "Ilya Obshadko" <il...@gmail.com> wrote:
>
> > I'm trying to set up QA execution mode for unit & integration tests with
> > TestNG, using PageTester.
> >
> > Upon test launch, I receive the following error:
> >
> > [2014-08-06 08:37:56,272] [ERROR] [Registry] Symbol 'my.custom.symbol' is
> > not defined.
> >
> > Not sure what's wrong here: this symbol is defined in both web.xml (as
> > context parameter) and pom.xml (as a system property
> > in maven-surefire-plugin configuration).
> >
> > Thanks for any suggestions.
> >
> > --
> > Ilya Obshadko
> >
>



-- 
Ilya Obshadko

Re: injecting symbols in QA mode

Posted by Lance Java <la...@googlemail.com>.
AFAIK the page tester does not reference web.xml. Depending how you are
running your test, it might not "see" the jar manifest generated by pom.xml
either (if the classes are on the classpath rather than the jar).

You might need to use the second PageTester constructor where you
explicitly pass an array of Module classes rather than relying on the jar
manifest / web.xml. You could create an extra TestModule for your symbols
(or use System properties).
On 6 Aug 2014 05:45, "Ilya Obshadko" <il...@gmail.com> wrote:

> I'm trying to set up QA execution mode for unit & integration tests with
> TestNG, using PageTester.
>
> Upon test launch, I receive the following error:
>
> [2014-08-06 08:37:56,272] [ERROR] [Registry] Symbol 'my.custom.symbol' is
> not defined.
>
> Not sure what's wrong here: this symbol is defined in both web.xml (as
> context parameter) and pom.xml (as a system property
> in maven-surefire-plugin configuration).
>
> Thanks for any suggestions.
>
> --
> Ilya Obshadko
>