Coverage Report - liquibase.integration.ant.DropAllTask
 
Classes in this File Line Coverage Branch Coverage Complexity
DropAllTask
0%
0/19
0%
0/4
2.667
 
 1  
 package liquibase.integration.ant;
 2  
 
 3  
 import liquibase.Liquibase;
 4  
 import liquibase.util.StringUtils;
 5  
 import org.apache.tools.ant.BuildException;
 6  
 
 7  
 import java.util.List;
 8  
 
 9  0
 public class DropAllTask extends BaseLiquibaseTask {
 10  
 
 11  
     private String schemas;
 12  
 
 13  
     public String getSchemas() {
 14  0
         return schemas;
 15  
     }
 16  
 
 17  
     public void setSchemas(String schemas) {
 18  0
         this.schemas = schemas;
 19  0
     }
 20  
 
 21  
     @Override
 22  
     public void execute() throws BuildException {
 23  
 
 24  0
         super.execute();
 25  
 
 26  0
         if (!shouldRun()) {
 27  0
             return;
 28  
         }
 29  
 
 30  0
         Liquibase liquibase = null;
 31  
         try {
 32  0
             liquibase = createLiquibase();
 33  
 
 34  0
             if (StringUtils.trimToNull(schemas) != null) {
 35  0
                 List<String> schemas = StringUtils.splitAndTrim(this.schemas, ",");
 36  0
                 liquibase.dropAll(schemas.toArray(new String[schemas.size()]));
 37  0
             } else {
 38  0
                 liquibase.dropAll();
 39  
             }
 40  
 
 41  0
         } catch (Exception e) {
 42  0
             throw new BuildException(e);
 43  
         } finally {
 44  0
             closeDatabase(liquibase);
 45  0
         }
 46  0
     }
 47  
 }