From 33abe5faaf56068323defe14c9631654cb22a7d8 Mon Sep 17 00:00:00 2001 From: Andreas Gudian Date: Sun, 14 Sep 2014 21:36:33 +0200 Subject: [PATCH] #202 Refactor integration tests to use Maven Verifier, different JDKs using toolchains, and the Eclipse JDT compiler. --- .../resources/build-config/checkstyle.xml | 2 +- etc/toolchains-cloudbees-jenkins.xml | 37 +++ etc/toolchains-example.xml | 36 +++ integrationtest-jdk8/pom.xml | 118 -------- integrationtest/pom.xml | 121 +++------ .../org/mapstruct/itest/tests/CdiTest.java | 33 +++ .../org/mapstruct/itest/tests/Java8Test.java | 33 +++ .../org/mapstruct/itest/tests/JaxbTest.java | 33 +++ .../org/mapstruct/itest/tests/Jsr330Test.java | 33 +++ .../org/mapstruct/itest/tests/SimpleTest.java | 33 +++ .../org/mapstruct/itest/tests/SpringTest.java | 33 +++ .../itest/testutil/runner/ProcessorSuite.java | 156 +++++++++++ .../testutil/runner/ProcessorSuiteRunner.java | 257 ++++++++++++++++++ .../src/test/resources/cdiTest/pom.xml | 81 ++++++ .../java/org/mapstruct/itest/cdi/Source.java | 0 .../itest/cdi/SourceTargetMapper.java | 0 .../java/org/mapstruct/itest/cdi/Target.java | 0 .../mapstruct/itest/cdi/other/DateMapper.java | 0 .../itest/cdi/CdiBasedMapperTest.java | 0 .../src/test/resources/java8Test/pom.xml | 34 +++ .../mapstruct/itest/java8/Java8Mapper.java | 0 .../org/mapstruct/itest/java8/Source.java | 0 .../org/mapstruct/itest/java8/Target.java | 0 .../itest/java8/Java8MapperTest.java | 0 .../src/test/resources/jaxbTest/pom.xml | 65 +++++ .../org/mapstruct/itest/jaxb/JaxbMapper.java | 0 .../mapstruct/itest/jaxb/OrderDetailsDto.java | 0 .../org/mapstruct/itest/jaxb/OrderDto.java | 0 .../mapstruct/itest/jaxb/OrderStatusDto.java | 0 .../itest/jaxb/ShippingAddressDto.java | 0 .../itest/jaxb/SourceTargetMapper.java | 0 .../src}/main/resources/binding/binding.xjb | 0 .../src}/main/resources/schema/test1.xsd | 0 .../src}/main/resources/schema/test2.xsd | 0 .../itest/jaxb/JaxbBasedMapperTest.java | 0 .../src/test/resources/jsr330Test/pom.xml | 50 ++++ .../org/mapstruct/itest/jsr330/Source.java | 0 .../itest/jsr330/SourceTargetMapper.java | 0 .../org/mapstruct/itest/jsr330/Target.java | 0 .../itest/jsr330/other/DateMapper.java | 0 .../itest/jsr330/Jsr330BasedMapperTest.java | 0 integrationtest/src/test/resources/pom.xml | 180 ++++++++++++ .../src/test/resources/simpleTest/pom.xml | 34 +++ .../org/mapstruct/itest/simple}/Source.java | 2 +- .../itest/simple}/SourceTargetMapper.java | 2 +- .../org/mapstruct/itest/simple}/Target.java | 2 +- .../itest/simple}/ConversionTest.java | 5 +- .../src/test/resources/springTest/pom.xml | 50 ++++ .../org/mapstruct/itest/spring/Source.java | 0 .../itest/spring/SourceTargetMapper.java | 0 .../org/mapstruct/itest/spring/Target.java | 0 .../itest/spring/other/DateMapper.java | 0 .../itest/spring/SpringBasedMapperTest.java | 0 parent/pom.xml | 8 +- pom.xml | 1 - 55 files changed, 1230 insertions(+), 209 deletions(-) create mode 100644 etc/toolchains-cloudbees-jenkins.xml create mode 100644 etc/toolchains-example.xml delete mode 100644 integrationtest-jdk8/pom.xml create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/CdiTest.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/Java8Test.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/JaxbTest.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/Jsr330Test.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/SimpleTest.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/tests/SpringTest.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java create mode 100644 integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java create mode 100644 integrationtest/src/test/resources/cdiTest/pom.xml rename integrationtest/src/{ => test/resources/cdiTest/src}/main/java/org/mapstruct/itest/cdi/Source.java (100%) rename integrationtest/src/{ => test/resources/cdiTest/src}/main/java/org/mapstruct/itest/cdi/SourceTargetMapper.java (100%) rename integrationtest/src/{ => test/resources/cdiTest/src}/main/java/org/mapstruct/itest/cdi/Target.java (100%) rename integrationtest/src/{ => test/resources/cdiTest/src}/main/java/org/mapstruct/itest/cdi/other/DateMapper.java (100%) rename integrationtest/src/test/{ => resources/cdiTest/src/test}/java/org/mapstruct/itest/cdi/CdiBasedMapperTest.java (100%) create mode 100644 integrationtest/src/test/resources/java8Test/pom.xml rename {integrationtest-jdk8 => integrationtest/src/test/resources/java8Test}/src/main/java/org/mapstruct/itest/java8/Java8Mapper.java (100%) rename {integrationtest-jdk8 => integrationtest/src/test/resources/java8Test}/src/main/java/org/mapstruct/itest/java8/Source.java (100%) rename {integrationtest-jdk8 => integrationtest/src/test/resources/java8Test}/src/main/java/org/mapstruct/itest/java8/Target.java (100%) rename {integrationtest-jdk8 => integrationtest/src/test/resources/java8Test}/src/test/java/org/mapstruct/itest/java8/Java8MapperTest.java (100%) create mode 100644 integrationtest/src/test/resources/jaxbTest/pom.xml rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/JaxbMapper.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/OrderDetailsDto.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/OrderDto.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/OrderStatusDto.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/ShippingAddressDto.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/java/org/mapstruct/itest/jaxb/SourceTargetMapper.java (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/resources/binding/binding.xjb (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/resources/schema/test1.xsd (100%) rename integrationtest/src/{ => test/resources/jaxbTest/src}/main/resources/schema/test2.xsd (100%) rename integrationtest/src/test/{ => resources/jaxbTest/src/test}/java/org/mapstruct/itest/jaxb/JaxbBasedMapperTest.java (100%) create mode 100644 integrationtest/src/test/resources/jsr330Test/pom.xml rename integrationtest/src/{ => test/resources/jsr330Test/src}/main/java/org/mapstruct/itest/jsr330/Source.java (100%) rename integrationtest/src/{ => test/resources/jsr330Test/src}/main/java/org/mapstruct/itest/jsr330/SourceTargetMapper.java (100%) rename integrationtest/src/{ => test/resources/jsr330Test/src}/main/java/org/mapstruct/itest/jsr330/Target.java (100%) rename integrationtest/src/{ => test/resources/jsr330Test/src}/main/java/org/mapstruct/itest/jsr330/other/DateMapper.java (100%) rename integrationtest/src/test/{ => resources/jsr330Test/src/test}/java/org/mapstruct/itest/jsr330/Jsr330BasedMapperTest.java (100%) create mode 100644 integrationtest/src/test/resources/pom.xml create mode 100644 integrationtest/src/test/resources/simpleTest/pom.xml rename integrationtest/src/{main/java/org/mapstruct/itest => test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple}/Source.java (97%) rename integrationtest/src/{main/java/org/mapstruct/itest => test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple}/SourceTargetMapper.java (97%) rename integrationtest/src/{main/java/org/mapstruct/itest => test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple}/Target.java (97%) rename integrationtest/src/test/{java/org/mapstruct/itest => resources/simpleTest/src/test/java/org/mapstruct/itest/simple}/ConversionTest.java (94%) create mode 100644 integrationtest/src/test/resources/springTest/pom.xml rename integrationtest/src/{ => test/resources/springTest/src}/main/java/org/mapstruct/itest/spring/Source.java (100%) rename integrationtest/src/{ => test/resources/springTest/src}/main/java/org/mapstruct/itest/spring/SourceTargetMapper.java (100%) rename integrationtest/src/{ => test/resources/springTest/src}/main/java/org/mapstruct/itest/spring/Target.java (100%) rename integrationtest/src/{ => test/resources/springTest/src}/main/java/org/mapstruct/itest/spring/other/DateMapper.java (100%) rename integrationtest/src/test/{ => resources/springTest/src/test}/java/org/mapstruct/itest/spring/SpringBasedMapperTest.java (100%) diff --git a/build-config/src/main/resources/build-config/checkstyle.xml b/build-config/src/main/resources/build-config/checkstyle.xml index 3de95264f..8fee6a8c3 100644 --- a/build-config/src/main/resources/build-config/checkstyle.xml +++ b/build-config/src/main/resources/build-config/checkstyle.xml @@ -163,7 +163,7 @@ - + diff --git a/etc/toolchains-cloudbees-jenkins.xml b/etc/toolchains-cloudbees-jenkins.xml new file mode 100644 index 000000000..e6ce86e06 --- /dev/null +++ b/etc/toolchains-cloudbees-jenkins.xml @@ -0,0 +1,37 @@ + + + + jdk + + 1.6 + oracle + jdk1.6 + + + /opt/jdk/jdk1.6.latest + + + + jdk + + 1.7 + oracle + jdk1.7 + + + /opt/jdk/jdk1.7.latest + + + + jdk + + 1.8 + oracle + jdk1.8 + + + /opt/jdk/jdk8.latest + + + + diff --git a/etc/toolchains-example.xml b/etc/toolchains-example.xml new file mode 100644 index 000000000..24ce7d98a --- /dev/null +++ b/etc/toolchains-example.xml @@ -0,0 +1,36 @@ + + + + jdk + + 1.6.0_45 + oracle + jdk1.6 + + + C:\Program Files\Java\jdk1.6.0_45 + + + + jdk + + 1.7.0_51 + oracle + jdk1.7 + + + C:\Program Files\Java\jdk1.7.0_51 + + + + jdk + + 1.8.0_11 + oracle + jdk1.8 + + + C:\Program Files\Java\jdk1.8.0_11 + + + diff --git a/integrationtest-jdk8/pom.xml b/integrationtest-jdk8/pom.xml deleted file mode 100644 index 6495b7125..000000000 --- a/integrationtest-jdk8/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - 4.0.0 - - - org.mapstruct - mapstruct-parent - 1.0.0-SNAPSHOT - ../parent/pom.xml - - - mapstruct-integrationtest-jdk8 - jar - MapStruct Integration Tests for JDK 8 - - - - ${project.groupId} - mapstruct-jdk8 - provided - - - - junit - junit - test - - - org.easytesting - fest-assert - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - org.bsc.maven - maven-processor-plugin - - ${project.build.directory}/generated-sources/mapstruct - - org.mapstruct.ap.MappingProcessor - - - - false - - - - - process - generate-sources - - process - - - - - - ${project.groupId} - mapstruct-processor - ${project.version} - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - check-style - verify - - checkstyle - - - - - - - diff --git a/integrationtest/pom.xml b/integrationtest/pom.xml index 632947f7a..521f57937 100644 --- a/integrationtest/pom.xml +++ b/integrationtest/pom.xml @@ -19,7 +19,8 @@ limitations under the License. --> - + 4.0.0 @@ -33,13 +34,11 @@ jar MapStruct Integration Test - - - ${project.groupId} - mapstruct - provided - + + ${project.version} + + junit @@ -51,92 +50,34 @@ fest-assert test - - - javax.enterprise - cdi-api - - - javax.inject - javax.inject - - - org.jboss.arquillian.junit - arquillian-junit-container + org.apache.maven.shared + maven-verifier test - - org.jboss.arquillian.container - arquillian-weld-se-embedded-1.1 - test - - - org.jboss.arquillian.container - arquillian-container-test-api - test - - - org.jboss.arquillian.junit - arquillian-junit-core - test - - - org.jboss.shrinkwrap - shrinkwrap-api - test - - - org.jboss.weld - weld-core - test - - - org.glassfish - javax.el - test - - - - - org.springframework - spring-test - test - - - org.springframework - spring-beans - - - org.springframework - spring-context - + + + src/test/resources + true + + - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - - - - generate - - - + org.apache.maven.plugins + maven-resources-plugin - ${project.build.resources[0].directory}/schema/ - - **/test1.xsd - - ${project.build.resources[0].directory}/binding - - **/binding.xjb - - true - true - 2.1 + \ + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 @@ -176,6 +117,18 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + + + 0 + + auto + + + org.apache.maven.plugins maven-checkstyle-plugin diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/CdiTest.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/CdiTest.java new file mode 100644 index 000000000..558f87656 --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/CdiTest.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "cdiTest", processorTypes = ProcessorType.ALL ) +public class CdiTest { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/Java8Test.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/Java8Test.java new file mode 100644 index 000000000..ff09162ed --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/Java8Test.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "java8Test", processorTypes = ProcessorType.ALL_JAVA_8 ) +public class Java8Test { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/JaxbTest.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/JaxbTest.java new file mode 100644 index 000000000..ae3764bd1 --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/JaxbTest.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "jaxbTest", processorTypes = ProcessorType.ALL ) +public class JaxbTest { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/Jsr330Test.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/Jsr330Test.java new file mode 100644 index 000000000..d7d757c4a --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/Jsr330Test.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "springTest", processorTypes = ProcessorType.ALL ) +public class Jsr330Test { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/SimpleTest.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/SimpleTest.java new file mode 100644 index 000000000..638609781 --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/SimpleTest.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "simpleTest", processorTypes = ProcessorType.ALL ) +public class SimpleTest { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/tests/SpringTest.java b/integrationtest/src/test/java/org/mapstruct/itest/tests/SpringTest.java new file mode 100644 index 000000000..91a6d2ba5 --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/tests/SpringTest.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.tests; + +import org.junit.runner.RunWith; +import org.mapstruct.itest.testutil.runner.ProcessorSuite; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner; + +/** + * @author Andreas Gudian + * + */ +@RunWith( ProcessorSuiteRunner.class ) +@ProcessorSuite( baseDir = "springTest", processorTypes = ProcessorType.ALL ) +public class SpringTest { +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java new file mode 100644 index 000000000..4fd0b7793 --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuite.java @@ -0,0 +1,156 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.testutil.runner; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Declares the content of the integration test. + *

+ * {@link #baseDir()} must be a path in the classpath that contains the maven module to run as integration test. The + * integration test module should contain at least one test class. The integration test passes, if + * {@code mvn clean test} finishes successfully. + *

+ * {@link #processorTypes()} configures the variants to execute the integration tests with. See {@link ProcessorType}. + * + * @author Andreas Gudian + */ +@Retention( RetentionPolicy.RUNTIME ) +@Documented +@Target( ElementType.TYPE ) +public @interface ProcessorSuite { + /** + * Describes the type of the processing variant(s) to use when executing the integration test. + *

+ * Types that require toolchains, will + * need the toolchains.xml file to be either installed in ~/m2, or alternatively passed to the mvn process using + * {@code mvn -DprocessorIntegrationTest.toolchainsFile=/path/to/toolchains.xml ...} + * + * @author Andreas Gudian + */ + public enum ProcessorType { + /** + * Use an Oracle JDK 1.6 (or 1.6.x) via toolchain support to perform the processing + */ + ORACLE_JAVA_6( "oracle-[1.6,1.7)", "javac", "1.6" ), + + /** + * Use an Oracle JDK 1.7 (or 1.7.x) via toolchain support to perform the processing + */ + ORACLE_JAVA_7( "oracle-[1.7,1.8)", "javac", "1.7" ), + + /** + * Use the same JDK that runs the mvn build to perform the processing + */ + ORACLE_JAVA_8( null, "javac", "1.8" ), + + /** + * Use the eclipse compiler with 1.7 source/target level from tycho-compiler-jdt to perform the build and + * processing + */ + ECLIPSE_JDT_JAVA_7( null, "jdt", "1.7" ), + + /** + * Use the eclipse compiler with 1.8 source/target level from tycho-compiler-jdt to perform the build and + * processing + */ + ECLIPSE_JDT_JAVA_8( null, "jdt", "1.8" ), + + /** + * Use the maven-processor-plugin with 1.7 source/target level with the same JDK that runs the mvn build to + * perform the processing + */ + PROCESSOR_PLUGIN_JAVA_7( null, null, "1.7" ), + + /** + * Use the maven-processor-plugin with 1.8 source/target level with the same JDK that runs the mvn build to + * perform the processing + */ + PROCESSOR_PLUGIN_JAVA_8( null, null, "1.8" ), + + /** + * Use all available processing variants + */ + ALL( 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 ), + + /** + * Use all JDK8 compatible processing variants + */ + ALL_JAVA_8( ORACLE_JAVA_8, ECLIPSE_JDT_JAVA_8, PROCESSOR_PLUGIN_JAVA_8 ); + + private ProcessorType[] included = { }; + + private String toolchain; + private String compilerId; + private String sourceTargetVersion; + + private ProcessorType(String toolchain, String compilerId, String sourceTargetVersion) { + this.toolchain = toolchain; + this.compilerId = compilerId; + this.sourceTargetVersion = sourceTargetVersion; + } + + private ProcessorType(ProcessorType... included) { + this.included = included; + } + + /** + * @return the processor types that are grouped by this type + */ + public ProcessorType[] getIncluded() { + return included; + } + + /** + * @return the toolchain + */ + public String getToolchain() { + return toolchain; + } + + /** + * @return the compilerId + */ + public String getCompilerId() { + return compilerId; + } + + /** + * @return the sourceTargetVersion + */ + public String getSourceTargetVersion() { + return sourceTargetVersion; + } + } + + /** + * @return a path in the classpath that contains the maven module to run as integration test: {@code mvn clean test} + */ + String baseDir(); + + /** + * @return the variants to execute the integration tests with. See {@link ProcessorType}. + */ + ProcessorType[] processorTypes() default { ProcessorType.ALL }; +} diff --git a/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java new file mode 100644 index 000000000..f56504c4a --- /dev/null +++ b/integrationtest/src/test/java/org/mapstruct/itest/testutil/runner/ProcessorSuiteRunner.java @@ -0,0 +1,257 @@ +/** + * Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.itest.testutil.runner; + +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.it.Verifier; +import org.junit.internal.AssumptionViolatedException; +import org.junit.internal.runners.model.EachTestNotifier; +import org.junit.runner.Description; +import org.junit.runner.notification.RunNotifier; +import org.junit.runner.notification.StoppedByUserException; +import org.junit.runners.ParentRunner; +import org.junit.runners.model.InitializationError; +import org.mapstruct.itest.testutil.runner.ProcessorSuite.ProcessorType; +import org.mapstruct.itest.testutil.runner.ProcessorSuiteRunner.ProcessorTestCase; + +import static org.apache.maven.it.util.ResourceExtractor.extractResourceToDestination; +import static org.apache.maven.shared.utils.io.FileUtils.copyURLToFile; +import static org.apache.maven.shared.utils.io.FileUtils.deleteDirectory; + +/** + * Runner for processor integration tests. Requires the annotation {@link ProcessorSuite} on the test class. + * + * @author Andreas Gudian + */ +public class ProcessorSuiteRunner extends ParentRunner { + + public static final class ProcessorTestCase { + private final String baseDir; + private final ProcessorType processor; + private final boolean ignored; + + public ProcessorTestCase(String baseDir, ProcessorType processor) { + this.baseDir = baseDir; + this.processor = processor; + this.ignored = !TOOLCHAINS_ENABLED && processor.getToolchain() != null; + } + } + + private static final File SPECIFIED_TOOLCHAINS_FILE = getSpecifiedToolchainsFile(); + private static final boolean TOOLCHAINS_ENABLED = toolchainsFileExists(); + + private final List methods; + + /** + * @param clazz the test class + * @throws InitializationError in case the initialization fails + */ + public ProcessorSuiteRunner(Class clazz) throws InitializationError { + super( clazz ); + + ProcessorSuite suite = clazz.getAnnotation( ProcessorSuite.class ); + + if ( null == suite ) { + throw new InitializationError( "The test class must be annotated with " + ProcessorSuite.class.getName() ); + } + + if ( suite.processorTypes().length == 0 ) { + throw new InitializationError( "ProcessorSuite#processorTypes must not be empty" ); + } + + methods = initializeTestCases( suite ); + } + + private List initializeTestCases(ProcessorSuite suite) { + List types = new ArrayList(); + + for ( ProcessorType compiler : suite.processorTypes() ) { + if ( compiler.getIncluded().length > 0 ) { + types.addAll( Arrays.asList( compiler.getIncluded() ) ); + } + else { + types.add( compiler ); + } + } + + List result = new ArrayList( types.size() ); + + for ( ProcessorType type : types ) { + result.add( new ProcessorTestCase( suite.baseDir(), type ) ); + } + + return result; + } + + @Override + protected List getChildren() { + return methods; + } + + @Override + protected Description describeChild(ProcessorTestCase child) { + return Description.createTestDescription( getTestClass().getJavaClass(), child.processor.name().toLowerCase() ); + } + + @Override + protected void runChild(ProcessorTestCase child, RunNotifier notifier) { + Description description = describeChild( child ); + EachTestNotifier testNotifier = new EachTestNotifier( notifier, description ); + + if ( child.ignored ) { + testNotifier.fireTestIgnored(); + } + else { + try { + testNotifier.fireTestStarted(); + doExecute( child, description ); + } + catch ( AssumptionViolatedException e ) { + testNotifier.fireTestIgnored(); + } + catch ( StoppedByUserException e ) { + throw e; + } + catch ( Throwable e ) { + testNotifier.addFailure( e ); + } + finally { + testNotifier.fireTestFinished(); + } + } + } + + private void doExecute(ProcessorTestCase child, Description description) throws Exception { + File destination = extractTest( child, description ); + PrintStream originalOut = System.out; + + Verifier verifier = new Verifier( destination.getCanonicalPath() ); + + List goals = new ArrayList( 3 ); + + goals.add( "clean" ); + + try { + configureToolchains( child, verifier, goals, originalOut ); + configureProcessor( child, verifier ); + + verifier.addCliOption( "-Dcompiler-source-target-version=" + child.processor.getSourceTargetVersion() ); + + if ( "1.8".equals( child.processor.getSourceTargetVersion() ) ) { + verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct-jdk8" ); + } + else { + verifier.addCliOption( "-Dmapstruct-artifact-id=mapstruct" ); + } + + goals.add( "test" ); + + originalOut.println( "executing " + child.processor.name().toLowerCase() ); + + verifier.executeGoals( goals ); + verifier.verifyErrorFreeLog(); + } + finally { + verifier.resetStreams(); + } + } + + private void configureProcessor(ProcessorTestCase child, Verifier verifier) { + if ( child.processor.getCompilerId() != null ) { + verifier.addCliOption( "-Pgenerate-via-compiler-plugin" ); + verifier.addCliOption( "-Dcompiler-id=" + child.processor.getCompilerId() ); + } + else { + verifier.addCliOption( "-Pgenerate-via-processor-plugin" ); + } + } + + private void configureToolchains(ProcessorTestCase child, Verifier verifier, List goals, + PrintStream originalOut) { + if ( child.processor.getToolchain() != null ) { + if ( null != SPECIFIED_TOOLCHAINS_FILE ) { + verifier.addCliOption( "--toolchains" ); + verifier.addCliOption( SPECIFIED_TOOLCHAINS_FILE.getPath().replace( '\\', '/' ) ); + } + + String[] parts = child.processor.getToolchain().split( "-" ); + + verifier.addCliOption( "-Dtoolchain-jdk-vendor=" + parts[0] ); + verifier.addCliOption( "-Dtoolchain-jdk-version=" + parts[1] ); + + goals.add( "toolchains:toolchain" ); + } + } + + private File extractTest(ProcessorTestCase child, Description description) throws IOException { + File tempDirBase = new File( "target/tmp", description.getClassName() ).getCanonicalFile(); + + if ( !tempDirBase.exists() ) { + tempDirBase.mkdirs(); + } + + File parentPom = new File( tempDirBase, "pom.xml" ); + copyURLToFile( getClass().getResource( "/pom.xml" ), parentPom ); + + File tempDir = new File( tempDirBase, description.getMethodName() ); + deleteDirectory( tempDir ); + + return extractResourceToDestination( getClass(), "/" + child.baseDir, tempDir, true ); + } + + private static File getSpecifiedToolchainsFile() { + String specifiedToolchainsFile = System.getProperty( "processorIntegrationTest.toolchainsFile" ); + if ( null != specifiedToolchainsFile ) { + try { + File canonical = new File( specifiedToolchainsFile ).getCanonicalFile(); + if ( canonical.exists() ) { + return canonical; + } + + // check the path relative to the parent directory (allows specifying a path relative to the top-level + // aggregator module) + canonical = new File( "..", specifiedToolchainsFile ).getCanonicalFile(); + if ( canonical.exists() ) { + return canonical; + } + } + catch ( IOException e ) { + return null; + } + } + + return null; + } + + private static boolean toolchainsFileExists() { + if ( null != SPECIFIED_TOOLCHAINS_FILE ) { + return SPECIFIED_TOOLCHAINS_FILE.exists(); + } + + String defaultPath = System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + ".m2"; + return new File( defaultPath, "toolchains.xml" ).exists(); + } + +} diff --git a/integrationtest/src/test/resources/cdiTest/pom.xml b/integrationtest/src/test/resources/cdiTest/pom.xml new file mode 100644 index 000000000..5de8e3e6d --- /dev/null +++ b/integrationtest/src/test/resources/cdiTest/pom.xml @@ -0,0 +1,81 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + cdiTest + jar + + + + + javax.enterprise + cdi-api + + + javax.inject + javax.inject + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.container + arquillian-weld-se-embedded-1.1 + test + + + org.jboss.arquillian.container + arquillian-container-test-api + test + + + org.jboss.arquillian.junit + arquillian-junit-core + test + + + org.jboss.shrinkwrap + shrinkwrap-api + test + + + org.jboss.weld + weld-core + test + + + org.glassfish + javax.el + test + + + diff --git a/integrationtest/src/main/java/org/mapstruct/itest/cdi/Source.java b/integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/Source.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/cdi/Source.java rename to integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/Source.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/cdi/SourceTargetMapper.java b/integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/SourceTargetMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/cdi/SourceTargetMapper.java rename to integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/SourceTargetMapper.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/cdi/Target.java b/integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/Target.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/cdi/Target.java rename to integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/Target.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/cdi/other/DateMapper.java b/integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/other/DateMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/cdi/other/DateMapper.java rename to integrationtest/src/test/resources/cdiTest/src/main/java/org/mapstruct/itest/cdi/other/DateMapper.java diff --git a/integrationtest/src/test/java/org/mapstruct/itest/cdi/CdiBasedMapperTest.java b/integrationtest/src/test/resources/cdiTest/src/test/java/org/mapstruct/itest/cdi/CdiBasedMapperTest.java similarity index 100% rename from integrationtest/src/test/java/org/mapstruct/itest/cdi/CdiBasedMapperTest.java rename to integrationtest/src/test/resources/cdiTest/src/test/java/org/mapstruct/itest/cdi/CdiBasedMapperTest.java diff --git a/integrationtest/src/test/resources/java8Test/pom.xml b/integrationtest/src/test/resources/java8Test/pom.xml new file mode 100644 index 000000000..0e8ed81f6 --- /dev/null +++ b/integrationtest/src/test/resources/java8Test/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + java8Test + jar + diff --git a/integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Java8Mapper.java b/integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Java8Mapper.java similarity index 100% rename from integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Java8Mapper.java rename to integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Java8Mapper.java diff --git a/integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Source.java b/integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Source.java similarity index 100% rename from integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Source.java rename to integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Source.java diff --git a/integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Target.java b/integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Target.java similarity index 100% rename from integrationtest-jdk8/src/main/java/org/mapstruct/itest/java8/Target.java rename to integrationtest/src/test/resources/java8Test/src/main/java/org/mapstruct/itest/java8/Target.java diff --git a/integrationtest-jdk8/src/test/java/org/mapstruct/itest/java8/Java8MapperTest.java b/integrationtest/src/test/resources/java8Test/src/test/java/org/mapstruct/itest/java8/Java8MapperTest.java similarity index 100% rename from integrationtest-jdk8/src/test/java/org/mapstruct/itest/java8/Java8MapperTest.java rename to integrationtest/src/test/resources/java8Test/src/test/java/org/mapstruct/itest/java8/Java8MapperTest.java diff --git a/integrationtest/src/test/resources/jaxbTest/pom.xml b/integrationtest/src/test/resources/jaxbTest/pom.xml new file mode 100644 index 000000000..e7bcc1f8c --- /dev/null +++ b/integrationtest/src/test/resources/jaxbTest/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + jaxbTest + jar + + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + initialize + + generate + + + + + \${project.build.resources[0].directory}/schema/ + + **/test1.xsd + + \${project.build.resources[0].directory}/binding + + **/binding.xjb + + true + true + 2.1 + + + + + diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/JaxbMapper.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/JaxbMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/JaxbMapper.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/JaxbMapper.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderDetailsDto.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderDetailsDto.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderDetailsDto.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderDetailsDto.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderDto.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderDto.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderDto.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderDto.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderStatusDto.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderStatusDto.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/OrderStatusDto.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/OrderStatusDto.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/ShippingAddressDto.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/ShippingAddressDto.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/ShippingAddressDto.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/ShippingAddressDto.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jaxb/SourceTargetMapper.java b/integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/SourceTargetMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jaxb/SourceTargetMapper.java rename to integrationtest/src/test/resources/jaxbTest/src/main/java/org/mapstruct/itest/jaxb/SourceTargetMapper.java diff --git a/integrationtest/src/main/resources/binding/binding.xjb b/integrationtest/src/test/resources/jaxbTest/src/main/resources/binding/binding.xjb similarity index 100% rename from integrationtest/src/main/resources/binding/binding.xjb rename to integrationtest/src/test/resources/jaxbTest/src/main/resources/binding/binding.xjb diff --git a/integrationtest/src/main/resources/schema/test1.xsd b/integrationtest/src/test/resources/jaxbTest/src/main/resources/schema/test1.xsd similarity index 100% rename from integrationtest/src/main/resources/schema/test1.xsd rename to integrationtest/src/test/resources/jaxbTest/src/main/resources/schema/test1.xsd diff --git a/integrationtest/src/main/resources/schema/test2.xsd b/integrationtest/src/test/resources/jaxbTest/src/main/resources/schema/test2.xsd similarity index 100% rename from integrationtest/src/main/resources/schema/test2.xsd rename to integrationtest/src/test/resources/jaxbTest/src/main/resources/schema/test2.xsd diff --git a/integrationtest/src/test/java/org/mapstruct/itest/jaxb/JaxbBasedMapperTest.java b/integrationtest/src/test/resources/jaxbTest/src/test/java/org/mapstruct/itest/jaxb/JaxbBasedMapperTest.java similarity index 100% rename from integrationtest/src/test/java/org/mapstruct/itest/jaxb/JaxbBasedMapperTest.java rename to integrationtest/src/test/resources/jaxbTest/src/test/java/org/mapstruct/itest/jaxb/JaxbBasedMapperTest.java diff --git a/integrationtest/src/test/resources/jsr330Test/pom.xml b/integrationtest/src/test/resources/jsr330Test/pom.xml new file mode 100644 index 000000000..57db54285 --- /dev/null +++ b/integrationtest/src/test/resources/jsr330Test/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + jsr330Test + jar + + + + org.springframework + spring-test + test + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jsr330/Source.java b/integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/Source.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jsr330/Source.java rename to integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/Source.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jsr330/SourceTargetMapper.java b/integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/SourceTargetMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jsr330/SourceTargetMapper.java rename to integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/SourceTargetMapper.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jsr330/Target.java b/integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/Target.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jsr330/Target.java rename to integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/Target.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/jsr330/other/DateMapper.java b/integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/other/DateMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/jsr330/other/DateMapper.java rename to integrationtest/src/test/resources/jsr330Test/src/main/java/org/mapstruct/itest/jsr330/other/DateMapper.java diff --git a/integrationtest/src/test/java/org/mapstruct/itest/jsr330/Jsr330BasedMapperTest.java b/integrationtest/src/test/resources/jsr330Test/src/test/java/org/mapstruct/itest/jsr330/Jsr330BasedMapperTest.java similarity index 100% rename from integrationtest/src/test/java/org/mapstruct/itest/jsr330/Jsr330BasedMapperTest.java rename to integrationtest/src/test/resources/jsr330Test/src/test/java/org/mapstruct/itest/jsr330/Jsr330BasedMapperTest.java diff --git a/integrationtest/src/test/resources/pom.xml b/integrationtest/src/test/resources/pom.xml new file mode 100644 index 000000000..b71f9e86f --- /dev/null +++ b/integrationtest/src/test/resources/pom.xml @@ -0,0 +1,180 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-parent + ${mapstruct.version} + ../../../../parent/pom.xml + + + 1.0.0 + mapstruct-it-parent + pom + MapStruct Integration Test Parent + + + ${mapstruct.version} + foobar + + + + + + + + + generate-via-compiler-plugin + + false + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + \${compiler-id} + + + + org.eclipse.tycho + tycho-compiler-jdt + 0.21.0 + + + + + + + + ${project.groupId} + mapstruct-processor + ${mapstruct.version} + provided + + + + + generate-via-processor-plugin + + false + + + + + org.bsc.maven + maven-processor-plugin + + + process + generate-sources + + process + + + + + \${project.build.directory}/generated-sources/mapstruct + + org.mapstruct.ap.MappingProcessor + + + + + ${project.groupId} + mapstruct-processor + ${mapstruct.version} + + + + + + + + + + + ${project.groupId} + \${mapstruct-artifact-id} + ${mapstruct.version} + provided + + + + + junit + junit + test + + + org.easytesting + fest-assert + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + \${compiler-source-target-version} + \${compiler-source-target-version} + + + + org.apache.maven.plugins + maven-toolchains-plugin + 1.0 + + + + \${toolchain-jdk-version} + \${toolchain-jdk-vendor} + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + 0 + + + + + diff --git a/integrationtest/src/test/resources/simpleTest/pom.xml b/integrationtest/src/test/resources/simpleTest/pom.xml new file mode 100644 index 000000000..d37386768 --- /dev/null +++ b/integrationtest/src/test/resources/simpleTest/pom.xml @@ -0,0 +1,34 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + simpleTest + jar + diff --git a/integrationtest/src/main/java/org/mapstruct/itest/Source.java b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Source.java similarity index 97% rename from integrationtest/src/main/java/org/mapstruct/itest/Source.java rename to integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Source.java index 297146731..49680c89b 100644 --- a/integrationtest/src/main/java/org/mapstruct/itest/Source.java +++ b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Source.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.mapstruct.itest; +package org.mapstruct.itest.simple; public class Source { diff --git a/integrationtest/src/main/java/org/mapstruct/itest/SourceTargetMapper.java b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/SourceTargetMapper.java similarity index 97% rename from integrationtest/src/main/java/org/mapstruct/itest/SourceTargetMapper.java rename to integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/SourceTargetMapper.java index 9f8b13313..513e0d20c 100644 --- a/integrationtest/src/main/java/org/mapstruct/itest/SourceTargetMapper.java +++ b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/SourceTargetMapper.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.mapstruct.itest; +package org.mapstruct.itest.simple; import org.mapstruct.Mapper; import org.mapstruct.Mapping; diff --git a/integrationtest/src/main/java/org/mapstruct/itest/Target.java b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Target.java similarity index 97% rename from integrationtest/src/main/java/org/mapstruct/itest/Target.java rename to integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Target.java index b3ee03a36..5aaa6703c 100644 --- a/integrationtest/src/main/java/org/mapstruct/itest/Target.java +++ b/integrationtest/src/test/resources/simpleTest/src/main/java/org/mapstruct/itest/simple/Target.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.mapstruct.itest; +package org.mapstruct.itest.simple; public class Target { diff --git a/integrationtest/src/test/java/org/mapstruct/itest/ConversionTest.java b/integrationtest/src/test/resources/simpleTest/src/test/java/org/mapstruct/itest/simple/ConversionTest.java similarity index 94% rename from integrationtest/src/test/java/org/mapstruct/itest/ConversionTest.java rename to integrationtest/src/test/resources/simpleTest/src/test/java/org/mapstruct/itest/simple/ConversionTest.java index 07fcdd0ec..0b1f67432 100644 --- a/integrationtest/src/test/java/org/mapstruct/itest/ConversionTest.java +++ b/integrationtest/src/test/resources/simpleTest/src/test/java/org/mapstruct/itest/simple/ConversionTest.java @@ -16,11 +16,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.mapstruct.itest; +package org.mapstruct.itest.simple; import static org.fest.assertions.Assertions.assertThat; import org.junit.Test; +import org.mapstruct.itest.simple.Source; +import org.mapstruct.itest.simple.SourceTargetMapper; +import org.mapstruct.itest.simple.Target; public class ConversionTest { diff --git a/integrationtest/src/test/resources/springTest/pom.xml b/integrationtest/src/test/resources/springTest/pom.xml new file mode 100644 index 000000000..a970934e2 --- /dev/null +++ b/integrationtest/src/test/resources/springTest/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + org.mapstruct + mapstruct-it-parent + 1.0.0 + ../pom.xml + + + springTest + jar + + + + org.springframework + spring-test + test + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + diff --git a/integrationtest/src/main/java/org/mapstruct/itest/spring/Source.java b/integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/Source.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/spring/Source.java rename to integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/Source.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/spring/SourceTargetMapper.java b/integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/SourceTargetMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/spring/SourceTargetMapper.java rename to integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/SourceTargetMapper.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/spring/Target.java b/integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/Target.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/spring/Target.java rename to integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/Target.java diff --git a/integrationtest/src/main/java/org/mapstruct/itest/spring/other/DateMapper.java b/integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/other/DateMapper.java similarity index 100% rename from integrationtest/src/main/java/org/mapstruct/itest/spring/other/DateMapper.java rename to integrationtest/src/test/resources/springTest/src/main/java/org/mapstruct/itest/spring/other/DateMapper.java diff --git a/integrationtest/src/test/java/org/mapstruct/itest/spring/SpringBasedMapperTest.java b/integrationtest/src/test/resources/springTest/src/test/java/org/mapstruct/itest/spring/SpringBasedMapperTest.java similarity index 100% rename from integrationtest/src/test/java/org/mapstruct/itest/spring/SpringBasedMapperTest.java rename to integrationtest/src/test/resources/springTest/src/test/java/org/mapstruct/itest/spring/SpringBasedMapperTest.java diff --git a/parent/pom.xml b/parent/pom.xml index c18d2e544..b9c400f83 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -200,6 +200,11 @@ mapstruct-processor ${project.version} + + org.apache.maven.shared + maven-verifier + 1.5 + @@ -226,7 +231,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.10 + 2.12.1 build-config/checkstyle.xml true @@ -446,6 +451,7 @@ copyright.txt **/license.txt **/mapstruct.xml + **/toolchains-*.xml **/eclipse-formatter-config.xml maven-settings.xml readme.md diff --git a/pom.xml b/pom.xml index 345f851fc..194d9ffb1 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,6 @@ core-jdk8 processor integrationtest - integrationtest-jdk8