Skip to content
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

Fixed issue #886 build errors #920

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import static cwms.cda.api.Controllers.*;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.*;

@Tag("integration")
class LocationGroupControllerTestIT extends DataApiTestIT {
Expand Down Expand Up @@ -656,7 +657,7 @@ void test_CWMS_permissions() throws Exception {
.statusCode(is(HttpServletResponse.SC_OK));

// get the location group and assert that changes were made
given()
ExtractableResponse<Response> otherResponse = given()
.log().ifValidationFails(LogDetail.ALL,true)
.accept(Formats.JSON)
.contentType(Formats.JSON)
Expand All @@ -670,12 +671,22 @@ void test_CWMS_permissions() throws Exception {
.log().ifValidationFails(LogDetail.ALL,true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_OK))
.body("office-id", equalTo(group.getOfficeId()))
.body("id", equalTo(group.getId()))
.body("description", equalTo(newLocGroup.getDescription()))
.body("assigned-locations[0].location-id", equalTo(locationId))
.body("assigned-locations[0].alias-id", nullValue())
.body("assigned-locations[0].ref-location-id", nullValue());
.extract();

assertEquals(otherResponse.body().jsonPath().getString("office-id"), group.getOfficeId());
assertEquals(otherResponse.body().jsonPath().getString("id"), group.getId());
assertEquals(otherResponse.body().jsonPath().getString("description"), newLocGroup.getDescription());
List<AssignedLocation> assignedLocations = otherResponse.body().jsonPath().getList("assigned-locations", AssignedLocation.class);
boolean found = false;
for (AssignedLocation assignedLocation : assignedLocations) {
if (assignedLocation.getLocationId().equals(locationId)) {
assertEquals(assignedLocation.getLocationId(), locationId);
assertNull(assignedLocation.getAliasId());
assertNull(assignedLocation.getRefLocationId());
found = true;
}
}
assertTrue(found);

// patch the location group owned by CWMS office
given()
Expand Down Expand Up @@ -764,12 +775,12 @@ void test_CWMS_permissions_with_replacement() throws Exception {
.redirects().max(3)
.patch("/location/group/" + group.getId())
.then()
.assertThat()
.log().ifValidationFails(LogDetail.ALL,true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_OK));

// get the location group and assert that changes were made
given()
ExtractableResponse<Response> otherResponse = given()
.log().ifValidationFails(LogDetail.ALL,true)
.accept(Formats.JSON)
.contentType(Formats.JSON)
Expand All @@ -780,15 +791,25 @@ void test_CWMS_permissions_with_replacement() throws Exception {
.redirects().max(3)
.get("/location/group/" + group.getId())
.then()
.assertThat()
.log().ifValidationFails(LogDetail.ALL,true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_OK))
.body("office-id", equalTo(group.getOfficeId()))
.body("id", equalTo(group.getId()))
.body("description", equalTo(newLocGroup.getDescription()))
.body("assigned-locations[0].location-id", equalTo(locationId))
.body("assigned-locations[0].alias-id", nullValue())
.body("assigned-locations[0].ref-location-id", nullValue());
.extract();

assertEquals(otherResponse.body().jsonPath().getString("office-id"), group.getOfficeId());
assertEquals(otherResponse.body().jsonPath().getString("id"), group.getId());
assertEquals(otherResponse.body().jsonPath().getString("description"), newLocGroup.getDescription());
List<AssignedLocation> assignedLocations = otherResponse.body().jsonPath().getList("assigned-locations", AssignedLocation.class);
boolean found = false;
for (AssignedLocation assignedLocation : assignedLocations) {
if (assignedLocation.getLocationId().equals(locationId)) {
assertEquals(assignedLocation.getLocationId(), locationId);
assertNull(assignedLocation.getAliasId());
assertNull(assignedLocation.getRefLocationId());
found = true;
}
}
assertTrue(found);

// patch the location group owned by CWMS office
given()
Expand Down
Loading