-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for expressions and distinct sums when evaluating Scores. #1067
- Loading branch information
Showing
6 changed files
with
73 additions
and
3 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
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
30 changes: 30 additions & 0 deletions
30
src/test/groovy/au/org/ala/ecodata/reporting/DistinctSumAggregatorSpec.groovy
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,30 @@ | ||
package au.org.ala.ecodata.reporting | ||
|
||
import spock.lang.Specification | ||
|
||
class DistinctSumAggregatorSpec extends Specification { | ||
|
||
// write a test for the DistinctSumAggregator | ||
def "The DistinctSumAggregator can sum the distinct values of a property"() { | ||
given: | ||
Map config = [ | ||
label:"value1", | ||
"property": "data.value1", | ||
"type": "DISTINCT_SUM", | ||
"keyProperty": "data.group" | ||
] | ||
Aggregators.DistinctSumAggregator aggregator = new AggregatorFactory().createAggregator(config) | ||
|
||
when: | ||
aggregator.aggregate([data:[value1:1, group: "group1"]]) | ||
aggregator.aggregate([data:[value1:1, group: "group1"]]) | ||
aggregator.aggregate([data:[value1:2, group: "group1"]]) | ||
aggregator.aggregate([data:[value1:2, group: "group2"]]) | ||
aggregator.aggregate([data:[value1:3, group: "group3"]]) | ||
|
||
AggregationResult result = aggregator.result() | ||
|
||
then: | ||
result.result == 6 | ||
} | ||
} |
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