mapstruct/mapstruct — pull request #296 by agudian (2014-09-14 19:59:34+00:00)
Title: #202 Refactor integration tests to use Maven Verifier, different JDKs and Eclipse JDT compiler

Finally did it. And it's working pretty good:

Each test in the integrationtest module now somehow looks like this here:

```java
@RunWith( ProcessorSuiteRunner.class )
@ProcessorSuite( baseDir = "jaxbTest", processorTypes = ProcessorType.ALL )
public class JaxbTest {
}
```

Located in ```src/test/resources/jaxbTest``` is a maven project (the pom.xml points to the parent pom.xml in ```src/test/resources```, containing the types to map, the mappers to generate (and in this case also the xsd to generate JAXB classes from), and last but not least a trivial JUnit test case that checks if the generation was successful, from a functional point of view.

The new integration test runner ( ```@RunWith( ProcessorSuiteRunner.class )``` ) takes that maven project and creates one test case for each item in ```@ProcessorSuite( processorTypes= { .. } ).
The currently supported types are: ```ORACLE_JAVA_6, ORACLE_JAVA_7, ORACLE_JAVA_8, ECLIPSE_JDT_JAVA_7, ECLIPSE_JDT_JAVA_8, PROCESSOR_PLUGIN_JAVA_7, PROCESSOR_PLUGIN_JAVA_8``` and as a short-cut ```ALL``` and ```ALL_JAVA_8```.

In order to use ```ORACLE_JAVA_6``` and ```ORACLE_JAVA_7```, a Maven toolchains.xml file must be present in your ~/.m2 directory, or it must be passed to the process as System-property: ```-DprocessorIntegrationTest.toolchainsFile=path/to/alternative-toolchains.xml```. If no toolchains file can be found, the respective test cases are marked as skipped and the build continues without them.
I've added two toolchains files as an example, see ```etc/toolchains-*.xml```. The toolchains-cloudbees-jenkins.xml should be suitable for usage in our CI.

One _must_ have executed a ```mvn install``` on the dependent projects (processor, core, ...) to see any changes take effect. Otherwise, the test cases would just use the latest snapshots still lying around in the repository.

On the IDE-support: the tests run in the IDE, but when not executed from a maven-build, they take considerably longer, as each test case needs to spawn a new maven process. Plus, we still need to ```mvn install``` the other modules first. But: remote-debugging works great. When running ```mvnDebug test -Dtest=JaxbTest``` in the console, we can just attach the IDE's remote debugger to see how the processor behaves with JDK6 or with the Eclipse JDT compiler.

I have removed the integrationtests-java8 module, as we don't need that one anymore now.

WDYT?