maven-plugin-testing-harness

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

maven-plugin-testing-harness

ahardy42
Is there life is in this testing harness still?

I'm looking at https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/ 

The link to JIRA returns  503 - http://jira.codehaus.org/browse/MPLUGINTESTING

and the link to git repo is 404

I can imagine there is a big population of maven users out there who look at it and give up, which is a shame because you can't beat a good test harness.

I have managed to put some code together to make my tests run nicely in IntelliJ and I was wondering if you wanted any documentation or example code?

I've still got issues and I've got a live question on StackOverflow: https://stackoverflow.com/questions/45241317/hard-time-mojo-testing-with-maven-plugin-testing-harness

Regards
Adam
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: maven-plugin-testing-harness

Karl Heinz Marbaise-3
Hi,

On 26/07/17 11:49, ahardy42 wrote:
> Is there life is in this testing harness still?
>
> I'm looking at
> https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/

>
> The link to JIRA returns  503 -
> http://jira.codehaus.org/browse/MPLUGINTESTING

Outch that are the old links which means there hasn't been a release for
a longer time ;-(

This is the new location:

https://issues.apache.org/jira/projects/MPLUGINTESTING/


>
> and the link to git repo is 404

https://github.com/apache/maven-plugin-testing

but it's out of date correct...

I have created an appropriate INFRA ticket to fix this[1].


[1]: https://issues.apache.org/jira/browse/INFRA-14716

>
> I can imagine there is a big population of maven users out there who look at
> it and give up, which is a shame because you can't beat a good test harness.

Yes this is unfortunately true...



>
> I have managed to put some code together to make my tests run nicely in
> IntelliJ and I was wondering if you wanted any documentation or example
> code?

Both is appreciated...sure ..


>
> I've still got issues and I've got a live question on StackOverflow:
> https://stackoverflow.com/questions/45241317/hard-time-mojo-testing-with-maven-plugin-testing-harness
>
> Regards
> Adam
>


Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: maven-plugin-testing-harness

Karl Heinz Marbaise-3
Hi,

On 26/07/17 20:13, Karl Heinz Marbaise wrote:

> Hi,
>
> On 26/07/17 11:49, ahardy42 wrote:
>> Is there life is in this testing harness still?
>>
>> I'm looking at
>> https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/
>
>>
>> The link to JIRA returns  503 -
>> http://jira.codehaus.org/browse/MPLUGINTESTING
>
> Outch that are the old links which means there hasn't been a release for
> a longer time ;-(
>
> This is the new location:
>
> https://issues.apache.org/jira/projects/MPLUGINTESTING/
>
>
>>
>> and the link to git repo is 404
>
> https://github.com/apache/maven-plugin-testing
>
> but it's out of date correct...
>
> I have created an appropriate INFRA ticket to fix this[1].
>
>
> [1]: https://issues.apache.org/jira/browse/INFRA-14716
>

Thanks to INFRA..already fixed the problem.

Kind regards
Karl Heinz Marbaise

>>
>> I can imagine there is a big population of maven users out there who
>> look at
>> it and give up, which is a shame because you can't beat a good test
>> harness.
>
> Yes this is unfortunately true...
>
>
>
>>
>> I have managed to put some code together to make my tests run nicely in
>> IntelliJ and I was wondering if you wanted any documentation or example
>> code?
>
> Both is appreciated...sure ..
>
>
>>
>> I've still got issues and I've got a live question on StackOverflow:
>> https://stackoverflow.com/questions/45241317/hard-time-mojo-testing-with-maven-plugin-testing-harness 
>>
>>
>> Regards
>> Adam
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: maven-plugin-testing-harness

ahardy42
In reply to this post by Karl Heinz Marbaise-3
On 26/07/17 11:49, ahardy42 wrote:
> Is there life is in this testing harness still?
>
> I'm looking at
> https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/

Hi All,
while I've made a lot of progress with my plugin testing with the maven-plugin-testing-harness, I'm stumped now because the setup and startup I've put in place isn't causing maven to set up the test project's classpath properly, so my resources from the test project (in the actual project's src/test/resources/my-test-project/src/main/resources dir) are missing.

Does that sound fixable?

Here's what I'm doing in my test:

        MojoRule mojoRule = new MojoRule(this);
        ClassLoader classLoader = getClass().getClassLoader();
        URL url = classLoader.getResource(TEST_POM);
        if (url == null) {
            throw new MojoExecutionException(String.format(
                    "Cannot locate %s", TEST_POM));
        }
        File pom = new File(url.getFile());
        MavenSettingsBuilder mavenSettingsBuilder = (MavenSettingsBuilder)
                getContainer().lookup(MavenSettingsBuilder.ROLE);
        Settings settings = mavenSettingsBuilder.buildSettings();
        MavenExecutionRequest request = new DefaultMavenExecutionRequest();
        request.setPom(pom);
        request.setLocalRepositoryPath(settings.getLocalRepository());
        MavenExecutionRequestPopulator populator =
                getContainer().lookup(MavenExecutionRequestPopulator.class);
        populator.populateDefaults(request);
        DefaultMaven maven = (DefaultMaven) getContainer().lookup(Maven.class);
        DefaultRepositorySystemSession repoSession =
                (DefaultRepositorySystemSession)
                    maven.newRepositorySession(request);
        LocalRepository localRepository = new LocalRepository(
                request.getLocalRepository().getBasedir());
        SimpleLocalRepositoryManagerFactory factory =
                new SimpleLocalRepositoryManagerFactory();
        LocalRepositoryManager localRepositoryManager =
                factory.newInstance(repoSession, localRepository);
        repoSession.setLocalRepositoryManager(localRepositoryManager);
        ProjectBuildingRequest buildingRequest =
                request.getProjectBuildingRequest()
                        .setRepositorySession(repoSession)
                        .setResolveDependencies(true);
        ProjectBuilder projectBuilder = mojoRule.lookup(ProjectBuilder.class);
        MavenProject project =
                projectBuilder.build(pom, buildingRequest).getProject();
        MavenSession session = mojoRule.newMavenSession(project);
        session.setCurrentProject(project);
        session.setProjects(Collections.singletonList(project));
        request.setSystemProperties(System.getProperties());
        testMojo = (GenerateConfig) lookupConfiguredMojo(session,
                mojoRule.newMojoExecution("configure"));


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: maven-plugin-testing-harness

ahardy42
In reply to this post by Karl Heinz Marbaise-3
On 26/07/17 20:13, Karl Heinz Marbaise wrote:
>> and the link to git repo is 404
>
> https://github.com/apache/maven-plugin-testing
>
> but it's out of date correct...
>
> I have created an appropriate INFRA ticket to fix this[1].
>
>
> [1]: https://issues.apache.org/jira/browse/INFRA-14716


As far as I can tell, the fix didn't work. I updated the JIRA issue but I was unable to re-open the ticket and I could only leave "internal comments" which aren't publicly visible, despite  logging in.

What would also be incredibly useful is a link to the wiki for maven-plugin-testing-harness

I assume there is one, I just can't find any link to one anywhere.

regards
Adam
Loading...