-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
700 lines (607 loc) · 29.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
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
import org.springframework.boot.gradle.tasks.run.BootRun
buildscript {
ext {
springBootVersion = '2.7.17'
springCloudBomVersion = "2021.0.8"
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("net.serenity-bdd:serenity-gradle-plugin:2.4.34")
}
}
plugins {
id 'application'
id 'checkstyle'
id 'com.github.ben-manes.versions' version '0.49.0'
id 'info.solidsoft.pitest' version '1.15.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'jacoco'
id 'org.flywaydb.flyway' version '9.22.3'
id 'org.owasp.dependencycheck' version '8.4.2'
id 'org.sonarqube' version '3.5.0.2730'
id 'org.springframework.boot' version "2.7.17"
id 'au.com.dius.pact' version '4.1.8'
id 'uk.gov.hmcts.java' version '0.12.47'
}
def versions = [
awaitility : '4.2.0',
bcpkixJdk15on : '1.70',
ccdStoreClient : '4.7.6',
commonsBeanUtils : '1.9.4',
commonsIo : '2.15.0',
commonsLang3 : '3.13.0',
commonsMath3 : '3.6.1',
divCommonLib : '1.2.16',
dumbster : '1.7.1',
elasticsearch : '7.17.15',
feignHttpClient : '12.5',
flyway : '6.5.7',
googleAuth : '1.5.0',
guava : '32.1.3-jre',
hibernateTypes : '2.21.1',
hmctsNotify : '3.19.2-RELEASE',
idamClient : '2.1.1',
jackson : '2.15.3',
jacksonDatabind : '2.15.3',
jacksonDatatypeJsr : '2.15.3',
jakartaMail : '1.6.7',
jakartaWsRs : '2.1.6',
javaMail : '1.6.2',
jdbi : '2.78',
jsonAssert : '1.5.1',
jsonPathAssert : '2.2.0',
junit : '4.13.2',
logbackVersion : '1.2.10',
lombok : '1.18.30',
postgresql : '42.6.0',
puppyCrawl : '8.45.1',
reformPropertiesVolume: '0.1.0',
reformsJavaLogging : '5.1.7',
sendLetterClient : '3.0.23',
serenity : '2.6.0',
serenityCucumber : '1.9.51',
serviceTokenGenerator : '3.1.4',
springDoc : '1.7.0',
springSecurityCrypto : '6.1.5',
springSecurityRsa : '1.1.1',
springBoot : '2.7.17',
tomcat : '9.0.82',
unirest : '1.4.9',
pact_version : '4.1.11',
httpComponents : '4.5.14',
bspCommonLib : '0.0.51',
ccdClient : '4.9.2',
reformLogging : '6.0.1'
]
allprojects {
def springBootVersion = '2.7.17'
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.divorce'
version = '0.0.1'
checkstyle.toolVersion = '8.34'
checkstyle.configFile = new File(rootDir, "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 = 'dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://repo.spring.io/libs-milestone' }
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://jitpack.io" }
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = true
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudBomVersion}"
}
dependencies {
dependencySet(
group: 'com.fasterxml.jackson.core',
version: versions.jackson
) {
entry 'jackson-core'
entry 'jackson-databind'
entry 'jackson-annotations'
}
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-2023-4586
dependencySet(group: 'io.netty', version: '4.1.101.Final') {
entry 'netty-buffer'
entry 'netty-codec'
entry 'netty-codec-http'
entry 'netty-common'
entry 'netty-handler'
entry 'netty-resolver'
entry 'netty-transport'
entry 'netty-transport-native-unix-common'
}
// CVE-2019-10086
dependency group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
// CVE-2020-9484
dependencySet(group: 'org.apache.tomcat.embed', version: versions.tomcat) {
entry 'tomcat-embed-core'
entry 'tomcat-embed-websocket'
entry 'tomcat-embed-el'
}
//CVE-2021-44228, CVE-2021-44832, CVE-2021-45046, CVE-2021-45105
dependencySet(group: 'org.apache.logging.log4j', version: '2.21.1') {
entry 'log4j-api'
entry 'log4j-to-slf4j'
}
//CVE-2017-18640
dependency group: 'org.yaml',name: 'snakeyaml', version: '1.33'
dependency group: 'org.glassfish', name: 'jakarta.el', version: '3.0.4'
//CVE-2022-22965
dependencySet(group: 'org.springframework', version: '5.3.30') {
entry 'spring-aop'
entry 'spring-beans'
entry 'spring-context'
entry 'spring-context-support'
entry 'spring-core'
entry 'spring-expression'
entry 'spring-jcl'
entry 'spring-web'
entry 'spring-webmvc'
entry 'spring-aspects'
entry 'spring-jdbc'
entry 'spring-orm'
entry 'spring-tx'
}
//CVE-2023-34047
dependencySet(group: 'org.springframework.plugin', version: '3.0.0') {
entry 'spring-plugin-core'
entry 'spring-plugin-metadata'
}
}
}
}
apply plugin: 'net.serenity-bdd.aggregator'
group = 'uk.gov.hmcts.reform.divorce'
version = '0.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
bootJar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
archiveFileName = 'div-case-orchestration-service.jar'
}
mainClassName = 'uk.gov.hmcts.reform.divorce.orchestration.OrchestrationServiceApplication'
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')
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntime.extendsFrom testRuntime
}
processTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processContractTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
processIntegrationTestResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
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 = 'dependency-check-suppressions.xml'
}
dependencies {
implementation project(':job-scheduler')
compileOnly("org.projectlombok:lombok:${versions.lombok}")
testCompileOnly("org.projectlombok:lombok:${versions.lombok}")
testImplementation('com.github.hmcts:fortify-client:1.3.0:all')
annotationProcessor("org.projectlombok:lombok:${versions.lombok}")
testAnnotationProcessor("org.projectlombok:lombok:${versions.lombok}")
implementation group: 'com.mchange', name: 'c3p0', version: '0.9.5.5'
implementation group: 'com.sun.xml.bind', name: 'jaxb-osgi', version: '2.3.9'
implementation group: 'com.jayway.jsonpath', name: 'json-path-assert', version: versions.jsonPathAssert
implementation group: 'com.github.kirviq', name: 'dumbster', version: versions.dumbster
implementation group: 'com.puppycrawl.tools', name: 'checkstyle', version: versions.puppyCrawl
implementation group: 'com.vladmihalcea', name: 'hibernate-types-52', version: versions.hibernateTypes
implementation group: 'com.sun.mail', name: 'javax.mail', version: versions.javaMail
implementation group: 'commons-io', name: 'commons-io', version: versions.commonsIo
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: versions.feignHttpClient
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: versions.springDoc
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations', version: '2.2.19'
implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '2.1.2'
implementation group: 'jakarta.mail', name: 'jakarta.mail-api', version: versions.jakartaMail
implementation group: 'jakarta.ws.rs', name: 'jakarta.ws.rs-api', version: versions.jakartaWsRs
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.elasticsearch', name: 'elasticsearch', version: versions.elasticsearch
implementation group: 'org.elasticsearch.client', name: 'transport', version: versions.elasticsearch
implementation group: 'org.flywaydb', name: 'flyway-core', version: versions.flyway
implementation group: 'org.jdbi', name: 'jdbi', version: versions.jdbi
implementation group: 'org.postgresql', name: 'postgresql', version: versions.postgresql
implementation group: 'org.springframework', name: 'spring-context-support'
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-data-jpa', version: versions.springBoot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-quartz', {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: versions.springBoot
implementation group: 'org.springframework.retry', name: 'spring-retry'
implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap'
implementation group: 'org.springframework.retry', name: 'spring-retry', version: versions.retry
implementation "com.github.hmcts:bsp-common-lib:${versions.bspCommonLib}"
implementation "com.github.hmcts:div-common-lib:1.2.21_DFR-829", {
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-openfeign'
}
implementation("org.springdoc:springdoc-openapi-ui") {
exclude group: "org.yaml", module: "snakeyaml"
}
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: versions.idamClient
implementation group: 'com.github.hmcts', name: 'ccd-client', version: versions.ccdClient
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: versions.reformLogging
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: versions.serviceTokenGenerator
implementation group: 'com.github.hmcts', name: 'bsp-common-lib', version: versions.bspCommonLib
implementation group: 'uk.gov.hmcts.reform', name: 'logging', version: versions.reformsJavaLogging
implementation group: 'uk.gov.hmcts.reform', name: 'logging-appinsights', version: versions.reformsJavaLogging, {
exclude group: 'ch.qos.logback', module: 'logback-core'
exclude group: 'ch.qos.logback', module: 'logback-classic'
}
implementation group: 'uk.gov.hmcts.reform', name: 'logging-httpcomponents', version: versions.reformsJavaLogging
implementation group: 'uk.gov.hmcts.reform', name: 'logging-spring', version: versions.reformsJavaLogging
implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: versions.reformPropertiesVolume, {
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-openfeign'
}
implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: versions.serviceTokenGenerator, {
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-openfeign'
}
implementation group: 'com.github.hmcts', name: 'send-letter-client', version: versions.sendLetterClient, {
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-openfeign'
}
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.hibernate', name: 'hibernate-core', version: '6.3.1.Final'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: versions.logbackVersion
implementation group: 'ch.qos.logback', name: 'logback-core', version: versions.logbackVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: versions.jacksonDatabind
implementation(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'
}
implementation(group: 'commons-beanutils', name: 'commons-beanutils', version: versions.commonsBeanUtils) {
force = true
}
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-jdk15on', version: versions.bcpkixJdk15on) {
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
}
constraints{
implementation group: 'com.warrenstrange', name: 'googleauth', version: '1.5.0'
}
runtimeOnly('org.springframework.boot:spring-boot-devtools')
testImplementation group: 'junit', name: 'junit', version: versions.junit
testImplementation("org.junit.vintage:junit-vintage-engine") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
testImplementation group: 'org.awaitility', name: 'awaitility', version: versions.awaitility
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-contract-wiremock', version: '3.1.8'
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test') {
exclude(module: 'commons-logging')
exclude(module: 'android-json')
}
//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: 'junit', name: 'junit', 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.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: 'uk.gov.hmcts.reform', name: 'core-case-data-store-client', version: versions.ccdStoreClient)
{
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: 'uk.gov.hmcts.reform', name: 'service-auth-provider-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'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-context'
exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-openfeign'
}
contractTestImplementation group: 'com.google.guava', name: 'guava', version: versions.guava
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.consumer', name: 'java8', version: versions.pact_version
contractTestRuntimeOnly group: 'com.google.guava', name: 'guava', version: versions.guava
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'junit5', version: versions.pact_version
contractTestRuntimeOnly group: 'au.com.dius.pact.consumer', name: 'java8', version: versions.pact_version
contractTestImplementation group: 'org.apache.httpcomponents', name: 'httpclient', version: versions.httpComponents
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test'
contractTestImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
contractTestRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1")
contractTestImplementation('org.junit.jupiter:junit-jupiter-api:5.10.1')
contractTestImplementation sourceSets.main.runtimeClasspath
contractTestImplementation sourceSets.test.runtimeClasspath
}
dependencies {
integrationTestImplementation(sourceSets.test.output)
}
task smoke(type: Test, description: 'Runs the smoke tests.', group: 'Verification') {
useJUnit {
includeCategories 'uk.gov.hmcts.reform.divorce.orchestration.category.SmokeTest'
}
}
task bootRunAat(type: BootRun, description: 'Runs the app using AAT config', dependsOn: 'classes', group: 'Application') {
doFirst() {
classpath = sourceSets.main.runtimeClasspath
systemProperties = System.properties
systemProperty 'spring.profiles.active', 'aat'
}
}
task functional(type: Test, description: 'Runs the functional tests.', group: 'Verification') {
doFirst(){
printf("Available processors:::::::::: " + Runtime.runtime.availableProcessors().intdiv(2).toString())
}
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
forkEvery = 10
exclude "uk/gov/hmcts/reform/divorce/callback/nightly/pipeline/**"
exclude "uk/gov/hmcts/reform/divorce/maintenance/nightly/pipeline/**"
setTestClassesDirs(sourceSets.integrationTest.output.classesDirs)
setClasspath(sourceSets.integrationTest.runtimeClasspath)
if (System.getenv('CHANGE_TITLE')?.startsWith('[FAST]')) {
useJUnit {
excludeCategories 'uk.gov.hmcts.reform.divorce.category.ExtendedTest'
}
}
finalizedBy aggregate
}
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
include "uk/gov/hmcts/reform/divorce/callback/nightly/pipeline/**"
include "uk/gov/hmcts/reform/divorce/maintenance/nightly/pipeline/**"
setTestClassesDirs(sourceSets.integrationTest.output.classesDirs)
setClasspath(sourceSets.integrationTest.runtimeClasspath)
if (System.getenv('CHANGE_TITLE')?.startsWith('[FAST]')) {
useJUnit {
excludeCategories 'uk.gov.hmcts.reform.divorce.category.ExtendedTest'
}
}
finalizedBy aggregate
}
pitest {
targetClasses = ['uk.gov.hmcts.reform.divorce.orchestration.*']
excludedClasses = ['uk.gov.hmcts.reform.divorce.orchestration.config.*',
'uk.gov.hmcts.reform.divorce.orchestration.domain.model.*',
'uk.gov.hmcts.reform.divorce.orchestration.exception.*',
'uk.gov.hmcts.reform.divorce.orchestration.client.*',
'uk.gov.hmcts.reform.divorce.orchestration.management.config.*',
'uk.gov.hmcts.reform.divorce.orchestration.framework.workflow.task.*']
threads = 10
outputFormats = ['XML', 'HTML']
timestampedReports = false
mutationThreshold = 80
}
jacocoTestReport {
executionData(test)
reports {
xml.required = true
csv.required = false
xml.outputLocation = file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.9
}
}
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
def sonarExclusions = [
'**uk/gov/hmcts/reform/divorce/orchestration/domain/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/**/config/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/OrchestrationServiceApplication.java',
'**uk/gov/hmcts/reform/divorce/orchestration/client/**',
'**uk/gov/hmcts/reform/divorce/orchestration/event/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/service/bulk/scan/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/controller/BulkScanController.java',
'**uk/gov/hmcts/reform/divorce/orchestration/framework/workflow/task/DefaultTaskContext.java',
'**uk/gov/hmcts/reform/divorce/scheduler/model/*',
'**uk/gov/hmcts/reform/divorce/scheduler/config/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/util/nfd/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/util/csv/**/*',
'**uk/gov/hmcts/reform/divorce/orchestration/job/BulkPrintAosJob.java',
'**uk/gov/hmcts/reform/divorce/orchestration/service/impl/PrintRespondentAosPackService.java'
]
sonarqube {
properties {
property "sonar.projectName", "Divorce :: div-case-orchestration-service"
property "sonar.projectKey", "div-case-orchestration-service"
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']
}
}
flyway {
url = System.getenv('FLYWAY_URL')
user = System.getenv('DIV_SCHEDULER_DB_USER_NAME')
password = System.getenv('DIV_SCHEDULER_DB_PASSWORD')
baselineOnMigrate = true
baselineVersion = '000'
schemas = 'public'
}
task migratePostgresDatabase(type: org.flywaydb.gradle.task.FlywayMigrateTask) {
baselineOnMigrate = true
if (project.hasProperty("dburl")) {
url = "jdbc:postgresql://${dburl}"
}
}
task contract(type: Test) {
group = 'Delivery pipeline'
description = 'Runs the consumer Pact tests'
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
include "uk/gov/hmcts/reform/divorce/orchestration/client/**"
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 fortifyScan(type: JavaExec) {
mainClass.set("uk.gov.hmcts.fortifyclient.FortifyClientMainApp")
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}