-
Notifications
You must be signed in to change notification settings - Fork 2
Rwa 4067 refactor integration tests #1392
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
Open
adityadwadasi
wants to merge
22
commits into
master
Choose a base branch
from
RWA-4067_refactor_integration_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
366b8d9
RWA-4067: Integration tests refactored
adityadwadasi b33e6ee
Code corrections.
adityadwadasi f6ded7d
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 7ae36cc
Removed PENDING_AUTO_ASSIGN Scenario
adityadwadasi 2504f1d
Corrected test cases.
adityadwadasi e291add
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi bd34f5d
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 36914e0
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 487bca5
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi a35cc22
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 4341622
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi b570a62
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 86a3377
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi f6bdfba
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi f2f2449
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 460753d
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 16b4bfe
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 2599113
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 7b2b849
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 0e59c19
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi c08cfdc
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi 790d997
Merge branch 'master' into RWA-4067_refactor_integration_tests
adityadwadasi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,15 +40,20 @@ | |
import uk.gov.hmcts.reform.wataskmanagementapi.domain.search.SortingParameter; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.domain.search.parameter.SearchParameterList; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.domain.task.Task; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.entity.TaskResource; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.repository.TaskResourceRepository; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.services.CFTTaskDatabaseService; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.services.CFTTaskMapper; | ||
import uk.gov.hmcts.reform.wataskmanagementapi.services.CamundaService; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
|
@@ -76,14 +81,21 @@ public class CftQueryServiceITTest extends RoleAssignmentHelper { | |
@Autowired | ||
private AllowedJurisdictionConfiguration allowedJurisdictionConfiguration; | ||
|
||
private CFTTaskDatabaseService cftTaskDatabaseService; | ||
|
||
private static final UserInfo userInfo = UserInfo.builder().email("[email protected]").uid("user").build(); | ||
|
||
@Autowired | ||
TaskResourceRepository taskResourceRepository; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
CFTTaskMapper cftTaskMapper = new CFTTaskMapper(new ObjectMapper()); | ||
cftQueryService = new CftQueryService(camundaService, cftTaskMapper, new TaskResourceDao(entityManager), | ||
allowedJurisdictionConfiguration | ||
); | ||
|
||
cftTaskDatabaseService = new CFTTaskDatabaseService(taskResourceRepository, cftTaskMapper); | ||
} | ||
|
||
@Disabled | ||
|
@@ -111,9 +123,9 @@ void shouldRetrieveTasks(TaskQueryScenario scenario) { | |
AccessControlResponse accessControlResponse = new AccessControlResponse(scenario.userInfo, | ||
scenario.roleAssignments); | ||
SearchRequest searchRequest = SearchTaskRequestMapper.map(scenario.searchTaskRequest); | ||
|
||
indexRecord(); | ||
//when | ||
final GetTasksResponse<Task> allTasks = cftQueryService.searchForTasks( | ||
final GetTasksResponse<Task> allTasks = cftTaskDatabaseService.searchForTasks( | ||
scenario.firstResult, | ||
scenario.maxResults, | ||
searchRequest, | ||
|
@@ -818,6 +830,7 @@ private static List<RoleAssignment> roleAssignmentWithAllGrantTypes(Classificati | |
List<RoleAssignment> roleAssignments = new ArrayList<>(); | ||
RoleAssignment roleAssignment = RoleAssignment.builder().roleName("hmcts-judiciary") | ||
.classification(classification) | ||
.attributes(Collections.emptyMap()) | ||
.grantType(GrantType.SPECIFIC) | ||
.roleType(RoleType.ORGANISATION) | ||
.beginTime(OffsetDateTime.now().minusYears(1)) | ||
|
@@ -869,12 +882,9 @@ private static List<RoleAssignment> roleAssignmentWithAllGrantTypes(Classificati | |
.build(); | ||
roleAssignments.add(roleAssignment); | ||
|
||
final Map<String, String> excludeddAttributes = Map.of( | ||
RoleAttributeDefinition.CASE_ID.value(), "1623278362431003" | ||
); | ||
roleAssignment = RoleAssignment.builder().roleName("senior-tribunal-caseworker") | ||
.classification(classification) | ||
.attributes(excludeddAttributes) | ||
.attributes(Collections.emptyMap()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove the excluded attributes? |
||
.grantType(GrantType.EXCLUDED) | ||
.roleType(RoleType.CASE) | ||
.beginTime(OffsetDateTime.now().minusYears(1)) | ||
|
@@ -891,6 +901,7 @@ private static List<RoleAssignment> defaultSort(Classification classification) { | |
.classification(classification) | ||
.roleType(RoleType.ORGANISATION) | ||
.grantType(GrantType.SPECIFIC) | ||
.attributes(Collections.emptyMap()) | ||
.beginTime(OffsetDateTime.now().minusYears(1)) | ||
.endTime(OffsetDateTime.now().plusYears(1)) | ||
.build(); | ||
|
@@ -919,4 +930,15 @@ public String toString() { | |
} | ||
|
||
} | ||
|
||
private void indexRecord() { | ||
List<String> ids = new ArrayList<>(); | ||
taskResourceRepository.findAll().forEach(taskResource -> ids.add(taskResource.getTaskId())); | ||
ids.forEach(id -> { | ||
Optional<TaskResource> taskResource = taskResourceRepository.findById(id); | ||
TaskResource task = taskResource.get(); | ||
task.setIndexed(true); | ||
taskResourceRepository.save(task); | ||
}); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?