|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DatabaseChangeLog | Line # 19 | 39 | 0% | 29 | 22 | 69% |
0.69014084
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (27) | |||
| Result | |||
|
0.3802817
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.preconditionsChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.preconditionsChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.simpleChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.simpleChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.nestedRelativeChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.nestedRelativeChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.doubleNestedRelativeChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.doubleNestedRelativeChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.doubleNestedChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.doubleNestedChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.otherNamespaceAttributesChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.otherNamespaceAttributesChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.multiChangeSetChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.multiChangeSetChangeLog
|
1 PASS | |
|
0.35211268
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.testNestedChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.testNestedChangeLog
|
1 PASS | |
|
0.33802816
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.logicalPathChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.logicalPathChangeLog
|
1 PASS | |
|
0.2535211
|
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreConditionsForOracleOnMSSQLWithChangeLog
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreConditionsForOracleOnMSSQLWithChangeLog
|
1 PASS | |
|
0.2535211
|
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreconditionForOracleOnOracleWithChangeLog
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreconditionForOracleOnOracleWithChangeLog
|
1 PASS | |
|
0.18309858
|
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.malformedChangeLog
liquibase.parser.core.xml.XMLChangeLogSAXParserTest.malformedChangeLog
|
1 PASS | |
|
0.18309858
|
liquibase.changelog.visitor.UpdateVisitorTest.visit_unrun
liquibase.changelog.visitor.UpdateVisitorTest.visit_unrun
|
1 PASS | |
|
0.18309858
|
liquibase.parser.core.formattedsql.FormattedSqlChangeLogParserTest.parse
liquibase.parser.core.formattedsql.FormattedSqlChangeLogParserTest.parse
|
1 PASS | |
|
0.08450704
|
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreConditionsForOracleOnMSSQLWithPreconditionTag
liquibase.changelog.visitor.ValidatingVisitorPreConditionsTest.testPreConditionsForOracleOnMSSQLWithPreconditionTag
|
1 PASS | |
|
0.028169014
|
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_emptyFiltersIterator
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_emptyFiltersIterator
|
1 PASS | |
|
0.028169014
|
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_doubleFilterIterator
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_doubleFilterIterator
|
1 PASS | |
|
0.028169014
|
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_reverseVisitor
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_reverseVisitor
|
1 PASS | |
|
0.028169014
|
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_singleFilterIterator
liquibase.changelog.ChangeLogIteratorTest.runChangeSet_singleFilterIterator
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.visitor.RollbackVisitorTest.visit
liquibase.changelog.visitor.RollbackVisitorTest.visit
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatSupportsDdlInTranWhenRunInTransactionIsTrue
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatSupportsDdlInTranWhenRunInTransactionIsTrue
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.visitor.ValidatingVisitorTest.visit_duplicate
liquibase.changelog.visitor.ValidatingVisitorTest.visit_duplicate
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.visitor.ValidatingVisitorTest.visit_successful
liquibase.changelog.visitor.ValidatingVisitorTest.visit_successful
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatDoesNotSupportDdlInTranWhenRunInTransactionIsFalse
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatDoesNotSupportDdlInTranWhenRunInTransactionIsFalse
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatSupportsDdlInTranWhenRunInTransactionIsFalse
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatSupportsDdlInTranWhenRunInTransactionIsFalse
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.visitor.ValidatingVisitorTest.visit_setupException
liquibase.changelog.visitor.ValidatingVisitorTest.visit_setupException
|
1 PASS | |
|
0.014084507
|
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatDoesNotSupportDdlInTranWhenRunInTransactionIsTrue
liquibase.changelog.ChangeSetExecuteTest.testExecuteForDatabaseThatDoesNotSupportDdlInTranWhenRunInTransactionIsTrue
|
1 PASS | |
| 1 | package liquibase.changelog; | |
| 2 | ||
| 3 | import liquibase.changelog.filter.ContextChangeSetFilter; | |
| 4 | import liquibase.changelog.filter.DbmsChangeSetFilter; | |
| 5 | import liquibase.changelog.visitor.ValidatingVisitor; | |
| 6 | import liquibase.database.Database; | |
| 7 | import liquibase.exception.LiquibaseException; | |
| 8 | import liquibase.exception.ValidationFailedException; | |
| 9 | import liquibase.logging.LogFactory; | |
| 10 | import liquibase.precondition.Conditional; | |
| 11 | import liquibase.precondition.core.PreconditionContainer; | |
| 12 | ||
| 13 | import java.util.ArrayList; | |
| 14 | import java.util.List; | |
| 15 | ||
| 16 | /** | |
| 17 | * Encapsulates the information stored in the change log XML file. | |
| 18 | */ | |
| 19 | public class DatabaseChangeLog implements Comparable<DatabaseChangeLog>, Conditional { | |
| 20 | private PreconditionContainer preconditionContainer = new PreconditionContainer(); | |
| 21 | private String physicalFilePath; | |
| 22 | private String logicalFilePath; | |
| 23 | ||
| 24 | private List<ChangeSet> changeSets = new ArrayList<ChangeSet>(); | |
| 25 | private ChangeLogParameters changeLogParameters; | |
| 26 | ||
| 27 | 34 |
public DatabaseChangeLog() { |
| 28 | } | |
| 29 | ||
| 30 | 2 |
public DatabaseChangeLog(String physicalFilePath) { |
| 31 | 2 | this.physicalFilePath = physicalFilePath; |
| 32 | } | |
| 33 | ||
| 34 | 38 |
public PreconditionContainer getPreconditions() { |
| 35 | 38 | return preconditionContainer; |
| 36 | } | |
| 37 | ||
| 38 | 2 |
public void setPreconditions(PreconditionContainer precond) { |
| 39 | 2 | preconditionContainer = precond; |
| 40 | } | |
| 41 | ||
| 42 | 0 |
public ChangeLogParameters getChangeLogParameters() { |
| 43 | 0 | return changeLogParameters; |
| 44 | } | |
| 45 | ||
| 46 | 16 |
public void setChangeLogParameters(ChangeLogParameters changeLogParameters) { |
| 47 | 16 | this.changeLogParameters = changeLogParameters; |
| 48 | } | |
| 49 | ||
| 50 | 31 |
public String getPhysicalFilePath() { |
| 51 | 31 | return physicalFilePath; |
| 52 | } | |
| 53 | ||
| 54 | 17 |
public void setPhysicalFilePath(String physicalFilePath) { |
| 55 | 17 | this.physicalFilePath = physicalFilePath; |
| 56 | } | |
| 57 | ||
| 58 | 10 |
public String getLogicalFilePath() { |
| 59 | 10 | String returnPath = logicalFilePath; |
| 60 | 10 | if (logicalFilePath == null) { |
| 61 | 9 | returnPath = physicalFilePath; |
| 62 | } | |
| 63 | 10 | return returnPath.replaceAll("\\\\", "/"); |
| 64 | } | |
| 65 | ||
| 66 | 16 |
public void setLogicalFilePath(String logicalFilePath) { |
| 67 | 16 | this.logicalFilePath = logicalFilePath; |
| 68 | } | |
| 69 | ||
| 70 | 29 |
public String getFilePath() { |
| 71 | 29 | if (logicalFilePath == null) { |
| 72 | 28 | return physicalFilePath; |
| 73 | } else { | |
| 74 | 1 | return logicalFilePath; |
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | 4 |
@Override |
| 79 | public String toString() { | |
| 80 | 4 | return getFilePath(); |
| 81 | } | |
| 82 | ||
| 83 | 0 |
public int compareTo(DatabaseChangeLog o) { |
| 84 | 0 | return getFilePath().compareTo(o.getFilePath()); |
| 85 | } | |
| 86 | ||
| 87 | 0 |
public ChangeSet getChangeSet(String path, String author, String id) { |
| 88 | 0 | for (ChangeSet changeSet : changeSets) { |
| 89 | 0 | if (changeSet.getFilePath().equalsIgnoreCase(path) && changeSet.getAuthor().equalsIgnoreCase(author) |
| 90 | && changeSet.getId().equalsIgnoreCase(id)) { | |
| 91 | 0 | return changeSet; |
| 92 | } | |
| 93 | } | |
| 94 | ||
| 95 | 0 | return null; |
| 96 | } | |
| 97 | ||
| 98 | 90 |
public List<ChangeSet> getChangeSets() { |
| 99 | 90 | return changeSets; |
| 100 | } | |
| 101 | ||
| 102 | 64 |
public void addChangeSet(ChangeSet changeSet) { |
| 103 | 64 | this.changeSets.add(changeSet); |
| 104 | } | |
| 105 | ||
| 106 | 1 |
@Override |
| 107 | public boolean equals(Object o) { | |
| 108 | 1 | if (this == o) |
| 109 | 0 | return true; |
| 110 | 1 | if (o == null || getClass() != o.getClass()) |
| 111 | 0 | return false; |
| 112 | ||
| 113 | 1 | DatabaseChangeLog that = (DatabaseChangeLog) o; |
| 114 | ||
| 115 | 1 | return getFilePath().equals(that.getFilePath()); |
| 116 | ||
| 117 | } | |
| 118 | ||
| 119 | 0 |
@Override |
| 120 | public int hashCode() { | |
| 121 | 0 | return getFilePath().hashCode(); |
| 122 | } | |
| 123 | ||
| 124 | 2 |
public void validate(Database database, String... contexts) throws LiquibaseException { |
| 125 | ||
| 126 | 2 | ChangeLogIterator logIterator = new ChangeLogIterator(this, new DbmsChangeSetFilter(database), |
| 127 | new ContextChangeSetFilter(contexts)); | |
| 128 | ||
| 129 | 2 | ValidatingVisitor validatingVisitor = new ValidatingVisitor(database.getRanChangeSetList()); |
| 130 | 2 | validatingVisitor.validate(database, this); |
| 131 | 2 | logIterator.run(validatingVisitor, database); |
| 132 | ||
| 133 | 2 | for (String message : validatingVisitor.getWarnings().getMessages()) { |
| 134 | 0 | LogFactory.getLogger().warning(message); |
| 135 | } | |
| 136 | ||
| 137 | 2 | if (!validatingVisitor.validationPassed()) { |
| 138 | 0 | throw new ValidationFailedException(validatingVisitor); |
| 139 | } | |
| 140 | } | |
| 141 | ||
| 142 | 0 |
public ChangeSet getChangeSet(RanChangeSet ranChangeSet) { |
| 143 | 0 | return getChangeSet(ranChangeSet.getChangeLog(), ranChangeSet.getAuthor(), ranChangeSet.getId()); |
| 144 | } | |
| 145 | } | |
|
||||||||||||