From fd4f5c9e27365f4424b01d62592f5843dd106b6d Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Mon, 16 Aug 2010 20:21:19 +0000 Subject: [PATCH] CSPACE-2479: CollectionObject service now returns authority references from objectProductionPerson and objectProductionOrganization fields. (This work will need to be revisited when those two fields become part of repeatable groups; test cases added in this check-in will help ensure we make the necessary changes at that time to continue to pull authrefs from those fields.) --- .../test/CollectionObjectAuthRefsTest.java | 40 +++++++++++++------ .../main/config/services/tenant-bindings.xml | 4 ++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java index 13db2d40b..a00afc0aa 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java @@ -110,6 +110,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { private String contentPersonRefName = null; private String contentInscriberRefName = null; private String descriptionInscriberRefName = null; + private String objectProductionPersonRefName = null; + private String objectProductionOrganizationRefName = null; private String assocEventOrganizationRefName = null; private String assocEventPersonRefName = null; private String assocOrganizationRefName = null; @@ -119,7 +121,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { private String fieldCollectorRefName = null; /** The number of authority references expected. */ - private final int NUM_AUTH_REFS_EXPECTED = 11; + private final int NUM_AUTH_REFS_EXPECTED = 13; /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() @@ -173,6 +175,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { contentPersonRefName, contentInscriberRefName, descriptionInscriberRefName, + objectProductionPersonRefName, + objectProductionOrganizationRefName, assocEventOrganizationRefName, assocEventPersonRefName, assocOrganizationRefName, @@ -280,6 +284,10 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { contentInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); personIdsCreated.add(csid); + csid = createPerson("Pacifico", "ProductionPerson", "pacificoProductionPerson"); + objectProductionPersonRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); + personIdsCreated.add(csid); + csid = createPerson("Dessie", "DescriptionInscriber", "dessieDescriptionInscriber"); descriptionInscriberRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); personIdsCreated.add(csid); @@ -366,6 +374,10 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { contentOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null); orgIdsCreated.add(csid); + csid = createOrganization("Production Org", "Production Org Town", "productionOrg"); + objectProductionOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null); + orgIdsCreated.add(csid); + csid = createOrganization("Associated Event Org", "Associated Event Org City", "associatedEventOrg"); assocEventOrganizationRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, csid, null); orgIdsCreated.add(csid); @@ -412,20 +424,10 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class); Assert.assertNotNull(collectionObject); - // Check a sample of one or more person authority ref fields - Assert.assertEquals(collectionObject.getInscriptionContentInscriber(), contentInscriberRefName); - Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName); - Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName); - Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName); - - // Check a sample of one or more organization authority ref fields - Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName); - Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName); - // Get all of the auth refs and check that the expected number is returned ClientResponse res2 = collectionObjectClient.getAuthorityRefs(knownResourceId); statusCode = res2.getStatus(); - + if(logger.isDebugEnabled()){ logger.debug(testName + ".getAuthorityRefs: status = " + statusCode); } @@ -443,6 +445,16 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED, "Did not find all expected authority references! " + "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound); + + // Check a sample of one or more person authority ref fields + Assert.assertEquals(collectionObject.getInscriptionContentInscriber(), contentInscriberRefName); + Assert.assertEquals(collectionObject.getAssocPersons().getAssocPerson().get(0), assocPersonRefName); + Assert.assertEquals(collectionObject.getOwners().getOwner().get(0), ownerRefName); + Assert.assertEquals(collectionObject.getFieldCollectionSources().getFieldCollectionSource().get(0), fieldCollectionSourceRefName); + + // Check a sample of one or more organization authority ref fields + Assert.assertEquals(collectionObject.getContentOrganizations().getContentOrganization().get(0), contentOrganizationRefName); + Assert.assertEquals(collectionObject.getAssocEventOrganizations().getAssocEventOrganization().get(0), assocEventOrganizationRefName); // Optionally output additional data about list members for debugging. boolean iterateThroughList = true; @@ -539,6 +551,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { String contentPerson, String contentInscriber, String descriptionInscriber, + String objectProductionPerson, + String objectProductionOrganization, String assocEventOrganization, String assocEventPerson, String assocOrganization, @@ -551,6 +565,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest { collectionObject.setObjectNumber(objNum); collectionObject.setInscriptionContentInscriber(contentInscriber); collectionObject.setInscriptionDescriptionInscriber(descriptionInscriber); + collectionObject.setObjectProductionPerson(objectProductionPerson); + collectionObject.setObjectProductionOrganization(objectProductionOrganization); ContentOrganizationList contentOrganizationList = new ContentOrganizationList(); List contentOrganizations = contentOrganizationList.getContentOrganization(); diff --git a/services/common/src/main/config/services/tenant-bindings.xml b/services/common/src/main/config/services/tenant-bindings.xml index f550f0fb0..dfe0b1eb3 100644 --- a/services/common/src/main/config/services/tenant-bindings.xml +++ b/services/common/src/main/config/services/tenant-bindings.xml @@ -67,6 +67,8 @@ authRefcontentPersons|contentPerson authRefinscriptionContentInscriber authRefinscriptionDescriptionInscriber + authRefobjectProductionPerson + authRefobjectProductionOrganization authRefassocEventOrganizations|assocEventOrganization authRefassocEventPersons|assocEventPerson authRefassocOrganizations|assocOrganization @@ -1140,6 +1142,8 @@ authRefcontentPersons|contentPerson authRefinscriptionContentInscriber authRefinscriptionDescriptionInscriber + authRefobjectProductionPerson + authRefobjectProductionOrganization authRefassocEventOrganizations|assocEventOrganization authRefassocEventPersons|assocEventPerson authRefassocOrganizations|assocOrganization -- 2.47.3