Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
Refactor demo integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkalt committed Jul 27, 2018
1 parent 3b25846 commit 73bfce3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ dockerCompose {

composeUp.dependsOn { tasks.docker }

void assertSheetRowCounts(File xlsxFile, int ... rowCounts) {
def assertSheetRowCounts(File xlsxFile, def rowCounts) {
def xlsx = new java.util.zip.ZipFile(xlsxFile)
rowCounts.eachWithIndex { rowCount, index ->
[rowCounts.terminations, rowCounts.commencements].eachWithIndex { rowCount, index ->
def sheetNr = index+1
def sheet = new XmlSlurper().parse(xlsx.getInputStream(xlsx.getEntry("xl/worksheets/sheet${sheetNr}.xml")))
def actual = sheet.sheetData.row.size()
Expand All @@ -205,13 +205,16 @@ task integrationTest {
sleep(40000)

//assert that all nodes are notified with the expected amount of matches
FileFilter outXlsx = {f -> f.name.startsWith("retirement-fund-out-data")}
[
NodeBaloiseExcel : [7, 5],
NodeHelvetiaExcel : [9, 11],
NodeZurichExcel : [5, 5]
].each { folder,counts ->
assertSheetRowCounts(new File("${buildDir}/demo/$folder").listFiles(outXlsx).find(), *counts)
def expectedMatchesPerNode = [
NodeBaloiseExcel : [terminations: 7, commencements: 5],
NodeHelvetiaExcel : [terminations: 9, commencements: 11],
NodeZurichExcel : [terminations: 5, commencements: 5]
]

expectedMatchesPerNode.each { folder , counts ->
FileFilter matchingOutputFile = { f -> f.name.startsWith("retirement-fund-out-data") }
File outputFile = new File("${buildDir}/demo/$folder").listFiles(matchingOutputFile).find()
assertSheetRowCounts(outputFile, counts)
}
}
}
Expand Down

0 comments on commit 73bfce3

Please sign in to comment.