geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pra...@apache.org
Subject 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
Date Thu, 13 Sep 2007 15:19:05 GMT
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')



Mime
View raw message