-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathbuild.gradle
1007 lines (847 loc) · 41.6 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
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
buildscript {
ext {
springBootVersion = '2.7.18'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'application'
id 'jacoco'
id 'idea'
id 'eclipse'
id 'org.springframework.boot' version '2.7.18'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'io.spring.dependency-management' version '1.1.5'
id 'org.sonarqube' version '5.0.0.4638'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.github.spacialcircumstances.gradle-cucumber-reporting' version '0.1.25'
id 'org.jetbrains.gradle.plugin.idea-ext' version '0.7'
id 'info.solidsoft.pitest' version '1.15.0'
id 'uk.gov.hmcts.java' version '0.12.57'
id 'au.com.dius.pact' version '4.3.12'
id "org.jsonschema2pojo" version "1.2.1"
}
apply from: './gradle/suppress.gradle'
def versions = [
pact_version : '4.3.4',
]
ext['spring-security.version'] = '5.7.11'
ext['spring-framework.version'] = '5.3.27'
ext['jackson.version'] = '2.16.0'
configurations {
compileClasspath {
resolutionStrategy.force 'org.springframework.cloud:spring-cloud-starter:4.0.5'
}
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
dependencyCheck {
suppressionFile = 'dependency-check-suppressions.xml'
}
application {
mainClass = 'uk.gov.hmcts.ccd.CoreCaseDataApplication'
}
sourceSets {
aat {
java {
srcDir('src/aat/java')
compileClasspath += main.output
runtimeClasspath += main.output
}
resources {
srcDir('src/aat/resources')
}
}
contractTest {
java {
srcDir('src/contractTest/java')
compileClasspath += main.output
runtimeClasspath += main.output
}
resources {
srcDir('src/contractTest/resources')
}
}
}
// tag::repositories[]
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
ext {
junitJupiterVersion = '5.8.2'
junitVintageVersion = '5.8.2'
powermockVersion = '2.0.7'
reformLogging = '6.0.1'
appInsightsVersion = '2.4.1'
swagger2Version = '3.0.0'
hibernateVersion = '5.6.10.Final'
limits = [
'instruction': 90,
'branch' : 85,
'line' : 90,
'complexity' : 88,
'method' : 90,
'class' : 98
]
springCloudVersion = '2021.0.3'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
group 'uk.gov.hmcts.ccd'
bootJar {
archiveFileName = 'core-case-data'
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
archiveFileName = 'core-case-data.jar'
}
configurations {
providedRuntime
annotationProcessor
aatImplementation.extendsFrom(testImplementation)
aatRuntimeOnly.extendsFrom(testRuntimeOnly)
aatAnnotationProcessor.extendsFrom(annotationProcessor)
contractTestImplementation.extendsFrom(testImplementation)
contractTestRuntimeOnly.extendsFrom(testRuntimeOnly)
contractTestAnnotationProcessor.extendsFrom(annotationProcessor)
cucumberRuntime.extendsFrom(functionalRuntime)
}
//This is to exclude generated files from build/generated-sources/js2p/uk/gov/hmcts/ccd/domain/types/sanitiser/document
tasks.withType(Checkstyle) {
exclude 'uk/gov/hmcts/ccd/domain/types/sanitiser/document/**'
}
tasks.withType(Test) {
maxParallelForks = System.getenv('MAX_NUM_PARALLEL_THREADS') ?: 6 as int
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
dependencies {
implementation('org.springframework.cloud:spring-cloud-starter-bootstrap') {
version {
strictly '4.0.5'
}
}
implementation('org.springframework.cloud:spring-cloud-starter') {
version {
strictly '4.0.5'
}
}
implementation('org.springframework.boot:spring-boot-starter') {
version {
strictly '3.1.8'
}
}
implementation('org.springframework.security:spring-security-rsa'){
version {
strictly '1.0.12.RELEASE'
}
}
implementation('org.bouncycastle:bcprov-jdk18on') {
version {
strictly '1.77'
}
}
implementation('commons-io:commons-io') {
version {
strictly '2.16.1'
}
}
implementation 'com.google.code.gson:gson:2.8.9'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '3.1.9'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: reformLogging
implementation group: 'com.microsoft.azure', name: 'applicationinsights-logging-logback', version: appInsightsVersion
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter', version: appInsightsVersion
implementation 'org.mapstruct:mapstruct-jdk8:1.3.1.Final'
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.3.1.Final', 'org.projectlombok:lombok:1.18.34', 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.3.1.Final', 'org.projectlombok:lombok:1.18.34', 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
testCompileOnly 'org.projectlombok:lombok:1.18.34'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation('org.springframework.hateoas:spring-hateoas:1.5.5')
implementation group: 'org.springframework.plugin', name: 'spring-plugin-core'
implementation(group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.retry:spring-retry')
implementation('org.springframework.boot:spring-boot-starter-cache')
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
implementation group: 'javax.inject', name: 'javax.inject', version: '1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: swagger2Version
implementation "org.flywaydb:flyway-core:8.5.13"
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.0'
implementation group: 'io.jsonwebtoken', name: 'jjwt', version:'0.9.1'
implementation group: 'com.github.hmcts', name: 'service-auth-provider-java-client', version: '4.0.3'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '2.0.1'
implementation group: 'org.bouncycastle', name: 'bcpkix-jdk15to18', version: '1.77'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-client'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-resource-server', version: '2.7.18'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-core'
implementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose'
implementation "io.github.openfeign:feign-httpclient:11.0"
implementation group: 'net.minidev', name: 'json-smart', version: '2.4.11'
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.37.2'
implementation group: 'io.vavr', name: 'vavr', version: '0.10.4'
testImplementation group: 'io.github.openfeign.form', name: 'feign-form', version: '3.8.0'
implementation group: 'io.github.openfeign.form', name: 'feign-form-spring', version: '3.8.0'
implementation group: 'com.sun.mail', name: 'mailapi', version: '1.6.1'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'commons-validator', name: 'commons-validator', version: '1.6'
// CVE-2019-10086 force update of commons-beanutils.
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
implementation group: 'org.awaitility', name: 'awaitility', version: '3.1.6'
// CVE-2021-28170
implementation "org.glassfish:jakarta.el:4.0.1"
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'commons-io', name: 'commons-io', version: '2.16.1'
// use the latest org.springframework.security
implementation group: 'org.springframework.security', name: 'spring-security-core'
implementation group: 'org.springframework.security', name: 'spring-security-config'
implementation group: 'org.springframework.security', name: 'spring-security-web'
implementation group: 'org.springframework.security', name: 'spring-security-crypto'
implementation group: 'com.vladmihalcea', name: 'hibernate-types-52', version: '2.9.13'
implementation "org.hibernate:hibernate-core:${hibernateVersion}"
implementation group: 'org.apache.commons', name: 'commons-jexl3', version: '3.1'
implementation group: 'pl.jalokim.propertiestojson', name: 'java-properties-to-json', version: '5.1.3'
// FIXME 0.6 doesn't support jsonb; 0.7 doesn't work on Windows
// runtime group: 'com.impossibl.pgjdbc-ng', name: 'pgjdbc-ng', version: '0.6'
runtimeOnly group: 'org.postgresql', name: 'postgresql', version: '42.5.5'
runtimeOnly group: 'com.zaxxer', name: 'HikariCP', version: '4.0.2'
implementation 'org.springframework.boot:spring-boot-starter-validation'
configurations.all {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
testImplementation group: 'org.json', name: 'json', version: '20211205'
testImplementation "org.flywaydb:flyway-core:8.5.13"
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-stub-runner')
testImplementation ('com.opentable.components:otj-pg-embedded:0.12.0')
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.22.0'
testImplementation group: 'org.assertj', name: 'assertj-vavr', version: '0.4.2'
testImplementation("org.testcontainers:postgresql:1.20.2")
testImplementation ('com.github.tomakehurst:wiremock-jre8:2.25.1')
testImplementation ('org.springframework.cloud:spring-cloud-contract-wiremock:2.2.4.RELEASE')
// To avoid compiler warnings about @API annotations in JUnit5 code.
testImplementation 'org.apiguardian:apiguardian-api:1.0.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-commons:1.8.1"
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.6.0'
testImplementation group:'org.mockito', name: 'mockito-junit-jupiter', version:'3.6.0'
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: powermockVersion
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0'
testImplementation group: 'com.xebialabs.restito', name: 'restito', version: '0.9.3'
testImplementation 'io.github.openfeign:feign-jackson:9.7.0'
testImplementation group: 'org.testcontainers', name: 'elasticsearch', version: '1.20.2'
testImplementation group: 'org.testcontainers', name: 'junit-jupiter', version: '1.20.2'
testImplementation 'com.github.hmcts:fortify-client:1.3.0:all'
testImplementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
// for sonar analysis
testImplementation group: 'org.openid4java', name: 'openid4java', version: '1.0.0'
// remove me once insights is in
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13'
//excluding log4j-core which causes a vulnerability issue
implementation(group: 'io.searchbox', name: 'jest', version: '6.3.1') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
implementation(group: 'org.elasticsearch', name: 'elasticsearch', version: '7.16.2') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
implementation 'org.jooq:jool-java-8:0.9.14'
implementation 'com.github.hmcts:ccd-case-document-am-client:1.7.1'
testImplementation group: 'com.github.hmcts', name: 'ccd-test-definitions', version: '7.24.2'
testImplementation group: 'com.github.hmcts', name: 'befta-fw', version: '9.2.0'
contractTestImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
contractTestImplementation "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'junit5', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'spring', version: versions.pact_version
contractTestImplementation group: 'au.com.dius.pact.provider', name: 'junit5spring', version: versions.pact_version
contractTestRuntimeOnly group: 'io.springfox', name: 'springfox-boot-starter', version: swagger2Version
contractTestImplementation group: 'io.vavr', name: 'vavr', version: '0.10.4'
contractTestImplementation group: 'org.springframework.security', name: 'spring-security-oauth2-client'
contractTestImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-oauth2-resource-server'
contractTestImplementation group: 'org.springframework.security', name: 'spring-security-oauth2-resource-server'
contractTestImplementation group: 'org.springframework.security', name: 'spring-security-oauth2-core'
contractTestImplementation group: 'org.springframework.security', name: 'spring-security-oauth2-jose'
contractTestImplementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.6.1'
contractTestImplementation group: 'javax.inject', name: 'javax.inject', version: '1'
contractTestImplementation group: 'com.github.hmcts', name: 'idam-java-client', version: '2.0.1'
contractTestImplementation('org.springframework.hateoas:spring-hateoas:1.5.5')
contractTestImplementation(group: 'io.searchbox', name: 'jest', version: '6.3.1') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
contractTestImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
contractTestImplementation("org.springframework.boot:spring-boot-starter-data-jpa")
contractTestImplementation group: 'org.apache.commons', name: 'commons-jexl3', version: '3.1'
contractTestImplementation(group: 'org.elasticsearch', name: 'elasticsearch', version: '7.16.2') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
contractTestImplementation 'com.github.hmcts:ccd-case-document-am-client:1.7.1'
contractTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.34'
contractTestImplementation 'org.springframework.boot:spring-boot-starter-cache'
contractTestImplementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
aatImplementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
aatImplementation group: 'io.rest-assured', name: 'rest-assured', version: '4.3.0'
aatImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.34'
aatAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.34'
}
// end::dependencies[]
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
dependencies {
// Versions prior to 30.0 vulnerable to CVE-2020-8908
dependency 'com.google.guava:guava:32.1.2-jre'
// CVE-2023-41080
dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.91') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-el'
entry 'tomcat-embed-websocket'
}
// CVE-2019-10086
dependencySet(group: 'commons-beanutils', version: '1.9.4') {
entry 'commons-beanutils'
}
// Required for Embedded ES with Java 11
dependency 'org.rauschig:jarchivelib:1.0.0'
// Remove once BEFTA rest-assured is updated
dependencySet(group: 'io.rest-assured', version: '4.3.0') {
entry 'json-path'
entry 'xml-path'
}
dependencySet(group: 'org.codehaus.groovy', version: '3.0.2') {
entry 'groovy'
entry 'groovy-xml'
entry 'groovy-json'
}
}
}
pitest {
targetClasses = ['uk.gov.hmcts.ccd.config.*',
'uk.gov.hmcts.ccd.AuthCheckerConfiguration',
'uk.gov.hmcts.ccd.exception.*',
'uk.gov.hmcts.ccd.infrastructure.*',
'uk.gov.hmcts.ccd.data.*',
'uk.gov.hmcts.ccd.domain.*']
targetTests = ['uk.gov.hmcts.ccd.config.*',
'uk.gov.hmcts.ccd.AuthCheckingConfigurationTest',
'uk.gov.hmcts.ccd.infrastructure.user.*',
'uk.gov.hmcts.ccd.data.caseaccess.[!DefaultCaseUserRepositoryTest].*',
'uk.gov.hmcts.ccd.data.casedetails.query.*',
'uk.gov.hmcts.ccd.data.casedetails.search.*',
'uk.gov.hmcts.ccd.data.casedetails.[!CaseAuditEventRepositoryTest].*',
'uk.gov.hmcts.ccd.data.casedetails.[!DefaultCaseDetailsRepositoryTest].*',
'uk.gov.hmcts.ccd.data.definition.CachedCaseDefinitionRepositoryTest',
'uk.gov.hmcts.ccd.data.draft.*',
'uk.gov.hmcts.ccd.data.JSONBConverterTest',
'uk.gov.hmcts.ccd.data.SecurityUtilsTest',
'uk.gov.hmcts.ccd.domain.model.*',
'uk.gov.hmcts.ccd.domain.service.aggregated.*',
'uk.gov.hmcts.ccd.domain.service.callbacks.CallbackServiceTest',
'uk.gov.hmcts.ccd.domain.service.caseaccess.*',
'uk.gov.hmcts.ccd.domain.service.common.*',
'uk.gov.hmcts.ccd.domain.service.createcase.*',
'uk.gov.hmcts.ccd.domain.service.createevent.*',
'uk.gov.hmcts.ccd.domain.service.getcase.*',
'uk.gov.hmcts.ccd.domain.service.getdraft.*',
'uk.gov.hmcts.ccd.domain.service.getevents.*',
'uk.gov.hmcts.ccd.domain.service.search.*',
'uk.gov.hmcts.ccd.domain.service.startevent.*',
'uk.gov.hmcts.ccd.domain.service.stdapi.CallbackInvokerTest',
'uk.gov.hmcts.ccd.domain.service.stdapi.PrintableDocumentListOperationTest',
'uk.gov.hmcts.ccd.domain.service.upsertdraft.*',
'uk.gov.hmcts.ccd.domain.service.validate.*',
'uk.gov.hmcts.ccd.domain.types.sanitiser.client.*',
'uk.gov.hmcts.ccd.domain.types.sanitiser.*',
'uk.gov.hmcts.ccd.domain.types.[!CaseDataValidatorTest].*',
'uk.gov.hmcts.ccd.test.*',
'uk.gov.hmcts.ccd.v2.external.controller.[!CaseControllerTestIT].*',
'uk.gov.hmcts.ccd.v2.external.controller.[!DocumentControllerITest].*',
'uk.gov.hmcts.ccd.v2.external.controller.[!StartTriggerControllerCaseRolesIT].*',
'uk.gov.hmcts.ccd.v2.internal.controller.[!UICaseControllerCaseRolesIT].*',
'uk.gov.hmcts.ccd.v2.internal.controller.[!UIStartTriggerControllerCaseRolesIT].*',
'uk.gov.hmcts.ccd.v2.external.resource.*',
'uk.gov.hmcts.ccd.v2.internal.resource.*'
]
excludedClasses = ['uk.gov.hmcts.ccd.CoreCaseDataApplication',
'uk.gov.hmcts.ccd.PersistenceIT',
'uk.gov.hmcts.ccd.v2.external.controller.TestingSupportController'
]
enableDefaultIncrementalAnalysis = true
historyInputLocation = 'build/reports/pitest/fastermutationtesting'
historyOutputLocation = 'build/reports/pitest/fastermutationtestingoutput'
threads = 15
testSourceSets = [sourceSets.test]
mainSourceSets = [sourceSets.main]
fileExtensionsToFilter.addAll('xml','json')
outputFormats = ['XML', 'HTML','CSV']
mutationThreshold = 4
coverageThreshold = 4
features = ["+CLASSLIMIT(limit[15])"]
jvmArgs = ['-Xms1G','-Xmx3G']
timestampedReports = false
failWhenNoMutations = false
detectInlinedCode = true
}
project.tasks['pitest'].group = "Verification"
task projectVersion {
description 'Prints the version of this project; used for publishing JAR file'
doLast {
print project.version
}
}
// copied from https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin
// Note A problem was found with the configuration of task ':generateJsonSchema2Pojo'.
// Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated
// and is scheduled to be removed in Gradle 5.0.
jsonSchema2Pojo {
// Whether to allow 'additional' properties to be supported in classes by adding a map to
// hold these. This is true by default, meaning that the schema rule 'additionalProperties'
// controls whether the map is added. Set this to false to globabally disable additional properties.
includeAdditionalProperties = true
// Whether to generate builder-style methods of the form withXxx(value) (that return this),
// alongside the standard, void-return setters.
generateBuilders = false
// Whether to use primitives (long, double, boolean) instead of wrapper types where possible
// when generating bean properties (has the side-effect of making those properties non-null).
usePrimitives = false
// Location of the JSON Schema file(s). This may refer to a single file or a directory of files.
source = files("${sourceSets.main.output.resourcesDir}/schema")
// Target directory for generated Java source files. The plugin will add this directory to the
// java source set so the compiler will find and compile the newly generated source files.
targetDirectory = file("${project.buildDir}/generated-sources/js2p")
// Package name used for generated Java classes (for types where a fully qualified name has not
// been supplied in the schema using the 'javaType' property).
targetPackage = 'uk.gov.hmcts.ccd.domain.types.sanitiser.document'
// The characters that should be considered as word delimiters when creating Java Bean property
// names from JSON property names. If blank or not set, JSON properties will be considered to
// contain a single word when creating Java Bean property names.
propertyWordDelimiters = [] as char[]
// Whether to use the java type long (or Long) instead of int (or Integer) when representing the
// JSON Schema type 'integer'.
useLongIntegers = false
// Whether to use the java type BigInteger when representing the JSON Schema type 'integer'. Note
// that this configuration overrides useLongIntegers
useBigIntegers = false
// Whether to use the java type double (or Double) instead of float (or Float) when representing
// the JSON Schema type 'number'.
useDoubleNumbers = true
// Whether to use the java type BigDecimal when representing the JSON Schema type 'number'. Note
// that this configuration overrides useDoubleNumbers
useBigDecimals = false
// Whether to include hashCode and equals methods in generated Java types.
includeHashcodeAndEquals = true
// Whether to include a toString method in generated Java types.
includeToString = true
// The style of annotations to use in the generated Java types. Supported values:
// - jackson (alias of jackson2)
// - jackson2 (apply annotations from the Jackson 2.x library)
// - jackson1 (apply annotations from the Jackson 1.x library)
// - gson (apply annotations from the Gson library)
// - moshi1 (apply annotations from the Moshi 1.x library)
// - none (apply no annotations at all)
annotationStyle = 'jackson'
// A fully qualified class name, referring to a custom annotator class that implements
// org.jsonschema2pojo.Annotator and will be used in addition to the one chosen
// by annotationStyle. If you want to use the custom annotator alone, set annotationStyle to none.
customAnnotator = 'org.jsonschema2pojo.NoopAnnotator'
// Whether to include JSR-303/349 annotations (for schema rules like minimum, maximum, etc) in
// generated Java types. Schema rules and the annotation they produce:
// - maximum = @DecimalMax
// - minimum = @DecimalMin
// - minItems,maxItems = @Size
// - minLength,maxLength = @Size
// - pattern = @Pattern
// - required = @NotNull
// Any Java fields which are an object or array of objects will be annotated with @Valid to
// support validation of an entire document tree.
includeJsr303Annotations = false
// The type of input documents that will be read. Supported values:
// - jsonschema (schema documents, containing formal rules that describe the structure of JSON data)
// - json (documents that represent an example of the kind of JSON data that the generated Java types
// will be mapped to)
// - yamlschema (JSON schema documents, represented as YAML)
// - yaml (documents that represent an example of the kind of YAML (or JSON) data that the generated Java types
// will be mapped to)
sourceType = 'jsonschema'
// Whether to empty the target directory before generation occurs, to clear out all source files
// that have been generated previously. <strong>Be warned</strong>, when activated this option
// will cause jsonschema2pojo to <strong>indiscriminately delete the entire contents of the target
// directory (all files and folders)</strong> before it begins generating sources.
removeOldOutput = false
// The character encoding that should be used when writing the generated Java source files
outputEncoding = 'UTF-8'
// Whether to use {@link org.joda.time.DateTime} instead of {@link java.util.Date} when adding
// date type fields to generated Java types.
useJodaDates = false
// Whether to add JsonFormat annotations when using Jackson 2 that cause format "date", "time", and "date-time"
// fields to be formatted as yyyy-MM-dd, HH:mm:ss.SSS and yyyy-MM-dd'T'HH:mm:ss.SSSZ respectively. To customize these
// patterns, use customDatePattern, customTimePattern, and customDateTimePattern config options or add these inside a
// schema to affect an individual field
formatDateTimes = true
formatDates = true
formatTimes = true
// Whether to use commons-lang 3.x imports instead of commons-lang 2.x imports when adding equals,
// hashCode and toString methods.
useCommonsLang3 = false
// Whether to initialize Set and List fields as empty collections, or leave them as null.
initializeCollections = true
// Whether to add a prefix to generated classes.
classNamePrefix = ""
// Whether to add a suffix to generated classes.
classNameSuffix = ""
// An array of strings that should be considered as file extensions and therefore not included in class names.
fileExtensions = [] as String[]
// Whether to generate constructors or not.
includeConstructors = false
// **EXPERIMENTAL** Whether to make the generated types Parcelable for Android
parcelable = false
// Whether to make the generated types Serializable
serializable = false
// Whether to include getters or to omit these accessor methods and create public fields instead.
includeGetters = true
// Whether to include setters or to omit these accessor methods and create public fields instead.
includeSetters = true
// Whether to include dynamic getters, setters, and builders or to omit these methods.
includeDynamicAccessors = false
// Whether to include dynamic getters or to omit these methods.
includeDynamicGetters = false
// Whether to include dynamic setters or to omit these methods.
includeDynamicSetters = false
// Whether to include dynamic builders or to omit these methods.
includeDynamicBuilders = false
// What type to use instead of string when adding string properties of format "date" to Java types
dateType = "java.time.LocalDate"
// What type to use instead of string when adding string properties of format "date-time" to Java types
dateTimeType = "java.time.LocalDateTime"
}
sonarqube {
properties {
property "sonar.exclusions", "build/generated-sources/**/*.java," +
"**/AppInsightsConfiguration.java," +
"**/TestingSupportController.java"
property "sonar.projectName", "ccd-data-store-api"
property "sonar.projectKey", "ccd-data-store-api"
property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.outputLocation}"
}
}
compileJava {
options.annotationProcessorPath = configurations.annotationProcessor
}
configurations {
all.collect { configuration ->
configuration.exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
}
}
compileTestJava {
options.annotationProcessorPath = configurations.annotationProcessor
}
idea.project.settings {
compiler {
javac {
javacAdditionalOptions "-parameters"
}
}
}
// adopted from
// https://github.com/springfox/springfox/blob/fb780ee1f14627b239fba95730a69900b9b2313a/gradle/coverage.gradle
jacocoTestReport {
doFirst {
logger.lifecycle("{} Starting jacocoTestReport ...", timestamp())
}
reports {
// XML required by coveralls and for the below coverage checks
// and html are generated by default
xml.required = true
}
afterEvaluate {
classDirectories.setFrom((classDirectories.files.collect {
fileTree(dir: it, exclude: ['uk/gov/hmcts/ccd/domain/types/sanitiser/document/**',
'**/service/doclink/**',
'**/domain/model/definition/CaseEventFieldComplex**',
'**/domain/model/definition/DisplayContext**'])
}))
}
doLast {
def report = file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
logger.lifecycle("Checking coverage results: ${report}")
def parser = new XmlParser()
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
def results = parser.parse(report)
def percentage = {
def covered = it.'@covered' as Double
def missed = it.'@missed' as Double
((covered / (covered + missed)) * 100).round(2)
}
def counters = results.counter
def metrics = [:]
metrics << [
'instruction': percentage(counters.find { it.'@type'.equals('INSTRUCTION') }),
'branch' : percentage(counters.find { it.'@type'.equals('BRANCH') }),
'line' : percentage(counters.find { it.'@type'.equals('LINE') }),
'complexity' : percentage(counters.find { it.'@type'.equals('COMPLEXITY') }),
'method' : percentage(counters.find { it.'@type'.equals('METHOD') }),
'class' : percentage(counters.find { it.'@type'.equals('CLASS') })
]
def failures = []
metrics.each {
def limit = limits[it.key]
if (it.value < limit) {
failures.add("- ${it.key} coverage rate is: ${it.value}%, minimum is ${limit}%")
}
}
if (failures) {
logger.quiet("------------------ Code Coverage Failed -----------------------")
failures.each {
logger.quiet(it)
}
logger.quiet("---------------------------------------------------------------")
throw new GradleException("Code coverage failed")
} else {
logger.quiet("Passed Code Coverage Checks")
}
}
}
test {
timeout = Duration.ofMinutes(30)
environment("AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY", "some-key")
generateCucumberReports.enabled = false
systemProperty 'java.locale.providers', 'COMPAT'
useJUnitPlatform()
testLogging {
// set options for log level LIFECYCLE
events "failed"
exceptionFormat "short"
// set options for log level DEBUG
debug {
events "passed", "started", "skipped", "failed"
exceptionFormat "full"
}
// remove standard output/error logging from --info builds
// by assigning only 'failed' and 'skipped' events
info.events = ["failed", "skipped"]
}
reports {
html.required = true
html.outputLocation = file("${buildDir}/reports/jacoco/html")
}
jvmArgs = [
'--add-modules', 'java.se',
'--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.nio=ALL-UNNAMED',
'--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens', 'java.management/sun.management=ALL-UNNAMED',
'--add-opens', 'jdk.management/com.sun.management.internal=ALL-UNNAMED'
]
}
check.dependsOn jacocoTestReport
task fortifyScan(type: JavaExec) {
mainClass = "uk.gov.hmcts.fortifyclient.FortifyClientMainApp"
classpath += sourceSets.test.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
idea {
module {
// config to allow Intelij to mark test source and resource files correctly to help linting tools
testSourceDirs += project.sourceSets.aat.java.srcDirs
testSourceDirs += project.sourceSets.contractTest.java.srcDirs
testResourceDirs += project.sourceSets.aat.resources.srcDirs
testResourceDirs += project.sourceSets.contractTest.resources.srcDirs
}
}
task highLevelDataSetup(type: JavaExec) {
dependsOn aatClasses
mainClass = "uk.gov.hmcts.ccd.datastore.befta.HighLevelDataSetupApp"
classpath += configurations.cucumberRuntime + sourceSets.aat.runtimeClasspath
jvmArgs = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED']
}
task smoke() {
description = 'Executes smoke tests against an the CCD Data Store API instance just deployed'
dependsOn aatClasses
new File("$buildDir/test-results/test").mkdirs()
copy {
from "src/aat/resources/DummyTest.xml"
into "$buildDir/test-results/test"
}
doLast {
generateCucumberReports.enabled = true
javaexec {
mainClass = "uk.gov.hmcts.ccd.datastore.befta.DataStoreBeftaMain"
classpath += configurations.cucumberRuntime + sourceSets.aat.runtimeClasspath
args = ['--plugin', "json:${rootDir}/target/cucumber.json",
'--plugin', "junit:${buildDir}/test-results/smoke/cucumber.xml",
'--tags', '@Smoke and not @Ignore',
'--glue', 'uk.gov.hmcts.befta.player',
'--glue', "uk.gov.hmcts.ccd.datastore.befta", 'src/aat/resources/features']
jvmArgs = [ '--add-opens=java.base/java.lang.reflect=ALL-UNNAMED' ]
}
}
finalizedBy {
generateCucumberReports {
doLast{
delete "${rootDir}/BEFTA Report for Smoke Tests/"
new File("${rootDir}/BEFTA Report for Smoke Tests").mkdirs()
file("${rootDir}/target/cucumber/cucumber-html-reports").renameTo(file("${rootDir}/BEFTA Report for Smoke Tests"))
logger.quiet("Smoke test report moved to ---> file://${rootDir}/BEFTA%20Report%20for%20Smoke%20Tests/overview-features.html")
}
}
}
outputs.upToDateWhen { false }
}
def tags = (findProperty('tags') == null) ? 'not @Ignore' : '(' + findProperty('tags') + ') and not @Ignore'
task functional(type: JavaExec) {
description = "Executes functional tests against an the CCD Data Store API instance just deployed"
group = "Verification"
dependsOn aatClasses
group = "Verification"
generateCucumberReports.enabled = false
mainClass = "uk.gov.hmcts.ccd.datastore.befta.DataStoreBeftaMain"
classpath += configurations.cucumberRuntime + sourceSets.aat.runtimeClasspath + sourceSets.main.output + sourceSets.test.output
args = [
'--threads', '1',
'--plugin', "json:${rootDir}/target/cucumber.json",
'--plugin', "junit:${buildDir}/test-results/functional/cucumber.xml",
'--tags',"${tags}",
'--glue', 'uk.gov.hmcts.befta.player',
'--glue', 'uk.gov.hmcts.ccd.datastore.befta',
'src/aat/resources/features'
]
// '--add-opens=...' added to suppress 'WARNING: An illegal reflective access operation has occurred' in uk.gov.hmcts.befta.util.CucumberStepAnnotationUtils
jvmArgs '--add-opens=java.base/java.lang.reflect=ALL-UNNAMED'
finalizedBy {
generateCucumberReports.enabled = true
generateCucumberReports {
doLast{
delete "${rootDir}/BEFTA Report for Functional Tests/"
new File("${rootDir}/BEFTA Report for Functional Tests").mkdirs()
file("${rootDir}/target/cucumber/cucumber-html-reports").renameTo(file("${rootDir}/BEFTA Report for Functional Tests"))
logger.quiet("Functional test report moved to ---> file://${rootDir}/BEFTA%20Report%20for%20Functional%20Tests/overview-features.html")
}
}
}
outputs.upToDateWhen { false }
}
project.ext {
pactVersion = getCheckedOutGitCommitHash()
}
def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}
task runProviderPactVerification(type:Test) {
logger.lifecycle("Runs provider pact Tests")
useJUnitPlatform()
testClassesDirs = sourceSets.contractTest.output.classesDirs
classpath = sourceSets.contractTest.runtimeClasspath
if (project.hasProperty('pact.verifier.publishResults')) {
systemProperty 'pact.verifier.publishResults', project.property('pact.verifier.publishResults')
}
systemProperty 'pact.provider.version', project.pactVersion
include "uk/gov/hmcts/reform/**"
}
runProviderPactVerification.finalizedBy pactVerify
def timestamp() {
def date = new Date()
return date.format('yyyy-MM-dd HH:mm:ss')
}
cucumberReports {
outputDir = file("${projectDir}/target/cucumber")
reports = files("${projectDir}/target/cucumber.json")
notFailingStatuses = ["skipped", "passed"]
}
task reloadEnvSecretsDemo {
doFirst {
reloadEnvSecrets("demo")
}
}
task reloadEnvSecretsAAT {
doFirst {
reloadEnvSecrets("aat")
}
}
void reloadEnvSecrets(String env) {
if (project.file("./.${env}-remote-env").exists()) {
project.file("./.${env}-remote-env").delete()
}
}
task runRemoteDemo(type: JavaExec) {
mainClass = 'uk.gov.hmcts.ccd.CoreCaseDataApplication'
classpath = sourceSets.main.runtimeClasspath
doFirst() {
configRemoteRunTask(it, 'demo')
}
}
task runRemoteAAT(type: JavaExec) {
mainClass = 'uk.gov.hmcts.ccd.CoreCaseDataApplication'
classpath = sourceSets.main.runtimeClasspath
doFirst() {
configRemoteRunTask(it, 'aat')
}
}
rootProject.tasks.named("processAatResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processContractTestResources") {
duplicatesStrategy = 'include'
}
void configRemoteRunTask(Task execTask, String env) {
loadEnvSecrets(env)
project.file("./.${env}-remote-env").readLines().each() {
def index = it.indexOf("=")
def key = it.substring(0, index)
def value = it.substring(index + 1)
execTask.environment(key, value)
}
}
void loadEnvSecrets(String env) {
def azCmd = ['az', 'keyvault', 'secret', 'show', '--vault-name', "ccd-${env}", '-o', 'tsv', '--query', 'value', '--name', 'data-store-remote-env']
if (!project.file("./.${env}-remote-env").exists()) {
new ByteArrayOutputStream().withStream { os ->
exec {
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine ['cmd', '/c'] + azCmd
} else {
commandLine azCmd