Fixed some roster tests
This commit is contained in:
@@ -17,6 +17,7 @@ public class ApplyForTaskController {
|
||||
this.applyForTaskUseCase = applyForTaskUseCase;
|
||||
}
|
||||
|
||||
// TODO fix return type
|
||||
/**
|
||||
* Checks if task is available for the requesting executor.
|
||||
* @return a task or null if no task found
|
||||
|
@@ -28,7 +28,7 @@ public class AddNewAssignmentToRosterServiceSystemTest {
|
||||
|
||||
String rosterItemId = "TEST-ID";
|
||||
String executorType = "TEST-TYPE";
|
||||
String executorURI = "TEST-URI";
|
||||
String executorURI = "http://localhost:6969";
|
||||
|
||||
ResponseEntity response = whenAddNewAssignmentToRoster(rosterItemId, executorType, executorURI);
|
||||
|
||||
|
@@ -37,12 +37,12 @@ public class ApplyForTaskControllerTest {
|
||||
void testApplyForTask() throws Exception{
|
||||
|
||||
String executorType = "TEST-TYPE";
|
||||
String executorURI = "TEST-URI";
|
||||
String executorURI = "http://localhost:6969";
|
||||
String taskId = "TEST-ID";
|
||||
|
||||
String jsonPayLoad = new JSONObject()
|
||||
.put("executorType", executorType )
|
||||
.put("executorUri",executorURI)
|
||||
.put("executorURI",executorURI)
|
||||
.toString();
|
||||
|
||||
RosterItem rosterItem = new RosterItem(taskId, executorType,
|
||||
@@ -60,7 +60,7 @@ public class ApplyForTaskControllerTest {
|
||||
mockMvc.perform(post("/task/apply/")
|
||||
.contentType("application/json")
|
||||
.content(jsonPayLoad))
|
||||
.andExpect(status().isCreated());
|
||||
.andExpect(status().is2xxSuccessful());
|
||||
|
||||
//TODO: No idea why this does not work yet
|
||||
then(applyForTaskUseCase).should()
|
||||
|
@@ -10,9 +10,11 @@ import org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataM
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureDataMongo
|
||||
@Import({RosterPersistenceAdapter.class, RosterMapper.class})
|
||||
public class RosterPersistenceAdapterTest {
|
||||
@@ -26,7 +28,7 @@ public class RosterPersistenceAdapterTest {
|
||||
@Test
|
||||
void addsNewRosterItem(){
|
||||
|
||||
String taskId = "TEST-ID";
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
String executorType = "TEST-TYPE";
|
||||
String executorURI = "TEST-URI";
|
||||
|
||||
@@ -35,6 +37,8 @@ public class RosterPersistenceAdapterTest {
|
||||
executorType,
|
||||
new ExecutorURI(executorURI)
|
||||
);
|
||||
|
||||
|
||||
adapterUnderTest.addRosterItem(testRosterItem);
|
||||
|
||||
MongoRosterDocument retrievedDoc = rosterRepository.findByTaskId(taskId);
|
||||
@@ -48,7 +52,7 @@ public class RosterPersistenceAdapterTest {
|
||||
@Test
|
||||
void retrievesRosterItem(){
|
||||
|
||||
String taskId = "TEST-ID";
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
String executorType = "TEST-TYPE";
|
||||
String executorURI = "TEST-URI";
|
||||
|
||||
@@ -59,6 +63,6 @@ public class RosterPersistenceAdapterTest {
|
||||
|
||||
assertThat(retrievedRosterItem.getTaskID()).isEqualTo(taskId);
|
||||
assertThat(retrievedRosterItem.getTaskType()).isEqualTo(executorType);
|
||||
assertThat(retrievedRosterItem.getExecutorURI()).isEqualTo(executorURI);
|
||||
assertThat(retrievedRosterItem.getExecutorURI().getValue().toString()).isEqualTo(executorURI);
|
||||
}
|
||||
}
|
||||
|
@@ -1,2 +1,2 @@
|
||||
spring.data.mongodb.uri=mongodb://127.0.0.1:27017
|
||||
spring.data.mongodb.database=tapas-tasks
|
||||
spring.data.mongodb.database=tapas-roster
|
||||
|
Reference in New Issue
Block a user