Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTSRD-4052 . Adding extra column to court venue table #893

Merged
merged 19 commits into from
Jan 21, 2025
Merged
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8dc814c
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 10, 2025
abbe62e
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 14, 2025
39d577d
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 15, 2025
05b7c1e
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 15, 2025
9d40b11
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 15, 2025
5985546
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 15, 2025
516ba28
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 16, 2025
d22d388
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 16, 2025
b0473c0
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 16, 2025
9018d42
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
c456f81
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
5663d56
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
2ccf385
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
3a69d5e
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
de7b932
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
aca35d4
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
f5f7a28
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
503b22a
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
cc14ba0
DTSRD-4052 . Adding extra column to court venue table
SabinaHMCTS Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ private void responseVerification(List<LrdBuildingLocationResponse> response, St
} else if (TWO_STR.equalsIgnoreCase(responseType)) {
assertThat(response).hasSize(2).containsAnyElementsOf(getTwoLocationResponse());
} else if (ALL.equalsIgnoreCase(responseType)) {
assertThat(response).hasSize(14).containsAnyElementsOf(getAllLocationResponse());
assertThat(response).hasSize(16).containsAnyElementsOf(getAllLocationResponse());
} else {
assertThat(response).hasSize(4).hasSameElementsAs(getAllOpenLocationResponse());
}
@@ -402,6 +402,7 @@ private List<LrdBuildingLocationResponse> getAllLocationResponse() {
.courtAddress("AB7, 54 HUNTLY STREET, ABERDEEN")
.courtVenueId("13")
.externalShortName("Aberdeen Tribunal External")
.welshExternalShortName("Welsh Aberdeen Tribunal External")
.build();

LrdBuildingLocationResponse locationResponses5 = LrdBuildingLocationResponse.builder()
rajkatla-hmcts marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -28,6 +28,22 @@ class RetrieveCourtVenueDetailsIntegrationTest extends LrdAuthorizationEnabledIn
private static final String HTTP_STATUS_STR = "http_status";
private static final String path = "/court-venues";

@ParameterizedTest
@ValueSource(strings = {"123462"})
@SuppressWarnings("unchecked")
void retrieveCourtVenues_WithEpimmsIdGiven_ShouldReturnValidResponseAndStatusCodeWithWelshExternalShortName200(
String id) throws JsonProcessingException {

final var response = (List<LrdCourtVenueResponse>)
lrdApiClient.retrieveCourtVenueResponseForGivenRequest("?epimms_id=" + id,
LrdCourtVenueResponse[].class, path);

assertThat(response).isNotEmpty().hasSize(1);
assertTrue(response.stream().allMatch(venue -> venue.getEpimmsId().equals("123462")));
assertTrue(response.stream().allMatch(venue -> venue.getWelshExternalShortName().equalsIgnoreCase(
"Welsh External Short Name")));
}

@ParameterizedTest
@ValueSource(strings = {"123456789", " 123456789 ", "123456789, *"})
@SuppressWarnings("unchecked")
@@ -53,8 +69,9 @@ void retrieveCourtVenues_AllepimmsIdGiven_ShouldReturnValidResponseAndStatusCode
LrdCourtVenueResponse[].class, path
);

assertThat(response).isNotEmpty().hasSize(13);
assertThat(response).isNotEmpty().hasSize(15);
assertEquals("Aberdeen Tribunal External", response.get(12).getExternalShortName());
assertEquals("Welsh External Short Name", response.get(13).getWelshExternalShortName());
}

@Test
@@ -67,9 +84,10 @@ void retrieveCourtVenues_NoEpimmsIdGiven_ShouldReturnValidResponseAndStatusCode2
LrdCourtVenueResponse[].class, path
);

assertThat(response).isNotEmpty().hasSize(13);
assertThat(response).isNotEmpty().hasSize(15);
assertTrue(response.stream().allMatch(venue -> venue.getCourtStatus().equalsIgnoreCase("Open")));
assertEquals("Aberdeen Tribunal External", response.get(12).getExternalShortName());
assertEquals("Welsh External Short Name", response.get(13).getWelshExternalShortName());
}


@@ -139,10 +157,10 @@ void retrieveCourtVenues_WithCourtTypeIdGiven_ShouldReturnValidResponseAndStatus
lrdApiClient.retrieveCourtVenueResponseForGivenRequest("?court_type_id=" + id,
LrdCourtVenueResponse[].class, path);

assertThat(response).isNotEmpty().hasSize(10);
assertThat(response).isNotEmpty().hasSize(12);
assertTrue(response.stream().allMatch(venue -> venue.getCourtTypeId().equals(id.trim())));
assertEquals("Aberdeen Tribunal External", response.get(9).getExternalShortName());

assertEquals("Welsh External Short Name", response.get(10).getWelshExternalShortName());
}

@ParameterizedTest
@@ -169,9 +187,10 @@ void retrieveCourtVenues_WithClusterIdGiven_ShouldReturnValidResponseAndStatusCo
lrdApiClient.retrieveCourtVenueResponseForGivenRequest("?cluster_id=" + id,
LrdCourtVenueResponse[].class, path);

assertThat(response).isNotEmpty().hasSize(6);
assertThat(response).isNotEmpty().hasSize(8);
assertTrue(response.stream().allMatch(venue -> venue.getClusterId().equals(id.trim())));
assertEquals("Aberdeen Tribunal External", response.get(5).getExternalShortName());
assertEquals("Welsh External Short Name", response.get(6).getWelshExternalShortName());
}

@Test
@@ -292,9 +311,10 @@ void shouldReturn200WhenParameterCourtTypeIdIsPassed() throws
path
);

assertThat(response).isNotEmpty().hasSize(10);
assertThat(response).isNotEmpty().hasSize(12);
assertTrue(response.stream().allMatch(venue -> venue.getCourtTypeId().equals("17")));
assertEquals("Aberdeen Tribunal External", response.get(9).getExternalShortName());
assertEquals("Welsh External Short Name", response.get(10).getWelshExternalShortName());
}

@Test
@@ -323,7 +343,7 @@ void shouldReturn200WhenParameterClusterIdIsPassed() throws
path
);

assertThat(response).isNotEmpty().hasSize(6);
assertThat(response).isNotEmpty().hasSize(8);
assertTrue(response.stream().allMatch(venue -> venue.getClusterId().equals("2")));
}

@@ -371,9 +391,8 @@ void shouldReturn200WhenNoQueryParameterIsPassed() throws
List<LrdCourtVenueResponse> response = (List<LrdCourtVenueResponse>)
lrdApiClient.retrieveCourtVenueResponseForGivenRequest(null, LrdCourtVenueResponse[].class, path);

assertThat(response).isNotEmpty().hasSize(13);
assertThat(response).isNotEmpty().hasSize(15);
assertEquals("Aberdeen Tribunal External", response.get(12).getExternalShortName());

rajkatla-hmcts marked this conversation as resolved.
Show resolved Hide resolved
}

rajkatla-hmcts marked this conversation as resolved.
Show resolved Hide resolved
@Test
Original file line number Diff line number Diff line change
@@ -41,9 +41,10 @@ void shouldRetrieveCourtVenues_For_SearchString_WithStatusCode_200()
path
);

assertThat(response).isNotEmpty().hasSize(12);
assertThat(response).isNotEmpty().hasSize(14);
responseVerification(new ArrayList<>(Arrays.asList(response)));
assertEquals("Aberdeen Tribunal External", response[11].getExternalShortName());
assertEquals("Welsh External Short Name", response[12].getWelshExternalShortName());
}

@Test
@@ -87,9 +88,10 @@ void shouldRetrieveCourtVenues_For_SearchString_And_CourtTypeId_WithStatusCode_2
path
);

assertThat(response).isNotEmpty().hasSize(12);
assertThat(response).isNotEmpty().hasSize(14);
responseVerification(new ArrayList<>(Arrays.asList(response)));
assertEquals("Aberdeen Tribunal External", response[11].getExternalShortName());
assertEquals("Welsh External Short Name", response[12].getWelshExternalShortName());
}

rajkatla-hmcts marked this conversation as resolved.
Show resolved Hide resolved
@ParameterizedTest
Original file line number Diff line number Diff line change
@@ -259,3 +259,57 @@ insert into
'EC2A 2YZ',
'3 Street, London',
now());

insert into
building_location(
building_location_id,
region_id,
building_location_status_id,
cluster_id,
epimms_id,
building_location_name,
area,
court_finder_url,
postcode,
address,
updated_time)
values(
'220420013',
'2',
'45678',
'01234',
'123462',
'Building Location C',
'Area C',
'Court Finder URL 3',
'EC2A 2YZ',
'3 Street London',
now());


insert into
building_location(
building_location_id,
region_id,
building_location_status_id,
cluster_id,
epimms_id,
building_location_name,
area,
court_finder_url,
postcode,
address,
updated_time)
values(
'220420012',
'2',
'45678',
'01234',
'123463',
'Building Location C',
'Area C',
'Court Finder URL 3',
'EC2A 2YZ',
'3 Street London',
now());

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE court_venue ADD COLUMN IF NOT EXISTS welsh_external_short_name VARCHAR(80);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

insert into court_venue (court_venue_id, epimms_id, site_name, created_time, updated_time, region_id, court_type_id, cluster_id, open_for_public, court_address, postcode, phone_number, closed_date, court_location_code, dx_address, welsh_site_name, welsh_court_address, court_status, court_open_date, court_name, venue_name, is_case_management_location, is_hearing_location, external_short_name,welsh_external_short_name)
values(14, '123462','Aberdeen Tribunal Hearing Centre 7', '2021-07-05 09:50:46.269032','2021-07-05 09:50:46.269032','2','17', '2',true,'AB7, 54 HUNTLY STREET, ABERDEEN','AB11 1TY',null,null,null,null,null,null,'Open', null,'ABERDEEN TRIBUNAL HEARING CENTRE 7',null,null,null, 'Aberdeen Tribunal External','Welsh External Short Name');
commit;

insert into court_venue (court_venue_id, epimms_id, site_name, created_time, updated_time, region_id, court_type_id, cluster_id, open_for_public, court_address, postcode, phone_number, closed_date, court_location_code, dx_address, welsh_site_name, welsh_court_address, court_status, court_open_date, court_name, venue_name, is_case_management_location, is_hearing_location, external_short_name,welsh_external_short_name)
values(15, '123463','Aberdeen Tribunal Hearing Centre 7', '2021-07-05 09:50:46.269032','2021-07-05 09:50:46.269032','2','17', '2',true,'AB7, 54 HUNTLY STREET, ABERDEEN','AB11 1TY',null,null,null,null,null,null,'Open', null,'ABERDEEN TRIBUNAL HEARING CENTRE 7',null,null,null, 'Aberdeen Tribunal External','Welsh External Short Name1');
commit;
Original file line number Diff line number Diff line change
@@ -130,6 +130,9 @@ public class LrdCourtVenueResponse implements Serializable {
@JsonProperty("external_short_name")
private String externalShortName;

@JsonProperty("welsh_external_short_name")
private String welshExternalShortName;

public LrdCourtVenueResponse(CourtVenue courtVenue) {

if (nonNull(courtVenue)) {
@@ -170,6 +173,7 @@ public LrdCourtVenueResponse(CourtVenue courtVenue) {
this.serviceUrl = courtVenue.getServiceUrl();
this.factUrl = courtVenue.getFactUrl();
this.externalShortName = courtVenue.getExternalShortName();
this.welshExternalShortName = courtVenue.getWelshExternalShortName();
courtVenue.getRegion().ifPresent(reg -> {
region = reg.getDescription();
regionId = reg.getRegionId();
Original file line number Diff line number Diff line change
@@ -144,6 +144,9 @@ public class CourtVenue implements Serializable {
@Column(name = "external_short_name")
private String externalShortName;

@Column(name = "welsh_external_short_name")
private String welshExternalShortName;

public Optional<LocalDateTime> getClosedDate() {
return Optional.ofNullable(closedDate);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE court_venue ADD COLUMN IF NOT EXISTS welsh_external_short_name VARCHAR(80);
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ void testCourtVenueTransformationToResponse_ClusterAndDatesAbsent() {
.serviceUrl("https://serviceurl.com")
.factUrl("https://facturl.com")
.externalShortName("External Short Court")
.welshExternalShortName("Welsh External Court")
.build();

LrdCourtVenueResponse courtVenueResponse = new LrdCourtVenueResponse(courtVenue);
@@ -86,6 +87,7 @@ void testCourtVenueTransformationToResponse_ClusterAndDatesAbsent() {
assertNotNull(courtVenueResponse.getServiceUrl());
assertNotNull(courtVenueResponse.getFactUrl());
assertNotNull(courtVenueResponse.getExternalShortName());
assertNotNull(courtVenueResponse.getWelshExternalShortName());
}

@Test