JCRVLT-253 Problems with Configuration inside an Execution with Filters

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk@1818113 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/FilterIT.java b/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/FilterIT.java
index e91feea..06e19da 100644
--- a/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/FilterIT.java
+++ b/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/FilterIT.java
@@ -120,6 +120,23 @@
     }
 
     /**
+     * Tests if a project with no filter file or inline filters and only a single embedded and sub package marked as filter entry
+     * is creating a filter
+     */
+    @Test
+    public void test_no_filter_container() throws Exception {
+        verify("no-filter-container", false);
+    }
+
+    /**
+     * Tests if a project with no filter file or inline filters and only a single embedded and sub package marked as filter entry
+     * is creating a filter but inside an execution's configuration
+     */
+    @Test
+    public void test_no_filter_container_in_execution() throws Exception {
+        verify("no-filter-container-in-execution", false);
+    }
+    /**
      * Tests if a project with an inline filter executed twice works w/o clean
      */
     @Test
diff --git a/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/expected-filter.xml b/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/expected-filter.xml
new file mode 100644
index 0000000..a163ada
--- /dev/null
+++ b/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/expected-filter.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspaceFilter version="1.0">
+    <filter root="/libs/install/jcr-2.0.jar"/>
+    <filter root="/etc/packages/apache/jackrabbit/test.content.package-1.0.4.zip"/>
+</workspaceFilter>
diff --git a/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/pom.xml b/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/pom.xml
new file mode 100644
index 0000000..d00bb50
--- /dev/null
+++ b/src/test/resources/test-projects/filter-tests/no-filter-container-in-execution/pom.xml
@@ -0,0 +1,86 @@
+<!--
+  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>
+
+    <!-- ====================================================================== -->
+    <!-- P R O J E C T  D E S C R I P T I O N                                   -->
+    <!-- ====================================================================== -->
+    <groupId>org.apache.jackrabbit.filevault</groupId>
+    <artifactId>package-plugin-test-pkg</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>content-package</packaging>
+    <name>No Filter File or Inline Filters but one filter Embed test</name>
+
+    <description>Test project that checks that a filter is created with only a embed marked to be a filter entry.</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.jackrabbit</groupId>
+                <artifactId>filevault-package-maven-plugin</artifactId>
+                <version>${plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <packageType>container</packageType>
+                    <failOnEmptyFilter>true</failOnEmptyFilter>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>default-package</id>
+                        <goals>
+                            <goal>package</goal>
+                        </goals>
+                        <configuration>
+                            <embeddeds>
+                                <embedded>
+                                    <groupId>javax.jcr</groupId>
+                                    <artifactId>jcr</artifactId>
+                                    <target>/libs/install</target>
+                                    <filter>true</filter>
+                                </embedded>
+                            </embeddeds>
+                            <subPackages>
+                                <subPackage>
+                                    <groupId>test</groupId>
+                                    <artifactId>test-package</artifactId>
+                                    <filter>true</filter>
+                                </subPackage>
+                            </subPackages>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>test-package</artifactId>
+            <version>1.0</version>
+            <scope>system</scope>
+            <type>content-package</type>
+            <systemPath>${basedir}/../../../test-content/test-package.zip</systemPath>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/test/resources/test-projects/filter-tests/no-filter-container/expected-filter.xml b/src/test/resources/test-projects/filter-tests/no-filter-container/expected-filter.xml
new file mode 100644
index 0000000..a163ada
--- /dev/null
+++ b/src/test/resources/test-projects/filter-tests/no-filter-container/expected-filter.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workspaceFilter version="1.0">
+    <filter root="/libs/install/jcr-2.0.jar"/>
+    <filter root="/etc/packages/apache/jackrabbit/test.content.package-1.0.4.zip"/>
+</workspaceFilter>
diff --git a/src/test/resources/test-projects/filter-tests/no-filter-container/pom.xml b/src/test/resources/test-projects/filter-tests/no-filter-container/pom.xml
new file mode 100644
index 0000000..cc9cd2a
--- /dev/null
+++ b/src/test/resources/test-projects/filter-tests/no-filter-container/pom.xml
@@ -0,0 +1,76 @@
+<!--
+  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>
+
+    <!-- ====================================================================== -->
+    <!-- P R O J E C T  D E S C R I P T I O N                                   -->
+    <!-- ====================================================================== -->
+    <groupId>org.apache.jackrabbit.filevault</groupId>
+    <artifactId>package-plugin-test-pkg</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>content-package</packaging>
+    <name>No Filter File or Inline Filters but one filter Embed test</name>
+
+    <description>Test project that checks that a filter is created with only a embed marked to be a filter entry.</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.jackrabbit</groupId>
+                <artifactId>filevault-package-maven-plugin</artifactId>
+                <version>${plugin.version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <packageType>container</packageType>
+                    <failOnEmptyFilter>true</failOnEmptyFilter>
+                    <embeddeds>
+                        <embedded>
+                            <groupId>javax.jcr</groupId>
+                            <artifactId>jcr</artifactId>
+                            <target>/libs/install</target>
+                            <filter>true</filter>
+                        </embedded>
+                    </embeddeds>
+                    <subPackages>
+                        <subPackage>
+                            <groupId>test</groupId>
+                            <artifactId>test-package</artifactId>
+                            <filter>true</filter>
+                        </subPackage>
+                    </subPackages>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>test</groupId>
+            <artifactId>test-package</artifactId>
+            <version>1.0</version>
+            <scope>system</scope>
+            <type>content-package</type>
+            <systemPath>${basedir}/../../../test-content/test-package.zip</systemPath>
+        </dependency>
+    </dependencies>
+</project>