From 43346a4f7f4816ac54e1ecd6afa7a756c51460ca Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Mon, 12 Apr 2021 08:00:05 -0700 Subject: [PATCH] DRYD-961: Added code to prevent more than one contact per authority term from being created. Services will now return 409 if a client attempts to create a second contact. --- .../src/main/resources/log4j2-surefire.xml | 34 +++++++++ .../xmlreplay/authority/authority.xml | 73 ++++++++++++++++++- .../authority/contactSubresource.xml | 11 +++ .../authority/personitemWithContact1.xml | 21 ++++++ .../authority/personitemWithContact2.xml | 29 ++++++++ .../authority/res/contactItems.res.xml | 9 +++ .../res/personItemsWithContact.res.xml | 7 ++ .../test-data/xmlreplay/xml-replay-master.xml | 1 + .../AuthorityResourceWithContacts.java | 17 +++-- .../test/PersonAuthorityServiceTest.java | 20 +---- 10 files changed, 199 insertions(+), 23 deletions(-) create mode 100644 services/IntegrationTests/src/main/resources/log4j2-surefire.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/contactSubresource.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitemWithContact1.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/personitemWithContact2.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/contactItems.res.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/res/personItemsWithContact.res.xml diff --git a/services/IntegrationTests/src/main/resources/log4j2-surefire.xml b/services/IntegrationTests/src/main/resources/log4j2-surefire.xml new file mode 100644 index 000000000..bf74484d1 --- /dev/null +++ b/services/IntegrationTests/src/main/resources/log4j2-surefire.xml @@ -0,0 +1,34 @@ + + + + + %d %-5p [%t] [%c:%L] %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml index 42748c70f..a49b568cf 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/authority/authority.xml @@ -1,11 +1,80 @@ - + YWRtaW5AY29yZS5jb2xsZWN0aW9uc3BhY2Uub3JnOkFkbWluaXN0cmF0b3I= - + + + + 201 + POST + /cspace-services/personauthorities + authority/personauthority.xml + + + + word_1111 + word_2222 + word_3333 + word_4444 + word_555 + + stem_111 + stem_222 + stem_333 + + display_name2 + short_id_value2 + + + + 201 + POST + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items + authority/personitemWithContact1.xml + + ${createPersonAuthority1.word1} ${createPersonAuthority1.word2} + ${createPersonAuthority1.word1}item1 + A bio note for this Person. + ${createPersonAuthority1.word1}@${createPersonAuthority1.word2}.com + + + + 200 + GET + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items/${personitemWithContact1.CSID}/contacts + + + authority/res/contactItems.res.xml + + ${createPersonAuthority1.word1}@${createPersonAuthority1.word2}.com + + + + + 400 + POST + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items + authority/personitemWithContact2.xml + + ${createPersonAuthority1.word2} ${createPersonAuthority1.word2} + ${createPersonAuthority2.word2}item2 + A bio note for this Person with two contacts. + + + + 409 + POST + /cspace-services/personauthorities/${createPersonAuthority1.CSID}/items/${personitemWithContact1.CSID}/contacts + authority/contactSubresource.xml + + ${createPersonAuthority1.word1}@${createPersonAuthority1.word2}.net + + + +