RepositorySystemSession Null in Maven 3 Plugin Unit Test - maven

I am attempting to write a unit test for a Maven 3 Plugin with a dependency on Aether using the Maven Plugin Testing Harness. When executing my tests though the RepositorySystemSession is null and after an extensive search I can not figure out how to inject a session into the unit tests plugin harness.
I am using Maven 3.0.3 core APIs, Maven Plugin Test Harness 2.0 and Aether 1.12. I have tried other various combinations but appear to be missing a critical component somewhere along the line.
The code base for the example can be found here: http://www.sonatype.com/people/2011/01/how-to-use-aether-in-maven-plugins/.
The documentation for the plugin harness can be found here: http://maven.apache.org/plugin-testing/maven-plugin-testing-harness/getting-started/index.html.
My example code can be seen here:
MyAetherMojo
MyAetherMojoTest
Any ideas on how to get the RepositorySystemSession injected into the container for the unit test?
TIA,
Scott ES

The plugin testing harness does not support Aether testing. You have to use the Maven Invoker Plugin as demonstrated in the How To Use Aether in Maven Plugins demo code.

Related

What maven plugin to use in pom.xml for automation tests testNG, java, rest-assured framework?

I have created maven based testNG, rest-assured framework using Java. Now I want to integrate with Jenkins. What maven plugin to use in order to run via Jenkins?

RestAssured Spring Boot Test returning 404s

I am building an API using Spring Boot and Katharsis. When writing integration tests using RestAssured my tests are passing in STS but getting 404s in Maven. I'm not sure what the difference might be or why it isn't working.
Running the API things are working as expected.
I was wondering if anyone had any thoughts?
Code Repo is here: https://github.com/Holmes89/liturgical-project
So the problem had to do with the fact Reflections wasn't populating my ResourcesRepository on test startup. I found a similar problem here:
Unit test using the Reflections google library fails only when executed by Maven
And used the following link to configure the Maven Surefire Plugin:
http://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html
Adding the following config helped:
<useSystemClassLoader>false</useSystemClassLoader>

How to instrument fragment bundles JUNIT tests using Cobertura?

We are trying to measure our code coverage of JUNIT test cases using Cobertura. Our application is a Java stack which was designed by OSGI model. Due to fragment bundle implementation of my test Cobertura is not able to calculate the code coverage against my source code. We are using surefire plugin in Maven.
Kindly share your thoughts/inputs about it.
When we started developing based on OSGi we replaced Cobertura to Jacoco as it can work as a Java agent. It also has a maven plugin.
Jacoco works until there is bytecode weaving in the runtime as in that case the hashcode of the classes will be changed. E.g.: If you use Aries-Proxy, Jacoco will not work.

Allure gradle integration

I'm trying to integrate Allure reports into a Gradle build. It seems there is no direct support for Gradle overall (all Maven) and only some recent support for TestNG. Digging further I see a number of issues with Gradle not supporting JUnit listeners, but they do support TestNG listeners (because TestNG does). I've tried a gradle integration following the Maven pom as guideline for the JUnit plugin, but it obviously produces no output.
So I guess my question is :
Will there be any gradle support coming soon or will we have to wait for Gradle to enable some sort of JUNit listener facility first?
If none of the above, has anyone done a custom integration ?
Allure TestNG Gradle example here https://github.com/allure-examples/allure-gradle-testng-example
It's works because TestNG supports Java SPI for adding test listeners. But JUnit does't have such feature. You can check out the following PR to JUnit https://github.com/junit-team/junit/pull/923
If you need Gradle support for JUnit right now you can try to implement Gradle Test Listener (http://www.gradle.org/docs/current/javadoc/org/gradle/api/tasks/testing/TestListener.html)
Hope it helps

Jersey Test Framework

I have a non maven project. I would like to test my jersey rest services using the Jersey Test Framework. The jersey docs only relate to maven for the jersey test framework. Is it possible to add a jar or library to the project to use this framework?
Using Jersey client instead of Jersey Test Framework have two advantages:
It's well documented and only needs the jersey-client JAR
The written code is standard and can be use by the Java clients of your services
I would suggest you to add Maven to your project for some reasons
ability to use and helpful dependencies
having mechanism to create a build of you application with one command like mvn clean package
If you use Ant scripts you can easily call old Ant scripts from Maven with Apache Maven AntRun Plugin without significant Ant scripts rebuilding.

Resources