This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 06913e5 Combine ITs that share a project layout
06913e5 is described below
commit 06913e5161f183a8c257aea7824f384fee403ffe
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 4 19:10:51 2026 +0000
Combine ITs that share a project layout
MWAR-441 becomes a second subproject of MWAR-427_update-without-clean, and
the delimiter variant becomes a second module of web-resources-filtering.
Both
verify scripts assert each case, with Unicode escapes instead of source
literals.
---
.../invoker.properties | 16 ++-
.../{ => outdated-default}/pom.xml | 2 +-
.../src/main/resources/resource.txt | 0
.../src/main/webapp/root.html | 0
.../outdated-root}/pom.xml | 4 +-
.../outdated-root}/src/main/resources/resource.txt | 0
.../outdated-root}/src/main/webapp/root.html | 0
src/it/MWAR-427_update-without-clean/pom.xml | 80 +++------------
src/it/MWAR-427_update-without-clean/verify.groovy | 21 ++--
src/it/MWAR-441/invoker.properties | 20 ----
src/it/MWAR-441/verify.groovy | 26 -----
.../parent/pom.xml | 62 ------------
src/it/web-resources-filtering-delimiter/pom.xml | 41 --------
.../verify.groovy | 108 --------------------
src/it/web-resources-filtering/pom.xml | 1 +
src/it/web-resources-filtering/verify.groovy | 112 +++++----------------
.../web-delimiter}/pom.xml | 6 +-
.../web-delimiter}/src/main/webapp/WEB-INF/web.xml | 0
.../web-delimiter}/src/main/webapp/index.jsp | 0
.../webresources/WEB-INF/classes/my.properties | 0
.../src/main/webresources/WEB-INF/jetty-env.xml | 0
21 files changed, 72 insertions(+), 427 deletions(-)
diff --git a/src/it/MWAR-427_update-without-clean/invoker.properties
b/src/it/MWAR-427_update-without-clean/invoker.properties
index ea3a622..e91006e 100644
--- a/src/it/MWAR-427_update-without-clean/invoker.properties
+++ b/src/it/MWAR-427_update-without-clean/invoker.properties
@@ -15,6 +15,16 @@
# specific language governing permissions and limitations
# under the License.
-invoker.goals.1=package
-invoker.goals.2=groovy:execute
-invoker.goals.3=package
+invoker.goals.1 = package
+invoker.project.1 = outdated-default
+invoker.goals.2 = groovy:execute
+invoker.project.2 = outdated-default
+invoker.goals.3 = package
+invoker.project.3 = outdated-default
+
+invoker.goals.4 = package
+invoker.project.4 = outdated-root
+invoker.goals.5 = groovy:execute
+invoker.project.5 = outdated-root
+invoker.goals.6 = package
+invoker.project.6 = outdated-root
diff --git a/src/it/MWAR-427_update-without-clean/pom.xml
b/src/it/MWAR-427_update-without-clean/outdated-default/pom.xml
similarity index 95%
copy from src/it/MWAR-427_update-without-clean/pom.xml
copy to src/it/MWAR-427_update-without-clean/outdated-default/pom.xml
index 401a4f3..7cec08a 100644
--- a/src/it/MWAR-427_update-without-clean/pom.xml
+++ b/src/it/MWAR-427_update-without-clean/outdated-default/pom.xml
@@ -58,7 +58,7 @@ under the License.
file.write(processText(file.text))
}
- new File('src/main/webapp/root.html').renameTo
'src/main/webapp/index.html'
+ new File(project.basedir,
"src/main/webapp/root.html").renameTo(new File(project.basedir,
"src/main/webapp/index.html"))
</source>
</configuration>
<dependencies>
diff --git
a/src/it/MWAR-427_update-without-clean/src/main/resources/resource.txt
b/src/it/MWAR-427_update-without-clean/outdated-default/src/main/resources/resource.txt
similarity index 100%
rename from src/it/MWAR-427_update-without-clean/src/main/resources/resource.txt
rename to
src/it/MWAR-427_update-without-clean/outdated-default/src/main/resources/resource.txt
diff --git a/src/it/MWAR-427_update-without-clean/src/main/webapp/root.html
b/src/it/MWAR-427_update-without-clean/outdated-default/src/main/webapp/root.html
similarity index 100%
rename from src/it/MWAR-427_update-without-clean/src/main/webapp/root.html
rename to
src/it/MWAR-427_update-without-clean/outdated-default/src/main/webapp/root.html
diff --git a/src/it/MWAR-441/pom.xml
b/src/it/MWAR-427_update-without-clean/outdated-root/pom.xml
similarity index 94%
rename from src/it/MWAR-441/pom.xml
rename to src/it/MWAR-427_update-without-clean/outdated-root/pom.xml
index b1726bb..54bd56b 100644
--- a/src/it/MWAR-441/pom.xml
+++ b/src/it/MWAR-427_update-without-clean/outdated-root/pom.xml
@@ -23,7 +23,7 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.war</groupId>
- <artifactId>mwar427</artifactId>
+ <artifactId>mwar441</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
@@ -59,7 +59,7 @@ under the License.
file.write(processText(file.text))
}
- new File('src/main/webapp/root.html').renameTo
'src/main/webapp/index.html'
+ new File(project.basedir,
"src/main/webapp/root.html").renameTo(new File(project.basedir,
"src/main/webapp/index.html"))
</source>
</configuration>
<dependencies>
diff --git a/src/it/MWAR-441/src/main/resources/resource.txt
b/src/it/MWAR-427_update-without-clean/outdated-root/src/main/resources/resource.txt
similarity index 100%
rename from src/it/MWAR-441/src/main/resources/resource.txt
rename to
src/it/MWAR-427_update-without-clean/outdated-root/src/main/resources/resource.txt
diff --git a/src/it/MWAR-441/src/main/webapp/root.html
b/src/it/MWAR-427_update-without-clean/outdated-root/src/main/webapp/root.html
similarity index 100%
rename from src/it/MWAR-441/src/main/webapp/root.html
rename to
src/it/MWAR-427_update-without-clean/outdated-root/src/main/webapp/root.html
diff --git a/src/it/MWAR-427_update-without-clean/pom.xml
b/src/it/MWAR-427_update-without-clean/pom.xml
index 401a4f3..45b82c8 100644
--- a/src/it/MWAR-427_update-without-clean/pom.xml
+++ b/src/it/MWAR-427_update-without-clean/pom.xml
@@ -1,5 +1,4 @@
<?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
@@ -18,73 +17,22 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
-<project>
+<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.its.war</groupId>
- <artifactId>mwar427</artifactId>
+ <artifactId>mwar427-root</artifactId>
<version>1.0-SNAPSHOT</version>
- <packaging>war</packaging>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!-- Pass the variable into the test project to be able to read them -->
- <testPlexusUtilVersion>@plexusUtilVersion@</testPlexusUtilVersion>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>@project.version@</version>
- <configuration>
- <archiveClasses>true</archiveClasses>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>groovy-maven-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <source>
- def plexusUtilVersion = project.properties['testPlexusUtilVersion']
- def fileToModify = new File(project.basedir, 'pom.xml')
- processFileInplace(fileToModify) { text ->
- text.replaceAll(plexusUtilVersion,'3.0.23')
- }
- def processFileInplace(file, Closure processText) {
- file.write(processText(file.text))
- }
-
- new File('src/main/webapp/root.html').renameTo
'src/main/webapp/index.html'
- </source>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>2.4.21</version>
- </dependency>
- </dependencies>
- </plugin>
-
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>@plexusUtilVersion@</version>
- </dependency>
- </dependencies>
-
+ <packaging>pom</packaging>
+
+ <description>
+ Lets the invoker plugin interpolate the two projects below, which it
builds one by one:
+ outdated-default keeps the default outdatedCheckPath (MWAR-427, MWAR-433),
+ outdated-root sets outdatedCheckPath to / (MWAR-441).
+ </description>
+
+ <modules>
+ <module>outdated-default</module>
+ <module>outdated-root</module>
+ </modules>
</project>
diff --git a/src/it/MWAR-427_update-without-clean/verify.groovy
b/src/it/MWAR-427_update-without-clean/verify.groovy
index 7577a60..282f1d0 100644
--- a/src/it/MWAR-427_update-without-clean/verify.groovy
+++ b/src/it/MWAR-427_update-without-clean/verify.groovy
@@ -17,10 +17,19 @@
* under the License.
*/
-def warFile = new java.util.jar.JarFile( new
File(basedir,"target/mwar427-1.0-SNAPSHOT.war"), false)
-assert warFile.getEntry('WEB-INF/lib/plexus-utils-3.0.23.jar') != null
-assert warFile.getEntry('WEB-INF/lib/mwar427-1.0-SNAPSHOT.jar') != null
-assert warFile.getEntry('index.html') != null
+// outdated-default: MWAR-427 and MWAR-433, only WEB-INF/lib/ is checked for
outdated files by default
+def defaultWar = new java.util.jar.JarFile( new File( basedir,
"outdated-default/target/mwar427-1.0-SNAPSHOT.war" ), false )
+assert defaultWar.getEntry( 'WEB-INF/lib/plexus-utils-3.0.23.jar' ) != null :
"updated dependency missing"
+assert defaultWar.getEntry( 'WEB-INF/lib/mwar427-1.0-SNAPSHOT.jar' ) != null :
"archived classes missing"
+assert defaultWar.getEntry( 'index.html' ) != null : "renamed page missing"
+assert defaultWar.getEntry( "WEB-INF/lib/plexus-utils-" + plexusUtilVersion +
".jar" ) == null : "outdated dependency not removed"
+// other resources may be generated outside the plugin, so root.html is not
removed
+assert defaultWar.getEntry( 'root.html' ) != null : "root.html must stay with
the default outdatedCheckPath"
-assert warFile.getEntry("WEB-INF/lib/plexus-utils-" + plexusUtilVersion +
".jar") == null
-assert warFile.getEntry('root.html') != null // after MWAR-433, only
WEB-INF/lib/ content is checked, other resources may be generated outside
m-war-p
\ No newline at end of file
+// outdated-root: MWAR-441, outdatedCheckPath=/ removes every outdated file
+def rootWar = new java.util.jar.JarFile( new File( basedir,
"outdated-root/target/mwar441-1.0-SNAPSHOT.war" ), false )
+assert rootWar.getEntry( 'WEB-INF/lib/plexus-utils-3.0.23.jar' ) != null :
"updated dependency missing"
+assert rootWar.getEntry( 'WEB-INF/lib/mwar441-1.0-SNAPSHOT.jar' ) != null :
"archived classes missing"
+assert rootWar.getEntry( 'index.html' ) != null : "renamed page missing"
+assert rootWar.getEntry( "WEB-INF/lib/plexus-utils-" + plexusUtilVersion +
".jar" ) == null : "outdated dependency not removed"
+assert rootWar.getEntry( 'root.html' ) == null : "outdated root.html not
removed with outdatedCheckPath=/"
diff --git a/src/it/MWAR-441/invoker.properties
b/src/it/MWAR-441/invoker.properties
deleted file mode 100644
index ea3a622..0000000
--- a/src/it/MWAR-441/invoker.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-invoker.goals.1=package
-invoker.goals.2=groovy:execute
-invoker.goals.3=package
diff --git a/src/it/MWAR-441/verify.groovy b/src/it/MWAR-441/verify.groovy
deleted file mode 100644
index 148011e..0000000
--- a/src/it/MWAR-441/verify.groovy
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-def warFile = new java.util.jar.JarFile( new
File(basedir,"target/mwar427-1.0-SNAPSHOT.war"), false)
-assert warFile.getEntry('WEB-INF/lib/plexus-utils-3.0.23.jar') != null
-assert warFile.getEntry('WEB-INF/lib/mwar427-1.0-SNAPSHOT.jar') != null
-assert warFile.getEntry('index.html') != null
-
-assert warFile.getEntry("WEB-INF/lib/plexus-utils-" + plexusUtilVersion +
".jar") == null
-assert warFile.getEntry('root.html') == null // after MWAR-441, this path is
also removed as outdated (with the '/' config in the pom).
diff --git a/src/it/web-resources-filtering-delimiter/parent/pom.xml
b/src/it/web-resources-filtering-delimiter/parent/pom.xml
deleted file mode 100644
index cee6b83..0000000
--- a/src/it/web-resources-filtering-delimiter/parent/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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>
-
- <name>Company Parent</name>
- <description>Parent that handles dependencyManagement</description>
-
- <groupId>com.edb.finance.example</groupId>
- <artifactId>example-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <inceptionYear>2008</inceptionYear>
-
- <developers>
- <developer>
- <id>1</id>
- <name>Valeriy Molyakov</name>
- <email>[email protected]</email>
- <organization>EDB Business Partner</organization>
- <organizationUrl>http://www.edb.com</organizationUrl>
- <roles>
- <role>developer</role>
- </roles>
- <timezone>+2</timezone>
- </developer>
- </developers>
-
- <distributionManagement>
- <site>
- <id>sample.website</id>
- <url>${website.url}/${project.name}</url>
- </site>
- </distributionManagement>
-
-
- <properties>
- <jdbc.url>jdbc:oracle:thin:@localhost:1521:orcl</jdbc.url>
- <website.url>scp://www.yourcompany.com/www/docs/project</website.url>
- </properties>
-
-</project>
diff --git a/src/it/web-resources-filtering-delimiter/pom.xml
b/src/it/web-resources-filtering-delimiter/pom.xml
deleted file mode 100644
index 9979ce9..0000000
--- a/src/it/web-resources-filtering-delimiter/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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>com.edb.finance.example</groupId>
- <artifactId>example-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>parent/pom.xml</relativePath>
- </parent>
-
- <artifactId>example</artifactId>
- <packaging>pom</packaging>
-
- <name>Example Maven Multi-module project For Filtering with Delimiters</name>
- <url>http://maven.apache.org</url>
-
- <modules>
- <module>parent</module>
- <module>web</module>
- </modules>
-</project>
diff --git a/src/it/web-resources-filtering-delimiter/verify.groovy
b/src/it/web-resources-filtering-delimiter/verify.groovy
deleted file mode 100644
index 44ea22b..0000000
--- a/src/it/web-resources-filtering-delimiter/verify.groovy
+++ /dev/null
@@ -1,108 +0,0 @@
-
-/*
- * 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.
- */
-
-import java.io.*;
-
-import org.codehaus.plexus.util.*;
-
-boolean result = true;
-
-try
-{
- // Load and check jetty-env.xml
-
- File target = new File( basedir, "web/target/example-web/WEB-INF" );
- if ( !target.exists() || !target.isDirectory() )
- {
- System.err.println( "web/target/example-web/WEB-INF is missing or is
not a directory." );
- return false;
- }
-
- File jettyEnv = new File( target, "jetty-env.xml" );
- if ( !jettyEnv.exists() || jettyEnv.isDirectory() )
- {
- System.err.println( "jetty-env.xml is missing or is a directory." );
- return false;
- }
-
-
- FileInputStream fis = new FileInputStream ( jettyEnv );
- String paramContent = IOUtil.toString ( fis, "UTF-8" );
-
- System.out.println( "content='" + paramContent + "'" );
-
-
- int indexOf = paramContent.indexOf( "Characters that should be encoded in
UTF-8: åäö" );
- if ( indexOf < 0 )
- {
- System.err.println( "Non-ascii characters changed encoding during
filtering" );
- return false;
- }
-
- indexOf = paramContent.indexOf( "<Set
name=\"URL\">jdbc:oracle:thin:@localhost:1521:orcl</Set>" );
- if ( indexOf < 0 )
- {
- System.err.println( "jdbc.url not filtered correctly" );
- return false;
- }
-
- indexOf = paramContent.indexOf( "<Set
name=\"password\">@@jdbc.password@@</Set>" );
- if ( indexOf < 0 )
- {
- System.err.println( "jdbc.password has been filtered" );
- return false;
- }
-
- // Load and check my.properties
-
- target = new File( basedir, "web/target/example-web/WEB-INF/classes" );
- if ( !target.exists() || !target.isDirectory() )
- {
- System.err.println( "web/target/example-web/WEB-INF/classes is missing
or is not a directory." );
- return false;
- }
-
- File myProperties = new File( target, "my.properties" );
- if ( !myProperties.exists() || myProperties.isDirectory() )
- {
- System.err.println( "my.properties is missing or is a directory." );
- return false;
- }
-
- Properties properties = new Properties();
- fis = new FileInputStream( myProperties );
- properties.load( fis );
- fis.close();
-
- String property = properties.get( "my.property" );
- System.out.println( "my.property='" + property + "'" );
- if ( !"Characters that should be encoded in ISO-8859-1: åäö".equals(
property ) )
- {
- System.err.println( "Non-ascii characters has wrong encoding after
filtering" );
- return false;
- }
-}
-catch( IOException e )
-{
- e.printStackTrace();
- result = false;
-}
-
-return result;
diff --git a/src/it/web-resources-filtering/pom.xml
b/src/it/web-resources-filtering/pom.xml
index 1db8bb5..4fe7df2 100644
--- a/src/it/web-resources-filtering/pom.xml
+++ b/src/it/web-resources-filtering/pom.xml
@@ -37,5 +37,6 @@ under the License.
<modules>
<module>parent</module>
<module>web</module>
+ <module>web-delimiter</module>
</modules>
</project>
diff --git a/src/it/web-resources-filtering/verify.groovy
b/src/it/web-resources-filtering/verify.groovy
index df04684..5038302 100644
--- a/src/it/web-resources-filtering/verify.groovy
+++ b/src/it/web-resources-filtering/verify.groovy
@@ -18,98 +18,32 @@
* under the License.
*/
-import java.io.*;
+def aao = "\u00e5\u00e4\u00f6" // a-ring, a-umlaut and o-umlaut
-import org.codehaus.plexus.util.*;
+def check = { String module, String finalName ->
+ def webInf = new File( basedir, "${module}/target/${finalName}/WEB-INF" )
+ assert webInf.isDirectory() : "${webInf} is missing or is not a directory"
-boolean result = true;
+ def jettyEnv = new File( webInf, "jetty-env.xml" )
+ assert jettyEnv.isFile() : "${jettyEnv} is missing or is a directory"
+ def jettyEnvContent = jettyEnv.getText( "UTF-8" )
+ assert jettyEnvContent.contains( "Characters that should be encoded in
UTF-8: ${aao}" ) : "non-ascii characters changed encoding during filtering"
+ assert jettyEnvContent.contains( '<Set
name="URL">jdbc:oracle:thin:@localhost:1521:orcl</Set>' ) : "jdbc.url not
filtered correctly"
-try
-{
- // Load and check jetty-env.xml
+ def myProperties = new File( webInf, "classes/my.properties" )
+ assert myProperties.isFile() : "${myProperties} is missing or is a
directory"
+ def properties = new Properties()
+ myProperties.withInputStream { properties.load( it ) } // reads ISO-8859-1
+ assert properties.getProperty( "my.property" ) == "Characters that should
be encoded in ISO-8859-1: ${aao}" : "non-ascii characters have wrong encoding
after filtering"
- File target = new File( basedir, "web/target/example-web/WEB-INF" );
- if ( !target.exists() || !target.isDirectory() )
- {
- System.err.println( "web/target/example-web/WEB-INF is missing or is
not a directory." );
- return false;
- }
-
- File jettyEnv = new File( target, "jetty-env.xml" );
- if ( !jettyEnv.exists() || jettyEnv.isDirectory() )
- {
- System.err.println( "jetty-env.xml is missing or is a directory." );
- return false;
- }
-
-
- FileInputStream fis = new FileInputStream ( jettyEnv );
- String paramContent = IOUtil.toString ( fis, "UTF-8" );
-
- System.out.println( "content='" + paramContent + "'" );
-
-
- int indexOf = paramContent.indexOf( "Characters that should be encoded in
UTF-8: åäö" );
- if ( indexOf < 0 )
- {
- System.err.println( "Non-ascii characters changed encoding during
filtering" );
- return false;
- }
-
- indexOf = paramContent.indexOf( "Author id: 1" );
- if ( indexOf < 0 )
- {
- System.err.println( "project.developers[0].id not filtered correctly" );
- return false;
- }
-
- indexOf = paramContent.indexOf( "<Set
name=\"URL\">jdbc:oracle:thin:@localhost:1521:orcl</Set>" );
- if ( indexOf < 0 )
- {
- System.err.println( "jdbc.url not filtered correctly" );
- return false;
- }
-
- indexOf = paramContent.indexOf( '<Set
name="password">${jdbc.password}</Set>' );
- if ( indexOf < 0 )
- {
- System.err.println( "jdbc.password has been filtered" );
- return false;
- }
-
- // Load and check my.properties
-
- target = new File( basedir, "web/target/example-web/WEB-INF/classes" );
- if ( !target.exists() || !target.isDirectory() )
- {
- System.err.println( "web/target/example-web/WEB-INF/classes is missing
or is not a directory." );
- return false;
- }
-
- File myProperties = new File( target, "my.properties" );
- if ( !myProperties.exists() || myProperties.isDirectory() )
- {
- System.err.println( "my.properties is missing or is a directory." );
- return false;
- }
-
- Properties properties = new Properties();
- fis = new FileInputStream( myProperties );
- properties.load( fis );
- fis.close();
-
- String property = properties.get( "my.property" );
- System.out.println( "my.property='" + property + "'" );
- if ( !"Characters that should be encoded in ISO-8859-1: åäö".equals(
property ) )
- {
- System.err.println( "Non-ascii characters has wrong encoding after
filtering" );
- return false;
- }
-}
-catch( IOException e )
-{
- e.printStackTrace();
- result = false;
+ return jettyEnvContent
}
-return result;
+// default delimiters, the escaped expression stays as it is
+def defaultContent = check( "web", "example-web" )
+assert defaultContent.contains( "Author id: 1" ) : "project.developers[0].id
not filtered correctly"
+assert defaultContent.contains( '<Set name="password">${jdbc.password}</Set>'
) : "jdbc.password has been filtered"
+
+// custom @@*@@ delimiters, the escaped expression stays as it is
+def delimiterContent = check( "web-delimiter", "example-web-delimiter" )
+assert delimiterContent.contains( '<Set
name="password">@@jdbc.password@@</Set>' ) : "jdbc.password has been filtered"
diff --git a/src/it/web-resources-filtering-delimiter/web/pom.xml
b/src/it/web-resources-filtering/web-delimiter/pom.xml
similarity index 93%
rename from src/it/web-resources-filtering-delimiter/web/pom.xml
rename to src/it/web-resources-filtering/web-delimiter/pom.xml
index b278b0f..f4fcdab 100644
--- a/src/it/web-resources-filtering-delimiter/web/pom.xml
+++ b/src/it/web-resources-filtering/web-delimiter/pom.xml
@@ -29,17 +29,17 @@ under the License.
</parent>
- <artifactId>example-web</artifactId>
+ <artifactId>example-web-delimiter</artifactId>
<packaging>war</packaging>
- <name>example-web Maven Webapp</name>
+ <name>example-web-delimiter Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
</dependencies>
<build>
- <finalName>example-web</finalName>
+ <finalName>example-web-delimiter</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git
a/src/it/web-resources-filtering-delimiter/web/src/main/webapp/WEB-INF/web.xml
b/src/it/web-resources-filtering/web-delimiter/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from
src/it/web-resources-filtering-delimiter/web/src/main/webapp/WEB-INF/web.xml
rename to
src/it/web-resources-filtering/web-delimiter/src/main/webapp/WEB-INF/web.xml
diff --git
a/src/it/web-resources-filtering-delimiter/web/src/main/webapp/index.jsp
b/src/it/web-resources-filtering/web-delimiter/src/main/webapp/index.jsp
similarity index 100%
rename from
src/it/web-resources-filtering-delimiter/web/src/main/webapp/index.jsp
rename to src/it/web-resources-filtering/web-delimiter/src/main/webapp/index.jsp
diff --git
a/src/it/web-resources-filtering-delimiter/web/src/main/webresources/WEB-INF/classes/my.properties
b/src/it/web-resources-filtering/web-delimiter/src/main/webresources/WEB-INF/classes/my.properties
similarity index 100%
rename from
src/it/web-resources-filtering-delimiter/web/src/main/webresources/WEB-INF/classes/my.properties
rename to
src/it/web-resources-filtering/web-delimiter/src/main/webresources/WEB-INF/classes/my.properties
diff --git
a/src/it/web-resources-filtering-delimiter/web/src/main/webresources/WEB-INF/jetty-env.xml
b/src/it/web-resources-filtering/web-delimiter/src/main/webresources/WEB-INF/jetty-env.xml
similarity index 100%
rename from
src/it/web-resources-filtering-delimiter/web/src/main/webresources/WEB-INF/jetty-env.xml
rename to
src/it/web-resources-filtering/web-delimiter/src/main/webresources/WEB-INF/jetty-env.xml