From: Aron Roberts Date: Fri, 4 May 2012 03:28:19 +0000 (-0700) Subject: CSPACE-4685,CSPACE-3718,CSPACE-5155: Update Organization AuthRefsTest to reflect... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=cfed9cdcd16c544d042a7cc02423eb37d69968bb;p=tmp%2Fjakarta-migration.git CSPACE-4685,CSPACE-3718,CSPACE-5155: Update Organization AuthRefsTest to reflect removal of subBody repeatable scalar field from Organization. OrganizationValidatorHandler now reflects repeatable term info group, and is based on ValidationHandlerImpl. --- diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java index 903013576..2125087e2 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java @@ -179,9 +179,6 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest subBodyOrgMap = new HashMap(); - String shortId = createIdentifier(); - subBodyOrgMap.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortId ); - subBodyOrgMap.put(OrganizationJAXBSchema.SHORT_NAME, - subBodyName + "-" + shortId); - subBodyOrgMap.put(OrganizationJAXBSchema.LONG_NAME, subBodyName + " Long Name"); - subBodyOrgMap.put(OrganizationJAXBSchema.FOUNDING_PLACE, subBodyName + " Founding Place"); - PoxPayloadOut multipart = - OrgAuthorityClientUtils.createOrganizationInstance( - knownResourceRefName, subBodyOrgMap, orgAuthClient.getItemCommonPartName()); - - String result = null; - ClientResponse res = orgAuthClient.createItem(knownResourceId, multipart); - try { - int statusCode = res.getStatus(); - Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), - invalidStatusCodeMessage(testRequestType, statusCode)); - Assert.assertEquals(statusCode, STATUS_CREATED); - result = extractId(res); - } finally { - res.releaseConnection(); - } - - return result; - } - // Success outcomes /** * Read and check auth refs. @@ -372,8 +329,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest termGroups = termGroupList.getOrgTermGroup(); + if ((termGroups == null) || (termGroups.size() == 0)) { + return false; + } + return true; + } - if (invalid) { - logger.error(msg); - throw new InvalidDocumentException(msg); + private boolean allTermsContainNameOrDisplayName(OrganizationsCommon person) { + OrgTermGroupList termGroupList = person.getOrgTermGroupList(); + List termGroups = termGroupList.getOrgTermGroup(); + for (OrgTermGroup termGroup : termGroups) { + if (Tools.isBlank(termGroup.getTermName()) || Tools.isBlank(termGroup.getTermDisplayName())) { + return false; } - } catch (InvalidDocumentException ide) { - throw ide; - } catch (Exception e) { - throw new InvalidDocumentException(e); } + return true; } }