package com.eactive.testmaster.loadtest.controller; import com.eactive.testmaster.loadtest.dto.LoadTestDTO; import com.eactive.testmaster.loadtest.service.LoadTestService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; 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; @RestController @Scope("session") public class LoadTestController { @Autowired private LoadTestService loadTestService; @PostMapping("/startLoadTest") public ResponseEntity startLoadTest(@RequestBody LoadTestDTO loadTestDTO) { loadTestService.startLoadTest(loadTestDTO); return ResponseEntity.ok("Load Test Started"); } //stop @PostMapping("/stopLoadTest") public ResponseEntity stopLoadTest(@RequestBody LoadTestDTO loadTestDTO) { loadTestService.stopLoadTest(loadTestDTO.getId()); return ResponseEntity.ok("Load Test Stopped"); } }