This is an automated email from the ASF dual-hosted git repository.

jgallimore pushed a commit to branch tomee-8.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit e446b100691188a19d208076f1f9c3a654cbd4a6
Author: Jonathan Gallimore <[email protected]>
AuthorDate: Tue Apr 26 11:08:42 2022 +0100

    TOMEE-3928 properties provider example
---
 examples/properties-provider/pom.xml               | 113 +++++++++++++++++++++
 .../properties-provider-impl/pom.xml               |  40 ++++++++
 .../properties/impl/CustomPropertiesProvider.java  |  99 ++++++++++++++++++
 .../superbiz/properties/impl/SampleResource.java   |  39 +++++++
 .../properties-provider-sample-webapp/pom.xml      | 106 +++++++++++++++++++
 .../superbiz/properties/webapp/ActionServlet.java  |  48 +++++++++
 .../src/main/webapp/WEB-INF/web.xml                |  21 ++++
 .../src/test/conf/db-properties.conf               |  18 ++++
 .../src/test/conf/tomee.xml                        |  23 +++++
 .../properties/webapp/PropertiesProviderTest.java  |  47 +++++++++
 .../src/test/resources/arquillian.xml              |  37 +++++++
 11 files changed, 591 insertions(+)

diff --git a/examples/properties-provider/pom.xml 
b/examples/properties-provider/pom.xml
new file mode 100644
index 0000000000..18bda64a0c
--- /dev/null
+++ b/examples/properties-provider/pom.xml
@@ -0,0 +1,113 @@
+<?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.
+-->
+<!-- $Rev: 661532 $ $Date: 2008-05-29 16:46:42 -0700 (Thu, 29 May 2008) $ -->
+<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>
+  <groupId>org.superbiz</groupId>
+  <artifactId>properties-provider</artifactId>
+  <version>8.0.12-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>TomEE :: Examples :: Properties Provider</name>
+  <modules>
+    <module>properties-provider-impl</module>
+    <module>properties-provider-sample-webapp</module>
+  </modules>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <repositories>
+    <repository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>https://repository.apache.org/content/groups/snapshots/</url>
+    </repository>
+  </repositories>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.5.1</version>
+          <configuration>
+            <source>1.7</source>
+            <target>1.7</target>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.18.1</version>
+          <configuration>
+            <systemProperties>
+              <property>
+                <name>tomee.version</name>
+                <value>8.0.12-SNAPSHOT</value>
+              </property>
+            </systemProperties>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.tomee</groupId>
+        <artifactId>javaee-api</artifactId>
+        <version>8.0-5</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.tomee</groupId>
+        <artifactId>openejb-core</artifactId>
+        <version>${project.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.13.2</version>
+        <scope>test</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <!--
+  This section allows you to configure where to publish libraries for sharing.
+  It is not required and may be deleted.  For more information see:
+  http://maven.apache.org/plugins/maven-deploy-plugin/
+  -->
+  <distributionManagement>
+    <repository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/repo/</url>
+    </repository>
+    <snapshotRepository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/snapshot-repo/</url>
+    </snapshotRepository>
+  </distributionManagement>
+</project>
diff --git a/examples/properties-provider/properties-provider-impl/pom.xml 
b/examples/properties-provider/properties-provider-impl/pom.xml
new file mode 100644
index 0000000000..9b2ca2d8bd
--- /dev/null
+++ b/examples/properties-provider/properties-provider-impl/pom.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+
+<!-- $Rev: 638272 $ $Date: 2008-03-18 01:59:59 -0700 (Tue, 18 Mar 2008) $ -->
+
+<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";>
+  <parent>
+    <groupId>org.superbiz</groupId>
+    <artifactId>properties-provider</artifactId>
+    <version>8.0.12-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>properties-provider-impl</artifactId>
+  <packaging>jar</packaging>
+  <name>TomEE :: Examples :: Properties Provider :: Implementation</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>openejb-core</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git 
a/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/CustomPropertiesProvider.java
 
b/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/CustomPropertiesProvider.java
new file mode 100644
index 0000000000..00986d6e92
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/CustomPropertiesProvider.java
@@ -0,0 +1,99 @@
+/**
+ * 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.superbiz.properties.impl;
+
+import org.apache.commons.lang3.text.StrLookup;
+import org.apache.commons.lang3.text.StrSubstitutor;
+import org.apache.openejb.api.resource.PropertiesResourceProvider;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+public class CustomPropertiesProvider implements PropertiesResourceProvider {
+    private static final Logger LOGGER = 
Logger.getLogger(CustomPropertiesProvider.class.getName());
+
+    private Properties properties;
+
+    /**
+     * This method is called by TomEE to provide the properties already set on 
the resource.
+     * This is optional, but allows us to do things like placeholder expansion.
+     *
+     * In this example, we'll substitute any properties in placeholders like 
$[property] with
+     * properties from the custom properties file.
+     *
+     * @param properties properties from the resource as defined in tomee.xml
+     */
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    /**
+     * This demonstrates a custom properties provider for TomEE resources by 
reading properties from a different
+     * properties file. However, the logic here can be customized to suit your 
needs.
+     * @return The properties for the resource
+     */
+    @Override
+    public Properties provides() {
+        // read from a different file in the conf/ folder
+
+        final String catalinaHome = System.getProperty("catalina.home"); // 
this is the TomEE root directory
+        final File dbConfigFile = new File(catalinaHome, 
"conf/db-properties.conf"); // let's get these properties from 
conf/db-properties.conf
+
+        try {
+            final Properties customProperties = new Properties();
+            customProperties.load(new FileInputStream(dbConfigFile));
+
+            final StrSubstitutor substitutor = new StrSubstitutor(new 
Lookup(customProperties), "$[", "]", StrSubstitutor.DEFAULT_ESCAPE);
+            final Properties result = new Properties();
+
+            // replace any placeholders in the resource properties
+            final Enumeration<?> enumeration = properties.propertyNames();
+            while (enumeration.hasMoreElements()) {
+                final String key = (String) enumeration.nextElement();
+                final String value = properties.getProperty(key);
+                final String newValue = (value == null ? null : 
substitutor.replace(value));
+
+                result.setProperty(key, newValue);
+            }
+
+            return result;
+        } catch (IOException e) {
+            LOGGER.severe("Unable to read properties from " + 
dbConfigFile.getAbsolutePath() + ", continuing without placeholder 
substitution");
+            e.printStackTrace();
+        }
+
+        return properties;
+    }
+
+    private static class Lookup extends StrLookup<Object> {
+        private final Properties properties;
+
+        public Lookup(Properties properties) {
+            this.properties = properties;
+        }
+
+
+        @Override
+        public String lookup(final String key) {
+            return properties.getProperty(key);
+        }
+    }
+}
diff --git 
a/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/SampleResource.java
 
b/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/SampleResource.java
new file mode 100644
index 0000000000..1d001b0cb1
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-impl/src/main/java/org/superbiz/properties/impl/SampleResource.java
@@ -0,0 +1,39 @@
+/**
+ * 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.superbiz.properties.impl;
+
+public class SampleResource {
+
+    private String username;
+    private String password;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/pom.xml 
b/examples/properties-provider/properties-provider-sample-webapp/pom.xml
new file mode 100644
index 0000000000..fe602a10c0
--- /dev/null
+++ b/examples/properties-provider/properties-provider-sample-webapp/pom.xml
@@ -0,0 +1,106 @@
+<?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.superbiz</groupId>
+    <artifactId>properties-provider</artifactId>
+    <version>8.0.12-SNAPSHOT</version>
+  </parent>
+  <artifactId>properties-provider-sample-webapp</artifactId>
+  <packaging>war</packaging>
+  <name>TomEE :: Examples :: Properties Provider :: Sample Webapp</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencyManagement>
+    <dependencies>
+      <!-- Override dependency resolver with test version. This must go 
*BEFORE*
+        the Arquillian BOM. -->
+      <dependency>
+        <groupId>org.jboss.shrinkwrap.resolver</groupId>
+        <artifactId>shrinkwrap-resolver-bom</artifactId>
+        <version>2.0.0</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+      <!-- Now pull in our server-based unit testing framework -->
+      <dependency>
+        <groupId>org.jboss.arquillian</groupId>
+        <artifactId>arquillian-bom</artifactId>
+        <version>1.1.10.Final</version>
+        <scope>import</scope>
+        <type>pom</type>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>javaee-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.superbiz</groupId>
+      <artifactId>properties-provider-impl</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>arquillian-tomee-remote</artifactId>
+      <version>8.0.12-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.junit</groupId>
+      <artifactId>arquillian-junit-container</artifactId>
+      <version>1.1.10.Final</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-api</artifactId>
+      <version>3.1.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-api-maven</artifactId>
+      <version>3.1.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.shrinkwrap.resolver</groupId>
+      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+      <version>3.1.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tomee</groupId>
+      <artifactId>ziplock</artifactId>
+      <version>8.0.12-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/main/java/org/superbiz/properties/webapp/ActionServlet.java
 
b/examples/properties-provider/properties-provider-sample-webapp/src/main/java/org/superbiz/properties/webapp/ActionServlet.java
new file mode 100644
index 0000000000..16c17738c9
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/main/java/org/superbiz/properties/webapp/ActionServlet.java
@@ -0,0 +1,48 @@
+/**
+ * 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.superbiz.properties.webapp;
+
+import org.superbiz.properties.impl.SampleResource;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @version $Revision$ $Date$
+ */
+@WebServlet("/*")
+public class ActionServlet extends HttpServlet {
+
+    @Resource
+    private SampleResource res;
+
+    @Override
+    protected void doGet(final HttpServletRequest request, final 
HttpServletResponse response) throws ServletException, IOException {
+        final PrintWriter writer = response.getWriter();
+        writer.println(res.getUsername());
+        writer.println(res.getPassword());
+        writer.flush();
+    }
+
+
+}
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/main/webapp/WEB-INF/web.xml
 
b/examples/properties-provider/properties-provider-sample-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..e15fe324e2
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";>
+</web-app>
+
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/db-properties.conf
 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/db-properties.conf
new file mode 100644
index 0000000000..bb483f7840
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/db-properties.conf
@@ -0,0 +1,18 @@
+# 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.
+
+
+username=tomee
+password=testing
\ No newline at end of file
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/tomee.xml
 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/tomee.xml
new file mode 100644
index 0000000000..03631826d9
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/conf/tomee.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<tomee>
+    <Resource id="sample" 
class-name="org.superbiz.properties.impl.SampleResource" 
properties-provider="org.superbiz.properties.impl.CustomPropertiesProvider">
+        username=sample$[username]
+        password=sample$[password]
+    </Resource>
+</tomee>
\ No newline at end of file
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/test/java/org/superbiz/properties/webapp/PropertiesProviderTest.java
 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/java/org/superbiz/properties/webapp/PropertiesProviderTest.java
new file mode 100644
index 0000000000..8d0d802a0f
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/java/org/superbiz/properties/webapp/PropertiesProviderTest.java
@@ -0,0 +1,47 @@
+/**
+ * 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.superbiz.properties.webapp;
+
+import org.apache.ziplock.IO;
+import org.apache.ziplock.maven.Mvn;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.net.URL;
+
+@RunWith(Arquillian.class)
+public class PropertiesProviderTest {
+
+    @ArquillianResource
+    private URL url;
+
+    @Deployment(testable = false)
+    public static Archive<?> deployment() {
+        return Mvn.war();
+    }
+
+    @Test
+    public void testShouldFillinPlaceholders() throws Exception {
+        final String result = IO.slurp(url);
+        Assert.assertEquals("sampletomee\nsampletesting\n", result);
+    }
+}
diff --git 
a/examples/properties-provider/properties-provider-sample-webapp/src/test/resources/arquillian.xml
 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/resources/arquillian.xml
new file mode 100644
index 0000000000..3b68140b22
--- /dev/null
+++ 
b/examples/properties-provider/properties-provider-sample-webapp/src/test/resources/arquillian.xml
@@ -0,0 +1,37 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    >
+
+  <container qualifier="tomee" default="true">
+    <configuration>
+      <property name="httpPort">-1</property>
+      <property name="stopPort">-1</property>
+      <property name="tomcatVersion"></property>
+      <property name="openejbVersion">${tomee.version}</property>
+      <property name="dir">target/apache-tomee-remote</property>
+      <property 
name="appWorkingDir">target/arquillian-test-working-dir</property>
+      <property name="conf">src/test/conf</property>
+      <property name="additionalLibs">
+        mvn:org.superbiz:properties-provider-impl:8.0.12-SNAPSHOT
+      </property>
+    </configuration>
+  </container>
+</arquillian>
\ No newline at end of file

Reply via email to