You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2018/03/12 15:00:41 UTC
[23/32] tomee git commit: Added MicroProfile Config TCK.
Added MicroProfile Config TCK.
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/1c6613b9
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/1c6613b9
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/1c6613b9
Branch: refs/heads/fb_tomee8
Commit: 1c6613b9e3e734f6accdfe5cd996b1686bfc3a62
Parents: 2421c52
Author: Roberto Cortez <ra...@yahoo.com>
Authored: Fri Mar 2 01:20:24 2018 +0000
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Fri Mar 2 01:20:24 2018 +0000
----------------------------------------------------------------------
tck/microprofile-tck/config/pom.xml | 98 ++++++++++++++++++++
.../microprofile/config/ConfigurationBean.java | 25 +++++
.../config/MicroProfileConfigurationTest.java | 69 ++++++++++++++
.../config/src/test/resources/arquillian.xml | 48 ++++++++++
tck/microprofile-tck/pom.xml | 37 ++++++++
tck/pom.xml | 1 +
6 files changed, 278 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/tck/microprofile-tck/config/pom.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/pom.xml b/tck/microprofile-tck/config/pom.xml
new file mode 100644
index 0000000..491241c
--- /dev/null
+++ b/tck/microprofile-tck/config/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>microprofile-tck</artifactId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>microprofile-config-tck</artifactId>
+ <name>OpenEJB :: TCK :: MicroProfile Config TCK</name>
+
+ <properties>
+ <microprofile.config.version>1.2</microprofile.config.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <dependenciesToScan>
+ <dependency>org.eclipse.microprofile.config:microprofile-config-tck</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>apache-tomee</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ <classifier>microprofile</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-api</artifactId>
+ <version>${microprofile.config.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.microprofile.config</groupId>
+ <artifactId>microprofile-config-tck</artifactId>
+ <version>${microprofile.config.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.9.9</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
new file mode 100644
index 0000000..3193ad9
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/java/org/apache/openejb/tck/microprofile/config/ConfigurationBean.java
@@ -0,0 +1,25 @@
+/*
+ * 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.ConfigProvider;
+
+public class ConfigurationBean {
+ public String getConfig() {
+ return ConfigProvider.getConfig().getValue("config.test", String.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/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
new file mode 100644
index 0000000..1bacc58
--- /dev/null
+++ b/tck/microprofile-tck/config/src/test/resources/arquillian.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ 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.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+ <container qualifier="tomee-remote" default="true">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="classifier">microprofile</property>
+ <property name="conf">src/test/conf</property>
+ <property name="dir">target/tomee</property>
+ <property name="appWorkingDir">target/workdir</property>
+ <property name="cleanOnStartUp">true</property>
+ <property name="properties">
+ config.test = SUCCESS
+ </property>
+ <property name="additionalLibs">
+ mvn:org.hamcrest:hamcrest-all:1.3
+ mvn:org.hamcrest:hamcrest-core:1.3
+ mvn:org.eclipse.microprofile.config:microprofile-config-tck:1.2
+ mvn:org.testng:testng:6.9.9
+ mvn:org.jboss.arquillian.test:arquillian-test-spi:1.1.13.Final
+ mvn:org.jboss.arquillian.testng:arquillian-testng-core:1.1.13.Final
+ mvn:org.jboss.shrinkwrap:shrinkwrap-api:1.2.6
+ </property>
+ </configuration>
+ </container>
+</arquillian>
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/tck/microprofile-tck/pom.xml
----------------------------------------------------------------------
diff --git a/tck/microprofile-tck/pom.xml b/tck/microprofile-tck/pom.xml
new file mode 100644
index 0000000..009fa0a
--- /dev/null
+++ b/tck/microprofile-tck/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>tck</artifactId>
+ <version>7.0.5-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>microprofile-tck</artifactId>
+ <packaging>pom</packaging>
+ <name>OpenEJB :: TCK :: MicroProfile</name>
+
+ <modules>
+ <module>config</module>
+ </modules>
+
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/1c6613b9/tck/pom.xml
----------------------------------------------------------------------
diff --git a/tck/pom.xml b/tck/pom.xml
index 774c80b..8a672f4 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -36,6 +36,7 @@
<module>cdi-embedded</module>
<module>cdi-tomee</module>
<module>bval-tomee</module>
+ <module>microprofile-tck</module>
<!-- TODO: either really use this module or delete it -->
<module>bval-embedded</module>