Skip to content

Conversation

@rma-kayla
Copy link
Contributor

Refactored and cleaned Entity Controller to address clean runner build fail PR #1507.

  • Fixed entity controller integration tests to incorporate unique data per test
  • Added test utility helpers for cleanup and unique entityJson test values
  • Cleaned up global variables to remove hard coded param values
  • Fixed teardown method to ensure all test entities cleaned up after testing.
  • Added check in Entity Controller to fix unused documented query param errors and check for required params

…PR1507)

- Fixed EntityControllerTestIT to incorporate unique data per test using test utility helpers.
- Removed hard coded static values
- Fixed teardown to ensure all test entities cleaned up after testsing.
- Added check in EntityController to fix unused documented query param errors
@rma-kayla
Copy link
Contributor Author

@rma-bryson and/or @adamkorynta this PR is ready for a review
@MikeNeilson this should fix the build fails from PR #1507


if (!officeId.equalsIgnoreCase(entity.getId().getOfficeId())) {
ctx.status(HttpServletResponse.SC_BAD_REQUEST);
ctx.result("Office ID in query parameter must match the Office ID in the request body.");
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we have "global" entities under the cwms office?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After discussion with Bryson, we decided the office query parameter is not needed in update method and will be validated in the body. I removed unnecessary office id checks in the update method.


if (!entityId.equalsIgnoreCase(entity.getId().getName())) {
ctx.status(HttpServletResponse.SC_NOT_FOUND);
ctx.result("Entity not found for the given entity-id.");
Copy link
Collaborator

@rma-bryson rma-bryson Dec 16, 2025

Choose a reason for hiding this comment

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

shouldn't this be a similar message and error response code to the mismatched office-id? something like:

""Entity ID in path parameter must match the Entity ID in the request body.""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated message to be more consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like the change Bryson asked for made it to github.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MikeNeilson, it is in next commit.

MikeNeilson
MikeNeilson previously approved these changes Dec 17, 2025
- Removed office-id query param and redundant checks
- Added missing entity-id validation test
- Added invalid office authorization test
- Improved variable naming
- Fixed failing .replace() logic
@rma-kayla
Copy link
Contributor Author

Refactored entity update controller and tests.

  • Removed office-id query param and redundant checks, cleaned up error message.
  • Added missing entity-id validation test and invalid office authorization test
  • Improved variable naming and fixed failing .replace() logic.

@rma-kayla rma-kayla requested a review from rma-bryson December 18, 2025 00:43
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the naming scheme you've chosen here. It's very explicit as to what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants