]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5119,CSPACE-5135,CSPACE-5138: All but one test now passes in PersonServiceTest.
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 2 May 2012 21:44:40 +0000 (14:44 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 2 May 2012 21:44:40 +0000 (14:44 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java

index ed3bfba73069e6e3377f3798ef4cb668d49b2f7a..38031921f67f4f68bb0b67261d7a8151d6701123 100644 (file)
@@ -672,9 +672,11 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
             String keywords = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW);
             String advancedSearch = queryParams.getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_AS);
 
-            String qualifiedDisplayNameField = 
-                    authorityItemCommonSchemaName + ":" + getItemTermInfoGroupXPathBase()
-                        + "/0/" + AuthorityItemJAXBSchema.TERM_DISPLAY_NAME;
+            String qualifiedDisplayNameField =
+                    NuxeoUtils.getPrimaryElPathPropertyName(authorityItemCommonSchemaName,
+                        getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
+                    // authorityItemCommonSchemaName + ":" + getItemTermInfoGroupXPathBase()
+                    //    + "/0/" + AuthorityItemJAXBSchema.TERM_DISPLAY_NAME;
 
                     // NuxeoUtils.getPrimaryXPathPropertyName(authorityItemCommonSchemaName, 
                     //     getItemTermInfoGroupXPathBase(), AuthorityItemJAXBSchema.TERM_DISPLAY_NAME);
index 520a4604047daa88920d0652576a2e2f28627570..598f970b7561947172760f308f8cc6adad575acf 100644 (file)
@@ -609,4 +609,12 @@ public class NuxeoUtils {
            return schema + ":" + complexPropertyName + "/[0]/" + fieldName;
         }
     }
+    
+    static public String getPrimaryElPathPropertyName(String schema, String complexPropertyName, String fieldName) {
+        if (Tools.isBlank(schema)) {
+            return complexPropertyName + "/0/" + fieldName;
+        } else {
+           return schema + ":" + complexPropertyName + "/0/" + fieldName;
+        }
+    }
 }
index fab22ad46957b9fa5baab77e514a5c69379b71f4..392721e8e1fc1f4aa0bce77aad0f06953396f9f9 100644 (file)
@@ -45,6 +45,8 @@ import org.collectionspace.services.client.PersonAuthorityClient;
 import org.collectionspace.services.client.PersonAuthorityClientUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.person.PersonauthoritiesCommon;
 import org.collectionspace.services.person.PersonTermGroup;
 import org.collectionspace.services.person.PersonTermGroupList;
@@ -71,7 +73,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
     private final String CLASS_NAME = PersonAuthorityServiceTest.class.getName();
     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
     private final String REFNAME = "refName";
-    private final String DISPLAYNAME = "displayName";
+    private final String TERM_DISPLAY_NAME = "termDisplayName";
+    // private final String TERM_DISPLAY_NAME_ELPATH =
+    //        NuxeoUtils.getPrimaryElPathPropertyName(null,
+    //            new PersonAuthorityClient().getTermInfoGroupXpathBase(), TERM_DISPLAY_NAME);
 
     @Override
     public String getServicePathComponent() {
@@ -822,8 +827,9 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             String value =
                     AbstractCommonListUtils.ListItemGetElementValue(item, REFNAME);
             Assert.assertTrue((null != value), "Item refName is null!");
+            
             value =
-                    AbstractCommonListUtils.ListItemGetElementValue(item, DISPLAYNAME);
+                    AbstractCommonListUtils.ListItemGetElementValue(item, TERM_DISPLAY_NAME);
             Assert.assertTrue((null != value), "Item displayName is null!");
         }
         if (logger.isTraceEnabled()) {
@@ -1003,7 +1009,8 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         List<PersonTermGroup> terms = termList.getPersonTermGroup();
         Assert.assertNotNull(terms);
         String foreName = terms.get(0).getForeName();
-        terms.get(0).setForeName("updated-" + foreName);
+        String updatedForeName = "updated-" + foreName;
+        terms.get(0).setForeName(updatedForeName);
         if (logger.isDebugEnabled()) {
             logger.debug("to be updated Person");
             logger.debug(objectAsXmlString(person,
@@ -1040,8 +1047,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         Assert.assertNotNull(updatedTermList);
         List<PersonTermGroup> updatedTerms = termList.getPersonTermGroup();
         Assert.assertNotNull(updatedTerms);
-        String updatedForeName = updatedTerms.get(0).getForeName();
-        Assert.assertEquals(updatedForeName, foreName,
+        Assert.assertEquals(updatedTerms.get(0).getForeName(), updatedForeName,
                 "Data in updated Person did not match submitted data.");
     }