Skip to content

Commit

Permalink
Provide test case to the properties closure
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois Hervieux authored and laurent-barbisan-ullink committed Apr 5, 2018
1 parent ca495ef commit 5ca3631
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/groovy/com/ullink/testtools/elastic/TestExportTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class TestExportTask extends Exec {
@Optional
String indexTimestampPattern = "yyyy-MM-dd"

@Internal
def resultProperties
@Internal
BulkProcessor processor
@Internal
Expand All @@ -79,13 +77,6 @@ class TestExportTask extends Exec {

@Override
void exec() {
if (properties instanceof Closure) {
resultProperties = properties.call()
}
if (properties instanceof Map) {
resultProperties = properties
}

ElasticSearchProcessor elasticSearchProcessor = new ElasticSearchProcessor()
Properties parameters = overrideDefaultProperties(elasticSearchProcessor.getParameters())

Expand Down Expand Up @@ -187,7 +178,17 @@ class TestExportTask extends Exec {
result.resultType = TestResult.ResultType.SKIPPED
}
}
result.properties = resultProperties
result.properties = resolveProperties(p)
result
}

def resolveProperties(testCase) {
if (properties instanceof Closure) {
return properties.call(testCase)
}
if (properties instanceof Map) {
return properties
}
return null
}
}

0 comments on commit 5ca3631

Please sign in to comment.