generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
714 lines (621 loc) · 29 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
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("net.serenity-bdd:serenity-gradle-plugin:2.4.34")
}
}
plugins {
id 'application'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'info.solidsoft.pitest' version '1.15.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'jacoco'
id 'org.owasp.dependencycheck' version '9.2.0'
id 'org.sonarqube' version '3.5.0.2730'
id 'org.springframework.boot' version '3.3.5'
id 'au.com.dius.pact' version '4.2.6'
id 'com.github.hmcts.rse-cft-lib' version '0.19.1554'
}
def versions = [
awaitility : '4.2.2',
bcpkixJdk18on : '1.78.1',
ccdClient : '4.9.2',
commonsBeanUtils : '1.9.4',
commonsIo : '2.16.1',
commonsLang3 : '3.17.0',
commonsMath3 : '3.6.1',
dumbster : '1.7.1',
//feignHttpClient : '10.3.0',
googleAuth : '1.5.0',
gradlePitest : '1.15.0',
guava : '32.1.3-jre',
hmctsNotify : '3.19.2-RELEASE',
// idamClient : '1.3.0',
httpComponents : '4.5.14',
jackson : '2.17.2',
jacksonDatatypeJsr : '2.18.2',
jsonAssert : '1.5.3',
// jsonPathAssert : '2.2.0',
junit : '5.10.3',
junitPlatform : '5.7.2',
lombok : '1.18.36',
pact : '4.1.11',
pitest : '1.16.3',
puppyCrawl : '8.45.1',
reformsJavaLogging : '6.1.7',
sendLetterClient : '4.0.4',
serenity : '4.2.13',
serenityCucumber : '4.2.14',
serviceTokenGenerator : '4.1.2',
sonarPitest : '0.5',
springSecurityCrypto : '5.8.16',
springSecurityRsa : '1.1.5',
springBoot : '3.3.5',
springCloud : '4.1.4',
tomcat : '10.1.26',
unirest : '1.4.9',
ccdCaseDocumentAmClient : '1.7.3',
pdfbox : '2.0.33',
springFramework : '6.1.14'
]
allprojects {
def springBootVersion = versions.springBoot
apply plugin: 'checkstyle'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'org.owasp.dependencycheck'
group = 'uk.gov.hmcts.reform.prl'
version = '0.0.1'
checkstyle.toolVersion = '9.2.1'
checkstyle.configFile = new File(rootDir, "config/checkstyle/checkstyle.xml")
checkstyle.maxWarnings(0)
// 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 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'false' ? 11 : 0
suppressionFile = 'config/checkstyle/checkstyle.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
tasks.withType(Test) {
systemProperties['spring.test.context.cache.maxSize'] = 5
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
dependencies {
dependencySet(
group: 'com.fasterxml.jackson.core',
version: versions.jackson
) {
entry 'jackson-core'
entry 'jackson-databind'
}
dependencySet(
group: 'com.fasterxml.jackson.datatype',
version: versions.jackson
) {
entry 'jackson-datatype-jdk8'
entry 'jackson-datatype-jsr310'
}
dependencySet(
group: 'com.fasterxml.jackson.module',
version: versions.jackson
) {
entry 'jackson-module-parameter-names'
}
// solves CVE-2014-3488, CVE-2015-2156, CVE-2019-16869, CVE-2021-21409
dependencySet(group: 'io.netty', version: '4.1.117.Final') {
entry 'netty-buffer'
entry 'netty-codec'
entry 'netty-codec-http'
entry 'netty-common'
entry 'netty-handler'
entry 'netty-resolver'
entry 'netty-transport'
}
// CVE-2019-10086
dependency group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
//CVE-2023-24998
dependencySet(group: 'commons-fileupload', version: '1.5') {
entry 'commons-fileupload'
}
//CVE-2023-24998
dependencySet(group: 'commons-fileupload', version: '1.5') {
entry 'commons-fileupload'
}
//CVE-2022-45688
dependencySet(group: 'org.json', version: '20231013') {
entry 'json'
}
//CVE-2023-2976
dependency group: 'com.google.guava', name: 'guava', version: '32.1.3-jre'
//CVE-2022-1471
dependencySet(group: 'org.yaml', version: '2.3') {
entry 'snakeyaml'
}
//CVE-2023-34034
dependency group: 'org.springframework.security', name: 'spring-security-crypto', version: '5.8.16'
//CVE-2023-42795, CVE-2023-45648
dependencySet(group: 'org.apache.tomcat.embed', version: '10.1.34') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-websocket'
}
}
}
}
apply plugin: 'net.serenity-bdd.aggregator'
group = 'uk.gov.hmcts.reform.prl'
version = '0.0.1'
mainClassName = 'uk.gov.hmcts.reform.prl.Application'
bootJar {
getArchiveFileName().set(provider {
'prl-cos-api.jar'
})
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
compileJava {
options.compilerArgs << '-parameters' << '-Xlint:deprecation'
}
compileTestJava {
options.compilerArgs << '-Xlint:deprecation'
}
distributions {
main {
contents {
from(file("$projectDir/lib/AI-Agent.xml")) {
into "lib"
}
}
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir('src/integrationTest/java')
}
resources {
srcDir('src/integrationTest/resources')
}
}
contractTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/contractTest/java')
}
resources.srcDir file('src/contractTest/resources')
}
functionalTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
smokeTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/smokeTest/java')
}
resources.srcDir file('src/smokeTest/resources')
}
}
configurations {
functionalTestImplementation.extendsFrom testImplementation
functionalTestRuntime.extendsFrom testRuntime
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
contractTestImplementation.extendsFrom testImplementation
smokeTest.extendsFrom testImplementation
smokeTestImplementation.extendsFrom testImplementation
smokeTestRuntimeOnly.extendsFrom runtimeOnly
}
// 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 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = System.getProperty('dependencyCheck.failBuild') == 'true' ? 0 : 11
suppressionFile = 'config/owasp/suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
ext['snakeyaml.version'] = '2.2'
ext['quartz.version'] = '2.4.0'
dependencies {
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.6.0'
implementation group: 'org.springframework', name: 'spring-context-support', version: versions.springFramework
implementation 'org.testng:testng:7.10.2'
implementation 'org.testng:testng:7.10.2'
implementation 'org.testng:testng:7.10.2'
implementation 'org.testng:testng:7.10.2'
implementation 'org.junit.jupiter:junit-jupiter:5.10.3'
implementation 'org.junit.jupiter:junit-jupiter:5.10.3'
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
implementation("org.projectlombok:lombok:${versions.lombok}")
testImplementation("org.projectlombok:lombok:${versions.lombok}")
annotationProcessor("org.projectlombok:lombok:${versions.lombok}")
testAnnotationProcessor("org.projectlombok:lombok:${versions.lombok}")
implementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: versions.junit
implementation group: 'com.sun.xml.bind', name: 'jaxb-osgi', version: '4.0.5'
implementation group: 'com.github.kirviq', name: 'dumbster', version: versions.dumbster
implementation group: 'com.puppycrawl.tools', name: 'checkstyle', version: versions.puppyCrawl
implementation group: 'commons-io', name: 'commons-io', version: versions.commonsIo
implementation group: 'io.github.openfeign', name: 'feign-httpclient'
implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '2.1.3'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: versions.commonsLang3
implementation group: 'org.apache.commons', name: 'commons-math3', version: versions.commonsMath3
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: versions.springBoot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: versions.springBoot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: versions.springBoot
implementation group: 'org.apache.httpcomponents', name: 'fluent-hc', version: versions.httpComponents
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-loadbalancer', version: versions.springCloud
implementation group: 'org.springframework.retry', name: 'spring-retry', version: '2.0.11'
implementation group: 'com.github.hmcts', name: 'core-case-data-store-client', version: '4.9.2'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.reformsJavaLogging
implementation group: 'com.github.hmcts.java-logging', name: 'logging-appinsights', version: versions.reformsJavaLogging
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.24.3'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.24.3'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: versions.serviceTokenGenerator
implementation group: 'com.github.hmcts', name: 'send-letter-client', version: versions.sendLetterClient
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: versions.hmctsNotify
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: versions.httpComponents
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-quartz', version: versions.springBoot
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: versions.hmctsNotify
implementation group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1.1'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '2.1.1'
implementation group: 'com.github.hmcts', name:'ccd-case-document-am-client', version: versions.ccdCaseDocumentAmClient
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '7.5.0'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '8.15.3'
implementation group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
implementation group: 'org.glassfish', name: 'javax.json', version: '1.1.4'
implementation group: 'com.github.hmcts', name: 'core-case-data-store-client', version: '4.9.2'
implementation group: 'com.sendgrid', name: 'sendgrid-java', version: '4.10.3'
implementation group: 'com.github.hmcts', name: 'core-case-data-store-client', version: '4.9.2'
implementation group: 'commons-net', name: 'commons-net', version: '3.11.1'
// //implementation group: 'uk.gov.hmcts.reform.auth', name: 'auth-checker-lib', version: '2.1.4'
//
implementation group: 'org.springframework.security', name: 'spring-security-web', version: '5.8.16'
// implementation group: 'org.springframework.security', name: 'spring-security-config'
// // CVE-2021-22112 - Privilege Escalation
implementation group: 'org.springframework.security', name: 'spring-security-core', version: '5.8.16'
// implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-client'
// implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-resource-server'
implementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.1.3')
{
exclude group: 'io.reactivex', module: 'io.reactivex'
exclude group: 'io.reactivex', module: 'rxnetty'
exclude group: 'io.reactivex', module: 'rxnetty-contexts'
exclude group: 'io.reactivex', module: 'rxnetty-servo'
}
implementation(group: 'commons-beanutils', name: 'commons-beanutils', version: versions.commonsBeanUtils)
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.google.guava', name: 'guava', version: versions.guava)
implementation(group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: versions.bcpkixJdk18on) {
force = true
}
implementation(group: 'org.springframework.security', name: 'spring-security-rsa', version: versions.springSecurityRsa) {
force = true
}
implementation(group: 'org.springframework.security', name: 'spring-security-crypto', version: versions.springSecurityCrypto) {
force = true
}
implementation group: 'io.netty', name: 'netty-transport-native-epoll', version: '4.1.117.Final'
constraints{
implementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
}
implementation(group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.16'){
force = true
}
implementation(group: 'ch.qos.logback', name: 'logback-core', version: '1.5.16'){
force = true
}
implementation group: 'net.logstash.logback', name: 'logstash-logback-encoder', version:'7.4'
runtimeOnly('org.springframework.boot:spring-boot-devtools')
testImplementation group: 'org.awaitility', name: 'awaitility', version: versions.awaitility
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-contract-wiremock', version: versions.springCloud
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
exclude(module: 'android-json')
exclude module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '5.5.0'
testImplementation group: 'io.rest-assured', name: 'json-path', version: '5.5.0'
testImplementation group: 'io.rest-assured', name: 'xml-path', version: '5.5.0'
testImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
testImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-cucumber', version: versions.serenityCucumber
testImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
testImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
testImplementation group: 'com.github.mifmif', name: 'generex', version: '1.0.2'
// integration test
integrationTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
integrationTestImplementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: versions.jacksonDatatypeJsr
integrationTestImplementation group: 'com.mashape.unirest', name: 'unirest-java', version: versions.unirest
integrationTestImplementation group: 'io.github.openfeign', name: 'feign-httpclient', version: versions.feignHttpClient
integrationTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: versions.junit
integrationTestImplementation group: 'net.serenity-bdd', name: 'serenity-core', version: versions.serenity
integrationTestImplementation group: 'net.serenity-bdd', name: 'serenity-cucumber', version: versions.serenityCucumber
integrationTestImplementation group: 'net.serenity-bdd', name: 'serenity-junit', version: versions.serenity
integrationTestImplementation group: 'net.serenity-bdd', name: 'serenity-rest-assured', version: versions.serenity
integrationTestImplementation group: 'net.serenity-bdd', name: 'serenity-spring', version: versions.serenity
integrationTestImplementation group: 'org.apache.commons', name: 'commons-lang3', version: versions.commonsLang3
integrationTestImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
integrationTestImplementation group: 'org.skyscreamer', name: 'jsonassert', version: versions.jsonAssert
integrationTestImplementation group: 'org.springframework', name: 'spring-context-support'
integrationTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
integrationTestImplementation group: 'org.apache.pdfbox', name: 'pdfbox', version: versions.pdfbox
integrationTestImplementation(group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign')
{
exclude group: 'io.reactivex', module: 'io.reactivex'
exclude group: 'io.reactivex', module: 'rxnetty'
exclude group: 'io.reactivex', module: 'rxnetty-contexts'
exclude group: 'io.reactivex', module: 'rxnetty-servo'
}
integrationTestImplementation(group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: versions.serviceTokenGenerator)
{
exclude group: 'io.reactivex', module: 'io.reactivex'
exclude group: 'io.reactivex', module: 'rxnetty'
exclude group: 'io.reactivex', module: 'rxnetty-contexts'
exclude group: 'io.reactivex', module: 'rxnetty-servo'
}
// functionTest Implementation
functionalTestImplementation sourceSets.main.runtimeClasspath
functionalTestImplementation sourceSets.test.runtimeClasspath
functionalTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestImplementation group: 'org.springframework', name: 'spring-context-support'
functionalTestImplementation group: 'org.projectlombok', name: 'lombok', version: versions.lombok
functionalTestImplementation (group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: versions.serviceTokenGenerator)
{
exclude group: 'io.reactivex', module: 'io.reactivex'
exclude group: 'io.reactivex', module: 'rxnetty'
exclude group: 'io.reactivex', module: 'rxnetty-contexts'
exclude group: 'io.reactivex', module: 'rxnetty-servo'
}
contractTestImplementation group: 'com.google.guava', name: 'guava', version: versions.guava
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pact
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'java8', version: versions.pact
contractTestRuntimeOnly group: 'com.google.guava', name: 'guava', version: versions.guava
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pact
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'java8', version: versions.pact
contractTestImplementation group: 'org.apache.httpcomponents', name: 'httpclient', version: versions.httpComponents
implementation 'org.junit.vintage:junit-vintage-engine:5.10.3'
testRuntimeOnly "org.junit.platform:junit-platform-commons:1.10.3"
contractTestRuntimeOnly(platform('org.junit:junit-bom:5.10.3'))
contractTestImplementation("org.junit.jupiter:junit-jupiter-api:5.10.3")
contractTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testRuntimeOnly(platform('org.junit:junit-bom:5.10.3'))
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation 'org.apiguardian:apiguardian-api:1.1.2'
contractTestImplementation('org.junit.jupiter:junit-jupiter-api:5.10.3')
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
smokeTestImplementation sourceSets.main.runtimeClasspath
smokeTestImplementation sourceSets.test.runtimeClasspath
integrationTestImplementation(sourceSets.test.output)
testImplementation 'com.github.hmcts:fortify-client:1.4.6:all'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.36'
implementation group: 'org.pitest', name: 'pitest', version: versions.pitest
implementation group:'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: versions.gradlePitest
implementation group:'org.codehaus.sonar-plugins', name:'sonar-pitest-plugin', version: versions.sonarPitest
}
task fortifyScan(type: JavaExec) {
main = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
processContractTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processFunctionalTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processIntegrationTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processSmokeTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
task smoke(type: Test, description: 'Runs the smoke tests.', group: 'Verification') {
useJUnitPlatform()
setTestClassesDirs(sourceSets.smokeTest.output.classesDirs)
setClasspath(sourceSets.smokeTest.runtimeClasspath)
}
task integration(type: Test, description: 'Runs integration tests.', group: 'Verification') {
useJUnitPlatform()
setTestClassesDirs(sourceSets.integrationTest.output.classesDirs)
setClasspath(sourceSets.integrationTest.runtimeClasspath)
}
task functional(type: Test, description: 'Runs functional tests.', group: 'Verification') {
useJUnitPlatform()
setTestClassesDirs(sourceSets.functionalTest.output.classesDirs)
setClasspath(sourceSets.functionalTest.runtimeClasspath)
}
task nightlyFunctional(type: Test, description: 'Runs the Nightly Only Functional tests.', group: 'Verification') {
doFirst(){
printf(":::::::::: Running nightlyFunctional ::::::::::")
}
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
forkEvery = 10
setTestClassesDirs(sourceSets.integrationTest.output.classesDirs)
setClasspath(sourceSets.integrationTest.runtimeClasspath)
finalizedBy aggregate
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.prl.*']
excludedClasses = [
'uk.gov.hmcts.reform.prl.config.*',
'uk.gov.hmcts.reform.prl.models.*',
'uk.gov.hmcts.reform.prl.enums.*',
'uk.gov.hmcts.reform.prl.Application.*',
'uk.gov.hmcts.reform.prl.utils.ElementUtils.*',
]
threads = 20
outputFormats = ['XML', 'HTML']
timestampedReports = true
mutationThreshold = 80
}
jacocoTestReport {
executionData(test)
reports {
xml.enabled = true
csv.enabled = false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
jacoco {
toolVersion = "0.8.12"
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.9
}
}
}
}
project.tasks['sonarqube'].dependsOn integration, jacocoTestReport
def sonarExclusions = [
'**uk/gov/hmcts/reform/prl/models/**/*',
'**uk/gov/hmcts/reform/prl/exception/*',
'**uk/gov/hmcts/reform/prl/enums/**/*',
'**uk/gov/hmcts/reform/prl/config/**/*',
'**uk/gov/hmcts/reform/prl/utils/*',
'**uk/gov/hmcts/reform/prl/services/validators/eventschecker/*',
'**uk/gov/hmcts/reform/prl/Application.*',
'**uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/validators/ResponseSubmitChecker.java',
"**uk/gov/hmcts/reform/prl/services.ManageOrderEmailService.java",
'**uk/gov/hmcts/reform/prl/services/RoleAssignmentServiceForSystemUser.java',
'**uk/gov/hmcts/reform/prl/services/RoleAssignmentService.java',
"**uk/gov/hmcts/reform/prl/services/DraftAnOrderService.java",
"**uk/gov/hmcts/reform/prl/services/ManageOrderService.java",
"**uk/gov/hmcts/reform/prl/services/EditReturnedOrderService.java",
'**uk/gov/hmcts/reform/prl/controllers/EditAndApproveDraftOrderController.java',
'**uk/gov/hmcts/reform/prl/services/ServiceOfApplicationService.java',
'**uk/gov/hmcts/reform/prl/controllers/Fm5ReminderController.java',
'**uk/gov/hmcts/reform/prl/services/TaskListService.java',
'**uk/gov/hmcts/reform/prl/services/citizen/CaseService.java',
'**uk/gov/hmcts/reform/prl/services/DraftAnOrderService.java',
'**uk/gov/hmcts/reform/prl/services/c100respondentsolicitor/C100RespondentSolicitorService.java',
'**uk/gov/hmcts/reform/prl/services/RoleAssignmentService.java',
'**uk/gov/hmcts/reform/prl/mapper/citizen/awp/CitizenAwpMapper.java',
'**uk/gov/hmcts/reform/prl/mapper/citizen/CitizenPartyDetailsMapper.java',
'**uk/gov/hmcts/reform/prl/services/UpdatePartyDetailsService.java',
'**uk/gov/hmcts/reform/prl/services/serviceofdocuments/ServiceOfDocumentsService.java',
'**uk/gov/hmcts/reform/prl/mapper/citizen/awp/CitizenAwpMapper.java'
]
sonarqube {
properties {
property "sonar.projectName", "Family Private Law :: prl-cos"
property "sonar.projectKey", "prl-cos-api"
property "sonar.exclusions", sonarExclusions.join(", ")
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.destination.path}"
property "sonar.pitest.mode", "reuseReport"
property "sonar.pitest.reportsDirectory", "build/reports/pitest"
}
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
def debug = System.getProperty("debug")
run {
if (debug == 'true') {
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5010']
}
}
task contract(type: Test, description: 'Runs the consumer Pact tests.', group: 'Delivery pipeline') {
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
include "uk/gov/hmcts/reform/prl/clients/**"
systemProperty 'pact.rootDir', "pacts"
environment("APPINSIGHTS_INSTRUMENTATIONKEY", "test-key")
}
task runAndPublishConsumerPactTests(type: Test){
logger.lifecycle("Runs pact Tests")
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
}
runAndPublishConsumerPactTests.dependsOn contract
runAndPublishConsumerPactTests.finalizedBy pactPublish
project.ext {
pactVersion = getCheckedOutGitCommitHash()
}
def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
pact {
publish {
pactDirectory = 'pacts'
pactBrokerUrl = System.getenv("PACT_BROKER_FULL_URL") ?: 'http://localhost:80'
tags = [System.getenv("PACT_BRANCH_NAME") ?:'Dev']
version = project.pactVersion
}
}
task loadEnvSecrets() {
doLast {
if (!project.file('./.aat-env').exists()) {
new ByteArrayOutputStream().withStream { os ->
exec {
commandLine 'az', 'keyvault', 'secret', 'show', '--vault-name', 'prl-aat', '-o', 'tsv', '--query', 'value', '--name', 'prl-cos-cft-lib-local-config'
standardOutput = os
}
project.file('./.aat-env').write(new String(os.toString().replace('\n', '').decodeBase64(), java.nio.charset.StandardCharsets.UTF_8))
}
}
}
}
bootWithCCD {
dependsOn(loadEnvSecrets)
doFirst() {
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
}
}
}
test {
useJUnitPlatform()
}