improve-performance-of-office-data-import #83

Merged
hsh-michaelhoennig merged 12 commits from improve-performance-of-office-data-import into master 2024-08-05 11:48:34 +02:00
3 changed files with 9 additions and 9 deletions
Showing only changes of commit 627ad68dfb - Show all commits

View File

@ -72,13 +72,13 @@ public class HsOfficeRelationController implements HsOfficeRelationsApi {
entityToSave.setType(HsOfficeRelationType.valueOf(body.getType())); entityToSave.setType(HsOfficeRelationType.valueOf(body.getType()));
entityToSave.setMark(body.getMark()); entityToSave.setMark(body.getMark());
entityToSave.setAnchor(holderRepo.findByUuid(body.getAnchorUuid()).orElseThrow( entityToSave.setAnchor(holderRepo.findByUuid(body.getAnchorUuid()).orElseThrow(
() -> new NoSuchElementException("cannot find anchorUuid " + body.getAnchorUuid()) () -> new NoSuchElementException("cannot find Person by anchorUuid: " + body.getAnchorUuid())
)); ));
entityToSave.setHolder(holderRepo.findByUuid(body.getHolderUuid()).orElseThrow( entityToSave.setHolder(holderRepo.findByUuid(body.getHolderUuid()).orElseThrow(
() -> new NoSuchElementException("cannot find holderUuid " + body.getHolderUuid()) () -> new NoSuchElementException("cannot find Person by holderUuid: " + body.getHolderUuid())
)); ));
entityToSave.setContact(contactBareRepo.findByUuid(body.getContactUuid()).orElseThrow( entityToSave.setContact(contactBareRepo.findByUuid(body.getContactUuid()).orElseThrow(
() -> new NoSuchElementException("cannot find contactUuid " + body.getContactUuid()) () -> new NoSuchElementException("cannot find Contact by contactUuid: " + body.getContactUuid())
)); ));
final var saved = relationRbacRepo.save(entityToSave); final var saved = relationRbacRepo.save(entityToSave);

View File

@ -124,7 +124,7 @@ class HsOfficePartnerControllerRestTest {
.andExpect(status().is4xxClientError()) .andExpect(status().is4xxClientError())
.andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusCode", is(400)))
.andExpect(jsonPath("statusPhrase", is("Bad Request"))) .andExpect(jsonPath("statusPhrase", is("Bad Request")))
.andExpect(jsonPath("message", startsWith("Cannot resolve HsOfficePersonEntity with uuid "))); .andExpect(jsonPath("message", startsWith("ERROR: [400] Cannot resolve HsOfficePersonEntity with uuid ")));
} }
@Test @Test
@ -161,7 +161,7 @@ class HsOfficePartnerControllerRestTest {
.andExpect(status().is4xxClientError()) .andExpect(status().is4xxClientError())
.andExpect(jsonPath("statusCode", is(400))) .andExpect(jsonPath("statusCode", is(400)))
.andExpect(jsonPath("statusPhrase", is("Bad Request"))) .andExpect(jsonPath("statusPhrase", is("Bad Request")))
.andExpect(jsonPath("message", startsWith("Cannot resolve HsOfficeContactBareEntity with uuid "))); .andExpect(jsonPath("message", startsWith("ERROR: [400] Cannot resolve HsOfficeContactBareEntity with uuid ")));
} }
} }

View File

@ -195,7 +195,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
.post("http://localhost/api/hs/office/relations") .post("http://localhost/api/hs/office/relations")
.then().log().all().assertThat() .then().log().all().assertThat()
.statusCode(404) .statusCode(404)
.body("message", is("cannot find anchorUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID)); .body("message", is("ERROR: [404] cannot find Person by anchorUuid: " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
// @formatter:on // @formatter:on
} }
@ -227,7 +227,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
.post("http://localhost/api/hs/office/relations") .post("http://localhost/api/hs/office/relations")
.then().log().all().assertThat() .then().log().all().assertThat()
.statusCode(404) .statusCode(404)
.body("message", is("cannot find holderUuid " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID)); .body("message", is("ERROR: [404] cannot find Person by holderUuid: " + GIVEN_NON_EXISTING_HOLDER_PERSON_UUID));
// @formatter:on // @formatter:on
} }
@ -250,7 +250,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
"holderUuid": "%s", "holderUuid": "%s",
"contactUuid": "%s" "contactUuid": "%s"
} }
""".formatted( """.formatted(
HsOfficeRelationTypeResource.DEBITOR, HsOfficeRelationTypeResource.DEBITOR,
givenAnchorPerson.getUuid(), givenAnchorPerson.getUuid(),
givenHolderPerson.getUuid(), givenHolderPerson.getUuid(),
@ -260,7 +260,7 @@ class HsOfficeRelationControllerAcceptanceTest extends ContextBasedTestWithClean
.post("http://localhost/api/hs/office/relations") .post("http://localhost/api/hs/office/relations")
.then().log().all().assertThat() .then().log().all().assertThat()
.statusCode(404) .statusCode(404)
.body("message", is("cannot find contactUuid 00000000-0000-0000-0000-000000000000")); .body("message", is("ERROR: [404] cannot find Contact by contactUuid: 00000000-0000-0000-0000-000000000000"));
// @formatter:on // @formatter:on
} }
} }