diff --git a/pom.xml b/pom.xml index a7e1883..67bed16 100644 --- a/pom.xml +++ b/pom.xml @@ -13,14 +13,14 @@ org.springframework.boot spring-boot-starter-parent - 3.1.5 + 3.2.2 - 17 - 7.0.0 - 2.2.0 + 21 + 7.0.1 + 2.3.0 diff --git a/src/main/java/flowabledemo/DefinitionsController.java b/src/main/java/flowabledemo/DefinitionsController.java index e25fe03..db07193 100644 --- a/src/main/java/flowabledemo/DefinitionsController.java +++ b/src/main/java/flowabledemo/DefinitionsController.java @@ -89,16 +89,16 @@ public ResponseEntity getProcessImageAtCurrentState(@PathVariable String } List activityIds = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(historicProcessInstances.get(0).getId()) + .processInstanceId(historicProcessInstances.getFirst().getId()) .listPage(0, 1000) .stream().map(HistoricActivityInstance::getActivityId).toList(); - String processDefinitionId = historicProcessInstances.get(0).getProcessDefinitionId(); + String processDefinitionId = historicProcessInstances.getFirst().getProcessDefinitionId(); ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId); if (processDefinition != null && processDefinition.hasGraphicalNotation()) { ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator(); BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); - if (bpmnModel.getLocationMap().size() == 0) { + if (bpmnModel.getLocationMap().isEmpty()) { BpmnAutoLayout autoLayout = new BpmnAutoLayout(bpmnModel); autoLayout.execute(); } diff --git a/src/test/java/flowabledemo/DemoFlowfestApplicationTests.java b/src/test/java/flowabledemo/DemoFlowfestApplicationTests.java index c7c05be..587efc8 100644 --- a/src/test/java/flowabledemo/DemoFlowfestApplicationTests.java +++ b/src/test/java/flowabledemo/DemoFlowfestApplicationTests.java @@ -2,8 +2,10 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; @SpringBootTest +@ActiveProfiles("test") class DemoFlowfestApplicationTests { @Test diff --git a/src/test/java/flowabledemo/config/TestAppConfig.java b/src/test/java/flowabledemo/config/TestAppConfig.java index 29972e6..322dc0b 100644 --- a/src/test/java/flowabledemo/config/TestAppConfig.java +++ b/src/test/java/flowabledemo/config/TestAppConfig.java @@ -4,8 +4,8 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Lazy; -import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.reactive.function.client.support.WebClientAdapter; +import org.springframework.web.client.RestClient; +import org.springframework.web.client.support.RestClientAdapter; import org.springframework.web.service.invoker.HttpServiceProxyFactory; @TestConfiguration @@ -16,22 +16,22 @@ public class TestAppConfig { @Bean VacationApi vacationApiClient() { - var webClient = WebClient.builder() + var webClient = RestClient.builder() .baseUrl("http://localhost:" + port) .build(); - var factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); + var factory = HttpServiceProxyFactory.builderFor(RestClientAdapter.create(webClient)).build(); return factory.createClient(VacationApi.class); } @Bean DefinitionsApi definitionsApi() { - var webClient = WebClient.builder() + var webClient = RestClient.builder() .baseUrl("http://localhost:" + port) .build(); - var factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build(); + var factory = HttpServiceProxyFactory.builderFor(RestClientAdapter.create(webClient)).build(); return factory.createClient(DefinitionsApi.class); } diff --git a/src/test/java/flowabledemo/vacation/FlowableTestBase.java b/src/test/java/flowabledemo/vacation/FlowableTestBase.java index 3faa5f5..f491c1a 100644 --- a/src/test/java/flowabledemo/vacation/FlowableTestBase.java +++ b/src/test/java/flowabledemo/vacation/FlowableTestBase.java @@ -125,7 +125,7 @@ private void assertAllTasksEnded(String processInstanceId) { historyService.createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) .list().forEach(h -> { - assertNotNull("Task " + h.getTaskDefinitionKey() + " has no start time", h.getStartTime()); + assertNotNull("Task " + h.getTaskDefinitionKey() + " has no start time", h.getCreateTime()); assertNotNull("Task " + h.getTaskDefinitionKey() + " has no end time", h.getEndTime()); }); } diff --git a/src/test/java/flowabledemo/vacation/VacationRequestProcessE2ETest.java b/src/test/java/flowabledemo/vacation/VacationRequestProcessE2ETest.java index a50aa01..459ddc3 100644 --- a/src/test/java/flowabledemo/vacation/VacationRequestProcessE2ETest.java +++ b/src/test/java/flowabledemo/vacation/VacationRequestProcessE2ETest.java @@ -52,7 +52,7 @@ void runVacationBPMN_E2E_Scenario_ManagerApprovedOnFirstReview() { .containsExactly("vacationRequestProcess"); //verify process created with expected variables - var vacationRequest = processes.get(0); + var vacationRequest = processes.getFirst(); assertThat(vacationRequest.getProcessVariables()) .as("process variables") .contains( @@ -69,13 +69,13 @@ void runVacationBPMN_E2E_Scenario_ManagerApprovedOnFirstReview() { var managerTasks = vacationApi.fetchAvailableTasks("MANAGER"); //claim task - vacationApi.claimTask(managerTasks.get(0).getId(), "Bob The Manager"); + vacationApi.claimTask(managerTasks.getFirst().getId(), "Bob The Manager"); System.out.println(getActivityIds(processInstanceId)); //review and approve request vacationApi.reviewVacationRequest(VacationProcessResult.builder() .vacationApproved(true) - .build(), managerTasks.get(0).getId()); + .build(), managerTasks.getFirst().getId()); //wait for async email sender task waitForAsyncTasks(); @@ -111,7 +111,7 @@ void runVacationBPMN_E2E_Scenario_ManagerApprovedOnSecondReview() { .containsExactly("vacationRequestProcess"); //verify process created with expected variables - var vacationRequest = processes.get(0); + var vacationRequest = processes.getFirst(); assertThat(vacationRequest.getProcessVariables()) .as("process variables") .contains( @@ -126,12 +126,12 @@ void runVacationBPMN_E2E_Scenario_ManagerApprovedOnSecondReview() { //fetch manager tasks var managerTasks = vacationApi.fetchAvailableTasks("MANAGER"); - vacationApi.claimTask(managerTasks.get(0).getId(), "Bob The Manager"); + vacationApi.claimTask(managerTasks.getFirst().getId(), "Bob The Manager"); //review and approve request vacationApi.reviewVacationRequest(VacationProcessResult.builder() .vacationApproved(false) - .build(), managerTasks.get(0).getId()); + .build(), managerTasks.getFirst().getId()); //wait for async email sender task waitForAsyncTasks(); @@ -141,22 +141,22 @@ void runVacationBPMN_E2E_Scenario_ManagerApprovedOnSecondReview() { //claim task by employee var employeeTasks = vacationApi.fetchAvailableTasks("EMPLOYEE"); - vacationApi.claimTask(employeeTasks.get(0).getId(), "Sally The Employee"); + vacationApi.claimTask(employeeTasks.getFirst().getId(), "Sally The Employee"); //appeal vacationApi.updateVacationRequest(VacationUpdateRequest.builder() .numberOfDays(15) .shouldAppeal(true) - .build(), employeeTasks.get(0).getId()); + .build(), employeeTasks.getFirst().getId()); System.out.println(getActivityIds(processInstanceId)); //claim task by manager managerTasks = vacationApi.fetchAvailableTasks("MANAGER"); - vacationApi.claimTask(managerTasks.get(0).getId(), "Bob The Manager"); + vacationApi.claimTask(managerTasks.getFirst().getId(), "Bob The Manager"); //review and approve request vacationApi.reviewVacationRequest(VacationProcessResult.builder() .vacationApproved(true) - .build(), managerTasks.get(0).getId()); + .build(), managerTasks.getFirst().getId()); //wait for async email sender task waitForAsyncTasks();