-
Notifications
You must be signed in to change notification settings - Fork 66
TMS migration #2175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
TMS migration #2175
Changes from all commits
a6144a5
00f8bac
6197f75
64ecbd6
6440a5e
f5e664e
373dd37
30a11ed
1349c39
ad0b7c6
05be3ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ hs_err_pid* | |
build/ | ||
.gradle/ | ||
out/ | ||
src/test/resources/db/migration/*.sql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import static com.epam.ta.reportportal.auth.permissions.Permissions.ADMIN_ONLY; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.ProductVersionRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TmsProductVersionRS; | ||
import com.epam.ta.reportportal.core.tms.service.ProductVersionService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@RequestMapping("/project/{projectId}/tms/productversion") | ||
@Tag(name = "Product Version", description = "Product Version API collection") | ||
@RequiredArgsConstructor | ||
public class ProductVersionController { | ||
|
||
private final ProductVersionService productVersionService; | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@GetMapping("/{productVersionId}") | ||
TmsProductVersionRS getById(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId) { | ||
return productVersionService.getById(projectId, productVersionId); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PostMapping | ||
TmsProductVersionRS createVersion(@PathVariable("projectId") final long projectId, | ||
@RequestBody final ProductVersionRQ inputDto) { | ||
return productVersionService.create(projectId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PutMapping("/{productVersionId}") | ||
TmsProductVersionRS updateVersion(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId, | ||
@RequestBody final ProductVersionRQ inputDto) { | ||
return productVersionService.update(projectId, productVersionId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@DeleteMapping("/{productVersionId}") | ||
void deleteVersion(@PathVariable("projectId") final long projectId, | ||
@PathVariable("productVersionId") final long productVersionId) { | ||
productVersionService.delete(projectId, productVersionId); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import static com.epam.ta.reportportal.auth.permissions.Permissions.ADMIN_ONLY; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.TmsTestCaseRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TmsTestCaseRS; | ||
import com.epam.ta.reportportal.core.tms.service.TmsTestCaseService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
import java.util.List; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
@RestController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@RequestMapping("/project/{projectId}/tms/test-case") | ||
@Tag(name = "Test Case", description = "Test Case API collection") | ||
@RequiredArgsConstructor | ||
public class TestCaseController { | ||
|
||
private final TmsTestCaseService tmsTestCaseService; | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@GetMapping("/{testCaseId}") | ||
public TmsTestCaseRS getTestCaseById(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId) { | ||
return tmsTestCaseService.getById(projectId, testCaseId); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@GetMapping | ||
public List<TmsTestCaseRS> getTestCaseByProjectId(@PathVariable("projectId") final long projectId) { | ||
return tmsTestCaseService.getTestCaseByProjectId(projectId); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PostMapping | ||
public TmsTestCaseRS createTestCase(@PathVariable("projectId") final long projectId, | ||
@RequestBody @Valid final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.create(projectId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PutMapping("/{testCaseId}") | ||
public TmsTestCaseRS updateTestCase(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId, | ||
@RequestBody final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.update(projectId, testCaseId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PatchMapping("/{testCaseId}") | ||
public TmsTestCaseRS patchTestCase(@PathVariable("projectId") final long projectId, | ||
@PathVariable("testCaseId") final long testCaseId, | ||
@RequestBody final TmsTestCaseRQ inputDto) { | ||
return tmsTestCaseService.patch(projectId, testCaseId, inputDto); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import static com.epam.ta.reportportal.auth.permissions.Permissions.ADMIN_ONLY; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.TestFolderRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TestFolderRS; | ||
import com.epam.ta.reportportal.core.tms.service.TestFolderService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
@RestController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@RequestMapping("/project/{projectId}/tms/folder") | ||
@Tag(name = "Test Folder", description = "Test Folder API collection") | ||
@RequiredArgsConstructor | ||
public class TestFolderController { | ||
|
||
private final TestFolderService testFolderService; | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PostMapping | ||
@Operation(summary = "Create Test Folder") | ||
TestFolderRS createTestFolder(@PathVariable("projectId") final long projectId, | ||
@RequestBody final TestFolderRQ inputDto) { | ||
return testFolderService.createFolder(projectId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@PutMapping("/{folderId}") | ||
@Operation(summary = "Update Test Folder") | ||
TestFolderRS updateTestFolder(@PathVariable("projectId") final long projectId, | ||
@PathVariable("folderId") final long folderId, | ||
@RequestBody final TestFolderRQ inputDto) { | ||
return testFolderService.updateFolder(projectId, folderId, inputDto); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@GetMapping("/{folderId}") | ||
@Operation(summary = "Get Test Folder by ID") | ||
TestFolderRS getTestFolderById(@PathVariable("projectId") final long projectId, | ||
@PathVariable("folderId") final long folderId) { | ||
return testFolderService.getFolderById(folderId); | ||
} | ||
|
||
@PreAuthorize(ADMIN_ONLY) | ||
@GetMapping("/") | ||
@Operation(summary = "Get Test Folders by project ID") | ||
List<TestFolderRS> getTestFolderByProjectId(@PathVariable("projectId") final long projectId) { | ||
return testFolderService.getFolderByProjectID(projectId); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package com.epam.ta.reportportal.core.tms.controller; | ||
|
||
import com.epam.ta.reportportal.core.tms.dto.TmsDatasetRQ; | ||
import com.epam.ta.reportportal.core.tms.dto.TmsDatasetRS; | ||
import com.epam.ta.reportportal.core.tms.service.TmsDatasetService; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RestController | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@RequestMapping("/project/{projectId}/tms/dataset") | ||
@RequiredArgsConstructor | ||
public class TmsDatasetController { | ||
|
||
private final TmsDatasetService tmsDatasetService; | ||
|
||
/** | ||
* Create a new Dataset. | ||
* | ||
* @param projectId The ID of the project. | ||
* @param datasetRQ Dataset creation request object. | ||
* @return Created Dataset information. | ||
*/ | ||
@PostMapping | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public TmsDatasetRS create(@PathVariable("projectId") Long projectId, | ||
@RequestBody TmsDatasetRQ datasetRQ) { | ||
return tmsDatasetService.create(projectId, datasetRQ); | ||
} | ||
|
||
/** | ||
* Extract Dataset from a file | ||
* | ||
* @param projectId The ID of the project | ||
* @param file file containing dataset data | ||
* @return Response with created dataset details | ||
*/ | ||
@PostMapping(path = "/upload", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE}) | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public List<TmsDatasetRS> uploadFromFile(@PathVariable("projectId") Long projectId, | ||
@RequestPart MultipartFile file) { | ||
return tmsDatasetService.uploadFromFile(projectId, file); | ||
} | ||
|
||
/** | ||
* Retrieve a list of Datasets for the specified project. | ||
* | ||
* @param projectId The ID of the project. | ||
* @return List of Datasets. | ||
*/ | ||
@GetMapping | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public List<TmsDatasetRS> getByProjectId(@PathVariable("projectId") Long projectId) { | ||
return tmsDatasetService.getByProjectId(projectId); | ||
} | ||
|
||
/** | ||
* Retrieve details of a specific Dataset. | ||
* | ||
* @param projectId The ID of the project. | ||
* @param datasetId The ID of the Dataset. | ||
* @return Dataset details. | ||
*/ | ||
@GetMapping("/{datasetId}") | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public TmsDatasetRS getById(@PathVariable("projectId") Long projectId, | ||
@PathVariable("datasetId") Long datasetId) { | ||
return tmsDatasetService.getById(projectId, datasetId); | ||
} | ||
|
||
/** | ||
* Fully update a Dataset. | ||
* | ||
* @param projectId The ID of the project. | ||
* @param datasetId The ID of the Dataset. | ||
* @param datasetRQ Dataset update request object. | ||
* @return Updated Dataset details. | ||
*/ | ||
@PutMapping("/{datasetId}") | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public TmsDatasetRS update(@PathVariable("projectId") Long projectId, | ||
@PathVariable("datasetId") Long datasetId, @RequestBody TmsDatasetRQ datasetRQ) { | ||
return tmsDatasetService.update(projectId, datasetId, datasetRQ); | ||
} | ||
|
||
/** | ||
* Patch a Dataset. | ||
* | ||
* @param projectId The ID of the project. | ||
* @param datasetId The ID of the Dataset. | ||
* @param tmsDatasetUpdateRQ Patch dataset request. | ||
* @return Updated Dataset details. | ||
*/ | ||
@PatchMapping("/{datasetId}") | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public TmsDatasetRS patch(@PathVariable("projectId") Long projectId, | ||
@PathVariable("datasetId") Long datasetId, @RequestBody TmsDatasetRQ tmsDatasetUpdateRQ) { | ||
return tmsDatasetService.patch(projectId, datasetId, tmsDatasetUpdateRQ); | ||
} | ||
|
||
/** | ||
* Delete a Dataset. | ||
* | ||
* @param projectId The ID of the project. | ||
* @param datasetId The ID of the Dataset. | ||
*/ | ||
@DeleteMapping("/{datasetId}") | ||
// @PreAuthorize(ADMIN_ONLY) | ||
public void delete(@PathVariable("projectId") Long projectId, | ||
@PathVariable("datasetId") Long datasetId) { | ||
tmsDatasetService.delete(projectId, datasetId); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the '.' form of import should be avoided - org.springframework.web.bind.annotation..