Added TODOs
This commit is contained in:
parent
459383b733
commit
5d9865b26d
|
@ -56,6 +56,7 @@ public class ApplyForTaskControllerTest {
|
||||||
Mockito.when(applyForTaskUseCase.applyForTask(applyForTaskCommand))
|
Mockito.when(applyForTaskUseCase.applyForTask(applyForTaskCommand))
|
||||||
.thenReturn(taskStub);
|
.thenReturn(taskStub);
|
||||||
|
|
||||||
|
// TODO Add slash at the front
|
||||||
mockMvc.perform(post("tasks/apply/")
|
mockMvc.perform(post("tasks/apply/")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.content(jsonPayLoad))
|
.content(jsonPayLoad))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ch.unisg.roster.roster.application.service;
|
package ch.unisg.roster.roster.application.service;
|
||||||
|
|
||||||
|
import ch.unisg.common.valueobject.ExecutorURI;
|
||||||
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
|
import ch.unisg.roster.roster.application.port.in.AddRosterItemPort;
|
||||||
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
|
import ch.unisg.roster.roster.application.port.in.ApplyForTaskCommand;
|
||||||
import ch.unisg.roster.roster.application.port.in.DeleteRosterItem;
|
import ch.unisg.roster.roster.application.port.in.DeleteRosterItem;
|
||||||
|
@ -12,6 +13,7 @@ import ch.unisg.roster.roster.domain.RosterItem;
|
||||||
import ch.unisg.roster.roster.domain.Task;
|
import ch.unisg.roster.roster.domain.Task;
|
||||||
import ch.unisg.roster.roster.domain.event.NewTaskEvent;
|
import ch.unisg.roster.roster.domain.event.NewTaskEvent;
|
||||||
import ch.unisg.roster.roster.domain.event.TaskAssignedEvent;
|
import ch.unisg.roster.roster.domain.event.TaskAssignedEvent;
|
||||||
|
import ch.unisg.roster.roster.domain.valueobject.ExecutorType;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ public class AddNewAssignmentToRosterServiceTest {
|
||||||
|
|
||||||
Task newTask = givenATaskWithIdAndType("test-id", "test-type", "test-input");
|
Task newTask = givenATaskWithIdAndType("test-id", "test-type", "test-input");
|
||||||
RosterItem newRosterItem = givenARosterItemWithIdAndTypeAndExecutorUri("test-id", "test-type", "test-uri");
|
RosterItem newRosterItem = givenARosterItemWithIdAndTypeAndExecutorUri("test-id", "test-type", "test-uri");
|
||||||
|
// TODO Add task to queue
|
||||||
|
|
||||||
ApplyForTaskCommand applyForTaskCommand = new ApplyForTaskCommand(newTask.getTaskType(), newRosterItem.getExecutorURI());
|
ApplyForTaskCommand applyForTaskCommand = new ApplyForTaskCommand(newTask.getTaskType(), newRosterItem.getExecutorURI());
|
||||||
|
|
||||||
|
@ -57,14 +59,14 @@ public class AddNewAssignmentToRosterServiceTest {
|
||||||
RosterItem rosterItem = Mockito.mock(RosterItem.class);
|
RosterItem rosterItem = Mockito.mock(RosterItem.class);
|
||||||
given(rosterItem.getTaskID()).willReturn(taskId);
|
given(rosterItem.getTaskID()).willReturn(taskId);
|
||||||
given(rosterItem.getTaskType()).willReturn(taskType);
|
given(rosterItem.getTaskType()).willReturn(taskType);
|
||||||
given(rosterItem.getExecutorURI().getValue()).willReturn(URI.create(executorURI));
|
given(rosterItem.getExecutorURI()).willReturn(new ExecutorURI(executorURI));
|
||||||
return rosterItem;
|
return rosterItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task givenATaskWithIdAndType(String taskId, String taskType, String inputData) {
|
private Task givenATaskWithIdAndType(String taskId, String taskType, String inputData) {
|
||||||
Task task = Mockito.mock(Task.class);
|
Task task = Mockito.mock(Task.class);
|
||||||
given(task.getTaskID()).willReturn(taskId);
|
given(task.getTaskID()).willReturn(taskId);
|
||||||
given(task.getTaskType().getValue()).willReturn(taskType);
|
given(task.getTaskType()).willReturn(new ExecutorType(taskType));
|
||||||
given(task.getInputData()).willReturn(inputData);
|
given(task.getInputData()).willReturn(inputData);
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,18 @@ public class RosterTest {
|
||||||
Roster roster = Roster.getInstance();
|
Roster roster = Roster.getInstance();
|
||||||
Collection<RosterItem> rosterMap = roster.getRosterMap();
|
Collection<RosterItem> rosterMap = roster.getRosterMap();
|
||||||
rosterMap.clear();
|
rosterMap.clear();
|
||||||
|
// TODO change test-type to upper case
|
||||||
roster.addTaskToQueue(new Task("test-id", "test-type"));
|
roster.addTaskToQueue(new Task("test-id", "test-type"));
|
||||||
Task task = roster.assignTaskToExecutor(new ExecutorType("test-type"), new ExecutorURI("Test-URI"));
|
Task task = roster.assignTaskToExecutor(new ExecutorType("test-type"), new ExecutorURI("Test-URI"));
|
||||||
|
|
||||||
|
|
||||||
assertThat(rosterMap.size()).isEqualTo(1);
|
assertThat(rosterMap.size()).isEqualTo(1);
|
||||||
assertThat(rosterMap.iterator().next().getTaskID()).isEqualTo("test-id");
|
assertThat(rosterMap.iterator().next().getTaskID()).isEqualTo("test-id");
|
||||||
assertThat(rosterMap.iterator().next().getTaskType()).isEqualTo("test-type");
|
assertThat(rosterMap.iterator().next().getTaskType()).isEqualTo("test-type");
|
||||||
|
// TODO test uri
|
||||||
|
|
||||||
|
// TODO test id and type of Task task
|
||||||
|
|
||||||
|
// TODO test that the task was removed from the Queue similar to below
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -37,5 +42,6 @@ public class RosterTest {
|
||||||
boolean test = roster.deleteTask("test-id", new ExecutorType("test-type"));
|
boolean test = roster.deleteTask("test-id", new ExecutorType("test-type"));
|
||||||
|
|
||||||
assertThat(test).isEqualTo(true);
|
assertThat(test).isEqualTo(true);
|
||||||
|
// TODO check that the queue has size 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user