Clover Coverage Report - Liquibase Core 2.0.3-SNAPSHOT
Coverage timestamp: Sat Aug 6 2011 11:33:15 EDT
../../../img/srcFileCovDistChart1.png 62% of files have more coverage
16   70   14   1.6
2   57   0.88   10
10     1.4  
1    
 
  ChangeSetExecutedPrecondition       Line # 13 16 0% 14 26 7.1% 0.071428575
 
  (2)
 
1    package liquibase.precondition.core;
2   
3    import liquibase.changelog.ChangeSet;
4    import liquibase.changelog.DatabaseChangeLog;
5    import liquibase.changelog.RanChangeSet;
6    import liquibase.database.Database;
7    import liquibase.exception.PreconditionErrorException;
8    import liquibase.exception.PreconditionFailedException;
9    import liquibase.exception.ValidationErrors;
10    import liquibase.exception.Warnings;
11    import liquibase.precondition.Precondition;
12   
 
13    public class ChangeSetExecutedPrecondition implements Precondition {
14   
15    private String changeLogFile;
16    private String id;
17    private String author;
18   
 
19  0 toggle public String getChangeLogFile() {
20  0 return changeLogFile;
21    }
22   
 
23  0 toggle public void setChangeLogFile(String changeLogFile) {
24  0 this.changeLogFile = changeLogFile;
25    }
26   
 
27  0 toggle public String getId() {
28  0 return id;
29    }
30   
 
31  0 toggle public void setId(String id) {
32  0 this.id = id;
33    }
34   
 
35  0 toggle public String getAuthor() {
36  0 return author;
37    }
38   
 
39  0 toggle public void setAuthor(String author) {
40  0 this.author = author;
41    }
42   
 
43  0 toggle public Warnings warn(Database database) {
44  0 return new Warnings();
45    }
46   
 
47  0 toggle public ValidationErrors validate(Database database) {
48  0 return new ValidationErrors();
49    }
50   
 
51  0 toggle public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet)
52    throws PreconditionFailedException, PreconditionErrorException {
53  0 ChangeSet interestedChangeSet = new ChangeSet(getId(), getAuthor(), false, false, getChangeLogFile(), null,
54    null, false);
55  0 RanChangeSet ranChangeSet;
56  0 try {
57  0 ranChangeSet = database.getRanChangeSet(interestedChangeSet);
58    } catch (Exception e) {
59  0 throw new PreconditionErrorException(e, changeLog, this);
60    }
61  0 if (ranChangeSet == null || ranChangeSet.getExecType() == null || !ranChangeSet.getExecType().ran) {
62  0 throw new PreconditionFailedException("Change Set '" + interestedChangeSet.toString(false)
63    + "' has not been run", changeLog, this);
64    }
65    }
66   
 
67  8 toggle public String getName() {
68  8 return "changeSetExecuted";
69    }
70    }