Re: [m2] Retrieving test dependencies in junit tests?

2005-08-29 Thread Brett Porter
Trygve Laugstøl wrote:

>I'm pretty sure that he was refering to the Modello build itself where we
>generate source code and use the Plexus compilers to compile the generated
>sources and test them[1]. Now I just realized that we're not doing that
>anymore, but I think we used to set that property there.
>
>Anyway, the Modello build show how we're using the local repository and
>the Maven components to get access to artifacts in the repository.
>
>[1]: 
>http://svn.modello.codehaus.org/trunk/modello/modello-test/src/main/java/org/codehaus/modello/AbstractModelloGeneratorTest.java?rev=430&view=auto
>
>[snip]
>
>  
>

Right... my memory failed me.

Actually, we have a reusable library for this:
http://svn.apache.org/viewcvs.cgi/maven/components/trunk/maven-artifact-test/src/main/java/org/apache/maven/artifact/test/ArtifactTestCase.java?rev=191634&view=markup

It does depend on plexus though.

- Brett

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



Re: [m2] Retrieving test dependencies in junit tests?

2005-08-29 Thread Trygve Laugstøl
On Mon, Aug 29, 2005 at 11:25:45AM +0200, Vincent Massol wrote:

[snip]

> > That said, we are currently setting and using the system property
> > ${maven.repo.local} in unit tests for modello. I'd considered that an
> > "undocumented" feature (as in deliberately undocument, unlike most of
> > the features which we intend to document :)
> 
> I don't understand why you mention modello. If you're setting the property
> in the model unit tests then how do you get the value in the first place?
> 
> I've tried doing a System.getProperty( "maven.repo.local" ) in my unit test
> and it returns null. So I'm not sure it is set anywhere in m2.
> 
> Is the local repo available as property in the POM? If so, I could use it
> and pass it to surefire using a system property?

I'm pretty sure that he was refering to the Modello build itself where we
generate source code and use the Plexus compilers to compile the generated
sources and test them[1]. Now I just realized that we're not doing that
anymore, but I think we used to set that property there.

Anyway, the Modello build show how we're using the local repository and
the Maven components to get access to artifacts in the repository.

[1]: 
http://svn.modello.codehaus.org/trunk/modello/modello-test/src/main/java/org/codehaus/modello/AbstractModelloGeneratorTest.java?rev=430&view=auto

[snip]

--
Trygve


signature.asc
Description: Digital signature


RE: [m2] Retrieving test dependencies in junit tests?

2005-08-29 Thread Vincent Massol


> -Original Message-
> From: Brett Porter [mailto:[EMAIL PROTECTED]
> Sent: lundi 29 août 2005 03:53
> To: Maven Developers List
> Subject: Re: [m2] Retrieving test dependencies in junit tests?
> 
> We had an open issue for this and decided to push it off for now. In our
> use case, there isn't really a good way for m2 to propogate information
> to JUnit without some intervening tool library, or system properties
> which are obviously limited.
> 
> The problem with knowing the local repository location is that you must
> also know the path structure. While I don't envisage this changing from
> the new format any time soon it'd be good to be able to have that freedom.
> 
> The preferred way would be to use ${localRepository} in a plugin and get
> localRepository.pathOf( artifact ).

I find it a bit awkward to have to develop a plugin and to host it alongside
project sources. Actually I've never seen this done so far probably for the
reason that anytime there was a need it found its way into m2 proper.
 
> That said, we are currently setting and using the system property
> ${maven.repo.local} in unit tests for modello. I'd considered that an
> "undocumented" feature (as in deliberately undocument, unlike most of
> the features which we intend to document :)

I don't understand why you mention modello. If you're setting the property
in the model unit tests then how do you get the value in the first place?

I've tried doing a System.getProperty( "maven.repo.local" ) in my unit test
and it returns null. So I'm not sure it is set anywhere in m2.

Is the local repo available as property in the POM? If so, I could use it
and pass it to surefire using a system property?

Thanks
-Vincent

> Vincent Massol wrote:
> 
> >Hi,
> >
> >I'm continuing my quest to convert the m1 Cargo build into m2. Thanks to
> >John and his implementation for inheriting properties I have now reached
> the
> >next level.
> >
> >The Cargo functional test subprojects depend on some other subprojects
> which
> >produce J2EE modules (WAR, EAR, etc).  Those are used for testing
> deployment
> >to a container.
> >
> >Thus, I need to get the file path of those dependencies from within a
> JUnit
> >TestCase class. How can I implement this?
> >
> >In m1, the way I had implemented it was a bit hacky:
> >- There was a property: cargo.testdata.dir =
> >${maven.repo.local}/${pom.groupId}
> >- The path to the J2EE module in the local repository was computed within
> >the TestCase
> >
> >Is there a property pointing to the local repo location that I could use
> in
> >the pom.xml file (same as ${maven.repo.local} is used in m1)?
> >
> >Obviously I'd rather not have to write a plugin for such a use case... I
> >think there's a potential need to gather all kind of information about
> the
> >POM in a JUnit TestCase and it might be interesting to implement this in
> a
> >generic way. WDYT?
> >
> >Thanks
> >-Vincent






___
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com

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



Re: [m2] Retrieving test dependencies in junit tests?

2005-08-28 Thread Brett Porter
We had an open issue for this and decided to push it off for now. In our
use case, there isn't really a good way for m2 to propogate information
to JUnit without some intervening tool library, or system properties
which are obviously limited.

The problem with knowing the local repository location is that you must
also know the path structure. While I don't envisage this changing from
the new format any time soon it'd be good to be able to have that freedom.

The preferred way would be to use ${localRepository} in a plugin and get
localRepository.pathOf( artifact ).

That said, we are currently setting and using the system property
${maven.repo.local} in unit tests for modello. I'd considered that an
"undocumented" feature (as in deliberately undocument, unlike most of
the features which we intend to document :)

- Brett

Vincent Massol wrote:

>Hi,
>
>I'm continuing my quest to convert the m1 Cargo build into m2. Thanks to
>John and his implementation for inheriting properties I have now reached the
>next level.
>
>The Cargo functional test subprojects depend on some other subprojects which
>produce J2EE modules (WAR, EAR, etc).  Those are used for testing deployment
>to a container.
>
>Thus, I need to get the file path of those dependencies from within a JUnit
>TestCase class. How can I implement this?
>
>In m1, the way I had implemented it was a bit hacky:
>- There was a property: cargo.testdata.dir =
>${maven.repo.local}/${pom.groupId}
>- The path to the J2EE module in the local repository was computed within
>the TestCase
>
>Is there a property pointing to the local repo location that I could use in
>the pom.xml file (same as ${maven.repo.local} is used in m1)?
>
>Obviously I'd rather not have to write a plugin for such a use case... I
>think there's a potential need to gather all kind of information about the
>POM in a JUnit TestCase and it might be interesting to implement this in a
>generic way. WDYT?
>
>Thanks
>-Vincent
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>

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