Re: [M2] Testing a m2 plugin

2005-04-17 Thread Brett Porter
Vincent Massol wrote:

>>Also requires the hooks to remove the files beforehand. But sounds good
>>
>>
>
>Yes, I still don't understand how you do this in m2... Is this goal
>aliasing?
>  
>
I just meant extra configuration for the plugin.

>I could give it a try. I'd rather name is something like "filechecker"
>rather than verifier which is too generic. 
>  
>
Well, it could be used to verify more complicated assumptions later on...

> 
>  
>
>>Ideally, the verifier could be converted to a mojo and used in both the
>>bootstrap and the m2 integration test phase for plugins.
>>
>>
>
>I'm not too familiar with the existing code.
>  
>
I think you'll find it fairly straightforward.

> 
>
>Ok cool, found it. Ok, so this where the default bindings are. So the
>different build types from my previous email could actually be different
>configurations of org.apache.maven.lifecycle.DefaultLifecycleExecutor.
>  
>
Different build types? Which was that from?

>I guess there's currently no way for a user to define a custom lifecycle,
>right? Maybe goal aliasing could be combined with this to give something
>like:
>  
>
That's not really the intention. You can bind your goals to any of the
phases, but we don't allow changing the lifecycle or unbinding any of
the default goals.

>Maybe the m1 model is actually the simplest (where there are no phases and
>the user decides on the ordering of the goals)?
>  
>
What is not simple about this is figuring out what that order is when
you weren't the one defining it. The lifecycle is much simpler to
understand IMO.

>Yep. This integration testing phase would be required for this
>verifier|filechecker plugin to work.
>  
>
I'll add it.

> 1/ the said plugin would first need to be bound to the right phase. For
> example let's imagine there is a clover:instrument goal bound to the
> generate-sources phase and a clover:compile goal bound to the compile phase.
> 
> 2/ then in your pom.xml you would specify:
> 
> 3/ Whenever the user would type something like "m2 compile" it would execute
> the 2 goals.
> 
> Is that correct?

Right... but I don't know that you need clover:compile. If the instrument adds 
it to the source roots, compiler:compile will compile it to target/classes.

So I'm not sure what you really want here... do you want it compiled to the 
test classes (add it to test source roots), main classes (add it to compile 
source roots), or a whole new output directory?

The last isn't currently possible - you'd either need to configure an 
additional compiler in POM (like you have), but it might be better to have a 
generic case (where clover:instrument can add a whole new source root + output 
directory mapping to the project).

> 
> Question: how is the order defined between compiler:compile and
> clover:compile in this case?
> 

You can't, other than the order the plugins are declared in the POM.

Cheers,
Brett

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



RE: [M2] Testing a m2 plugin

2005-04-17 Thread Vincent Massol


> -Original Message-
> From: Brett Porter [mailto:[EMAIL PROTECTED]
> Sent: dimanche 17 avril 2005 15:33
> To: Maven Developers List
> Subject: Re: [M2] Testing a m2 plugin
> 
> Vincent Massol wrote:
> 
> >I think a verifier plugin that simply verifies existence/nonexistence of
> >files/dir and their contents would be a good first step.
> >
> >It could be configured with:
> >
> >
> >  
> >
> >  ${basedir}/target/clover/clover.db
> >  [enter a regexp here - This is optional]
> >  exist (default)|notfound
> >
> >[...]
> >  
> >
> >
> >
> Also requires the hooks to remove the files beforehand. But sounds good

Yes, I still don't understand how you do this in m2... Is this goal
aliasing?

> - do you think it is too verbose for configuration? Maybe better to
> externalise it in files and use the configuration to point to that.

I was going to say that my preference goes to pom.xml but then you're
completely right: It's a test and it should go elsewhere. Something like:

/
  |_ src/
|_ test/
  |_ java/
  |_ [...]
  |_ verifier|filechecker/
|_ some config file here. Could be java, XML, properties, etc. My
preference goes to XML.

> Will you be able to implement this? I hadn't seen it being ready for
> alpha-2, though perhaps if it is required for proper mojo testing it
> should be.

I could give it a try. I'd rather name is something like "filechecker"
rather than verifier which is too generic. 
 
> Ideally, the verifier could be converted to a mojo and used in both the
> bootstrap and the m2 integration test phase for plugins.

I'm not too familiar with the existing code.
 
> >Could you please tell me where I can find the list of the existing
> lifecycle
> >phases?
> >
> maven-core/src/main/resources/META-INF/plexus/components.xml (there
> should be an older version of a doc in src/site/apt as well).

Ok cool, found it. Ok, so this where the default bindings are. So the
different build types from my previous email could actually be different
configurations of org.apache.maven.lifecycle.DefaultLifecycleExecutor.

I guess there's currently no way for a user to define a custom lifecycle,
right? Maybe goal aliasing could be combined with this to give something
like:


  
customelifecycle1
true

  [...]
  
process-resources

  mycustomresources:resources

  
  [...]

  


And it would be called with "m2 -l customlifecycle1 install" (or simply "m2
install" because it's configured to be the default lifecycle).

Of course in most cases you wouldn't need to define custom lifecycles...

Hmm... this sounds a bit too complex... However you do need a way to tell
the build how you would want the different phases to be bound to, no?

Maybe the m1 model is actually the simplest (where there are no phases and
the user decides on the ordering of the goals)?

> 
> >This verifier plugin could be bound to a terminal phase.
> >
> >
> There is meant to be an integration testing phase between package and
> install, which is what you are looking for.

Yep. This integration testing phase would be required for this
verifier|filechecker plugin to work.

Thanks
-Vincent

___

Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !

Yahoo! Mail : http://fr.mail.yahoo.com


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



Re: [M2] Testing a m2 plugin

2005-04-17 Thread Brett Porter
Vincent Massol wrote:

>I think a verifier plugin that simply verifies existence/nonexistence of
>files/dir and their contents would be a good first step.
>
>It could be configured with:
>
>
>  
>
>  ${basedir}/target/clover/clover.db
>  [enter a regexp here - This is optional]
>  exist (default)|notfound
>
>[...]
>  
>
>  
>
Also requires the hooks to remove the files beforehand. But sounds good
- do you think it is too verbose for configuration? Maybe better to
externalise it in files and use the configuration to point to that.

Will you be able to implement this? I hadn't seen it being ready for
alpha-2, though perhaps if it is required for proper mojo testing it
should be.

Ideally, the verifier could be converted to a mojo and used in both the
bootstrap and the m2 integration test phase for plugins.

>Could you please tell me where I can find the list of the existing lifecycle
>phases? 
>
maven-core/src/main/resources/META-INF/plexus/components.xml (there
should be an older version of a doc in src/site/apt as well).

>This verifier plugin could be bound to a terminal phase.
>  
>
There is meant to be an integration testing phase between package and
install, which is what you are looking for.

- Brett


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



RE: [M2] Testing a m2 plugin

2005-04-17 Thread Vincent Massol
I think a verifier plugin that simply verifies existence/nonexistence of
files/dir and their contents would be a good first step.

It could be configured with:


  

  ${basedir}/target/clover/clover.db
  [enter a regexp here - This is optional]
  exist (default)|notfound

[...]
  


Could you please tell me where I can find the list of the existing lifecycle
phases? This verifier plugin could be bound to a terminal phase.

Now, how will I tell my test project to execute this verifier plugin goal
when "m2 install" is called for example? I'm assuming a directory structure
of:

mypluginroot/
  |_ plugin/
  |_ tests/
|_ test01/
[_ testNN/

Thanks
-Vincent

> -Original Message-
> From: Brett Porter [mailto:[EMAIL PROTECTED]
> Sent: dimanche 17 avril 2005 01:52
> To: Maven Developers List
> Subject: Re: [M2] Testing a m2 plugin
> 
> Yes, I have a JIRA in to turn that into an m2 plugin itself.
> 
> Not sure that's exactly what you want, as it forks m2 to run the goals.
> 
> Really, an integration test should not be needed - if the plugin is in
> Java, you should be able to test with junit. At least up until the point
> that multiple goals need to occur inside the lifecycle.
> 
> I think the best thing to do would be to put together the tests you need
> and single out the things you don't think are covered by juni, and we
> can all discuss what we can provide for plugin writers - whether it be a
> way to completely run m2, or a test suite that provides APIs to help
> test with junit, or testing implementations of some of the m2 components.
> 
> Just to double check too - you're going to run your ideas for the plugin
> past here as well? I assume you are planning now, and using test first,
> so testing was the first thing :)
> Whether the clover plugin is written as part of the m2 project or not,
> the plugin API is currently being finalised and any reporting coming out
> of it should help form the m2 API's for that along with the other
> plugins getting developed, so I want to make sure everyone is helping
> each other out :)
> 
> Thanks,
> Brett
> 
> Vincent Massol wrote:
> 
> >Hi,
> >
> >I'm writing a Clover plugin and I'd like to write tests for it as I
> >progress. Obviously most tests will have to be integration tests.
> >
> >I've seen that the m2 team has developed an integration test system in
> >maven-components/maven-core-it-verifier with tests in
> >maven-components/maven-core-it.
> >
> >I was wondering if this tester is made available in the form of a m2
> plugin
> >for external plugin writers?
> >
> >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]





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



RE: [M2] Testing a m2 plugin

2005-04-17 Thread Vincent Massol
I'm planning to use the following directory structure:

maven-clover-plugin/
  |_ plugin/
|_ pom.xml
|_ [this is the plugin itself]
  |_ tests/
|_ test
  |_ pom.xml
|_ [...]
|_ test
  |_ pom.xml
  |_ pom.xml

So that to build the plugin you would go at the top level and type "m2
install" and it will run the integration tests too.

What do you think?

Thanks
-Vincent

> -Original Message-
> From: Vincent Massol [mailto:[EMAIL PROTECTED]
> Sent: dimanche 17 avril 2005 10:20
> To: 'Maven Developers List'
> Subject: RE: [M2] Testing a m2 plugin
> 
> 
> > -Original Message-
> > From: Brett Porter [mailto:[EMAIL PROTECTED]
> > Sent: dimanche 17 avril 2005 01:52
> > To: Maven Developers List
> > Subject: Re: [M2] Testing a m2 plugin
> >
> > Yes, I have a JIRA in to turn that into an m2 plugin itself.
> >
> > Not sure that's exactly what you want, as it forks m2 to run the goals.
> >
> > Really, an integration test should not be needed - if the plugin is in
> > Java, you should be able to test with junit.
> 
> Funny that you should say this when I've been unable to find a single unit
> test in all the plugins that currently exist for m2! :-)
> 
> That said I would be happy if you can show me how to write a significant
> unit test for http://rafb.net/paste/results/u2dtsf30.html
> 
> > At least up until the point
> > that multiple goals need to occur inside the lifecycle.
> 
> What is needed is a test project using the plugin because I need source
> dirs and output dirs to test that Clover works. Of course I also need to
> validate that all the plugin's magic (all the javadoc tags) works.
> 
> > I think the best thing to do would be to put together the tests you need
> > and single out the things you don't think are covered by juni, and we
> > can all discuss what we can provide for plugin writers - whether it be a
> > way to completely run m2, or a test suite that provides APIs to help
> > test with junit, or testing implementations of some of the m2
> components.
> 
> I think we need to have a separate m2 project that tests the plugin
> (functional tests). I can already do this but in the same manner that we
> have asserts in the m1 plugin plugin we'll probably need helper APIs. I
> thought this was what you were doing in the it tests with the expected-
> results.txt and goals.txt files. The problem is that it was easy in m1 to
> have a maven.xml file to define the test setup, decide which goals to run
> and perform the assertions. Here's it's not doable easily (correct me if
> it is) so we'll probably need support for this (this is what you're doing
> with the txt files it seems).
> 
> > Just to double check too - you're going to run your ideas for the plugin
> > past here as well? I assume you are planning now, and using test first,
> > so testing was the first thing :)
> 
> Yep, almost :-)
> 
> I have spoken with Jason on IRC yesterday and he said I should speak to
> you too but you were sleeping so I thought I might as well start
> something... :-)
> 
> My first ideas are:
> 1) Bind the plugin to the generate-sources phase
> 2) Modify the project source roots to replace the main source root with
> the one generated by Clover
> 
> I have not thought at all about the reports, just about executing Clover
> for now.
> 
> > Whether the clover plugin is written as part of the m2 project or not,
> > the plugin API is currently being finalised and any reporting coming out
> > of it should help form the m2 API's for that along with the other
> > plugins getting developed, so I want to make sure everyone is helping
> > each other out :)
> 
> Definitely!
> 
> Thanks
> -Vincent
> 
> >
> > Thanks,
> > Brett
> >
> > Vincent Massol wrote:
> >
> > >Hi,
> > >
> > >I'm writing a Clover plugin and I'd like to write tests for it as I
> > >progress. Obviously most tests will have to be integration tests.
> > >
> > >I've seen that the m2 team has developed an integration test system in
> > >maven-components/maven-core-it-verifier with tests in
> > >maven-components/maven-core-it.
> > >
> > >I was wondering if this tester is made available in the form of a m2
> > plugin
> > >for external plugin writers?
> > >
> > >Thanks
> > >-Vincent




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



RE: [M2] Testing a m2 plugin

2005-04-17 Thread Vincent Massol

> -Original Message-
> From: Brett Porter [mailto:[EMAIL PROTECTED]
> Sent: dimanche 17 avril 2005 01:52
> To: Maven Developers List
> Subject: Re: [M2] Testing a m2 plugin
> 
> Yes, I have a JIRA in to turn that into an m2 plugin itself.
> 
> Not sure that's exactly what you want, as it forks m2 to run the goals.
> 
> Really, an integration test should not be needed - if the plugin is in
> Java, you should be able to test with junit. 

Funny that you should say this when I've been unable to find a single unit
test in all the plugins that currently exist for m2! :-)

That said I would be happy if you can show me how to write a significant
unit test for http://rafb.net/paste/results/u2dtsf30.html

> At least up until the point
> that multiple goals need to occur inside the lifecycle.

What is needed is a test project using the plugin because I need source dirs
and output dirs to test that Clover works. Of course I also need to validate
that all the plugin's magic (all the javadoc tags) works. 
 
> I think the best thing to do would be to put together the tests you need
> and single out the things you don't think are covered by juni, and we
> can all discuss what we can provide for plugin writers - whether it be a
> way to completely run m2, or a test suite that provides APIs to help
> test with junit, or testing implementations of some of the m2 components.

I think we need to have a separate m2 project that tests the plugin
(functional tests). I can already do this but in the same manner that we
have asserts in the m1 plugin plugin we'll probably need helper APIs. I
thought this was what you were doing in the it tests with the
expected-results.txt and goals.txt files. The problem is that it was easy in
m1 to have a maven.xml file to define the test setup, decide which goals to
run and perform the assertions. Here's it's not doable easily (correct me if
it is) so we'll probably need support for this (this is what you're doing
with the txt files it seems).

> Just to double check too - you're going to run your ideas for the plugin
> past here as well? I assume you are planning now, and using test first,
> so testing was the first thing :)

Yep, almost :-)

I have spoken with Jason on IRC yesterday and he said I should speak to you
too but you were sleeping so I thought I might as well start something...
:-)

My first ideas are:
1) Bind the plugin to the generate-sources phase
2) Modify the project source roots to replace the main source root with the
one generated by Clover

I have not thought at all about the reports, just about executing Clover for
now.

> Whether the clover plugin is written as part of the m2 project or not,
> the plugin API is currently being finalised and any reporting coming out
> of it should help form the m2 API's for that along with the other
> plugins getting developed, so I want to make sure everyone is helping
> each other out :)

Definitely!

Thanks
-Vincent

> 
> Thanks,
> Brett
> 
> Vincent Massol wrote:
> 
> >Hi,
> >
> >I'm writing a Clover plugin and I'd like to write tests for it as I
> >progress. Obviously most tests will have to be integration tests.
> >
> >I've seen that the m2 team has developed an integration test system in
> >maven-components/maven-core-it-verifier with tests in
> >maven-components/maven-core-it.
> >
> >I was wondering if this tester is made available in the form of a m2
> plugin
> >for external plugin writers?
> >
> >Thanks
> >-Vincent




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



Re: [M2] Testing a m2 plugin

2005-04-16 Thread Brett Porter
Yes, I have a JIRA in to turn that into an m2 plugin itself.

Not sure that's exactly what you want, as it forks m2 to run the goals.

Really, an integration test should not be needed - if the plugin is in
Java, you should be able to test with junit. At least up until the point
that multiple goals need to occur inside the lifecycle.

I think the best thing to do would be to put together the tests you need
and single out the things you don't think are covered by juni, and we
can all discuss what we can provide for plugin writers - whether it be a
way to completely run m2, or a test suite that provides APIs to help
test with junit, or testing implementations of some of the m2 components.

Just to double check too - you're going to run your ideas for the plugin
past here as well? I assume you are planning now, and using test first,
so testing was the first thing :)
Whether the clover plugin is written as part of the m2 project or not,
the plugin API is currently being finalised and any reporting coming out
of it should help form the m2 API's for that along with the other
plugins getting developed, so I want to make sure everyone is helping
each other out :)

Thanks,
Brett

Vincent Massol wrote:

>Hi,
>
>I'm writing a Clover plugin and I'd like to write tests for it as I
>progress. Obviously most tests will have to be integration tests. 
>
>I've seen that the m2 team has developed an integration test system in
>maven-components/maven-core-it-verifier with tests in
>maven-components/maven-core-it.
>
>I was wondering if this tester is made available in the form of a m2 plugin
>for external plugin writers?
>
>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]



[M2] Testing a m2 plugin

2005-04-16 Thread Vincent Massol
Hi,

I'm writing a Clover plugin and I'd like to write tests for it as I
progress. Obviously most tests will have to be integration tests. 

I've seen that the m2 team has developed an integration test system in
maven-components/maven-core-it-verifier with tests in
maven-components/maven-core-it.

I was wondering if this tester is made available in the form of a m2 plugin
for external plugin writers?

Thanks
-Vincent




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