tests #43

Merged
sebastian merged 41 commits from tests into master 2023-11-11 11:20:50 +01:00
2 changed files with 38 additions and 30 deletions
Showing only changes of commit 94b469238d - Show all commits

View File

@ -4,10 +4,8 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Resolve Merge-Conflict"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Consider increased number of tasks">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/core/tasks/TaskServiceTest.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -87,6 +85,21 @@
</key> </key>
</component> </component>
<component name="RunManager" selected="JUnit.TaskServiceTest.deleteTask"> <component name="RunManager" selected="JUnit.TaskServiceTest.deleteTask">
<configuration name="TaskRepositoryTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="core.tasks.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="core.tasks" />
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskRepositoryTest" />
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> <configuration name="TaskServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" /> <module name="demo" />
<extension name="coverage"> <extension name="coverage">
@ -134,22 +147,6 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration name="TaskServiceTest.editTask" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="core.tasks.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="core.tasks" />
<option name="MAIN_CLASS_NAME" value="core.tasks.TaskServiceTest" />
<option name="METHOD_NAME" value="editTask" />
<option name="TEST_OBJECT" value="method" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TaskgroupServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true"> <configuration name="TaskgroupServiceTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="demo" /> <module name="demo" />
<extension name="coverage"> <extension name="coverage">
@ -176,9 +173,9 @@
<list> <list>
<item itemvalue="JUnit.TaskServiceTest.deleteTask" /> <item itemvalue="JUnit.TaskServiceTest.deleteTask" />
<item itemvalue="JUnit.TaskServiceTest" /> <item itemvalue="JUnit.TaskServiceTest" />
<item itemvalue="JUnit.TaskServiceTest.createTask" /> <item itemvalue="JUnit.TaskRepositoryTest" />
<item itemvalue="JUnit.TaskServiceTest.editTask" />
<item itemvalue="JUnit.TaskgroupServiceTest" /> <item itemvalue="JUnit.TaskgroupServiceTest" />
<item itemvalue="JUnit.TaskServiceTest.createTask" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
@ -458,15 +455,29 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1699693472182</updated> <updated>1699693472182</updated>
</task> </task>
<option name="localTasksCounter" value="31" /> <task id="LOCAL-00031" summary="Deleting Task test">
<option name="closed" value="true" />
<created>1699694400508</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1699694400508</updated>
</task>
<task id="LOCAL-00032" summary="Consider increased number of tasks">
<option name="closed" value="true" />
<created>1699694552466</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1699694552466</updated>
</task>
<option name="localTasksCounter" value="33" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Delete Schedules" />
<MESSAGE value="Deliver Schedule Path Info when fetching Schedules" />
<MESSAGE value="Removed unused TaskgroupShortInfo.java" /> <MESSAGE value="Removed unused TaskgroupShortInfo.java" />
<MESSAGE value="Fix Foreign Key Constraint Fail when deleting Taskgroups" /> <MESSAGE value="Fix Foreign Key Constraint Fail when deleting Taskgroups" />
<MESSAGE value="Stop and Finish TaskSchedules" /> <MESSAGE value="Stop and Finish TaskSchedules" />
@ -490,7 +501,9 @@
<MESSAGE value="Use @Sql instead of persit()" /> <MESSAGE value="Use @Sql instead of persit()" />
<MESSAGE value="Make the Test Transactional" /> <MESSAGE value="Make the Test Transactional" />
<MESSAGE value="Resolve Merge-Conflict" /> <MESSAGE value="Resolve Merge-Conflict" />
<option name="LAST_COMMIT_MESSAGE" value="Resolve Merge-Conflict" /> <MESSAGE value="Deleting Task test" />
<MESSAGE value="Consider increased number of tasks" />
<option name="LAST_COMMIT_MESSAGE" value="Consider increased number of tasks" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@ -24,8 +24,6 @@ public class TaskService {
private final TaskRepository taskRepository; private final TaskRepository taskRepository;
private final TaskScheduleService taskScheduleService; private final TaskScheduleService taskScheduleService;
private final TaskgroupRepository taskgroupRepository; private final TaskgroupRepository taskgroupRepository;
@PersistenceContext
private EntityManager entityManager;
public TaskService(@Autowired TaskRepository taskRepository, public TaskService(@Autowired TaskRepository taskRepository,
@ -101,9 +99,6 @@ public class TaskService {
public void deleteTask(Task task) { public void deleteTask(Task task) {
taskScheduleService.deleteScheduleByTask(task); taskScheduleService.deleteScheduleByTask(task);
taskRepository.deleteByTaskID(task.getTaskID()); taskRepository.deleteByTaskID(task.getTaskID());
entityManager.flush();
entityManager.detach(task);
} }
public void clearTasks(Taskgroup taskgroup) { public void clearTasks(Taskgroup taskgroup) {