-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
671 lines (549 loc) · 28.7 KB
/
build.gradle
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
plugins {
id 'application'
id 'pmd'
id 'org.sonarqube' version '5.1.0.4882'
id 'jacoco'
id 'org.springframework.boot' version '2.7.18'
id 'uk.gov.hmcts.java' version '0.12.63'
id 'com.gorylenko.gradle-git-properties' version '2.4.2'
id 'com.github.ben-manes.versions' version '0.46.0'
id "info.solidsoft.pitest" version '1.9.11'
id 'org.owasp.dependencycheck' version '10.0.3'
id 'au.com.dius.pact' version '4.3.15'
id 'com.github.hmcts.rse-cft-lib' version '0.19.1425'
}
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "info.solidsoft.pitest"
gitProperties {
gitPropertiesDir = new File("${project.rootDir}/src/main/resources/uk/gov/hmcts/reform/sscs")
keys = ['git.commit.id', 'git.commit.time']
dateFormat = "yyyy-MM-dd'T'HH:mmZ"
dateFormatTimeZone = "GMT"
}
group = 'uk.gov.hmcts.reform'
version = '1.0.0'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
compileJava {
options.compilerArgs << '-parameters' << '-Xlint:deprecation' << "-Xlint:unchecked"
}
compileTestJava {
options.compilerArgs << '-Xlint:deprecation'
}
tasks.withType(Copy).configureEach { duplicatesStrategy DuplicatesStrategy.WARN }
application {
mainClass.set('uk.gov.hmcts.reform.sscs.TribunalsCaseApiApplication')
// this is required to force Java running on the Azure Windows Server OS into using
// UTF-8 as the default character set instead of windows-1252 which causes issues
applicationDefaultJvmArgs = ["-Dfile.encoding=UTF-8"]
}
pmd {
toolVersion = "7.6.0"
ignoreFailures = true
sourceSets = [sourceSets.main, sourceSets.test]
reportsDir = layout.buildDirectory.dir("reports/pmd").get().asFile
ruleSetFiles = files("config/pmd/ruleset.xml")
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir('src/IntegrationTests/java')
}
resources {
srcDir('src/IntegrationTests/resources')
}
}
functionalTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir('src/functionalTest/java')
}
}
contractTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/contractTest/java')
}
resources.srcDir file('src/contractTest/resources')
}
}
dependencies {
integrationTestImplementation(sourceSets.test.output)
functionalTestImplementation(sourceSets.test.output)
}
tasks.withType(Test).configureEach {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
tasks.register('integration', Test) {
jvmArgs = ['-Xms1024m', '-Xmx2048m']
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
forkEvery = 10
setTestClassesDirs(sourceSets.integrationTest.output.classesDirs)
setClasspath(sourceSets.integrationTest.runtimeClasspath)
}
tasks.register('functional', Test) {
group = 'Functional Tests'
description = 'Executes non-destructive functional tests in AAT against a running CCD and notification service'
setTestClassesDirs(sourceSets.functionalTest.output.classesDirs)
setClasspath(sourceSets.functionalTest.runtimeClasspath)
include "uk/gov/hmcts/reform/sscs/functional/**"
exclude "uk/gov/hmcts/reform/sscs/smoke/**"
maxParallelForks = Runtime.runtime.availableProcessors()
}
tasks.register('smoke', Test) {
group = 'verification'
description = 'Executes non-destructive smoke tests against a running Tribual Case API'
setTestClassesDirs(sourceSets.functionalTest.output.classesDirs)
setClasspath(sourceSets.functionalTest.runtimeClasspath)
include "uk/gov/hmcts/reform/sscs/smoke/**"
exclude "uk/gov/hmcts/reform/sscs/functional/**"
}
tasks.register('contract', Test) {
description = "Runs the consumer Pact tests"
group = 'Verification'
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}
tasks.register('fortifyScan', JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
jacoco {
toolVersion = "0.8.10"
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
xml.outputLocation = layout.buildDirectory.file("reports/jacoco/test/jacocoTestReport.xml")
}
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
selection.reject('Release candidate')
}
}
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 7-10 fails the build, anything lower and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild', 'true') == 'true' ? 7.0 : 11
suppressionFile = 'config/owasp/suppressions.xml'
nvd.validForHours = 24
analyzers {
retirejs {
enabled = false
}
ossIndex {
enabled = false
}
}
}
repositories {
mavenLocal()
mavenCentral()
// jitpack should be last resort
// see: https://github.com/jitpack/jitpack.io/issues/1939
maven { url 'https://jitpack.io' }
// Requires authentication, if it gets here the library cannot be found!
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
processResources.dependsOn(generateGitProperties)
project.tasks.named('sonarqube') {
dependsOn test, integration, jacocoTestReport
}
check.dependsOn integration
checkstyleMain.shouldRunAfter(compileJava)
test.shouldRunAfter(checkstyleTest)
integration.shouldRunAfter(checkstyleIntegrationTest)
integration.shouldRunAfter(test)
sonarqube {
properties {
property "sonar.projectName", "SSCS - Tribunals Case Api"
property "sonar.projectKey", "SSCSTCA"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.outputLocation}"
property "sonar.exclusions", "**/CreateCaseException.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/domain/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/evidenceshare/domain/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/TribunalsCaseApiApplication.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/email/Email.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/config/*," +
"src/main/java/uk/gov/hmcts/reform/sscs/model/**/*.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/evidenceshare/model/**/*.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/EvidenceUploadService.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/OnlineHearingService.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/pdf/data/EvidenceDescriptionPdfData.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/pdf/StoreAppellantStatementService.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/pdf/StorePdfService.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/servicebus/SessionAwareServiceBusMessagingService.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/coversheet/PdfCoverSheet.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/controllers/CreateCaseController.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/pdf/data/PdfData.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/writefinaldecision/esa/EsaWriteFinalDecisionMidEventValidationHandler.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/evidenceshare/config/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/service/servicebus/messaging/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/docmosis/domain/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/docmosis/config/**," +
"src/main/java/uk/gov/hmcts/reform/sscs/EnvironmentPropertiesPrinter.java," +
"src/main/java/uk/gov/hmcts/reform/sscs/controller/FunctionalTestController.java,"
property "sonar.host.url", "https://sonar.reform.hmcts.net/"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}
configurations {
integrationTestImplementation.extendsFrom(testImplementation)
integrationTestRuntimeOnly.extendsFrom(testRuntimeOnly)
functionalTestImplementation.extendsFrom(testImplementation)
functionalTestRuntimeOnly.extendsFrom(testRuntimeOnly)
contractTestImplementation.extendsFrom(testImplementation)
contractTestRuntimeOnly.extendsFrom(testRuntimeOnly)
}
tasks.register('installLocalGitHook', Copy) {
from new File(rootProject.rootDir, 'config/git/pre-commit')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0775
}
generateGitProperties.dependsOn installLocalGitHook
compileJava.dependsOn installLocalGitHook
tasks.register('runGitPreCommitTasks') {
dependsOn 'test'
dependsOn 'pmdMain'
dependsOn 'pmdTest'
dependsOn 'checkstyleMain'
dependsOn 'checkstyleTest'
}
dependencyManagement {
dependencies {
//CVE-2022-25857
dependencySet(group: 'org.yaml', version: '2.0') {
entry 'snakeyaml'
}
//CVE-2023-33202
dependencySet(group: 'org.springframework.security', version: '1.1.5') {
entry 'spring-security-rsa'
}
//CVE-2023-6378, CVE-2023-6481
dependencySet(group: 'ch.qos.logback', version: '1.2.13') {
entry 'logback-core'
entry 'logback-classic'
}
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.9"
}
}
}
def versions = [
springsecurity : '5.8.14',
jackson : '2.17.2',
lombok : '1.18.28',
commonsio : '2.13.0'
]
dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-autoconfigure', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-activemq', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: springBoot.class.package.implementationVersion
implementation group: 'org.springframework.security', name: 'spring-security-core', version: versions.springsecurity
implementation group: 'org.springframework.security', name: 'spring-security-crypto', version: versions.springsecurity
implementation group: 'org.springframework.security', name: 'spring-security-config', version: versions.springsecurity
implementation group: 'org.springframework.security', name: 'spring-security-web', version: versions.springsecurity
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
implementation group: 'org.springframework.retry', name: 'spring-retry', version: '1.3.4'
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.7.3'
implementation group: 'com.google.guava', name: 'guava', version: '32.1.1-jre'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '7.17.19'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '4.1.2'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '2.1.1'
implementation group: 'com.github.hmcts', name: 'ccd-client', version: '4.9.5-SPRING2'
implementation group: 'net.objectlab.kit', name: 'datecalc-jdk8', version: '1.4.8'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.7.0'
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: '12.4'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.11.0'
implementation group: 'com.squareup.okio', name: 'okio-jvm', version: '3.9.1'
implementation group: 'com.github.hmcts', name: 'auth-checker-lib', version: '2.3.0'
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '8.0'
implementation group: 'com.github.hmcts', name: 'java-logging', version: '6.0.1'
implementation group: 'com.github.hmcts', name: 'doc-assembly-client', version: '1.07'
implementation group: 'com.github.hmcts', name: 'ccd-case-document-am-client', version: '1.8.1'
//remove when secure doc store is live
implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.0'
implementation group: 'com.github.hmcts', name: 'cmc-pdf-service-client', version: '7.0.1'
implementation group: 'com.mchange', name: 'c3p0', version: '0.10.1'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '9.22.3'
implementation group: 'com.github.hmcts', name: 'sscs-common', version: '5.12.15'
implementation group: 'com.github.hmcts', name: 'sscs-pdf-email-common', version: '5.2.18'
implementation group: 'com.azure', name: 'azure-core', version: '1.46.0'
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.15.1'
implementation group: 'io.projectreactor', name: 'reactor-core', version: '3.5.8'
implementation group:'org.overviewproject', name: 'mime-types', version: '1.0.4'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: versions.jackson
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: versions.jackson
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: versions.jackson
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
implementation group: 'org.springframework', name: 'spring-jms'
implementation group: 'org.apache.qpid', name: 'qpid-jms-client', version: '1.10.0'
implementation group: 'org.pitest', name: 'pitest', version: '1.14.2'
implementation group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: pitest.pitestVersion.get()
implementation group:'org.codehaus.sonar-plugins', name:'sonar-pitest-plugin', version: '0.5'
implementation group: 'com.github.hmcts', name: 'sscs-job-scheduler', version: '1.6.1', {
exclude group: "uk.gov.hmcts.reform", module:"properties-volume-spring-boot-starter"
}
implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '4.1.0-RELEASE'
implementation group: 'com.atlassian.commonmark', name: 'commonmark', version: '0.17.0'
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '5.3.1'
testImplementation group: 'io.rest-assured', name: 'xml-path', version: '5.3.1'
testImplementation group: 'io.rest-assured', name: 'json-path', version: '5.3.1'
testImplementation group: 'com.github.hmcts', name: 'fortify-client', version: '1.4.5', classifier: 'all', {
exclude group: 'commons-io', module: 'commons-io'
}
testImplementation group: 'com.github.hmcts', name: 'sscs-job-scheduler', version: '1.6.1', {
exclude group: "uk.gov.hmcts.reform", module:"properties-volume-spring-boot-starter"
}
implementation group: 'commons-io', name: 'commons-io', version: versions.commonsio
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
implementation group: 'org.apache.pdfbox', name: 'xmpbox', version: '2.0.29'
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.29'
implementation group: 'org.apache.tika', name: 'tika-core', version: '2.8.0'
implementation group: 'org.apache.tika', name: 'tika-parsers', version: '2.8.0'
implementation group: 'org.json', name: 'json', version: '20240205'
implementation group: 'com.opencsv', name: 'opencsv', version: '5.7.1'
implementation group: "com.networknt", name: "json-schema-validator", version: "1.0.81"
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.86'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '9.0.86'
//evidence-share depenedencies
implementation group: 'com.github.hmcts', name: 'cmc-pdf-service-client', version: '7.0.1'
implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '3.0.23'
// Remove this dependency once the secure doc-store is in use
implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.1'
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '6.2.1'
implementation group: 'com.github.hmcts', name: 'befta-fw', version: '9.1.0', {
exclude group: 'org.apache.commons', module: 'commons-compress'
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'org.apache.poi', module: 'poi-ooxml'
exclude group: 'org.apache.poi', module: 'poi'
exclude group: 'com.launchdarkly', module: 'launchdarkly-java-server-sdk'
exclude group: 'org.codehaus.groovy', module: 'groovy-xml'
}
integrationTestImplementation group: 'commons-io', name: 'commons-io', version: versions.commonsio
functionalTestImplementation group: 'commons-io', name: 'commons-io', version: versions.commonsio
implementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
testImplementation group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.14'
testImplementation group: 'com.azure', name: 'azure-core', version: '1.46.0'
testImplementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.15.1'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.11.0'
testImplementation group: 'net.javacrumbs.json-unit', name: 'json-unit', version: '2.37.0'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.11.0'
testImplementation group: 'net.javacrumbs.json-unit', name: 'json-unit-fluent', version: '2.37.0'
testImplementation group: 'io.github.artsok', name: 'rerunner-jupiter', version: '2.1.6'
// https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy-dep
testImplementation group: 'net.bytebuddy', name: 'byte-buddy-dep', version: '1.14.5'
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: '1.1.1'
testImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-quartz', version: springBoot.class.package.implementationVersion
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
integrationTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testImplementation platform(group: 'org.junit', name: 'junit-bom', version: '5.9.3')
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter'
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine'
testImplementation group: 'com.h2database', name: 'h2', version: '2.3.232'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.24.2'
// https://mvnrepository.com/artifact/org.awaitility/awaitility
testImplementation group: 'org.awaitility', name: 'awaitility', version: '4.2.2'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-core', version: '8.0.6'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-plugins-amqp-1-0-protocol', version: '8.0.6'
testImplementation group: 'org.apache.qpid', name: 'qpid-broker-plugins-memory-store', version: '8.0.6'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.27.2'
//pact contract testing
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit5', version: '4.3.16'
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'java8', version: '4.1.7'
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'junit5', version: '4.3.16'
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'java8', version: '4.1.7'
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBoot.class.package.implementationVersion
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
cftlibImplementation group: 'org.springframework.boot', name: 'spring-boot-devtools', version: springBoot.class.package.implementationVersion
cftlibAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
}
bootJar {
archiveFileName = 'tribunals-case-api.jar'
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.sscs.service.*']
excludedClasses = ['uk.gov.hmcts.reform.sscs.config.*',
'uk.gov.hmcts.reform.sscs.builder.*',
'uk.gov.hmcts.reform.sscs.domain.*',
'uk.gov.hmcts.reform.sscs.exception.*',
'uk.gov.hmcts.reform.sscs.healthcheck.*',
'uk.gov.hmcts.reform.sscs.model.*',
'uk.gov.hmcts.reform.sscs.transform.*',
'uk.gov.hmcts.reform.sscs.TribunalsCaseApiApplication']
excludedMethods = ['equals', 'hashcode']
jvmArgs = ['-Xms1G','-Xmx3G']
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation = 'build/reports/pitest/fastermutationtestingoutput'
threads = 20
verbose = true
outputFormats = ['XML', 'HTML']
timestampedReports = false
mutationThreshold = 50
}
project.ext {
pacticipant = 'sscs_tribunalsCaseApi'
pacticipantVersion = getCheckedOutGitCommitHash()
}
tasks.register('runAndPublishConsumerPactTests', Test) {
logger.lifecycle("Runs pact Tests")
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}
tasks.register('getSscsCommonVersion') {
doLast {
print '4.18.0'
}
}
runAndPublishConsumerPactTests.dependsOn contract
runAndPublishConsumerPactTests.finalizedBy pactPublish
pact {
broker {
pactBrokerUrl = System.getenv("PACT_BROKER_FULL_URL") ?: 'http://localhost:80'
}
publish {
pactDirectory = 'pacts'
tags = [System.getenv("PACT_BRANCH_NAME") ?:'Dev']
version = project.pacticipantVersion
}
}
static def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
run {
def debug = System.getProperty("debug")
if (debug == 'true') {
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006']
}
}
tasks.register('generateXls', Exec) {
commandLine project.file('./bin/create-xlsx.sh').path, 'benefit', 'dev', 'local'
}
bootWithCCD {
group 'application'
dependsOn generateXls
authMode = uk.gov.hmcts.rse.AuthMode.Local
doFirst() {
if (!project.file('./.aat-env').exists()) {
new ByteArrayOutputStream().withStream { os ->
exec {
commandLine 'az', 'keyvault', 'secret', 'show', '--vault-name', 'sscs-aat', '-o', 'tsv', '--query', 'value', '--name', 'sscs-tribunals-case-api-dot-env'
standardOutput = os
}
project.file('./.aat-env').write(new String(os.toString().replace('\n', '').decodeBase64(), java.nio.charset.StandardCharsets.UTF_8))
}
}
project.file('./.aat-env').readLines().each() {
def index = it.indexOf("=")
def key = it.substring(0, index)
def value = it.substring(index + 1)
environment key, value
}
}
//---Debug-----
//Uncomment to launch with debug
//jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006']
//---Extra ccd loging----
//Uncomment for ccd callback logging
//environment 'LOG_CALLBACK_DETAILS', '*'
def fileLogger = [ onOutput: {
File logfile = new File('gradle-build.log')
logfile << it
}
] as org.gradle.api.logging.StandardOutputListener
logging.addStandardOutputListener(fileLogger)
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.allTasks.each { Task t ->
t.doFirst {
logging.addStandardOutputListener(fileLogger)
}
}
}
}
task yarnInstall(type:Exec) {
workingDir = file("${project.projectDir}/definitions/test")
commandLine 'yarn', 'install'
}
task runE2eTests(type: Exec) {
dependsOn yarnInstall
workingDir = file("${project.projectDir}/definitions/test")
commandLine 'yarn', 'test:' + System.getenv('ENVIRONMENT')
}
task runE2eTestsNightly(type: Exec) {
dependsOn yarnInstall
workingDir = file("${project.projectDir}/definitions/test")
commandLine 'yarn', 'test:nightly'
}
task highLevelDataSetup(type: JavaExec) {
mainClass = "uk.gov.hmcts.reform.sscs.config.HighLevelDataSetupApp"
classpath += sourceSets.main.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
// this is required to force Java running on the Azure Windows Server OS into using
// UTF-8 as the default character set instead of windows-1252 which causes issues
applicationDefaultJvmArgs = ["-Dfile.encoding=UTF-8"]
run {
def debug = System.getProperty("debug")
if (debug == 'true') {
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006']
}
}
def dbHost = System.env.JOB_SCHEDULER_DB_HOST ?: "localhost"
def dbPort = System.env.JOB_SCHEDULER_DB_PORT ?: 5432
def dbName = System.env.JOB_SCHEDULER_DB_NAME ?: "sscsjobscheduler"
def dbUser = System.env.JOB_SCHEDULER_DB_USERNAME ?: "sscsjobscheduler"
def dbPass = System.env.JOB_SCHEDULER_DB_PASSWORD ?: "sscsjobscheduler"