upgrading g-config to ensure we pass tck + fixing tck setup (speed improvement and removing some workarounds)
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/59c398d1 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/59c398d1 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/59c398d1 Branch: refs/heads/fb_tomee8 Commit: 59c398d19d715d03c0549bf92d9a70b6ba1c7644 Parents: 4a7531d Author: Romain Manni-Bucau <rmannibu...@gmail.com> Authored: Mon Mar 12 15:59:55 2018 +0100 Committer: Romain Manni-Bucau <rmannibu...@gmail.com> Committed: Mon Mar 12 15:59:55 2018 +0100 ---------------------------------------------------------------------- pom.xml | 2 +- tck/bval-embedded/pom.xml | 1 + tck/microprofile-tck/config/pom.xml | 26 ++++++-- .../MicroProfileConfigTCKArchiveProcessor.java | 23 ++++--- .../config/MicroProfileConfigurationTest.java | 69 -------------------- .../config/src/test/resources/arquillian.xml | 1 - tomee/tomee-microprofile-webapp/pom.xml | 16 +---- 7 files changed, 39 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 92db56b..53ded49 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ <tomee.version>${project.version}</tomee.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <surefire.version>2.20</surefire.version> + <surefire.version>2.21.0</surefire.version> <!-- To easily change the javaee api version --> <version.javaee-api>8.0-SNAPSHOT</version.javaee-api> http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tck/bval-embedded/pom.xml ---------------------------------------------------------------------- diff --git a/tck/bval-embedded/pom.xml b/tck/bval-embedded/pom.xml index 2ff885a..dbf59a6 100644 --- a/tck/bval-embedded/pom.xml +++ b/tck/bval-embedded/pom.xml @@ -132,6 +132,7 @@ <artifactId>maven-surefire-plugin</artifactId> <version>${surefire.version}</version> <configuration> + <reuseForks>true</reuseForks> <suiteXmlFiles> <suiteXmlFile>${project.build.directory}/dependency/beanvalidation-tck-tests-suite.xml</suiteXmlFile> </suiteXmlFiles> http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tck/microprofile-tck/config/pom.xml ---------------------------------------------------------------------- diff --git a/tck/microprofile-tck/config/pom.xml b/tck/microprofile-tck/config/pom.xml index 55c81d6..a218412 100644 --- a/tck/microprofile-tck/config/pom.xml +++ b/tck/microprofile-tck/config/pom.xml @@ -33,25 +33,40 @@ <microprofile.config.version>1.2</microprofile.config.version> </properties> + <!-- TODO - see ServerClassConverter: requires a fix in geronimo-config-impl to use the Thread ClassLoader in ClassConverter. --> + <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> + <forkCount>1</forkCount> + <reuseForks>true</reuseForks> <dependenciesToScan> <dependency>org.eclipse.microprofile.config:microprofile-config-tck</dependency> </dependenciesToScan> - <!-- TODO - This requires a fix in geronimo-config-impl to use the Thread ClassLoader in ClassConverter. --> - <excludes> - <exclude>org.eclipse.microprofile.config.tck.ClassConverterTest</exclude> - </excludes> </configuration> </plugin> </plugins> </build> <dependencies> + <!-- debug libs --> + <dependency> + <groupId>org.apache.geronimo.config</groupId> + <artifactId>geronimo-config-impl</artifactId> + <version>1.1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.tomee</groupId> + <artifactId>tomee-catalina</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + + <!-- distro --> <dependency> <groupId>${project.groupId}</groupId> <artifactId>apache-tomee</artifactId> @@ -61,6 +76,7 @@ <scope>test</scope> </dependency> + <!-- tck stack --> <dependency> <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> @@ -92,7 +108,7 @@ <dependency> <groupId>org.jboss.arquillian.testng</groupId> <artifactId>arquillian-testng-core</artifactId> - <version>1.1.13.Final</version> + <version>${version.arquillian}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java ---------------------------------------------------------------------- diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java index 0cad5eb..dcee75d 100644 --- a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java +++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigTCKArchiveProcessor.java @@ -1,33 +1,38 @@ package org.apache.openejb.tck.microprofile.config; +import static org.apache.openejb.loader.JarLocation.jarLocation; + import org.eclipse.microprofile.config.tck.converters.UpperCaseDuckConverter; +import org.hamcrest.object.HasToString; import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor; import org.jboss.arquillian.test.spi.TestClass; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.jboss.shrinkwrap.resolver.api.maven.Maven; import java.io.File; public class MicroProfileConfigTCKArchiveProcessor implements ApplicationArchiveProcessor { + private File hamcrest; + @Override public void process(final Archive<?> archive, final TestClass testClass) { if (archive instanceof WebArchive) { + final WebArchive war = WebArchive.class.cast(archive); + // TODO - this could be fixed in the TCK by adding UpperCaseDuckConverter into org.eclipse.microprofile.config.tck.ConverterTest JavaArchive configJar = ShrinkWrap .create(JavaArchive.class, "config-tck-additional.jar") .addClass(UpperCaseDuckConverter.class) ; - ((WebArchive) archive).addAsLibraries(configJar); - - File[] requiredLibraries = Maven.resolver() - .loadPomFromFile("pom.xml") - .resolve("org.hamcrest:hamcrest-all:1.3") - .withTransitivity() - .asFile(); - ((WebArchive) archive).addAsLibraries(requiredLibraries); + + war.addAsLibraries(configJar); + + if (hamcrest == null) { + hamcrest = jarLocation(HasToString.class); + } + war.addAsLibrary(hamcrest); } } } http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigurationTest.java ---------------------------------------------------------------------- diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigurationTest.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigurationTest.java deleted file mode 100644 index 64e754d..0000000 --- a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigurationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.openejb.tck.microprofile.config; - -import org.eclipse.microprofile.config.Config; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.testng.Arquillian; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.EmptyAsset; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.testng.Assert; -import org.testng.annotations.Test; - -import javax.inject.Inject; - -import static org.testng.Assert.assertEquals; - -@Test -public class MicroProfileConfigurationTest extends Arquillian { - @Deployment - public static WebArchive deploy() { - JavaArchive testJar = ShrinkWrap - .create(JavaArchive.class, "microprofile-configuration.jar") - .addClass(ConfigurationBean.class) - .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml") - .as(JavaArchive.class); - - WebArchive war = ShrinkWrap - .create(WebArchive.class, "microprofile-configuration.war") - .addAsLibrary(testJar); - - return war; - } - - @Inject - private ConfigurationBean configurationBean; - - @Test - public void testConfiguration() throws Exception { - assertEquals("SUCCESS", configurationBean.getConfig()); - } - - @Inject - private Config config; - - @Test - public void testDynamicValueInPropertyConfigSource() { - String configKey = "tck.config.test.systemproperty.dynamic.value"; - String configValue = "myDynamicValue;"; - - System.setProperty(configKey, configValue); - Assert.assertEquals(config.getValue(configKey, String.class), configValue); - } -} http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tck/microprofile-tck/config/src/test/resources/arquillian.xml ---------------------------------------------------------------------- diff --git a/tck/microprofile-tck/config/src/test/resources/arquillian.xml b/tck/microprofile-tck/config/src/test/resources/arquillian.xml index d04c730..ecddd0c 100644 --- a/tck/microprofile-tck/config/src/test/resources/arquillian.xml +++ b/tck/microprofile-tck/config/src/test/resources/arquillian.xml @@ -23,7 +23,6 @@ http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <container qualifier="tomee-remote" default="true"> <configuration> - <property name="debug">false</property> <property name="httpPort">-1</property> <property name="ajpPort">-1</property> <property name="stopPort">-1</property> http://git-wip-us.apache.org/repos/asf/tomee/blob/59c398d1/tomee/tomee-microprofile-webapp/pom.xml ---------------------------------------------------------------------- diff --git a/tomee/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile-webapp/pom.xml index 9a6868c..927bafe 100644 --- a/tomee/tomee-microprofile-webapp/pom.xml +++ b/tomee/tomee-microprofile-webapp/pom.xml @@ -37,11 +37,8 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <microprofile.version>1.3</microprofile.version> - - <!-- Geronimo Config 1.1 targets MP Config 1.2 API --> - <microprofile.config.api.version>1.2</microprofile.config.api.version> - <microprofile.config.impl.version>1.1</microprofile.config.impl.version> + <microprofile.config.api.version>1.3-SNAPSHOT</microprofile.config.api.version> + <microprofile.config.impl.version>1.2-SNAPSHOT</microprofile.config.impl.version> </properties> <dependencies> @@ -52,15 +49,6 @@ <type>war</type> </dependency> - <!-- When we have everything - <dependency> - <groupId>org.eclipse.microprofile</groupId> - <artifactId>microprofile</artifactId> - <version>${microprofile.version}</version> - <type>pom</type> - </dependency> - --> - <dependency> <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId>