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 |
|
|
|
|
| 7.1% |
Uncovered Elements: 26 (28) |
Complexity: 14 |
Complexity Density: 0.88 |
|
13 |
|
public class ChangeSetExecutedPrecondition implements Precondition { |
14 |
|
|
15 |
|
private String changeLogFile; |
16 |
|
private String id; |
17 |
|
private String author; |
18 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
19 |
0
|
public String getChangeLogFile() {... |
20 |
0
|
return changeLogFile; |
21 |
|
} |
22 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
23 |
0
|
public void setChangeLogFile(String changeLogFile) {... |
24 |
0
|
this.changeLogFile = changeLogFile; |
25 |
|
} |
26 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
27 |
0
|
public String getId() {... |
28 |
0
|
return id; |
29 |
|
} |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
31 |
0
|
public void setId(String id) {... |
32 |
0
|
this.id = id; |
33 |
|
} |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
35 |
0
|
public String getAuthor() {... |
36 |
0
|
return author; |
37 |
|
} |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
0
|
public void setAuthor(String author) {... |
40 |
0
|
this.author = author; |
41 |
|
} |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0
|
public Warnings warn(Database database) {... |
44 |
0
|
return new Warnings(); |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
0
|
public ValidationErrors validate(Database database) {... |
48 |
0
|
return new ValidationErrors(); |
49 |
|
} |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 5 |
Complexity Density: 0.71 |
|
51 |
0
|
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 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
8
|
public String getName() {... |
68 |
8
|
return "changeSetExecuted"; |
69 |
|
} |
70 |
|
} |