Sounds like Ant is running the script then System.exit(0)-ing!  Can't see
why.  But you could try the Maven SQL plugin instead.

Jon

> -----Original Message-----
> From: Neil Chaudhuri [mailto:[email protected]] 
> Sent: 02 September 2009 20:12
> To: [email protected]
> Subject: Tests Not Running After Executing SQL Script
> 
> I am using Surefire and Failsafe to perform unit testing and 
> integration testing respectively. In the latter case, I want 
> to run a sql script in the pre-integration-test phase to put 
> the database into a known state (not using DBUnit but the 
> same idea). Here is what I have in my pom:
> 
> 
>             <plugin>
>                 <artifactId>maven-antrun-plugin</artifactId>
>                 <executions>
>                     <execution>
>                         <phase>pre-integration-test</phase>
>                         <configuration>
>                             <tasks>
>                                 <sql driver="${db.driver}"
>                                      url="${db.url}"
>                                      userid="id"
>                                      password="pwd"
>                                      src="${sql.dir}/script.sql">
>                                     <classpath>
>                                         <pathelement 
> location="${user.home}/.m2/repository/com/oracle/jdbc/ojdbc6/1
> 1.1.0.7.0/ojdbc6-11.1.0.7.0.jar"/>
>                                     </classpath>
>                                 </sql>
>                             </tasks>
>                         </configuration>
>                         <goals>
>                             <goal>run</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>failsafe-maven-plugin</artifactId>
>                 <version>2.4.3-alpha-1</version>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>integration-test</goal>
>                             <goal>verify</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> 
> The problem is that when I run verify, I get the following:
> 
> [sql] Executing resource: C:\myapp\sql\script.sql Process 
> finished with exit code 0
> 
> In other words, the script executes just fine, but then 
> nothing else happen--namely, the tests don't run.
> 
> Any insight into what I need to tweak to get my tests to run 
> after the script executes is much appreciated.
> 
> Thanks.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to