From 59e3bd1d532c3c868cb592f11816a0db257ee23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Wed, 9 Oct 2024 11:04:41 +0200 Subject: [PATCH 1/3] NOTICKET: Update TestData Generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- .../java/de/hmmh/pmt/IntegrationTest.java | 127 +++++++++--------- .../java/de/hmmh/pmt/project/GetAllTest.java | 4 +- 2 files changed, 63 insertions(+), 68 deletions(-) diff --git a/src/test/java/de/hmmh/pmt/IntegrationTest.java b/src/test/java/de/hmmh/pmt/IntegrationTest.java index bdcf3fa..eb59826 100644 --- a/src/test/java/de/hmmh/pmt/IntegrationTest.java +++ b/src/test/java/de/hmmh/pmt/IntegrationTest.java @@ -3,7 +3,6 @@ package de.hmmh.pmt; import com.fasterxml.jackson.databind.ObjectMapper; import de.hmmh.pmt.db.Project; import de.hmmh.pmt.db.ProjectRepository; -import de.hmmh.pmt.employee.ApiClientFactory; import de.hmmh.pmt.employee.api.EmployeeControllerApi; import de.hmmh.pmt.employee.api.QualificationControllerApi; import org.junit.jupiter.api.AfterEach; @@ -16,7 +15,8 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import java.time.LocalDateTime; -import java.util.List; +import java.util.HashMap; +import java.util.Map; @SpringBootTest @AutoConfigureMockMvc(addFilters = false) @@ -47,70 +47,65 @@ public abstract class IntegrationTest { projectRepository.deleteAll(); } - protected List createTestProjectData() { - Project project1 = new Project( - 1L, - "Build a Dream Space Station", - "Launch a self-sustaining space habitat!", - 42L, - 101L, - LocalDateTime.of(2024, 3, 1, 10, 0), - LocalDateTime.of(2028, 6, 30, 18, 0), - LocalDateTime.of(2029, 12, 15, 16, 30) - ); - Project project2 = new Project( - 2L, - "Underwater Research Lab", - "Discover new marine species!", - 73L, - 202L, - LocalDateTime.of(2025, 5, 22, 8, 45), - LocalDateTime.of(2027, 11, 5, 17, 0), - LocalDateTime.of(2027, 10, 20, 14, 0) - ); - Project project3 = new Project( - 3L, - "AI-Powered Smart City", - "Create the world's most advanced smart city!", - 89L, - 303L, - LocalDateTime.of(2026, 9, 14, 12, 0), - LocalDateTime.of(2030, 4, 1, 9, 30), - LocalDateTime.of(2030, 5, 2, 15, 0) - ); - Project project4 = new Project( - 4L, - "Renewable Energy Revolution", - "Replace all fossil fuels with renewables!", - 56L, - 404L, - LocalDateTime.of(2023, 7, 19, 11, 30), - LocalDateTime.of(2029, 12, 31, 20, 0), - LocalDateTime.of(2029, 10, 5, 18, 45) - ); - Project project5 = new Project( - 5L, - "Virtual Reality Theme Park", - "Build a fully immersive VR theme park!", - 99L, - 505L, - LocalDateTime.of(2024, 2, 28, 9, 15), - LocalDateTime.of(2026, 9, 30, 17, 0), - LocalDateTime.of(2026, 8, 15, 13, 45) - ); + protected Map createTestProjectData() { + Map projects = new HashMap<>(); + + Project researchLabProject = new Project(); + researchLabProject.setName("Underwater Research Lab"); + researchLabProject.setGoal( "Discover new marine species!"); + researchLabProject.setCustomerId(73L); + researchLabProject.setAdministratorId(202L); + researchLabProject.setStart(LocalDateTime.of(2025, 5, 22, 8, 45)); + researchLabProject.setPlannedEnd(LocalDateTime.of(2026, 5, 22, 8, 45)); + projects.put("research-lab", researchLabProject); + + Project spaceStationProject = new Project(); + spaceStationProject.setName("International Space Station Expansion"); + spaceStationProject.setGoal("Build new modules for extended research."); + spaceStationProject.setCustomerId(85L); + spaceStationProject.setAdministratorId(150L); + spaceStationProject.setStart(LocalDateTime.of(2024, 10, 15, 10, 0)); + spaceStationProject.setPlannedEnd(LocalDateTime.of(2025, 12, 15, 10, 0)); + projects.put("space-station", spaceStationProject); + + Project aiResearchProject = new Project(); + aiResearchProject.setName("AI Human Interaction Study"); + aiResearchProject.setGoal("Study AI interactions in healthcare."); + aiResearchProject.setCustomerId(63L); + aiResearchProject.setAdministratorId(180L); + aiResearchProject.setStart(LocalDateTime.of(2023, 11, 3, 9, 30)); + aiResearchProject.setPlannedEnd(LocalDateTime.of(2024, 6, 3, 9, 30)); + projects.put("ai-research", aiResearchProject); + + Project renewableEnergyProject = new Project(); + renewableEnergyProject.setName("Renewable Energy Storage System"); + renewableEnergyProject.setGoal("Develop new battery tech for solar power."); + renewableEnergyProject.setCustomerId(90L); + renewableEnergyProject.setAdministratorId(175L); + renewableEnergyProject.setStart(LocalDateTime.of(2024, 1, 10, 11, 0)); + renewableEnergyProject.setPlannedEnd(LocalDateTime.of(2025, 1, 10, 11, 0)); + projects.put("renewable-energy", renewableEnergyProject); + + Project climateChangeProject = new Project(); + climateChangeProject.setName("Climate Change Impact Analysis"); + climateChangeProject.setGoal("Study global warming effects on ecosystems."); + climateChangeProject.setCustomerId(72L); + climateChangeProject.setAdministratorId(190L); + climateChangeProject.setStart(LocalDateTime.of(2025, 3, 12, 8, 0)); + climateChangeProject.setPlannedEnd(LocalDateTime.of(2026, 3, 12, 8, 0)); + projects.put("climate change", climateChangeProject); + + + Project medicalResearchProject = new Project(); + medicalResearchProject.setName("Cancer Treatment Innovation"); + medicalResearchProject.setGoal("Develop new gene therapy techniques."); + medicalResearchProject.setCustomerId(95L); + medicalResearchProject.setAdministratorId(155L); + medicalResearchProject.setStart(LocalDateTime.of(2024, 8, 20, 9, 15)); + medicalResearchProject.setPlannedEnd(LocalDateTime.of(2026, 8, 20, 9, 15)); + projects.put("medical-research", medicalResearchProject); - projectRepository.save(project1); - projectRepository.save(project2); - projectRepository.save(project3); - projectRepository.save(project4); - projectRepository.save(project5); - - return List.of( - project1, - project2, - project3, - project4, - project5 - ); + projectRepository.saveAllAndFlush(projects.values()); + return projects; } } diff --git a/src/test/java/de/hmmh/pmt/project/GetAllTest.java b/src/test/java/de/hmmh/pmt/project/GetAllTest.java index ea8fb84..b71ecf0 100644 --- a/src/test/java/de/hmmh/pmt/project/GetAllTest.java +++ b/src/test/java/de/hmmh/pmt/project/GetAllTest.java @@ -5,7 +5,7 @@ import de.hmmh.pmt.IntegrationTest; import de.hmmh.pmt.db.Project; import org.junit.jupiter.api.Test; -import java.util.List; +import java.util.Map; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasSize; @@ -25,7 +25,7 @@ public class GetAllTest extends IntegrationTest { @Test void multipleProjects() throws Exception { - List allProjects = createTestProjectData(); + Map allProjects = createTestProjectData(); mvc .perform(get(baseUri + "/project")) -- 2.45.2 From d49d5233bf7b22f94f4addc937b890a2ef2b995e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Wed, 9 Oct 2024 11:04:47 +0200 Subject: [PATCH 2/3] NOTICKET: Update Intelij Run Config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- .run/Test.run.xml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/.run/Test.run.xml b/.run/Test.run.xml index e33b35f..667c096 100644 --- a/.run/Test.run.xml +++ b/.run/Test.run.xml @@ -1,24 +1,12 @@ - - - - - - true - true - false - false - + + + \ No newline at end of file -- 2.45.2 From ca7ad3f19d7817f7ce00988fa9eb4d426c882044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Wed, 9 Oct 2024 11:15:25 +0200 Subject: [PATCH 3/3] NOTICKET: Revert Limiting to One Parallel run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index f290ba7..7b6b717 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -110,7 +110,6 @@ tasks { } withType { useJUnitPlatform() - maxParallelForks = 1 } named("compileJava").configure { dependsOn(swaggerSources.getByName("pmt").code) -- 2.45.2