32 lines
1.1 KiB
Java
32 lines
1.1 KiB
Java
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<String> startLoadTest(@RequestBody LoadTestDTO loadTestDTO) {
|
|
loadTestService.startLoadTest(loadTestDTO);
|
|
return ResponseEntity.ok("Load Test Started");
|
|
}
|
|
|
|
//stop
|
|
@PostMapping("/stopLoadTest")
|
|
public ResponseEntity<String> stopLoadTest(@RequestBody LoadTestDTO loadTestDTO) {
|
|
loadTestService.stopLoadTest(loadTestDTO.getId());
|
|
return ResponseEntity.ok("Load Test Stopped");
|
|
}
|
|
}
|