Compare commits

..

12 commits

Author SHA1 Message Date
ec7b3b5e40
testing....... (Comit needs to be edited later)
Some checks failed
Quality Check / Validate OAS (push) Successful in 30s
Quality Check / Linting (push) Successful in 1m6s
Quality Check / Static Analysis (push) Successful in 1m12s
Quality Check / Testing (push) Failing after 34s
Co-authored-by: Rajbir Singh <rajbir.singh@hmmh.de>
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
20a22001c2
PMT-16: Update Manual Validation Method of Projects to Include the builtin.
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
21df04fbc6
PMT-16: Implement New Endpoint Logic
Co-authored-by: Rajbir Singh <rajbir.singh@hmmh.de>
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
ec9b930386
PMT-16: Add Validation for Time Range to Project Entity
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
cde8556d9c
PMT-16: Add Mapper for Project Creation/Created DTO to/from Project Entity
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
Rajbir Singh
264595ca58
PMT-16: Add Method to Check if Project with Name Exists to ProjectRepository 2024-10-09 10:32:23 +02:00
f866eaade6
PMT-16: Add More Errors to Endpoint Specification
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:32:23 +02:00
Rajbir Singh
f774450986
PMT-16: Add Endpoint Specification 2024-10-09 10:32:23 +02:00
5c06b052af Merge pull request 'bugfix/testing' (!8) from bugfix/testing into trunk
Some checks failed
Quality Check / Validate OAS (push) Successful in 29s
Quality Check / Linting (push) Has been cancelled
Quality Check / Static Analysis (push) Has been cancelled
Quality Check / Testing (push) Has been cancelled
Reviewed-on: #8
Reviewed-by: SZUT-Rajbir <rajbir2@schule.bremen.de>
Reviewed-by: SZUT-Ole <ole.kueck@hmmh.de>
2024-10-09 08:26:02 +00:00
137095814f
PMT-16: Disable Parallel Unittests
All checks were successful
Quality Check / Validate OAS (push) Successful in 3m53s
Quality Check / Linting (push) Successful in 4m26s
Quality Check / Static Analysis (push) Successful in 4m32s
Quality Check / Testing (push) Successful in 4m31s
Quality Check / Validate OAS (pull_request) Successful in 30s
Quality Check / Linting (pull_request) Successful in 1m7s
Quality Check / Testing (pull_request) Successful in 1m8s
Quality Check / Static Analysis (pull_request) Successful in 1m11s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:13:59 +02:00
13d5283b67
PMT-16: Add ObjectMapper and MockAPI to base IntegrationTest
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:13:56 +02:00
dc018471b2
PMT-16: Change Java Datetime Library to be follow Spring Context.
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-10-09 10:13:33 +02:00
3 changed files with 89 additions and 72 deletions

View file

@ -1,12 +1,24 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test" type="JUnit" factoryName="JUnit"> <configuration default="false" name="Test" type="GradleRunConfiguration" factoryName="Gradle">
<module name="Project_Management_Tool.test" /> <ExternalSystemSettings>
<option name="PACKAGE_NAME" value="" /> <option name="executionName" />
<option name="MAIN_CLASS_NAME" value="" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="METHOD_NAME" value="" /> <option name="externalSystemIdString" value="GRADLE" />
<option name="TEST_OBJECT" value="package" /> <option name="scriptParameters" value="" />
<method v="2"> <option name="taskDescriptions">
<option name="Make" enabled="true" /> <list />
</method> </option>
<option name="taskNames">
<list>
<option value="test" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration> </configuration>
</component> </component>

View file

@ -3,6 +3,7 @@ package de.hmmh.pmt;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import de.hmmh.pmt.db.Project; import de.hmmh.pmt.db.Project;
import de.hmmh.pmt.db.ProjectRepository; 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.EmployeeControllerApi;
import de.hmmh.pmt.employee.api.QualificationControllerApi; import de.hmmh.pmt.employee.api.QualificationControllerApi;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
@ -15,8 +16,7 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap; import java.util.List;
import java.util.Map;
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc(addFilters = false) @AutoConfigureMockMvc(addFilters = false)
@ -47,65 +47,70 @@ public abstract class IntegrationTest {
projectRepository.deleteAll(); projectRepository.deleteAll();
} }
protected Map<String, Project> createTestProjectData() { protected List<Project> createTestProjectData() {
Map<String, Project> projects = new HashMap<>(); Project project1 = new Project(
1L,
Project researchLabProject = new Project(); "Build a Dream Space Station",
researchLabProject.setName("Underwater Research Lab"); "Launch a self-sustaining space habitat!",
researchLabProject.setGoal( "Discover new marine species!"); 42L,
researchLabProject.setCustomerId(73L); 101L,
researchLabProject.setAdministratorId(202L); LocalDateTime.of(2024, 3, 1, 10, 0),
researchLabProject.setStart(LocalDateTime.of(2025, 5, 22, 8, 45)); LocalDateTime.of(2028, 6, 30, 18, 0),
researchLabProject.setPlannedEnd(LocalDateTime.of(2026, 5, 22, 8, 45)); LocalDateTime.of(2029, 12, 15, 16, 30)
projects.put("research-lab", researchLabProject); );
Project project2 = new Project(
Project spaceStationProject = new Project(); 2L,
spaceStationProject.setName("International Space Station Expansion"); "Underwater Research Lab",
spaceStationProject.setGoal("Build new modules for extended research."); "Discover new marine species!",
spaceStationProject.setCustomerId(85L); 73L,
spaceStationProject.setAdministratorId(150L); 202L,
spaceStationProject.setStart(LocalDateTime.of(2024, 10, 15, 10, 0)); LocalDateTime.of(2025, 5, 22, 8, 45),
spaceStationProject.setPlannedEnd(LocalDateTime.of(2025, 12, 15, 10, 0)); LocalDateTime.of(2027, 11, 5, 17, 0),
projects.put("space-station", spaceStationProject); LocalDateTime.of(2027, 10, 20, 14, 0)
);
Project aiResearchProject = new Project(); Project project3 = new Project(
aiResearchProject.setName("AI Human Interaction Study"); 3L,
aiResearchProject.setGoal("Study AI interactions in healthcare."); "AI-Powered Smart City",
aiResearchProject.setCustomerId(63L); "Create the world's most advanced smart city!",
aiResearchProject.setAdministratorId(180L); 89L,
aiResearchProject.setStart(LocalDateTime.of(2023, 11, 3, 9, 30)); 303L,
aiResearchProject.setPlannedEnd(LocalDateTime.of(2024, 6, 3, 9, 30)); LocalDateTime.of(2026, 9, 14, 12, 0),
projects.put("ai-research", aiResearchProject); LocalDateTime.of(2030, 4, 1, 9, 30),
LocalDateTime.of(2030, 5, 2, 15, 0)
Project renewableEnergyProject = new Project(); );
renewableEnergyProject.setName("Renewable Energy Storage System"); Project project4 = new Project(
renewableEnergyProject.setGoal("Develop new battery tech for solar power."); 4L,
renewableEnergyProject.setCustomerId(90L); "Renewable Energy Revolution",
renewableEnergyProject.setAdministratorId(175L); "Replace all fossil fuels with renewables!",
renewableEnergyProject.setStart(LocalDateTime.of(2024, 1, 10, 11, 0)); 56L,
renewableEnergyProject.setPlannedEnd(LocalDateTime.of(2025, 1, 10, 11, 0)); 404L,
projects.put("renewable-energy", renewableEnergyProject); LocalDateTime.of(2023, 7, 19, 11, 30),
LocalDateTime.of(2029, 12, 31, 20, 0),
Project climateChangeProject = new Project(); LocalDateTime.of(2029, 10, 5, 18, 45)
climateChangeProject.setName("Climate Change Impact Analysis"); );
climateChangeProject.setGoal("Study global warming effects on ecosystems."); Project project5 = new Project(
climateChangeProject.setCustomerId(72L); 5L,
climateChangeProject.setAdministratorId(190L); "Virtual Reality Theme Park",
climateChangeProject.setStart(LocalDateTime.of(2025, 3, 12, 8, 0)); "Build a fully immersive VR theme park!",
climateChangeProject.setPlannedEnd(LocalDateTime.of(2026, 3, 12, 8, 0)); 99L,
projects.put("climate change", climateChangeProject); 505L,
LocalDateTime.of(2024, 2, 28, 9, 15),
LocalDateTime.of(2026, 9, 30, 17, 0),
Project medicalResearchProject = new Project(); LocalDateTime.of(2026, 8, 15, 13, 45)
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.saveAllAndFlush(projects.values()); projectRepository.save(project1);
return projects; projectRepository.save(project2);
projectRepository.save(project3);
projectRepository.save(project4);
projectRepository.save(project5);
return List.of(
project1,
project2,
project3,
project4,
project5
);
} }
} }

View file

@ -5,7 +5,7 @@ import de.hmmh.pmt.IntegrationTest;
import de.hmmh.pmt.db.Project; import de.hmmh.pmt.db.Project;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.Map; import java.util.List;
import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
@ -25,7 +25,7 @@ public class GetAllTest extends IntegrationTest {
@Test @Test
void multipleProjects() throws Exception { void multipleProjects() throws Exception {
Map<String, Project> allProjects = createTestProjectData(); List<Project> allProjects = createTestProjectData();
mvc mvc
.perform(get(baseUri + "/project")) .perform(get(baseUri + "/project"))