Re: Unit tests seeing test application context files in their dependencies

2008-06-17 Thread James Rutherford
On Tue, Jun 17, 2008 at 12:00:51PM +, Kristian Rink wrote:
> Am Tue, 17 Jun 2008 03:39:19 -0700 (PDT)
> schrieb Papapara Tudu <[EMAIL PROTECTED]>:
> 
> > The test application context in the dependency is located in the
> > /src/test/resources folder in its project
> > (in the project I'm writing the tests for, my app context is in
> > /src/test/resources also).
> 
> I see... Used to do this only while having the context configuration
> somewhere in src/main/resources.
> 
> 
> > The actual error I'm getting when I use the
> >  line is:
> >
> > org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> > Configuration problem: Failed to import bean definitions from URL
> > location [classpath:DependencyTestContext.xml]
> 
> Off-hands I am not sure whether the _test_ classpath of an artifact the
> project depends upon is available to that project. Looking at how
> things work for test classes (src/test/java , which aren't part of the
> deployed artifact), I'd take a guess that this might be your problem...
> This would explain this behaviour as, this way, things below src/test
> won't be available to you when depending upon the (binary) artifact (in
> your repository). Don't really know how to get along this, anyhow.
> Anyone else? :)

The approach I've used is to have (eg) DependencyContext.xml for the
live service under src/main/resources/ and one for tests (with the same
name) under src/test/resources/. This way, the  statement
(which is presumably in a file under src/main/resources/) should pick up
the correct resource for both situations because of the way the
classpath is constructed.

cheers,

Jim

-- 
James Rutherford  |  Hewlett-Packard Limited registered Office:
Research Engineer |  Cain Road,
HP Labs   |  Bracknell,
Bristol, UK   |  Berks
+44 117 312 7066  |  RG12 1HN.
[EMAIL PROTECTED]   |  Registered No: 690597 England

The contents of this message and any attachments to it are confidential
and may be legally privileged. If you have received this message in
error, you should delete it from your system immediately and advise the
sender. To any recipient of this message within HP, unless otherwise
stated you should consider this message and attachments as "HP
CONFIDENTIAL".

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit tests seeing test application context files in their dependencies

2008-06-17 Thread Kristian Rink
Am Tue, 17 Jun 2008 03:39:19 -0700 (PDT)
schrieb Papapara Tudu <[EMAIL PROTECTED]>:

> The test application context in the dependency is located in the
> /src/test/resources folder in its project
> (in the project I'm writing the tests for, my app context is in
> /src/test/resources also).

I see... Used to do this only while having the context configuration
somewhere in src/main/resources. 


> The actual error I'm getting when I use the
>  line is:
> 
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Failed to import bean definitions from URL
> location [classpath:DependencyTestContext.xml]

Off-hands I am not sure whether the _test_ classpath of an artifact the
project depends upon is available to that project. Looking at how
things work for test classes (src/test/java , which aren't part of the
deployed artifact), I'd take a guess that this might be your problem...
This would explain this behaviour as, this way, things below src/test
won't be available to you when depending upon the (binary) artifact (in
your repository). Don't really know how to get along this, anyhow.
Anyone else? :)

Cheers,
Kristian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit tests seeing test application context files in their dependencies

2008-06-17 Thread Papapara Tudu



> Looking at your terminologies and file snippets: Are you using Spring
> in your projects?
> 
Yes



> If (I assume so) Spring is involved, this should work, at least I do
> have libraries (jar artifacts) wired up with web applications (war
> artifacts) right this way. Where is your DependencyTestContext.xml
> located? Are you sure this is a maven2 related problem?
> 

I'm not sure if this is a maven2 problem.

The test application context in the dependency is located in the
/src/test/resources folder in its project
(in the project I'm writing the tests for, my app context is in
/src/test/resources also).

The actual error I'm getting when I use the
 line is:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Failed to import bean definitions from URL location
[classpath:DependencyTestContext.xml]

-- 
View this message in context: 
http://www.nabble.com/Unit-tests-seeing-test-application-context-files-in-their-dependencies-tp17881883p17882205.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unit tests seeing test application context files in their dependencies

2008-06-17 Thread Kristian Rink
Hi there;

Am Tue, 17 Jun 2008 03:13:02 -0700 (PDT)
schrieb Papapara Tudu <[EMAIL PROTECTED]>:

> My application context uses some beans from a different application
> context which is located in one of its dependencies. 

Looking at your terminologies and file snippets: Are you using Spring
in your projects?

> I tried this line:
>   
> but it didn't work - that app context was not visible.

If (I assume so) Spring is involved, this should work, at least I do
have libraries (jar artifacts) wired up with web applications (war
artifacts) right this way. Where is your DependencyTestContext.xml
located? Are you sure this is a maven2 related problem?

Cheers,
Kristian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Unit tests seeing test application context files in their dependencies

2008-06-17 Thread Papapara Tudu

Hi,
I am wondering if it's possible to do the following:
My application context uses some beans from a different application context
which is located in one of its dependencies. 
I am now writing unit tests for this project and the dependency as well. 
So I have my test application context in both these projects, and I would
like the one from the dependency to be visible in the other one.

Is that possible in any way?
I tried this line:

but it didn't work - that app context was not visible.

Thanks,
Papapara Tudu
-- 
View this message in context: 
http://www.nabble.com/Unit-tests-seeing-test-application-context-files-in-their-dependencies-tp17881883p17881883.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]