Author: bentmann
Date: Fri Aug 15 06:14:08 2008
New Revision: 686210

URL: http://svn.apache.org/viewvc?rev=686210&view=rev
Log:
o Added integration test to check proper handling of POM encoding

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml  
 (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
   (with props)

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml?rev=686210&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml 
(added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml 
Fri Aug 15 06:14:08 2008
@@ -0,0 +1,65 @@
+<?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>org.apache.maven.plugins.invoker</groupId>
+  <artifactId>pom-filtering-encoding</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check for proper handling of file encoding during POM 
filtering.</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <debug>true</debug>
+          <projectsDirectory>src/it</projectsDirectory>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>process-resources</goal>
+          </goals>
+          <filterProperties>
+            
<latin1Chars>&#169;&#174;&#196;&#214;&#220;&#228;&#246;&#252;&#223;</latin1Chars>
+          </filterProperties>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml?rev=686210&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
 Fri Aug 15 06:14:08 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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>test</groupId>
+  <artifactId>pom-filtering-encoding-latin1</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <prop0>©®ÄÖÜäöüß</prop0>
+    <prop1>@latin1Chars@</prop1>
+  </properties>
+
+  <build>
+    <!-- using the Resources Plugin to create a backup of the executed POM for 
later inspection by the parent build -->
+    <resources>
+      <resource>
+        <directory>${basedir}</directory>
+        <filtering>false</filtering>
+        <includes>
+          <include>*.xml</include>
+        </includes>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml?rev=686210&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
 Fri Aug 15 06:14:08 2008
@@ -0,0 +1,51 @@
+<?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>test</groupId>
+  <artifactId>pom-filtering-encoding-utf8</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <prop0>©®ÄÖÜäöüß</prop0>
+    <prop1>@latin1Chars@</prop1>
+  </properties>
+
+  <build>
+    <!-- using the Resources Plugin to create a backup of the executed POM for 
later inspection by the parent build -->
+    <resources>
+      <resource>
+        <directory>${basedir}</directory>
+        <filtering>false</filtering>
+        <includes>
+          <include>*.xml</include>
+        </includes>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh?rev=686210&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
 Fri Aug 15 06:14:08 2008
@@ -0,0 +1,46 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
+
+boolean check( String project, String encoding )
+{
+    File pomFile = new File( basedir, "target/it/" + project + 
"/target/classes/interpolated-pom.xml" );
+    System.out.println( "Checking for existence of interpolated IT POM: " + 
pomFile );
+    if ( !pomFile.exists() )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+
+    String xml = FileUtils.fileRead( pomFile, encoding );
+    
+    String[] values = {
+            "<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>",
+            
"<prop0>\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF</prop0>",
+            
"<prop1>\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF</prop1>",
+        };
+    for ( String value : values )
+    {
+        System.out.println( "Checking for occurrence of: " + value );
+        if ( xml.indexOf( value ) < 0 )
+        {
+            System.out.println( "FAILED!" );
+            return false;
+        }
+    }
+    return true;
+}
+
+try
+{
+    return check( "latin-1", "ISO-8859-1" ) && check( "utf-8", "UTF-8" );
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/pom-filtering-encoding/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to