You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Beermann <mb...@yahoo.com> on 2006/12/12 18:14:22 UTC

Mojos, Testing, and Dependency Resolution

So, I've written a Mojo that I want to write some test cases for. I found the AbstractMojoTestCase in the maven-plugin-testing-harness, and it works great - up to a point. The problem is that my Mojo @requiresDependencyResolution. In other words, I need the configuration items backed by ${plugin.artifacts} and ${project.artifacts} to exist with the resolved dependencies from the POM. And of course, the AbstractMojoTestCase doesn't actually /run/ Maven, resolve any dependencies, or any other lifecycle stuff.

Is there a straightforward way to make the resolution happen without needing to reimplement large chunks of Maven in my test cases?

--Matthew


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

Re: Mojos, Testing, and Dependency Resolution

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

I'm currently extending the kodo-maven-plugin and
facing a similar problem.

I have 2 test cases, one for jdo-mapping and one for
jdo-enhancement. The enhancement step needs the result
of the jdo-mapping for running the tests.

Usually i would implement a simple TestSuite:

>  public static Test suite() {
>      TestSuite suite = new TestSuite("KodoTests");
>      suite.addTest( new KodoTest("testMapping") );
>      suite.addTest( new KodoTest("testEnhance") );
>  }

Problem is, that the AbstractMojoTestCase does not
implement a constructor with the 'name' parameter, so
the 'new KodoTest("testMapping")' is not applicable.

Is there any ambition to implement this ct? Or does
anyone have another idea how to resolve this (except
calling testMapping as first instruction in
testEnhance)?

txs,
strub



--- Edwin Punzalan <ep...@exist.com> schrieb:

> 
> It depends on what you'll do with
> ${project.artifacts}...
> 
> I usually just create several artifact stubs into a
> List and inject the 
> list into the plugin bec that's all what my plugin
> needed.  Your plugin 
> may need the actual jars or even poms, which is
> still doable with stubs 
> but requires more effort.
> 
> Hope that helped.
> 
> 
> ^_^
> 
> 
> Matthew Beermann wrote:
> > So, I've written a Mojo that I want to write some
> test cases for. I found the AbstractMojoTestCase in
> the maven-plugin-testing-harness, and it works great
> - up to a point. The problem is that my Mojo
> @requiresDependencyResolution. In other words, I
> need the configuration items backed by
> ${plugin.artifacts} and ${project.artifacts} to
> exist with the resolved dependencies from the POM.
> And of course, the AbstractMojoTestCase doesn't
> actually /run/ Maven, resolve any dependencies, or
> any other lifecycle stuff.
> >
> > Is there a straightforward way to make the
> resolution happen without needing to reimplement
> large chunks of Maven in my test cases?
> >
> > --Matthew
> >
> >
> >  
> >
>
____________________________________________________________________________________
> > Do you Yahoo!?
> > Everyone is raving about the all-new Yahoo! Mail
> beta.
> > http://new.mail.yahoo.com
> >   
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org
> 
> 





	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Mojos, Testing, and Dependency Resolution

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

I'm currently extending the kodo-maven-plugin and
facing a similar problem.

I have 2 test cases, one for jdo-mapping and one for
jdo-enhancement. The enhancement step needs the result
of the jdo-mapping for running the tests.

Usually i would implement a simple TestSuite:

>  public static Test suite() {
>      TestSuite suite = new TestSuite("KodoTests");
>      suite.addTest( new KodoTest("testMapping") );
>      suite.addTest( new KodoTest("testEnhance") );
>  }

Problem is, that the AbstractMojoTestCase does not
implement a constructor with the 'name' parameter, so
the 'new KodoTest("testMapping")' is not applicable.

Is there any ambition to implement this ct? Or does
anyone have another idea how to resolve this (except
calling testMapping as first instruction in
testEnhance)?

txs,
strub



--- Edwin Punzalan <ep...@exist.com> schrieb:

> 
> It depends on what you'll do with
> ${project.artifacts}...
> 
> I usually just create several artifact stubs into a
> List and inject the 
> list into the plugin bec that's all what my plugin
> needed.  Your plugin 
> may need the actual jars or even poms, which is
> still doable with stubs 
> but requires more effort.
> 
> Hope that helped.
> 
> 
> ^_^
> 
> 
> Matthew Beermann wrote:
> > So, I've written a Mojo that I want to write some
> test cases for. I found the AbstractMojoTestCase in
> the maven-plugin-testing-harness, and it works great
> - up to a point. The problem is that my Mojo
> @requiresDependencyResolution. In other words, I
> need the configuration items backed by
> ${plugin.artifacts} and ${project.artifacts} to
> exist with the resolved dependencies from the POM.
> And of course, the AbstractMojoTestCase doesn't
> actually /run/ Maven, resolve any dependencies, or
> any other lifecycle stuff.
> >
> > Is there a straightforward way to make the
> resolution happen without needing to reimplement
> large chunks of Maven in my test cases?
> >
> > --Matthew
> >
> >
> >  
> >
>
____________________________________________________________________________________
> > Do you Yahoo!?
> > Everyone is raving about the all-new Yahoo! Mail
> beta.
> > http://new.mail.yahoo.com
> >   
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> users-help@maven.apache.org
> 
> 



		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Mojos, Testing, and Dependency Resolution

Posted by Edwin Punzalan <ep...@exist.com>.
It depends on what you'll do with ${project.artifacts}...

I usually just create several artifact stubs into a List and inject the 
list into the plugin bec that's all what my plugin needed.  Your plugin 
may need the actual jars or even poms, which is still doable with stubs 
but requires more effort.

Hope that helped.


^_^


Matthew Beermann wrote:
> So, I've written a Mojo that I want to write some test cases for. I found the AbstractMojoTestCase in the maven-plugin-testing-harness, and it works great - up to a point. The problem is that my Mojo @requiresDependencyResolution. In other words, I need the configuration items backed by ${plugin.artifacts} and ${project.artifacts} to exist with the resolved dependencies from the POM. And of course, the AbstractMojoTestCase doesn't actually /run/ Maven, resolve any dependencies, or any other lifecycle stuff.
>
> Is there a straightforward way to make the resolution happen without needing to reimplement large chunks of Maven in my test cases?
>
> --Matthew
>
>
>  
> ____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org