Skip to content

Conversation

@Nefarious46
Copy link
Contributor

  • CaptureFile and CaptureRelp controllers separated and refactored to new design
  • Delete endpoints use void
  • No postfixes on endpoints
  • Some tests still rely on older version which has not been refactored in this branch.
  • Capture Controller tests were separated and relevant data for Capture testing is now inserted before unit tests

Pull request #155 has more in-detail comments about changes.

@Nefarious46 Nefarious46 requested a review from kortemik May 14, 2025 09:27
@Nefarious46 Nefarious46 self-assigned this May 14, 2025
@Nefarious46 Nefarious46 added the enhancement New feature or request label May 14, 2025
content = @Content),
@ApiResponse(responseCode = "500", description = "Internal server error, contact admin", content = @Content)
})
public ResponseEntity<?> getRelp(@PathVariable("id") int id, @RequestParam(required = false) Integer version) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why suffix Relp? is get not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was accidentally left behind. Corrected.

content = {@Content(mediaType = "application/json",
schema = @Schema(implementation = CaptureRelp.class))}),
})
public List<CaptureRelp> getAllRelp(@RequestParam(required = false) Integer version) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why suffix Relp? is get not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as get endpoint

*/
USE cfe_18;
DELIMITER //
CREATE OR REPLACE PROCEDURE select_all_cfe_captures(tx_id INT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create an issue about renaming cfe -> file on the sql and mapper resultsets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@ExtendWith(MigrateDatabaseExtension.class)
public class CaptureControllerTest extends TestSpringBootInformation {
class CaptureFileControllerTest extends TestSpringBootInformation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public final please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Order(5)
public void testgetAllCaptures() throws Exception {
@Order(3)
public void testgetAllCfeCaptures() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File, not Cfe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

// Entity response string
String response2 = EntityUtils.toString(entity2);

// Parsin respponse as JSONObject
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

request1.setHeader("Authorization", "Bearer " + token);

// Get the response from endpoint
HttpClientBuilder.create().build().execute(request1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response assertion missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asserted

stmnt.execute();
});
Assertions.assertEquals("42000", state.getSQLState());
Assertions.assertEquals("45000", state.getSQLState());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why expected sqls state code changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously had 42000 in the custom error handling. That was wrong since 42000 is reserved for MariaDB own specific errors.

For customized errors, the recommended SQLSTATE is '45000'.
Source : https://mariadb.com/kb/en/signal/

@kortemik kortemik merged commit 992fc6a into teragrep:main May 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants