maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1201889 - /maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java
Date Mon, 14 Nov 2011 20:47:36 GMT
Author: olamy
Date: Mon Nov 14 20:47:36 2011
New Revision: 1201889

URL: http://svn.apache.org/viewvc?rev=1201889&view=rev
Log:
more unit test

Modified:
    maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java

Modified: maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java?rev=1201889&r1=1201888&r2=1201889&view=diff
==============================================================================
--- maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java
(original)
+++ maven/shared/trunk/maven-script-interpreter/src/test/java/org/apache/maven/shared/scriptinterpreter/ScriptRunnerTest.java
Mon Nov 14 20:47:36 2011
@@ -52,6 +52,26 @@ public class ScriptRunnerTest
 
     }
 
+    public void testBeanshellWithFile()
+        throws Exception
+    {
+        File logFile = new File( "target/build.log" );
+        if ( logFile.exists() )
+        {
+            logFile.delete();
+        }
+        SystemStreamLog systemStreamLog = new SystemStreamLog();
+
+        ScriptRunner scriptRunner = new ScriptRunner( systemStreamLog );
+        scriptRunner.run( "test", new File( "src/test/resources/bsh-test/verify.bsh" ), buildContext(),
+                          new FileLogger( logFile ), "foo", true );
+
+        String logContent = FileUtils.fileRead( logFile );
+        assertTrue( logContent.contains( new File( "src/test/resources/bsh-test/verify.bsh"
).getPath() ) );
+        assertTrue( logContent.contains( "foo=bar" ) );
+
+    }
+
     public void testGroovy()
         throws Exception
     {
@@ -72,6 +92,27 @@ public class ScriptRunnerTest
 
     }
 
+    public void testGroovyWithFile()
+        throws Exception
+    {
+        File logFile = new File( "target/build.log" );
+        if ( logFile.exists() )
+        {
+            logFile.delete();
+        }
+        SystemStreamLog systemStreamLog = new SystemStreamLog();
+
+        ScriptRunner scriptRunner = new ScriptRunner( systemStreamLog );
+        scriptRunner.run( "test", new File( "src/test/resources/groovy-test/verify.groovy"
), buildContext(),
+                          new FileLogger( logFile ), "foo", true );
+
+        String logContent = FileUtils.fileRead( logFile );
+        assertTrue( logContent.contains( new File( "src/test/resources/groovy-test/verify.groovy"
).getPath() ) );
+        assertTrue( logContent.contains( "foo=bar" ) );
+
+    }
+
+
     private Map<String, ? extends Object> buildContext()
     {
         Map<String, Object> context = new HashMap<String, Object>();



Mime
View raw message