]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-590, CSPACE-852. Added tests for getting a list of persons from a named (not...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 2 Mar 2010 01:55:53 +0000 (01:55 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Tue, 2 Mar 2010 01:55:53 +0000 (01:55 +0000)
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java

index fecd59d426402c2a1ca744b752111aed0f8492d4..c17eeec0b48b3fabbdb53bfd4c85046951edfcfd 100644 (file)
@@ -1,5 +1,6 @@
 package org.collectionspace.services.client;
 
+import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.contact.ContactsCommonList;
@@ -138,6 +139,14 @@ public class PersonAuthorityClient extends AbstractServiceClientImpl {
         return personAuthorityProxy.readItemList(vcsid);
     }
 
+    /**
+     * @return
+     * @see org.collectionspace.services.client.PersonAuthorityProxy#readItemListForNamedAuthority()
+     */
+    public ClientResponse<PersonsCommonList> readItemListForNamedAuthority(String specifier) {
+        return personAuthorityProxy.readItemListForNamedAuthority(specifier);
+    }
+
     /**
      * @param csid
      * @return
index 3a25ba8a1533aa9e2b8dd77f1cc8d3d6e1f97ee7..10c27a0011a9a8e92712fd018528dceede8fe827 100644 (file)
@@ -60,6 +60,12 @@ public interface PersonAuthorityProxy {
     @Path("/{vcsid}/items/")
     ClientResponse<PersonsCommonList> readItemList(@PathParam("vcsid") String vcsid);
 
+    // List Items for a named authority
+    @GET
+    @Produces({"application/xml"})
+    @Path("/urn:cspace:name({specifier})/items/")
+    ClientResponse<PersonsCommonList> readItemListForNamedAuthority(@PathParam("specifier") String specifier);
+
     //(C)reate Item
     @POST
     @Path("/{vcsid}/items/")
index 31f726b21854a43fe3cd6f313fd415b328b448e8..1fce517d49a0bc6b7ae1daf812695864520e05da 100644 (file)
@@ -810,7 +810,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
                         item.getDisplayName());
                 logger.debug(testName + ": list-item[" + i + "] URI=" +
                         item.getUri());
-                readItemList(csid);
+                readItemList(csid, null);
                 i++;
             }
         }
@@ -818,19 +818,31 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
 
     @Test(groups = {"readList"}, dependsOnMethods = {"readList"})
     public void readItemList() {
-        readItemList(knownResourceId);
+        readItemList(knownResourceId, null);
     }
 
-    private void readItemList(String vcsid) {
+    @Test(groups = {"readList"}, dependsOnMethods = {"readItemList"})
+    public void readItemListByAuthorityName() {
+        readItemList(null, knownResourceDisplayName);
+    }
+    private void readItemList(String vcsid, String name) {
 
         final String testName = "readItemList";
 
         // Perform setup.
         setupReadList(testName);
-
-        // Submit the request to the service and store the response.
-        ClientResponse<PersonsCommonList> res =
-                client.readItemList(vcsid);
+        
+        ClientResponse<PersonsCommonList> res = null;
+        
+        if(vcsid!= null) {
+               // Submit the request to the service and store the response.
+               res = client.readItemList(vcsid);
+        } else if(name!= null) {
+               // Submit the request to the service and store the response.
+               res = client.readItemListForNamedAuthority(name);
+        } else {
+               Assert.fail("readItemList passed null csid and name!");
+        }
         PersonsCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
@@ -946,7 +958,7 @@ public class PersonAuthorityServiceTest extends AbstractServiceTestImpl {
     // Success outcomes
     @Override
     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
-        groups = {"update"}, dependsOnGroups = {"read"})
+        groups = {"update"}, dependsOnGroups = {"read", "readList"})
     public void update(String testName) throws Exception {
 
         // Perform setup.