You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by pr...@apache.org on 2007/09/13 17:19:05 UTC
svn commit: r575331 - in
/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it:
j2ee-system-2/validate.groovy metadatageneration-2/validate.groovy
metadatageneration/validate.groovy
Author: prasad
Date: Thu Sep 13 08:19:04 2007
New Revision: 575331
URL: http://svn.apache.org/viewvc?rev=575331&view=rev
Log:
* normalizes text files' EOL-style for platform-safe validation.
Modified:
geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system-2/validate.groovy
geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration-2/validate.groovy
geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/validate.groovy
Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system-2/validate.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system-2/validate.groovy?rev=575331&r1=575330&r2=575331&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system-2/validate.groovy (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/j2ee-system-2/validate.groovy Thu Sep 13 08:19:04 2007
@@ -17,13 +17,34 @@
* under the License.
*/
+/**
+ * Loads text from a file an normalizes its EOL-style for platform-safe validation.
+ */
+def loadText = { filename ->
+ def file = new File(basedir, "$filename")
+
+ def tmp = File.createTempFile('validate', null)
+ tmp.deleteOnExit()
+
+ ant.copy(file: file, tofile: tmp)
+ ant.fixcrlf(eol: 'unix', file: tmp)
+
+ def text = tmp.text
+ tmp.delete()
+
+ return text
+}
-def expected1 = new File(basedir, "src/test/resources/META-INF/geronimo-plugin.xml").text
-def found1 = new File(basedir, "target/resources/META-INF/geronimo-plugin.xml").text
+/**
+ * Asserts that the text of both files are the same in a platform-safe fasion.
+ */
+def assertSame = { file1, file2 ->
+ def expect = loadText(file1)
+ def found = loadText(file2)
+
+ assert expect == found
+}
-assert expected1 == found1
+assertSame('src/test/resources/META-INF/geronimo-plugin.xml', 'target/resources/META-INF/geronimo-plugin.xml')
-def expected2 = new File(basedir, "src/test/resources/META-INF/plan.xml").text
-def found2 = new File(basedir, "target/resources/META-INF/plan.xml").text
-
-assert expected2 == found2
\ No newline at end of file
+assertSame('src/test/resources/META-INF/plan.xml', 'target/resources/META-INF/plan.xml')
Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration-2/validate.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration-2/validate.groovy?rev=575331&r1=575330&r2=575331&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration-2/validate.groovy (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration-2/validate.groovy Thu Sep 13 08:19:04 2007
@@ -17,8 +17,32 @@
* under the License.
*/
+/**
+ * Loads text from a file an normalizes its EOL-style for platform-safe validation.
+ */
+def loadText = { filename ->
+ def file = new File(basedir, "$filename")
+
+ def tmp = File.createTempFile('validate', null)
+ tmp.deleteOnExit()
+
+ ant.copy(file: file, tofile: tmp)
+ ant.fixcrlf(eol: 'unix', file: tmp)
+
+ def text = tmp.text
+ tmp.delete()
+
+ return text
+}
-def expected = new File(basedir, "src/test/resources/META-INF/geronimo-plugin.xml").text
-def found = new File(basedir, "target/resources/META-INF/geronimo-plugin.xml").text
+/**
+ * Asserts that the text of both files are the same in a platform-safe fasion.
+ */
+def assertSame = { file1, file2 ->
+ def expect = loadText(file1)
+ def found = loadText(file2)
+
+ assert expect == found
+}
-assert expected == found
\ No newline at end of file
+assertSame('src/test/resources/META-INF/geronimo-plugin.xml', 'target/resources/META-INF/geronimo-plugin.xml')
Modified: geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/validate.groovy
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/validate.groovy?rev=575331&r1=575330&r2=575331&view=diff
==============================================================================
--- geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/validate.groovy (original)
+++ geronimo/server/trunk/maven-plugins/car-maven-plugin/src/it/metadatageneration/validate.groovy Thu Sep 13 08:19:04 2007
@@ -17,8 +17,32 @@
* under the License.
*/
+/**
+ * Loads text from a file an normalizes its EOL-style for platform-safe validation.
+ */
+def loadText = { filename ->
+ def file = new File(basedir, "$filename")
+
+ def tmp = File.createTempFile('validate', null)
+ tmp.deleteOnExit()
+
+ ant.copy(file: file, tofile: tmp)
+ ant.fixcrlf(eol: 'unix', file: tmp)
+
+ def text = tmp.text
+ tmp.delete()
+
+ return text
+}
-def expected = new File(basedir, "src/test/resources/META-INF/geronimo-plugin.xml").text
-def found = new File(basedir, "target/resources/META-INF/geronimo-plugin.xml").text
+/**
+ * Asserts that the text of both files are the same in a platform-safe fasion.
+ */
+def assertSame = { file1, file2 ->
+ def expect = loadText(file1)
+ def found = loadText(file2)
+
+ assert expect == found
+}
-assert expected == found
\ No newline at end of file
+assertSame('src/test/resources/META-INF/geronimo-plugin.xml', 'target/resources/META-INF/geronimo-plugin.xml')