Clover Coverage Report - Impex Parent 1.0.21-SNAPSHOT (Aggregated)
Coverage timestamp: Tue Feb 8 2011 11:33:53 EST
../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
12   39   3   6
0   28   0.25   2
2     1.5  
1    
 
  ResetMojo       Line # 17 12 0% 3 14 0% 0.0
 
No Tests
 
1    package org.apache.torque.mojo;
2   
3    import java.io.IOException;
4    import java.util.Properties;
5   
6    import org.apache.maven.plugin.MojoExecutionException;
7    import org.kuali.db.jdbc.DatabaseCommand;
8    import org.kuali.db.jdbc.SQLGenerator;
9    import org.kuali.db.jdbc.Transaction;
10   
11    /**
12    * Does a DROP->CREATE of a database and the corresponding default user. See also <code>impex:create</code> and
13    * <code>impex:drop</code>
14    *
15    * @goal reset
16    */
 
17    public class ResetMojo extends AbstractDBACommandMojo {
18   
 
19  0 toggle protected Transaction getTransaction(Properties properties, DatabaseCommand command) throws IOException {
20  0 SQLGenerator generator = new SQLGenerator(properties, url, command);
21  0 generator.setEncoding(getEncoding());
22  0 String sql = generator.getSQL();
23  0 Transaction t = new Transaction();
24  0 t.setDescription(getTransactionDescription(command));
25  0 t.addText(sql);
26  0 return t;
27    }
28   
 
29  0 toggle @Override
30    protected void configureTransactions() throws MojoExecutionException {
31  0 Properties properties = getContextProperties();
32  0 try {
33  0 transactions.add(getTransaction(properties, DatabaseCommand.DROP));
34  0 transactions.add(getTransaction(properties, DatabaseCommand.CREATE));
35    } catch (IOException e) {
36  0 throw new MojoExecutionException("Error generating SQL", e);
37    }
38    }
39    }