From commits-return-42846-archive-asf-public=cust-asf.ponee.io@tomee.apache.org Wed Aug 15 17:41:55 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6932C1807A6 for ; Wed, 15 Aug 2018 17:41:54 +0200 (CEST) Received: (qmail 90406 invoked by uid 500); 15 Aug 2018 15:41:53 -0000 Mailing-List: contact commits-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tomee.apache.org Delivered-To: mailing list commits@tomee.apache.org Received: (qmail 90083 invoked by uid 99); 15 Aug 2018 15:41:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Aug 2018 15:41:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 63292E0C6A; Wed, 15 Aug 2018 15:41:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jgallimore@apache.org To: commits@tomee.apache.org Date: Wed, 15 Aug 2018 15:41:56 -0000 Message-Id: <59488f9407734b95ac8a99d5766545fd@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [05/26] tomee git commit: Fixed MP Config. Fixed MP Config. (cherry picked from commit 4b2d148) Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5d86cc80 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5d86cc80 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5d86cc80 Branch: refs/heads/master Commit: 5d86cc801ef8881a70c5c14019869c078b86c24b Parents: 2bd4df7 Author: Roberto Cortez Authored: Tue Jul 24 21:04:23 2018 +0100 Committer: Roberto Cortez Committed: Fri Jul 27 19:48:12 2018 +0100 ---------------------------------------------------------------------- tck/microprofile-tck/config/pom.xml | 4 -- .../MicroProfileConfigTCKArchiveProcessor.java | 15 +---- .../config/MicroProfileConfigurationTest.java | 69 ++++++++++++++++++++ 3 files changed, 72 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/5d86cc80/tck/microprofile-tck/config/pom.xml ---------------------------------------------------------------------- diff --git a/tck/microprofile-tck/config/pom.xml b/tck/microprofile-tck/config/pom.xml index 5f509e8..56c1d28 100644 --- a/tck/microprofile-tck/config/pom.xml +++ b/tck/microprofile-tck/config/pom.xml @@ -29,16 +29,12 @@ microprofile-config-tck OpenEJB :: TCK :: MicroProfile Config TCK - - org.apache.maven.plugins maven-surefire-plugin - 1 - true org.eclipse.microprofile.config:microprofile-config-tck http://git-wip-us.apache.org/repos/asf/tomee/blob/5d86cc80/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 dcee75d..e07033b 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,7 +1,5 @@ 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; @@ -11,11 +9,9 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.jboss.shrinkwrap.api.spec.WebArchive; -import java.io.File; +import static org.apache.openejb.loader.JarLocation.jarLocation; public class MicroProfileConfigTCKArchiveProcessor implements ApplicationArchiveProcessor { - private File hamcrest; - @Override public void process(final Archive archive, final TestClass testClass) { if (archive instanceof WebArchive) { @@ -24,15 +20,10 @@ public class MicroProfileConfigTCKArchiveProcessor implements ApplicationArchive // 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) - ; + .addClass(UpperCaseDuckConverter.class); war.addAsLibraries(configJar); - - if (hamcrest == null) { - hamcrest = jarLocation(HasToString.class); - } - war.addAsLibrary(hamcrest); + war.addAsLibrary(jarLocation(HasToString.class)); } } } http://git-wip-us.apache.org/repos/asf/tomee/blob/5d86cc80/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 new file mode 100644 index 0000000..64e754d --- /dev/null +++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/MicroProfileConfigurationTest.java @@ -0,0 +1,69 @@ +/* + * 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); + } +}