]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-2586: Retrieving referencing objects now works for repeatable, single scalar...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 6 Aug 2010 00:30:15 +0000 (00:30 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 6 Aug 2010 00:30:15 +0000 (00:30 +0000)
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java

index b383298b3fcd1902da7ad68b50636f7e615da458..0cad751cd1411a6ad00ab076cdcf05333ce0d262 100644 (file)
@@ -57,147 +57,189 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 public class RefNameServiceUtils {\r
 \r
     private final Logger logger = LoggerFactory.getLogger(RefNameServiceUtils.class);\r
-    \r
+\r
     public static AuthorityRefDocList getAuthorityRefDocs(ServiceContext ctx,\r
-               RepositoryClient repoClient, \r
-               String serviceType,\r
-               String refName,\r
-               int pageSize, int pageNum, boolean computeTotal ) throws DocumentException, DocumentNotFoundException {\r
-       AuthorityRefDocList wrapperList = new AuthorityRefDocList();\r
-        List<AuthorityRefDocList.AuthorityRefDocItem> list = \r
-               wrapperList.getAuthorityRefDocItem();\r
-       TenantBindingConfigReaderImpl tReader =\r
-            ServiceMain.getInstance().getTenantBindingConfigReader();\r
-       List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(ctx.getTenantId(), serviceType);\r
-       if (servicebindings == null || servicebindings.isEmpty())\r
-               return null;\r
-       // Need to escape the quotes in the refName\r
-       // TODO What if they are already escaped?\r
-       String escapedRefName = refName.replaceAll("'", "\\\\'");\r
+            RepositoryClient repoClient,\r
+            String serviceType,\r
+            String refName,\r
+            int pageSize, int pageNum, boolean computeTotal) throws DocumentException, DocumentNotFoundException {\r
+        AuthorityRefDocList wrapperList = new AuthorityRefDocList();\r
+        List<AuthorityRefDocList.AuthorityRefDocItem> list =\r
+                wrapperList.getAuthorityRefDocItem();\r
+        TenantBindingConfigReaderImpl tReader =\r
+                ServiceMain.getInstance().getTenantBindingConfigReader();\r
+        List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(ctx.getTenantId(), serviceType);\r
+        if (servicebindings == null || servicebindings.isEmpty()) {\r
+            return null;\r
+        }\r
+        // Need to escape the quotes in the refName\r
+        // TODO What if they are already escaped?\r
+        String escapedRefName = refName.replaceAll("'", "\\\\'");\r
 //     String domain = \r
 //             tReader.getTenantBinding(ctx.getTenantId()).getRepositoryDomain();\r
-       ArrayList<String> docTypes = new ArrayList<String>(); \r
-       HashMap<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>(); \r
-       HashMap<String, List<String>> authRefFieldsByService = new HashMap<String, List<String>>(); \r
-       StringBuilder whereClause = new StringBuilder();\r
-       boolean fFirst = true;\r
-       for(ServiceBindingType sb:servicebindings) {\r
-               List<String> authRefFields = \r
-                       ServiceBindingUtils.getAllPartsPropertyValues(sb, \r
-                               ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);\r
-               if(authRefFields.isEmpty())\r
-                       continue;\r
-                String fieldName = "";\r
-                for (int i = 0; i < authRefFields.size(); i++) {\r
-                    // fieldName = DocumentUtils.getDescendantOrAncestor(authRefFields.get(i));\r
-                    fieldName = DocumentUtils.getAncestorAuthRefFieldName(authRefFields.get(i));\r
-                    authRefFields.set(i, fieldName);\r
+        ArrayList<String> docTypes = new ArrayList<String>();\r
+        HashMap<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>();\r
+        HashMap<String, List<String>> authRefFieldsByService = new HashMap<String, List<String>>();\r
+        StringBuilder whereClause = new StringBuilder();\r
+        boolean fFirst = true;\r
+        for (ServiceBindingType sb : servicebindings) {\r
+            List<String> authRefFields =\r
+                    ServiceBindingUtils.getAllPartsPropertyValues(sb,\r
+                    ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);\r
+            if (authRefFields.isEmpty()) {\r
+                continue;\r
+            }\r
+            String fieldName = "";\r
+            for (int i = 0; i < authRefFields.size(); i++) {\r
+                // fieldName = DocumentUtils.getDescendantOrAncestor(authRefFields.get(i));\r
+                fieldName = DocumentUtils.getAncestorAuthRefFieldName(authRefFields.get(i));\r
+                authRefFields.set(i, fieldName);\r
+            }\r
+\r
+            String docType = sb.getObject().getName();\r
+            queriedServiceBindings.put(docType, sb);\r
+            authRefFieldsByService.put(docType, authRefFields);\r
+            docTypes.add(docType);\r
+            /*\r
+            // HACK - need to get qualified properties from the ServiceBinding\r
+            String prefix = "";\r
+            if(docType.equalsIgnoreCase("Intake"))\r
+            prefix = "intakes_common:";\r
+            else if(docType.equalsIgnoreCase("Loanin"))\r
+            prefix = "loansin_common:";\r
+            else if(docType.equalsIgnoreCase("Acquisition"))\r
+            prefix = "acquisitions_common:";\r
+             */\r
+            for (String field : authRefFields) {\r
+                // Build up the where clause for each authRef field\r
+                if (fFirst) {\r
+                    fFirst = false;\r
+                } else {\r
+                    whereClause.append(" OR ");\r
                 }\r
-                \r
-               String docType = sb.getObject().getName();\r
-               queriedServiceBindings.put(docType, sb);\r
-               authRefFieldsByService.put(docType, authRefFields);\r
-               docTypes.add(docType);\r
-               /*\r
-               // HACK - need to get qualified properties from the ServiceBinding\r
-               String prefix = "";\r
-               if(docType.equalsIgnoreCase("Intake"))\r
-                       prefix = "intakes_common:";\r
-               else if(docType.equalsIgnoreCase("Loanin"))\r
-                       prefix = "loansin_common:";\r
-               else if(docType.equalsIgnoreCase("Acquisition"))\r
-                       prefix = "acquisitions_common:";\r
-               */\r
-               for(String field:authRefFields) {\r
-                       // Build up the where clause for each authRef field\r
-                       if(fFirst) {\r
-                               fFirst = false;\r
-                       } else {\r
-                               whereClause.append(" OR ");\r
-                       }\r
-                       //whereClause.append(prefix);\r
-                        whereClause.append(field);\r
-                       whereClause.append("='");\r
-                       whereClause.append(escapedRefName);\r
-                       whereClause.append("'");\r
-               }\r
-       }\r
-       if(fFirst) // found no authRef fields - nothing to query\r
-               return wrapperList;\r
-       String fullQuery = whereClause.toString(); // for debug\r
-               // Now we have to issue the search\r
-               DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(ctx,\r
-                       docTypes, whereClause.toString(), pageSize, pageNum, computeTotal );\r
-               // Now we gather the info for each document into the list and return\r
+                //whereClause.append(prefix);\r
+                whereClause.append(field);\r
+                whereClause.append("='");\r
+                whereClause.append(escapedRefName);\r
+                whereClause.append("'");\r
+            }\r
+        }\r
+        if (fFirst) // found no authRef fields - nothing to query\r
+        {\r
+            return wrapperList;\r
+        }\r
+        String fullQuery = whereClause.toString(); // for debug\r
+        // Now we have to issue the search\r
+        DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(ctx,\r
+                docTypes, whereClause.toString(), pageSize, pageNum, computeTotal);\r
+        // Now we gather the info for each document into the list and return\r
         DocumentModelList docList = docListWrapper.getWrappedObject();\r
         Iterator<DocumentModel> iter = docList.iterator();\r
-        while(iter.hasNext()){\r
+        while (iter.hasNext()) {\r
             DocumentModel docModel = iter.next();\r
             AuthorityRefDocList.AuthorityRefDocItem ilistItem = new AuthorityRefDocList.AuthorityRefDocItem();\r
             String csid = NuxeoUtils.extractId(docModel.getPathAsString());\r
             String docType = docModel.getDocumentType().getName();\r
             ServiceBindingType sb = queriedServiceBindings.get(docType);\r
-            if(sb==null) {\r
-               throw new RuntimeException(\r
-                               "getAuthorityRefDocs: No Service Binding for docType: "+docType);\r
+            if (sb == null) {\r
+                throw new RuntimeException(\r
+                        "getAuthorityRefDocs: No Service Binding for docType: " + docType);\r
             }\r
             String serviceContextPath = "/" + sb.getName().toLowerCase() + "/";\r
             // The id and URI are the same on all doctypes\r
             ilistItem.setDocId(csid);\r
-            ilistItem.setUri(serviceContextPath+csid);\r
+            ilistItem.setUri(serviceContextPath + csid);\r
             ilistItem.setDocType(docType);\r
             ilistItem.setDocNumber(\r
-                       ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NUMBER_PROP, docModel));\r
+                    ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NUMBER_PROP, docModel));\r
             ilistItem.setDocName(\r
-                       ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NAME_PROP, docModel));\r
+                    ServiceBindingUtils.getMappedFieldInDoc(sb, ServiceBindingUtils.OBJ_NAME_PROP, docModel));\r
             // Now, we have to loop over the authRefFieldsByService to figure\r
             // out which field matched this. Ignore multiple matches.\r
             List<String> authRefFields = authRefFieldsByService.get(docType);\r
-            if(authRefFields==null || authRefFields.isEmpty()){\r
-               throw new RuntimeException(\r
-                               "getAuthorityRefDocs: internal logic error: can't fetch authRefFields for DocType." );\r
+            if (authRefFields == null || authRefFields.isEmpty()) {\r
+                throw new RuntimeException(\r
+                        "getAuthorityRefDocs: internal logic error: can't fetch authRefFields for DocType.");\r
             }\r
             boolean fRefFound = false;\r
-            /* Use this if we go to qualified field names\r
-            for(String field:authRefFields){\r
+            // Use this if we go to qualified field names\r
+            for (String field : authRefFields) {\r
                 String[] strings = field.split(":");\r
-                if(strings.length!=2) {\r
-                       throw new RuntimeException(\r
-                                       "getAuthorityRefDocs: Bad configuration of authRefField.");\r
+                if (strings.length != 2) {\r
+                    throw new RuntimeException(\r
+                            "getAuthorityRefDocs: Bad configuration of authRefField.");\r
                 }\r
-               try {\r
-                    if(refName.equals(docModel.getProperty(strings[0], strings[1]))) {\r
+                try {\r
+                    Object fieldValue = docModel.getProperty(strings[0], strings[1]);\r
+                    fRefFound = refNameFoundInField(refName, fieldValue);\r
+                    if (fRefFound) {\r
                         ilistItem.setSourceField(field);\r
-                        fRefFound = true;\r
+                        // FIXME Returns only the first field in which the refName is found.\r
+                        // We may want to return all; this may require multiple sourceFields\r
+                        // in the list item schema.\r
                         break;\r
                     }\r
-               } catch(ClientException ce) {\r
-                       throw new RuntimeException(\r
-                                       "getAuthorityRefDocs: Problem fetching: "+field, ce);\r
-               }\r
+\r
+                } catch (ClientException ce) {\r
+                    throw new RuntimeException(\r
+                            "getAuthorityRefDocs: Problem fetching: " + field, ce);\r
+                }\r
             }\r
-            */\r
+            // Used before going to schema-qualified field names.\r
+            /*\r
             for(String field:authRefFields){\r
-               try {\r
-                    if(refName.equals(docModel.getPropertyValue(field))) {\r
-                        ilistItem.setSourceField(field);\r
-                        fRefFound = true;\r
-                        break;\r
-                    }\r
-               } catch(ClientException ce) {\r
-                       throw new RuntimeException(\r
-                                       "getAuthorityRefDocs: Problem fetching: "+field, ce);\r
-               }\r
+            try {\r
+            if(refName.equals(docModel.getPropertyValue(field))) {\r
+            ilistItem.setSourceField(field);\r
+            fRefFound = true;\r
+            break;\r
+            }\r
+            } catch(ClientException ce) {\r
+            throw new RuntimeException(\r
+            "getAuthorityRefDocs: Problem fetching: "+field, ce);\r
             }\r
-            if(!fRefFound) {\r
-               throw new RuntimeException(\r
-                               "getAuthorityRefDocs: Could not find refname in object:"\r
-                               +docType+":"+csid);\r
+            }\r
+             * \r
+             */\r
+            if (!fRefFound) {\r
+                throw new RuntimeException(\r
+                        "getAuthorityRefDocs: Could not find refname in object:"\r
+                        + docType + ":" + csid);\r
             }\r
             list.add(ilistItem);\r
         }\r
-       return wrapperList;\r
+        return wrapperList;\r
     }\r
 \r
+    /*\r
+     * Identifies whether the refName was found in the supplied field.\r
+     *\r
+     * Only works for:\r
+     * * Scalar fields\r
+     * * Repeatable scalar fields (aka multi-valued fields)\r
+     *\r
+     * Does not work for:\r
+     * * Structured fields (complexTypes)\r
+     * * Repeatable structured fields (repeatable complexTypes)\r
+     */\r
+    private static boolean refNameFoundInField(String refName, Object fieldValue) {\r
+\r
+        boolean result = false;\r
+        if (fieldValue instanceof List) {\r
+            List<String> fieldValueList = (List) fieldValue;\r
+            for (String listItemValue : fieldValueList) {\r
+                if (refName.equals(listItemValue)) {\r
+                    result = true;\r
+                    break;\r
+                }\r
+\r
+            }\r
+        } else {\r
+            if (refName.equals(fieldValue)) {\r
+                result = true;\r
+            }\r
+        }\r
+        return result;\r
+    }\r
 }\r
 \r
index 8dcaf353b556d2349d17c2c4f99cefb1b3a51382..e3cd24446a76f6ad0054e59de8a5f10d1cbcab4f 100644 (file)
@@ -64,15 +64,16 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
 
     private final String CLASS_NAME = PersonAuthRefDocsTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
-
     // Instance variables specific to this test.
     final String SERVICE_PATH_COMPONENT = "intakes";
     final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
     private String knownIntakeId = null;
     private List<String> intakeIdsCreated = new ArrayList<String>();
     private List<String> personIdsCreated = new ArrayList<String>();
-    private String personAuthCSID = null; 
-    private String currentOwnerPersonCSID = null; 
+    private String personAuthCSID = null;
+    private String currentOwnerPersonCSID = null;
+    private String depositorPersonCSID = null;
+    private String insurerPersonCSID = null;
     private String currentOwnerRefName = null;
     private String depositorRefName = null;
     private String conditionCheckerAssessorRefName = null;
@@ -85,23 +86,23 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
      */
     @Override
     protected CollectionSpaceClient getClientInstance() {
-       throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
-    
+
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getAbstractCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-       throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+    protected AbstractCommonList getAbstractCommonList(
+            ClientResponse<AbstractCommonList> response) {
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
     // ---------------------------------------------------------------
     // CRUD tests : CREATE tests
     // ---------------------------------------------------------------
     // Success outcomes
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
     public void createIntakeWithAuthRefs(String testName) throws Exception {
 
         if (logger.isDebugEnabled()) {
@@ -111,7 +112,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
 
         // Submit the request to the service and store the response.
         String identifier = createIdentifier();
-        
+
         // Create all the person refs and entities
         createPersonRefs();
 
@@ -119,53 +120,53 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         MultipartOutput multipart = createIntakeInstance(
                 "entryNumber-" + identifier,
                 "entryDate-" + identifier,
-                                                               currentOwnerRefName,
-                                                               depositorRefName,
-                                                               conditionCheckerAssessorRefName,
-                                                               insurerRefName,
-                                                               valuerRefName );
+                currentOwnerRefName,
+                depositorRefName,
+                conditionCheckerAssessorRefName,
+                insurerRefName,
+                valuerRefName);
 
         ClientResponse<Response> res = intakeClient.create(multipart);
         try {
-               int statusCode = res.getStatus();
-       
-               // Check the status code of the response: does it match
-               // the expected response(s)?
-               //
-               // Specifically:
-               // Does it fall within the set of valid status codes?
-               // Does it exactly match the expected status code?
-               if(logger.isDebugEnabled()){
-                   logger.debug(testName + ": status = " + statusCode);
-               }
-               Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-               Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+            int statusCode = res.getStatus();
+
+            // Check the status code of the response: does it match
+            // the expected response(s)?
+            //
+            // Specifically:
+            // Does it fall within the set of valid status codes?
+            // Does it exactly match the expected status code?
+            if (logger.isDebugEnabled()) {
+                logger.debug(testName + ": status = " + statusCode);
+            }
+            Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+            Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
         } finally {
-               res.releaseConnection();
+            res.releaseConnection();
         }
 
         // Store the ID returned from the first resource created
         // for additional tests below.
-        if (knownIntakeId == null){
+        if (knownIntakeId == null) {
             knownIntakeId = extractId(res);
             if (logger.isDebugEnabled()) {
                 logger.debug(testName + ": knownIntakeId=" + knownIntakeId);
             }
         }
-        
+
         // Store the IDs from every resource created by tests,
         // so they can be deleted after tests have been run.
         intakeIdsCreated.add(extractId(res));
     }
-    
+
     /**
      * Creates the person refs.
      */
-    protected void createPersonRefs(){
+    protected void createPersonRefs() {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-       MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
-                       PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+                PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
         ClientResponse<Response> res = personAuthClient.create(multipart);
         int statusCode = res.getStatus();
 
@@ -173,64 +174,65 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
         personAuthCSID = extractId(res);
-        
+
         String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
-        
+
         String csid = createPerson("Olivier", "Owner", "olivierOwner", authRefName);
         Assert.assertNotNull(csid);
         currentOwnerPersonCSID = csid;
         currentOwnerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
         Assert.assertNotNull(currentOwnerRefName);
         personIdsCreated.add(csid);
-        
+
         csid = createPerson("Debbie", "Depositor", "debbieDepositor", authRefName);
         Assert.assertNotNull(csid);
         depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+        depositorPersonCSID = csid;
         Assert.assertNotNull(depositorRefName);
         personIdsCreated.add(csid);
-        
+
         csid = createPerson("Andrew", "Assessor", "andrewAssessor", authRefName);
         Assert.assertNotNull(csid);
         conditionCheckerAssessorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
         Assert.assertNotNull(conditionCheckerAssessorRefName);
         personIdsCreated.add(csid);
-        
+
         csid = createPerson("Ingrid", "Insurer", "ingridInsurer", authRefName);
         Assert.assertNotNull(csid);
+        insurerPersonCSID = csid;
         insurerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
         Assert.assertNotNull(insurerRefName);
         personIdsCreated.add(csid);
-        
+
         csid = createPerson("Vince", "Valuer", "vinceValuer", authRefName);
         Assert.assertNotNull(csid);
         valuerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
         Assert.assertNotNull(valuerRefName);
         personIdsCreated.add(csid);
-        
+
     }
-    
-    protected String createPerson(String firstName, String surName, String shortId, String authRefName ) {
+
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-        Map<String, String> personInfo = new HashMap<String,String>();
+        Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
         personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
-       MultipartOutput multipart = 
-               PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
-                               authRefName, personInfo, personAuthClient.getItemCommonPartName());
+        MultipartOutput multipart =
+                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+                authRefName, personInfo, personAuthClient.getItemCommonPartName());
         ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
         int statusCode = res.getStatus();
 
         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
         Assert.assertEquals(statusCode, STATUS_CREATED);
-       return extractId(res);
+        return extractId(res);
     }
 
     // Success outcomes
-    
-    @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        dependsOnMethods = {"createIntakeWithAuthRefs"})
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+    dependsOnMethods = {"createIntakeWithAuthRefs"})
     public void readAndCheckAuthRefDocs(String testName) throws Exception {
 
         if (logger.isDebugEnabled()) {
@@ -238,17 +240,16 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         }
         // Perform setup.
         testSetup(STATUS_OK, ServiceRequestType.READ);
-        
+
         // Get the auth ref docs and check them
 
-        // Single scalar field
-       PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-       ClientResponse<AuthorityRefDocList> refDocListResp =
-               personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID);
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        ClientResponse<AuthorityRefDocList> refDocListResp =
+                personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID);
 
         int statusCode = refDocListResp.getStatus();
 
-        if(logger.isDebugEnabled()){
+        if (logger.isDebugEnabled()) {
             logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
         }
         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
@@ -256,27 +257,60 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
         AuthorityRefDocList list = refDocListResp.getEntity();
 
-        // Repeatable scalar field
-
-        // FIXME: Add an appropriate test here, or preferably a new test case.
-
         // Optionally output additional data about list members for debugging.
         boolean iterateThroughList = true;
         boolean fFoundIntake = false;
-        if(iterateThroughList && logger.isDebugEnabled()){
+        if (iterateThroughList && logger.isDebugEnabled()) {
             List<AuthorityRefDocList.AuthorityRefDocItem> items =
                     list.getAuthorityRefDocItem();
             int i = 0;
             logger.debug(testName + ": Docs that use: " + currentOwnerRefName);
-            for(AuthorityRefDocList.AuthorityRefDocItem item : items){
-                logger.debug(testName + ": list-item[" + i + "] " +
-                               item.getDocType() + "(" +
-                               item.getDocId() + ") Name:[" +
-                               item.getDocName() + "] Number:[" +
-                               item.getDocNumber() + "] in field:[" +
-                               item.getSourceField() + "]");
-                if(!fFoundIntake && knownIntakeId.equalsIgnoreCase(item.getDocId())) {
-                               fFoundIntake = true;
+            for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] "
+                        + item.getDocType() + "("
+                        + item.getDocId() + ") Name:["
+                        + item.getDocName() + "] Number:["
+                        + item.getDocNumber() + "] in field:["
+                        + item.getSourceField() + "]");
+                if (!fFoundIntake && knownIntakeId.equalsIgnoreCase(item.getDocId())) {
+                    fFoundIntake = true;
+                }
+                i++;
+            }
+            Assert.assertTrue(fFoundIntake, "Did not find Intake with authref!");
+        }
+
+        personAuthClient = new PersonAuthorityClient();
+        refDocListResp =
+                personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
+
+        statusCode = refDocListResp.getStatus();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        list = refDocListResp.getEntity();
+
+        // Optionally output additional data about list members for debugging.
+        iterateThroughList = true;
+        fFoundIntake = false;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            List<AuthorityRefDocList.AuthorityRefDocItem> items =
+                    list.getAuthorityRefDocItem();
+            int i = 0;
+            logger.debug(testName + ": Docs that use: " + depositorRefName);
+            for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] "
+                        + item.getDocType() + "("
+                        + item.getDocId() + ") Name:["
+                        + item.getDocName() + "] Number:["
+                        + item.getDocNumber() + "] in field:["
+                        + item.getSourceField() + "]");
+                if (!fFoundIntake && knownIntakeId.equalsIgnoreCase(item.getDocId())) {
+                    fFoundIntake = true;
                 }
                 i++;
             }
@@ -284,11 +318,64 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         }
     }
 
+    /*
+     * Read and check the list of referencing objects, where the authRef field
+     * is a value instance of a repeatable scalar field.
+     */
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+    dependsOnMethods = {"createIntakeWithAuthRefs"}, groups = {"repeatableScalar"})
+    public void readAndCheckAuthRefDocsRepeatableScalar(String testName) throws Exception {
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(testBanner(testName, CLASS_NAME));
+        }
+        // Perform setup.
+        testSetup(STATUS_OK, ServiceRequestType.READ);
+
+        // Get the auth ref docs and check them
+
+        // Single scalar field
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        ClientResponse<AuthorityRefDocList> refDocListResp =
+                personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID);
+
+        int statusCode = refDocListResp.getStatus();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(testName + ".getReferencingObjects: status = " + statusCode);
+        }
+        Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+                invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+        Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+        AuthorityRefDocList list = refDocListResp.getEntity();
+
+        // Optionally output additional data about list members for debugging.
+        boolean iterateThroughList = true;
+        boolean fFoundIntake = false;
+        if (iterateThroughList && logger.isDebugEnabled()) {
+            List<AuthorityRefDocList.AuthorityRefDocItem> items =
+                    list.getAuthorityRefDocItem();
+            int i = 0;
+            logger.debug(testName + ": Docs that use: " + insurerRefName);
+            for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] "
+                        + item.getDocType() + "("
+                        + item.getDocId() + ") Name:["
+                        + item.getDocName() + "] Number:["
+                        + item.getDocNumber() + "] in field:["
+                        + item.getSourceField() + "]");
+                if (!fFoundIntake && knownIntakeId.equalsIgnoreCase(item.getDocId())) {
+                    fFoundIntake = true;
+                }
+                i++;
+            }
+            Assert.assertTrue(fFoundIntake, "Did not find Intake with authref!");
+        }
+    }
 
     // ---------------------------------------------------------------
     // Cleanup of resources created during testing
     // ---------------------------------------------------------------
-
     /**
      * Deletes all resources created by tests, after all tests have been run.
      *
@@ -297,15 +384,15 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
      * at any point during testing, even if some of those resources
      * may be expected to be deleted by certain tests.
      */
-    @AfterClass(alwaysRun=true)
+    @AfterClass(alwaysRun = true)
     public void cleanUp() {
         String noTest = System.getProperty("noTestCleanup");
-       if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+        if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Skipping Cleanup phase ...");
             }
             return;
-       }
+        }
         if (logger.isDebugEnabled()) {
             logger.debug("Cleaning up temporary resources created for testing ...");
         }
@@ -322,7 +409,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
             res.releaseConnection();
         }
         if (personAuthCSID != null) {
-               personAuthClient.delete(personAuthCSID).releaseConnection();
+            personAuthClient.delete(personAuthCSID).releaseConnection();
         }
     }
 
@@ -334,13 +421,13 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
         return SERVICE_PATH_COMPONENT;
     }
 
-   private MultipartOutput createIntakeInstance(String entryNumber,
-               String entryDate,
-                               String currentOwner,
-                               String depositor,
-                               String conditionCheckerAssessor,
-                               String insurer,
-                               String Valuer ) {
+    private MultipartOutput createIntakeInstance(String entryNumber,
+            String entryDate,
+            String currentOwner,
+            String depositor,
+            String conditionCheckerAssessor,
+            String insurer,
+            String Valuer) {
         IntakesCommon intake = new IntakesCommon();
         intake.setEntryNumber(entryNumber);
         intake.setEntryDate(entryDate);
@@ -360,10 +447,10 @@ public class PersonAuthRefDocsTest extends BaseServiceTest {
 
         MultipartOutput multipart = new MultipartOutput();
         OutputPart commonPart =
-            multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
+                multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
         commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
 
-        if(logger.isDebugEnabled()){
+        if (logger.isDebugEnabled()) {
             logger.debug("to be created, intake common");
             logger.debug(objectAsXmlString(intake, IntakesCommon.class));
         }