[MEAR-247] resource-ref in generated application.xml
 o Added integration test for resource-refs.


git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1806717 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
index 987b009..ea4913b 100644
--- a/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
+++ b/src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java
@@ -892,4 +892,12 @@
         doTestProject( "project-086", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

     }

 

+    /**

+     * Builds an EAR with resource-ref entries.

+     */

+    public void testProject087()

+        throws Exception

+    {

+        doTestProject( "project-087", new String[] { "ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar" } );

+    }

 }

diff --git a/src/test/resources/projects/project-087/expected-META-INF/application.xml b/src/test/resources/projects/project-087/expected-META-INF/application.xml
new file mode 100644
index 0000000..941367b
--- /dev/null
+++ b/src/test/resources/projects/project-087/expected-META-INF/application.xml
@@ -0,0 +1,53 @@
+<?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.
+-->
+<application 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/application_6.xsd" version="6">
+  <display-name>maven-ear-plugin-test-project-087</display-name>
+  <module>
+    <ejb>ejb-sample-one-1.0.jar</ejb>
+  </module>
+  <module>
+    <ejb>ejb-sample-two-1.0.jar</ejb>
+  </module>
+  <env-entry>
+    <description>A complete entry.</description>
+    <env-entry-name>complete</env-entry-name>
+    <env-entry-type>java.lang.Integer</env-entry-type>
+    <env-entry-value>4</env-entry-value>
+  </env-entry>
+  <env-entry>
+    <env-entry-name>no-type</env-entry-name>
+    <env-entry-value>4</env-entry-value>
+  </env-entry>
+  <env-entry>
+    <env-entry-name>no-value</env-entry-name>
+    <env-entry-type>java.lang.String</env-entry-type>
+    <lookup-name>java:global/Example</lookup-name>
+  </env-entry>
+  <resource-ref>
+    <res-ref-name>jdbc/myDs1</res-ref-name>
+    <res-type>javax.sql.DataSource</res-type>
+    <res-auth>Container</res-auth>
+  </resource-ref>
+  <resource-ref>
+    <res-ref-name>jdbc/myDs2</res-ref-name>
+    <res-type>javax.sql.DataSource</res-type>
+    <res-auth>Container</res-auth>
+  </resource-ref>
+</application>
diff --git a/src/test/resources/projects/project-087/pom.xml b/src/test/resources/projects/project-087/pom.xml
new file mode 100644
index 0000000..804e903
--- /dev/null
+++ b/src/test/resources/projects/project-087/pom.xml
@@ -0,0 +1,84 @@
+<?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>
+  <groupId>ear</groupId>
+  <artifactId>maven-ear-plugin-test-project-087</artifactId>
+  <version>99.0</version>
+  <name>Maven</name>
+  <packaging>ear</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>eartest</groupId>
+      <artifactId>ejb-sample-one</artifactId>
+      <version>1.0</version>
+      <type>ejb</type>
+    </dependency>
+    <dependency>
+      <groupId>eartest</groupId>
+      <artifactId>ejb-sample-two</artifactId>
+      <version>1.0</version>
+      <type>ejb</type>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-ear-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <version>6</version>
+          <resourceRefs>
+            <resourceRef>
+              <res-ref-name>jdbc/myDs1</res-ref-name>
+              <res-type>javax.sql.DataSource</res-type>
+              <res-auth>Container</res-auth>
+            </resourceRef>
+            <resourceRef>
+              <res-ref-name>jdbc/myDs2</res-ref-name>
+              <res-type>javax.sql.DataSource</res-type>
+              <res-auth>Container</res-auth>
+            </resourceRef>
+          </resourceRefs>
+          <envEntries>
+            <env-entry>
+              <description>A complete entry.</description>
+              <env-entry-name>complete</env-entry-name>
+              <env-entry-type>java.lang.Integer</env-entry-type>
+              <env-entry-value>4</env-entry-value>
+            </env-entry>
+            <env-entry>
+              <env-entry-name>no-type</env-entry-name>
+              <env-entry-value>4</env-entry-value>
+            </env-entry>
+            <env-entry>
+              <env-entry-name>no-value</env-entry-name>
+              <env-entry-type>java.lang.String</env-entry-type>
+              <lookup-name>java:global/Example</lookup-name>
+            </env-entry>
+          </envEntries>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>