Skip to content

Commit

Permalink
[MENFORCER-463] Change success message from executed to passed
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Jan 28, 2023
1 parent 769da0a commit 73fef5a
Show file tree
Hide file tree
Showing 22 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass executed' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass passed' )



Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.BanDistributionManagement executed' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.BanDistributionManagement passed' )
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
File buildLog = new File(basedir, 'build.log')

rulesExecuted = buildLog.readLines()
.findAll {it == '[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence executed'}
.findAll {it == '[INFO] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed'}

// Rule should be executed in each module
assert rulesExecuted.size() == 3
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
*/

File buildLog = new File(basedir, 'build.log')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.EvaluateBeanshell executed')
assert buildLog.text.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.EvaluateBeanshell executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.EvaluateBeanshell passed')
assert buildLog.text.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.EvaluateBeanshell passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@

File buildLog = new File(basedir, 'build.log')
assert buildLog.text.contains('[INFO] Rule Config Provider org.apache.maven.enforcer.rules.ExternalRules executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass executed')
assert buildLog.text.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.AlwaysPass executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass passed')
assert buildLog.text.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.AlwaysPass passed')
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def buildLog = new File( basedir, 'build.log' ).text
assert buildLog.contains( '[WARNING] The POM for org.example:test-not-existing:jar:1.0 is missing, no dependency information available' )

// rule executed
assert buildLog.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass executed' )
assert buildLog.contains( '[INFO] Rule 1: org.apache.maven.enforcer.rules.dependency.BanTransitiveDependencies executed' )
assert buildLog.contains( '[INFO] Rule 2: org.apache.maven.enforcer.rules.dependency.BannedDependencies executed' )
assert buildLog.contains( '[INFO] Rule 3: org.apache.maven.enforcer.rules.dependency.DependencyConvergence executed')
assert buildLog.contains( '[INFO] Rule 4: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps executed')
assert buildLog.contains( '[INFO] Rule 5: org.apache.maven.enforcer.rules.dependency.RequireUpperBoundDeps executed')
assert buildLog.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.AlwaysPass passed' )
assert buildLog.contains( '[INFO] Rule 1: org.apache.maven.enforcer.rules.dependency.BanTransitiveDependencies passed' )
assert buildLog.contains( '[INFO] Rule 2: org.apache.maven.enforcer.rules.dependency.BannedDependencies passed' )
assert buildLog.contains( '[INFO] Rule 3: org.apache.maven.enforcer.rules.dependency.DependencyConvergence passed')
assert buildLog.contains( '[INFO] Rule 4: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps passed')
assert buildLog.contains( '[INFO] Rule 5: org.apache.maven.enforcer.rules.dependency.RequireUpperBoundDeps passed')
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*/
File buildLog = new File(basedir, 'build.log')

assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.property.RequireEnvironmentVariable executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.property.RequireEnvironmentVariable passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum executed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum executed')
assert buildLog.contains('[INFO] Rule 2: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum executed')
assert buildLog.contains('[INFO] Rule 3: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum executed')
assert buildLog.contains('[INFO] Rule 4: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum passed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum passed')
assert buildLog.contains('[INFO] Rule 2: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum passed')
assert buildLog.contains('[INFO] Rule 3: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum passed')
assert buildLog.contains('[INFO] Rule 4: org.apache.maven.enforcer.rules.checksum.RequireFileChecksum passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesDontExist executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesDontExist passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesExist executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesExist passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesSize executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.files.RequireFilesSize passed')
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
File buildLog = new File(basedir, 'build.log')

rulesExecuted = buildLog.readLines()
.findAll {it == '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireJavaVendor executed'}
.findAll {it == '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireJavaVendor passed'}

assert rulesExecuted.size() == 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion executed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion executed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireMavenVersion executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed')
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories executed' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories passed' )
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories executed' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories passed' )
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/
File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories executed' )
assert buildLog.text.contains( '[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireNoRepositories passed' )
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*/
File buildLog = new File(basedir, 'build.log')
assert buildLog.text.contains('OS Info - Arch')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireOS executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.RequireOS passed')
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/
File buildLog = new File(basedir, 'build.log')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.property.RequireProperty executed')
assert buildLog.text.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.property.RequireProperty passed')
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
def buildLog = new File(basedir, 'build.log').text

// rule executed
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum executed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum executed')
assert buildLog.contains('[INFO] Rule 2: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum executed')
assert buildLog.contains('[INFO] Rule 3: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum executed')
assert buildLog.contains('[INFO] Rule 4: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum executed')
assert buildLog.contains('[INFO] Rule 0: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum passed')
assert buildLog.contains('[INFO] Rule 1: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum passed')
assert buildLog.contains('[INFO] Rule 2: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum passed')
assert buildLog.contains('[INFO] Rule 3: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum passed')
assert buildLog.contains('[INFO] Rule 4: org.apache.maven.enforcer.rules.checksum.RequireTextFileChecksum passed')
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private void executeRule(int ruleIndex, EnforcerRuleDesc ruleDesc, EnforcerRuleH
if (getLog().isDebugEnabled()) {
long workTime = System.currentTimeMillis() - startTime;
getLog().debug(String.format(
"Finish Rule %d: %s take %d ms", ruleIndex, getRuleName(ruleDesc), workTime));
"Finish Rule %d: %s takes %d ms", ruleIndex, getRuleName(ruleDesc), workTime));
}
}
}
Expand All @@ -340,7 +340,7 @@ private void executeRuleOld(int ruleIndex, EnforcerRuleDesc ruleDesc, EnforcerRu

if (ignoreCache || shouldExecute(rule)) {
rule.execute(helper);
getLog().info(String.format("Rule %d: %s executed", ruleIndex, getRuleName(ruleDesc)));
getLog().info(String.format("Rule %d: %s passed", ruleIndex, getRuleName(ruleDesc)));
}
}

Expand All @@ -349,7 +349,7 @@ private void executeRuleNew(int ruleIndex, EnforcerRuleDesc ruleDesc) throws Enf
AbstractEnforcerRule rule = (AbstractEnforcerRule) ruleDesc.getRule();
if (ignoreCache || !ruleCache.isCached(rule)) {
rule.execute();
getLog().info(String.format("Rule %d: %s executed", ruleIndex, getRuleName(ruleDesc)));
getLog().info(String.format("Rule %d: %s passed", ruleIndex, getRuleName(ruleDesc)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void breakBuildImmediately() throws Exception {
assertTrue(((MockEnforcerRule) rules[0].getRule()).executed, "Expected this rule to be executed.");
assertFalse(((MockEnforcerRule) rules[2].getRule()).executed, "Expected this rule to be not executed.");

verify(logSpy).info(Mockito.contains("Rule 0: org.apache.maven.plugins.enforcer.MockEnforcerRule executed"));
verify(logSpy).info(Mockito.contains("Rule 0: org.apache.maven.plugins.enforcer.MockEnforcerRule passed"));
}

@Test
Expand Down

0 comments on commit 73fef5a

Please sign in to comment.