Implemented the following points:

- Roster/Auctionhouse send initial getExecutors request
- Remove executor (made DELETE endpoint in executor pool)
This commit is contained in:
reynisson
2021-12-16 20:39:14 +01:00
parent 6c17b20c55
commit cab63d6b76
19 changed files with 239 additions and 31 deletions

View File

@@ -27,7 +27,7 @@ public class AddNewExecutorToExecutorPoolWebController {
this.addNewExecutorToExecutorPoolUseCase = addNewExecutorToExecutorPoolUseCase;
}
@PostMapping(path = "/executor-pool/AddExecutor", consumes = {ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE})
@PostMapping(path = "/executor-pool/executors", consumes = {ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE})
public ResponseEntity<String> addNewExecutorToExecutorPool(@RequestBody ExecutorJsonRepresentation payload){
try {
AddNewExecutorToExecutorPoolCommand command = new AddNewExecutorToExecutorPoolCommand(

View File

@@ -19,7 +19,7 @@ public class GetAllExecutorsInExecutorPoolWebController {
this.getAllExecutorsInExecutorPoolUseCase = getAllExecutorsInExecutorPoolUseCase;
}
@GetMapping(path = "executor-pool/GetAllExecutorsinExecutorPool")
@GetMapping(path = "executor-pool/GetAllExecutorsInExecutorPool")
public ResponseEntity<String> getAllExecutorsInExecutorPool(){
List<ExecutorClass> executorClassList = getAllExecutorsInExecutorPoolUseCase.getAllExecutorsInExecutorPool();

View File

@@ -7,9 +7,7 @@ import ch.unisg.executorpool.domain.ExecutorClass;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.net.URI;
@@ -23,10 +21,10 @@ public class RemoveExecutorFromExecutorPoolWebController {
this.removeExecutorFromExecutorPoolUseCase = removeExecutorFromExecutorPoolUseCase;
}
@PostMapping(path = "/executor-pool/RemoveExecutor", consumes = {ExecutorJsonRepresentation.EXECUTOR_MEDIA_TYPE})
public ResponseEntity<String> removeExecutorFromExecutorPool(@RequestBody ExecutorJsonRepresentation executorJsonRepresentation){
@DeleteMapping(path = "/executor-pool/executors/{executorUri}")
public ResponseEntity<String> removeExecutorFromExecutorPool(@PathVariable("executorUri") String executorUri){
RemoveExecutorFromExecutorPoolCommand command = new RemoveExecutorFromExecutorPoolCommand(
new ExecutorClass.ExecutorUri(URI.create(executorJsonRepresentation.getExecutorUri()))
new ExecutorClass.ExecutorUri(URI.create(executorUri))
);
Optional<ExecutorClass> removedExecutor = removeExecutorFromExecutorPoolUseCase.removeExecutorFromExecutorPool(command);