You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Ole Ersoy <ol...@yahoo.com> on 2006/12/05 18:53:05 UTC
Testing Harness Bug?
Hi,
If I run the mojo tests in the same project that the
mojo is in, they run fine.
If I create another project with the same setup, but
different artifactId, I get the exception pasted at
the end (xml2spec.mojo.test is the new testing project
I created. It allows me to simulate how the mojo
works without modifying the resource directories that
a project that uses the mojo would use).
It seems like the Test Harness is reading the mojo
artifact Id from the project POM, instead of the
plugin-config.xml testing pom.
Thoughts?
Thanks,
- Ole
EXCEPTION
org.apache.maven.plugin.testing.ConfigurationException:
Cannot find a configuration element for a plugin with
an artifactId of xml2spec.mojo.test.
at
org.apache.maven.plugin.testing.AbstractMojoTestCase.extractPluginConfiguration(AbstractMojoTestCase.java:217)
at
org.apache.maven.plugin.testing.AbstractMojoTestCase.extractPluginConfiguration(AbstractMojoTestCase.java:191)
at
org.apache.maven.plugin.testing.AbstractMojoTestCase.lookupMojo(AbstractMojoTestCase.java:108)
at org.jpackage.test.JPackageMojoTest.setUp(JPackageMojoTest.java:27
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Testing Harness Bug?
Posted by Ole Ersoy <ol...@yahoo.com>.
Well,
I had to fudge it a little by adding a bogus
Boolean b to avoid signature conflict,
but it seems to works fine now. Here is the
convenience method:
protected Mojo lookupMojo(
String mojoArtifactId,
String mojoGroupId,
String mojoVersion,
String goal,
File pom,
Boolean b)
throws Exception
{
PlexusConfiguration pluginConfiguration =
extractPluginConfiguration( mojoArtifactId, pom );
return lookupMojo( mojoGroupId, mojoArtifactId,
mojoVersion, goal, pluginConfiguration );
}
Here is are my JUnit test methods:
protected void setUp() throws Exception {
// required for mojo lookups to work
super.setUp();
File pluginXml = new File(getBasedir(),
"src/test/resources/plugin-config.xml");
mojo = (JPackageMojo) lookupMojo(
"xml2spec.mojo",
"org.jpackage",
"1.0-SNAPSHOT",
"generate",
pluginXml,
false);
}
public void testMojoLookup() throws Exception {
File pluginXml = new File(getBasedir(),
"src/test/resources/plugin-config.xml");
mojo = (JPackageMojo) lookupMojo(
"xml2spec.mojo",
"org.jpackage",
"1.0-SNAPSHOT",
"generate",
pluginXml,
false);
assertNotNull(mojo);
}
Cheers,
- Ole
--- Ole Ersoy <ol...@yahoo.com> wrote:
> Hmmm,
>
> Sorry - Not really a bug...but more of a convenience
> lookup method request.
>
> I reviewed lookupMojo, and if these was another one
> like this I think everything would work out:
> protected Mojo lookupMojo(
> String mojoArtifactId,
> String mojoGroupId,
> String mojoVersion,
> String goal,
> File pom )
> throws Exception
> {
> PlexusConfiguration pluginConfiguration =
> extractPluginConfiguration( artifactId, pom );
>
> return lookupMojo( groupId, artifactId, version,
> goal, pluginConfiguration );
> }
>
> I'll give this a shot next, and post back. I have a
> CLA with Apache...in case anyone wants to throw this
> in with the rest of the harness.
>
> Cheers,
> - Ole
>
>
>
>
____________________________________________________________________________________
> Any questions? Get answers on any topic at
> www.Answers.yahoo.com. Try it now.
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@maven.apache.org
> For additional commands, e-mail:
> dev-help@maven.apache.org
>
>
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Testing Harness Bug?
Posted by Ole Ersoy <ol...@yahoo.com>.
Hmmm,
Sorry - Not really a bug...but more of a convenience
lookup method request.
I reviewed lookupMojo, and if these was another one
like this I think everything would work out:
protected Mojo lookupMojo(
String mojoArtifactId,
String mojoGroupId,
String mojoVersion,
String goal,
File pom )
throws Exception
{
PlexusConfiguration pluginConfiguration =
extractPluginConfiguration( artifactId, pom );
return lookupMojo( groupId, artifactId, version,
goal, pluginConfiguration );
}
I'll give this a shot next, and post back. I have a
CLA with Apache...in case anyone wants to throw this
in with the rest of the harness.
Cheers,
- Ole
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com. Try it now.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org