Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Validation Service may not be the most efficient application to write and debug new rules.  Here is a relatively simple groovy project that attempts to help make this task easier. The aim of this utility is to execute rules the same way Validation does.

This utility loads load a Validation rules file and an event file, then execute executes the rules on the event.  Unfortunately , this is not a command line utility, currently it currently can only be executed within an IDE.

Installation and Execution

What you need

Java IDE

...

Eclipse

...

Oxygen was used at the time of writing
Groovy

...

IDE pluginGroovy Development Tools 3.3.0

Importing Code

Once the Groovy IDE plugin has been installed, import the following project.

View file
namevalidation-rule-tester.zip
height150

The rules and event files are located in resources.

  • resources/poa-rules.groovy
  • resources/test-event.json

The file resources, the names are hard-coded in RuleValidation.Main's main:

Code Block
languagejava
class RuleValidation {
	
	static main(args) {
		String rulesFileName = "resources/poa-rules.groovy"
		String eventFileName = "resources/test-event.json"
		
		File rulesFile = new File(rulesFileName)
		RuleManager ruleManager = RulesConfigurationLoader.loadConfiguration(rulesFile.text)
		ruleManager.groovyRules.each{ rule ->
			def attributes = getAttributes(eventFileName, rule.attributePaths)
			displayResults(rule.execute(attributes))
		}
	}
	...

Execution

To execute, right-click on RuleValidation.groovy → Run as... → GroovyScript

Results are displayed as standard out in the console.

Disclaimer

This project is provided as-is.  Enhancements and fixes are encouraged, simply upload a newer version here if the changes are beneficial to others.Right-click on RuleValidation → Run as... →