-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for json output with severity
- Loading branch information
Przemek Bednarek
committed
Jun 29, 2018
1 parent
2896517
commit b866dc8
Showing
9 changed files
with
216 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.cognifide.secureaem; | ||
|
||
public class TestRunParameters { | ||
public static boolean SILENT_MODE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.cognifide.secureaem.json; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public enum Severity { | ||
BLOCKER("BLOCKER"), CRITICAL("CRITICAL"), MAJOR("MAJOR"), MINOR("MINOR"), INFO("INFO"); | ||
|
||
private String value; | ||
|
||
private Severity(String value) { | ||
this.value = value; | ||
} | ||
|
||
public static Severity of(String value) { | ||
return Arrays.stream(Severity.values()) | ||
.filter(severity -> StringUtils.equals(severity.value, value)) | ||
.findFirst().orElse(null); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/cognifide/secureaem/json/SingleTestResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.cognifide.secureaem.json; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import com.cognifide.secureaem.AbstractTest; | ||
import com.cognifide.secureaem.TestResult; | ||
|
||
@SuppressWarnings("unused") //serialized | ||
public class SingleTestResult { | ||
|
||
private String name; | ||
|
||
private TestResult testResult; | ||
|
||
private List<String> errorMessages; | ||
|
||
private List<String> infoMessages; | ||
|
||
private Set<String> environments; | ||
|
||
private Severity severity; | ||
|
||
public SingleTestResult(String name, AbstractTest abstractTest, Severity severity) { | ||
this.name = name; | ||
testResult = abstractTest.getResult(); | ||
errorMessages = abstractTest.getErrorMessages(); | ||
infoMessages = abstractTest.getInfoMessages(); | ||
environments = abstractTest.getEnvironments(); | ||
this.severity = severity; | ||
} | ||
|
||
public TestResult getTestResult() { | ||
return testResult; | ||
} | ||
|
||
public Severity getSeverity() { | ||
return severity; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/cognifide/secureaem/json/TestSuiteResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.cognifide.secureaem.json; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.cognifide.secureaem.TestResult; | ||
|
||
public class TestSuiteResult { | ||
|
||
List<SingleTestResult> testResults = new ArrayList<>(); | ||
|
||
int passed = 0; | ||
int failed = 0; | ||
|
||
int blocker = 0; | ||
int critical = 0; | ||
int major = 0; | ||
int minor = 0; | ||
int info = 0; | ||
|
||
public void addTestResult(SingleTestResult testResult) { | ||
testResults.add(testResult); | ||
appendResults(testResult); | ||
} | ||
|
||
private void appendResults(SingleTestResult testResult) { | ||
if (testResult.getTestResult() != TestResult.OK) { | ||
failed++; | ||
switch (testResult.getSeverity()) { | ||
case BLOCKER: | ||
blocker++; | ||
break; | ||
case CRITICAL: | ||
critical++; | ||
break; | ||
case MAJOR: | ||
major++; | ||
break; | ||
case MINOR: | ||
minor++; | ||
break; | ||
case INFO: | ||
default: | ||
info++; | ||
break; | ||
} | ||
} else { | ||
passed++; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
com.cognifide.secureaem.tests.ConfigValidation, config-validation | ||
com.cognifide.secureaem.tests.DefaultPasswordsTest, default-passwords | ||
com.cognifide.secureaem.tests.CrxdeLogsTest, crxde-logs | ||
com.cognifide.secureaem.tests.PageContentTest, dispatcher-access | ||
com.cognifide.secureaem.tests.PageContentTest, shindig-proxy | ||
com.cognifide.secureaem.tests.PublishPathsTest, third-party | ||
com.cognifide.secureaem.tests.GroovyConsoleTest, groovy-console | ||
com.cognifide.secureaem.tests.PageContentTest, etc-tools | ||
com.cognifide.secureaem.tests.ExtensionsTest, content-grabbing | ||
com.cognifide.secureaem.tests.ExtensionsTest, feed-selector | ||
com.cognifide.secureaem.tests.WcmDebugTest, wcm-debug | ||
com.cognifide.secureaem.tests.WebDavTest, webdav | ||
com.cognifide.secureaem.tests.PathsTest, felix-console | ||
com.cognifide.secureaem.tests.PageContentTest, geometrixx | ||
com.cognifide.secureaem.tests.ExtensionsTest, redundant-selectors | ||
com.cognifide.secureaem.tests.ReplicationTransportUsersTest, replication-transport-users | ||
com.cognifide.secureaem.tests.BundlesTest, crx-development-bundles | ||
com.cognifide.secureaem.tests.BundlesTest, sling-development-bundle | ||
com.cognifide.secureaem.tests.ErrorHandlerTest, error-handler | ||
com.cognifide.secureaem.tests.SlingReferrerFilterTest, sling-referrer-filter | ||
com.cognifide.secureaem.tests.WcmFilterTest, wcm-filter | ||
com.cognifide.secureaem.tests.HtmlLibraryManagerTest, html-library-manager | ||
com.cognifide.secureaem.tests.SlingJsHandlerTest, sling-js-handler | ||
com.cognifide.secureaem.tests.SlingJspScriptHandlerTest, sling-jsp-script-handler | ||
|
||
com.cognifide.secureaem.tests.ConfigValidation, config-validation, INFO | ||
com.cognifide.secureaem.tests.DefaultPasswordsTest, default-passwords, BLOCKER | ||
com.cognifide.secureaem.tests.CrxdeLogsTest, crxde-logs, CRITICAL | ||
com.cognifide.secureaem.tests.PageContentTest, dispatcher-access, BLOCKER | ||
com.cognifide.secureaem.tests.PageContentTest, shindig-proxy, CRITICAL | ||
com.cognifide.secureaem.tests.PublishPathsTest, third-party, CRITICAL | ||
com.cognifide.secureaem.tests.GroovyConsoleTest, groovy-console, CRITICAL | ||
com.cognifide.secureaem.tests.PageContentTest, etc-tools, CRITICAL | ||
com.cognifide.secureaem.tests.ExtensionsTest, content-grabbing, CRITICAL | ||
com.cognifide.secureaem.tests.ExtensionsTest, feed-selector, MAJOR | ||
com.cognifide.secureaem.tests.WcmDebugTest, wcm-debug, MAJOR | ||
com.cognifide.secureaem.tests.WebDavTest, webdav, MAJOR | ||
com.cognifide.secureaem.tests.PathsTest, felix-console, MAJOR | ||
com.cognifide.secureaem.tests.PageContentTest, geometrixx, MAJOR | ||
com.cognifide.secureaem.tests.ExtensionsTest, redundant-selectors, MAJOR | ||
com.cognifide.secureaem.tests.ReplicationTransportUsersTest, replication-transport-users, MAJOR | ||
com.cognifide.secureaem.tests.BundlesTest, crx-development-bundles, CRITICAL | ||
com.cognifide.secureaem.tests.BundlesTest, sling-development-bundle, CRITICAL | ||
com.cognifide.secureaem.tests.ErrorHandlerTest, error-handler, MAJOR | ||
com.cognifide.secureaem.tests.SlingReferrerFilterTest, sling-referrer-filter, MAJOR | ||
com.cognifide.secureaem.tests.WcmFilterTest, wcm-filter, MAJOR | ||
com.cognifide.secureaem.tests.HtmlLibraryManagerTest, html-library-manager, MAJOR | ||
com.cognifide.secureaem.tests.SlingJsHandlerTest, sling-js-handler, MAJOR | ||
com.cognifide.secureaem.tests.SlingJspScriptHandlerTest, sling-jsp-script-handler, MAJOR |