Skip to content

Conversation

adityadwadasi
Copy link
Contributor

Before creating a pull request make sure that:

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)

Please remove this line and everything above and fill the following sections:

JIRA link (if applicable)

https://tools.hmcts.net/jira/browse/RWA-4067

Change description

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[ ] No


private static SearchTaskRequest invalidCaseId() {
return new SearchTaskRequest(List.of(
new SearchParameterList(CASE_ID, SearchOperator.IN, asList("000000", "", null))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is null here we are getting "SQLGrammarException: could not extract ResultSet: operator does not exist: text = bytea".
But post springboot upgrade we are not getting that exception.
If this PR is merged before Springboot upgrade, I will add null's in springboot PR.
If springboot PR is merged before this PR, I will put the null's back here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add a ticket to review search request validations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private static SearchTaskRequest invalidUserId() {
return new SearchTaskRequest(List.of(
new SearchParameterList(USER, SearchOperator.IN, asList("unknown", "", null))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add a ticket to review search request validations.

accessControlResponse
))
.hasNoCause()
.hasMessage("Offset index must not be less than zero");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Hibernate criteria's there's a method call to validate the pagination values.
This is the method "Pageable page = OffsetPageableRequest.of(firstResult, maxResults);"

But in the gin index approach we do not have such validations. So instead of looking for a message I was asserting the Exception directly.

Please suggest if anything needs to be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add a ticket to review search request validations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searchRequest,
accessControlResponse
))
.hasNoCause()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add a ticket to review search request validations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.roleAssignments(pagination(Classification.RESTRICTED))
.searchTaskRequest(searchTaskRequest)
.expectedAmountOfTasksInResponse(20)
.expectedTotalRecords(29)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the gin index approach we don't retrieve any other states except ASSIGNED and UNASSIGNED, I had to correct the expectation count here.

final TaskQueryScenario allTasks = TaskQueryScenario.builder()
.scenarioName("Search by state")
final TaskQueryScenario pendingAssignEmptyTasks = TaskQueryScenario.builder()
.scenarioName("Search by PENDING_AUTO_ASSIGN state, empty results")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably remove this scenario if you like. It's not an observable state at the moment with the way things work. So I'd be happy with covering just COMPLETED and CANCELLED states for negative scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the case suggested Ravi.

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 13, 2025
Copy link
Contributor

@raghera raghera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have had a look through but we probably want Ben's involvement so that tests maintain their value. Can also consider removing any that are not useful any more.

roleAssignment = RoleAssignment.builder().roleName("senior-tribunal-caseworker")
.classification(classification)
.attributes(excludeddAttributes)
.attributes(Collections.emptyMap())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the excluded attributes?

cftTaskDatabaseService = new CFTTaskDatabaseService(taskResourceRepository, cftTaskMapper);
}

@Disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test still looks like it is Disabled?

final SearchTaskRequest searchTaskRequest = new SearchTaskRequest(List.of(
new SearchParameterList(JURISDICTION, SearchOperator.IN, List.of(WA_JURISDICTION))
final SearchTaskRequest searchTaskRequest = new SearchTaskRequest(
RequestContext.AVAILABLE_TASKS,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come you added this? This will change the nature of the search and apply a set of permissions on it which were not there previously.

.expectedAmountOfTasksInResponse(2)
.expectedTotalRecords(2)
.expectedAmountOfTasksInResponse(0)
.expectedTotalRecords(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure but maybe this test is better served by just removing the state clause or modifying it so ASSIGNED/UNASSIGNED is requested. Seems to lose it's value if it just returns nothing.

.expectedAmountOfTasksInResponse(2)
.expectedTotalRecords(2)
.expectedAmountOfTasksInResponse(1)
.expectedTotalRecords(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it's worth keeping the result of this test as multiple. Appears to be sending in multiple work_types and then expecting both to hit a record in response? Would be good to modify the data so you have at least one hit per workType.


INSERT INTO cft_task_db.tasks (task_id, assignee, assignment_expiry, auto_assigned, business_context, case_id, case_name, case_type_id, created, description, due_date_time, has_warnings, jurisdiction, LOCATION, location_name, major_priority, minor_priority, notes, region, region_name, role_category, security_classification, state, task_name, task_system, task_type, termination_reason, title, work_type, execution_type_code, priority_date)
values('8d6cc5cf-c973-11eb-bdba-0242ac111023', 'SELF', '2022-05-09T20:15:45.345875+01:00', FALSE, 'CFT_TASK', '1623278362431023', 'TestCase2', 'Asylum', '2021-05-09T20:15:45.345875+01:00', 'description', '2022-08-09T20:15:45.345875+01:00', FALSE, 'IA', '765324', 'Taylor House', 5000, 0, '[{"user": "userVal", "noteType": "noteTypeVal"}]', '1', 'TestRegion', 'JUDICIAL', 'PUBLIC', 'UNASSIGNED', 'taskName', 'SELF', 'startAppeal', NULL, 'title', 'hearing_work', 'MANUAL', '2022-08-09T20:15:45.345875+01:00');
values('8d6cc5cf-c973-11eb-bdba-0242ac111023', null, '2022-05-09T20:15:45.345875+01:00', FALSE, 'CFT_TASK', '1623278362431023', 'TestCase2', 'Asylum', '2021-05-09T20:15:45.345875+01:00', 'description', '2022-08-09T20:15:45.345875+01:00', FALSE, 'IA', '765324', 'Taylor House', 5000, 0, '[{"user": "userVal", "noteType": "noteTypeVal"}]', '1', 'TestRegion', 'JUDICIAL', 'PUBLIC', 'UNASSIGNED', 'taskName', 'SELF', 'startAppeal', NULL, 'title', 'hearing_work', 'MANUAL', '2022-08-09T20:15:45.345875+01:00');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this change in data? SELF


}

private void indexRecord() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put this in it's own class?

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 15, 2025
@github-actions github-actions bot closed this Sep 23, 2025
@adityadwadasi adityadwadasi reopened this Oct 1, 2025
@github-actions github-actions bot removed the stale label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants