-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsuccessEvaluation.groovy
71 lines (62 loc) · 2.39 KB
/
successEvaluation.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def summaryFile
def gradlePropertiesFile = new File('gradle.properties')
if (gradlePropertiesFile.exists()) {
def properties = new Properties()
gradlePropertiesFile.withInputStream {
properties.load(it)
}
def configBasePath = new File(properties.configBasePath)
summaryFile = new File(configBasePath, 'Zusammenfassung.log')
}
else {
summaryFile = new File('Zusammenfassung.log')
}
def sourceFileUrl = aggregated['eu.esdihumboldt.hale.io.instance.read.source'].report.location
if ([Collection, Object[]].any { it.isAssignableFrom(sourceFileUrl.getClass()) }) {
sourceFileUrl = new URL(sourceFileUrl[0])
}
else {
sourceFileUrl = new URL(sourceFileUrl)
}
def sourceFile = new File(sourceFileUrl.toURI())
def outputFileUrl = aggregated['eu.esdihumboldt.hale.io.instance.write.transformed'].report.location
if ([Collection, Object[]].any { it.isAssignableFrom(outputFileUrl.getClass()) }) {
outputFileUrl = new URL(outputFileUrl[0])
}
else {
outputFileUrl = new URL(outputFileUrl)
}
def outputFile = new File(outputFileUrl.toURI())
def reportedFile
if (outputFileUrl.toString().contains('validation')) {
reportedFile = sourceFile
}
else {
reportedFile = outputFile
}
def validationType
def targetSchema = aggregated['eu.esdihumboldt.hale.io.schema.read.target'].report.location
if (targetSchema.toString().contains('CoverageArea')) {
validationType = 'Gültigkeitsbereich'
}
else if (targetSchema.toString().contains('QuietAreas')) {
validationType = 'Ruhige Gebiete'
}
else {
validationType = 'Lärmaktionsplan'
}
if (aggregated['eu.esdihumboldt.hale.transform'].report.errors > 0) {
summaryFile << "\u274c ${reportedFile.getAbsolutePath()} (${validationType}) - Validierungsfehler\n"
println ""
println "${(char)27}[31;49m!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
println '!!! Validierung war nicht erfolgreich, bitte Fehlermeldungen im Log beachten !!!'
println '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
System.exit(-1)
}
else {
summaryFile << "\u2705 ${reportedFile.getAbsolutePath()} (${validationType}) - OK\n"
}
// the transformation must have been completed
assert aggregated['eu.esdihumboldt.hale.transform'].report.completed == true
// without errors
assert aggregated['eu.esdihumboldt.hale.transform'].report.errors == 0 : "Anzahl der Validierungsfehler > 0"