]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6281: More changes for RESTEasy client update for v3.0.1Final
authorremillet <remillet@yahoo.com>
Fri, 7 Aug 2015 22:44:24 +0000 (15:44 -0700)
committerremillet <remillet@yahoo.com>
Fri, 7 Aug 2015 22:44:24 +0000 (15:44 -0700)
68 files changed:
services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java
services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountServiceTest.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java
services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionRoleServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/PermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RolePermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceCommonListPoxProxy.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxProxy.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceProxy.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractAuthorityServiceTest.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java
services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckServiceTest.java
services/contact/client/src/test/java/org/collectionspace/services/client/test/ContactServiceTest.java
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionProxy.java
services/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.java
services/group/client/src/test/java/org/collectionspace/services/client/test/GroupServiceTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/PersonAuthRefDocsTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java
services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninServiceTest.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java
services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutServiceTest.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/media/client/src/main/java/org/collectionspace/services/client/MediaClient.java
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementSortByTest.java
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java
services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitServiceTest.java
services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java
services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityServiceTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java
services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServiceTest.java
services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java
services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java
services/publicitem/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.java
services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthenticationServiceTest.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/AuthorizationServiceTest.java
services/security/client/src/test/java/org/collectionspace/services/security/client/test/MultiTenancyTest.java
services/servicegroup/client/src/test/java/org/collectionspace/services/client/test/ServiceGroupServiceTest.java
services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java
services/taxonomy/client/src/test/java/org/collectionspace/services/client/test/TaxonomyAuthorityServiceTest.java
services/valuationcontrol/client/src/test/java/org/collectionspace/services/client/test/ValuationcontrolServiceTest.java
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClientUtils.java
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClientUtils.java
services/work/client/src/test/java/org/collectionspace/services/client/test/WorkAuthorityServiceTest.java

index 1c1c6af86f0f5dc0c1e82e1505a3b8b477bf9b83..58829438036cc8f6c9176d5008e6172f46a2f6e6 100644 (file)
@@ -484,12 +484,12 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
         for(RelationsCommonList.RelationListItem listItem : relationListItems){
                
                String foundCsid = listItem.getCsid();
-               ClientResponse<String> multiPartResponse = null;
+               Response multiPartResponse = null;
                try {
                        multiPartResponse = relationClient.read(foundCsid);
                        int responseStatus = multiPartResponse.getStatus();
                        Assert.assertEquals(responseStatus, Response.Status.OK.getStatusCode());
-                       PoxPayloadIn input = new PoxPayloadIn(multiPartResponse.getEntity());
+                       PoxPayloadIn input = new PoxPayloadIn((String)multiPartResponse.getEntity());
                        resultRelation = (RelationsCommon) extractPart(input,
                                        relationClient.getCommonPartName(),
                                        RelationsCommon.class);
@@ -613,12 +613,12 @@ public class RelationIntegrationTest extends CollectionSpaceIntegrationTest {
                RelationsCommon resultRelation = null;
                for(RelationsCommonList.RelationListItem listItem : relationListItems){
                        String foundCsid = listItem.getCsid();
-                       ClientResponse<String> multiPartResponse = null;
+                       Response multiPartResponse = null;
                        try {
                                multiPartResponse = relationClient.read(foundCsid);
                                int responseStatus = multiPartResponse.getStatus();
                                Assert.assertEquals(responseStatus, Response.Status.OK.getStatusCode());
-                               PoxPayloadIn input = new PoxPayloadIn(multiPartResponse.getEntity());
+                               PoxPayloadIn input = new PoxPayloadIn((String)multiPartResponse.getEntity());
                                resultRelation = (RelationsCommon) extractPart(input,
                                                relationClient.getCommonPartName(),
                                                RelationsCommon.class);
index 216f0cc38e3dc541e692a2b49251e8f4367b370f..b610d8c898edc6fbf319f1bf74f3cdf9ac1757b8 100644 (file)
@@ -31,13 +31,10 @@ import javax.ws.rs.core.Response;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.jboss.resteasy.client.ClientResponse;
 import org.jboss.resteasy.util.HttpResponseCodes;
-
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -96,7 +93,7 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
             try {
                 Assert.assertEquals(response.getStatus(), HttpResponseCodes.SC_OK);
             } finally {
-                response.releaseConnection();
+                response.close();
             }
             Date stopTime = new Date();
             totalTime = totalTime + (stopTime.getTime() - startTime.getTime());
@@ -140,7 +137,7 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
                 try {
                     coListItem = searchResults.getEntity();
                 } finally {
-                    searchResults.releaseConnection();
+                    searchResults.close();
                 }
 
                 long time = stopTime.getTime() - startTime.getTime();
@@ -253,8 +250,8 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      */
     private void readCollectionObject(CollectionObjectClient collectionObjectClient,
             String resourceId) {
-        ClientResponse<String> res = collectionObjectClient.read(resourceId);
-        res.releaseConnection();
+        Response res = collectionObjectClient.read(resourceId);
+        res.close();
     }
 
     /**
@@ -283,18 +280,17 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      */
     public void readCollectionObjects() {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        ClientResponse<AbstractCommonList> response;
 
         List<AbstractCommonList.ListItem> coListItems = null;
         do {
-            response = collectionObjectClient.readList(new Long(MAX_RECORDS),
+            Response res = collectionObjectClient.readList(new Long(MAX_RECORDS),
                     new Long(0));
             try {
                 AbstractCommonList commonListElement =
-                        (AbstractCommonList) response.getEntity(AbstractCommonList.class);
+                        (AbstractCommonList) res.readEntity(AbstractCommonList.class);
                 coListItems = commonListElement.getListItem();
             } finally {
-                response.releaseConnection();
+                res.close();
             }
 
             Date startTime = new Date();
@@ -350,18 +346,17 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      */
     private void deleteCollectionObjects() {
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        ClientResponse<AbstractCommonList> response;
 
         List<AbstractCommonList.ListItem> coListItems = null;
         do {
-            response = collectionObjectClient.readList(new Long(MAX_RECORDS),
+            Response res = collectionObjectClient.readList(new Long(MAX_RECORDS),
                     new Long(0));
             try {
                 AbstractCommonList commonListElement =
-                        (AbstractCommonList) response.getEntity(AbstractCommonList.class);
+                        (AbstractCommonList) res.readEntity(AbstractCommonList.class);
                 coListItems = commonListElement.getListItem();
             } finally {
-                response.releaseConnection();
+                res.close();
             }
 
             Date startTime = new Date();
index 9850d1ab9b1095157aeb3967cf29979437c682f0..79340c43d970a174b4782a7aba6312cb7a9f2580 100644 (file)
@@ -25,6 +25,7 @@ package org.collectionspace.services.account.client.test;
 import java.util.Collection;
 import java.util.Hashtable;
 import java.util.List;
+import java.lang.UnsupportedOperationException;
 
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
@@ -44,13 +45,12 @@ import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
 
 import javax.ws.rs.core.Response;
-import org.jboss.resteasy.client.ClientResponse;
 
+import org.jboss.resteasy.client.ClientResponse;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -85,6 +85,13 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
     protected String getServicePathComponent() {
         return new AccountRoleClient().getServicePathComponent();
     }
+    
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<AccountRole> getEntityResponseType() {
+       return AccountRole.class;
+    }
 
     /**
      * Seed data.
@@ -636,4 +643,10 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
        protected Class<AccountRole> getCommonListType() {
                return AccountRole.class;
        }
+
+       @Override
+       protected long getSizeOfList(AccountRole list) {
+               // TODO Auto-generated method stub
+               throw new UnsupportedOperationException("Method getSizeOfList() is not implemented because this service does not support lists.");
+       }
 }
index 28aa2aa133ea0241a2a56191868056aaf9460c95..2c39ac72b4209137608c84416361f521a0e26be7 100644 (file)
 package org.collectionspace.services.account.client.test;
 
 import java.util.List;
+
 import javax.ws.rs.core.Response;
-import org.jboss.resteasy.client.ClientResponse;
 
+import org.jboss.resteasy.client.ClientResponse;
 import org.collectionspace.services.client.AccountClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.account.AccountsCommon;
 import org.collectionspace.services.account.AccountsCommonList;
 import org.collectionspace.services.account.AccountListItem;
-
 import org.collectionspace.services.account.Status;
+import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.client.AccountFactory;
 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
 import org.collectionspace.services.client.test.ServiceRequestType;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -69,6 +68,13 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
         return AccountClient.SERVICE_NAME;
     }
     
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<AccountsCommon> getEntityResponseType() {
+       return AccountsCommon.class;
+    }
+    
     /*
      * This method is called only by the parent class, AbstractServiceTestImpl
      */
@@ -92,8 +98,7 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AccountsCommonList getCommonList(
-            ClientResponse<AccountsCommonList> response) {
+    protected AccountsCommonList getCommonList(Response response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
@@ -1074,4 +1079,9 @@ public class AccountServiceTest extends AbstractServiceTestImpl<AccountsCommonLi
                 "Data in updated object did not match submitted data.");
        }
        
+       @Override
+       protected long getSizeOfList(AccountsCommonList list) {
+               return list.getTotalItems();
+       }
+       
 }
index aaecd2c2e5e34de717cfda97d7aacab80f87b108..d79938806ba268a5d17871e73cfebd0ffb6ed26f 100644 (file)
@@ -93,8 +93,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
         */
        @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
                throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
        }
 
index 1f947f34e366789af979d7f0d9201032de6f981a..56fb58711e778882a81292ac5530662ea213e1b8 100644 (file)
@@ -288,27 +288,32 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
         AcquisitionClient client = new AcquisitionClient();
 
         // Submit the request to the service and store the response.
-        ClientResponse<String> res = client.read(knownResourceId);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.read(knownResourceId);
+        PoxPayloadIn input = null;
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if(logger.isDebugEnabled()){
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               input = new PoxPayloadIn((String)res.getEntity());
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+        
         AcquisitionsCommon acquisitionObject = (AcquisitionsCommon) extractPart(input,
                 client.getCommonPartName(), AcquisitionsCommon.class);
         Assert.assertNotNull(acquisitionObject);
 
         // Verify the number and contents of values in repeatable fields,
         // as created in the instance record used for testing.
-        List<String> acqSources =
-                acquisitionObject.getAcquisitionSources().getAcquisitionSource();
+        List<String> acqSources = acquisitionObject.getAcquisitionSources().getAcquisitionSource();
         Assert.assertTrue(acqSources.size() > 0);
         Assert.assertNotNull(acqSources.get(0));
 
@@ -335,7 +340,7 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -364,12 +369,12 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         try {
                // Check the status code of the response: does it match
                // the expected response(s)?
                assertStatusCode(res, testName);
-               AbstractCommonList list = res.getEntity();
+               AbstractCommonList list = res.readEntity(this.getCommonListType());
        
                // Optionally output additional data about list members for debugging.
                if (logger.isTraceEnabled() == true){
@@ -377,7 +382,7 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -402,13 +407,18 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Retrieve the contents of a resource to update.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": read status = " + res.getStatus());
+        Response res = client.read(knownResourceId);
+        PoxPayloadIn input = null;
+        try {
+               if(logger.isDebugEnabled()){
+                   logger.debug(testName + ": read status = " + res.getStatus());
+               }
+               Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
+       
+               input = new PoxPayloadIn((String)res.getEntity());
+        } finally {
+               res.close();
         }
-        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
 
         AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
                 client.getCommonPartName(), AcquisitionsCommon.class);
@@ -426,24 +436,28 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
         commonPart.setLabel(client.getCommonPartName());
 
         res = client.update(knownResourceId, output);
-        int statusCode = res.getStatus();
-        // Check the status code of the response: does it match the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               int statusCode = res.getStatus();
+               // Check the status code of the response: does it match the expected response(s)?
+               if(logger.isDebugEnabled()){
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               input = new PoxPayloadIn((String)res.getEntity());
+               AcquisitionsCommon updatedAcquisition =
+                       (AcquisitionsCommon) extractPart(input,
+                               client.getCommonPartName(), AcquisitionsCommon.class);
+               Assert.assertNotNull(updatedAcquisition);
+       
+               Assert.assertEquals(updatedAcquisition.getAcquisitionReferenceNumber(),
+                       acquisition.getAcquisitionReferenceNumber(),
+                       "Data in updated object did not match submitted data.");
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        input = new PoxPayloadIn(res.getEntity());
-        AcquisitionsCommon updatedAcquisition =
-                (AcquisitionsCommon) extractPart(input,
-                        client.getCommonPartName(), AcquisitionsCommon.class);
-        Assert.assertNotNull(updatedAcquisition);
-
-        Assert.assertEquals(updatedAcquisition.getAcquisitionReferenceNumber(),
-                acquisition.getAcquisitionReferenceNumber(),
-                "Data in updated object did not match submitted data.");
 
     }
 
@@ -607,18 +621,21 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
         // The only relevant ID may be the one used in update(), below.
         AcquisitionClient client = new AcquisitionClient();
         PoxPayloadOut multipart = createAcquisitionInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res =
-            client.update(NON_EXISTENT_ID, multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if(logger.isDebugEnabled()){
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if(logger.isDebugEnabled()){
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -851,13 +868,13 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<String> res = client.read(csid);
+        Response res = client.read(csid);
         AcquisitionsCommon acquisition = null;
         try {
                // Check the status code of the response: does it match
                // the expected response(s)?
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
        
                if (logger.isDebugEnabled()) {
                    logger.debug(testName + ": Reading Common part ...");
@@ -867,7 +884,7 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
                Assert.assertNotNull(acquisition);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
index 78649e079ab2fd067c0494026d968c3f3a43a7c9..9599b45a58bbd91c50ecc1dca8e4895a1348a944 100644 (file)
@@ -95,7 +95,14 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
        protected String getServiceName() {
        return PermissionClient.SERVICE_NAME; //Since we're a sub-resource of permission service return its name?
        }
-
+       
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<PermissionRole> getEntityResponseType() {
+       return PermissionRole.class;
+    }
+       
     /**
      * Seed data.
      */
@@ -149,8 +156,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected PermissionRole getCommonList(
-            ClientResponse<PermissionRole> response) {
+    protected PermissionRole getCommonList(Response response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
@@ -201,7 +207,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
             }
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -725,5 +731,11 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
                        "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
     public void CRUDTests(String testName) {
        // Do nothing.  Simply here to for a TestNG execution order for our tests
-    }  
+    }
+    
+       @Override
+       protected long getSizeOfList(PermissionRole list) {
+               // TODO Auto-generated method stub
+               throw new UnsupportedOperationException("Method getSizeOfList() is not implemented because this service does not support lists.");
+       }
 }
index 4d2e26365e93255c5bfbfe1e46ea0913fc7af79a..5fceb11767eefe6dcee9759ee36bf65579698e94 100644 (file)
@@ -82,6 +82,13 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
         return new PermissionClient();
     }
 
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<Permission> getEntityResponseType() {
+       return Permission.class;
+    }
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
      */
@@ -428,4 +435,10 @@ public class PermissionServiceTest extends AbstractServiceTestImpl<PermissionsLi
                // TODO Auto-generated method stub
                
        }
+
+       @Override
+       protected long getSizeOfList(PermissionsList list) {
+               // TODO Auto-generated method stub
+               return list.getPermission().size();
+       }
 }
index 23f9794c27aca941aa64c79dca80a32b389c1388..d84730d53fbdfd882381f2d204ede0f666a06d8f 100644 (file)
@@ -95,6 +95,13 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
         return TEST_ROLE_NAME + TEST_MARKER + now.toString();
     }
 
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<PermissionRole> getEntityResponseType() {
+       return PermissionRole.class;
+    }
+    
     /**
      * Seed data.
      */
@@ -707,6 +714,12 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
        return roleValues.get(getRoleName()).getRoleId();
     }
        
+       @Override
+       protected long getSizeOfList(PermissionRole permRole) {
+               // TODO Auto-generated method stub
+               throw new UnsupportedOperationException("Method getSizeOfList() is not implemented because this service does not support lists.");
+       }
+    
     /*
      * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
      * refer to this method in their @Test annotation declarations.
index c6842fb98c0aa65deffa38a3123a3a27bc057451..25fcdd2230b53a7ed67ad9dbc90670803597dc92 100644 (file)
@@ -71,6 +71,13 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
         return new RoleClient().getServicePathComponent();
     }
 
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<Role> getEntityResponseType() {
+       return Role.class;
+    }
+    
     /* (non-Javadoc)
      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
      */
@@ -902,5 +909,10 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
                        "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
     public void CRUDTests(String testName) {
        // Do nothing.  Simply here to for a TestNG execution order for our tests
-    }  
+    }
+
+       @Override
+       protected long getSizeOfList(RolesList list) {
+               return list.getRole().size();
+       }       
 }
index 96a88e2967e9dad864286eb661bbbafe88666f97..7c4fbe7f399338768812df63d873b757f36ceea0 100644 (file)
@@ -85,7 +85,7 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 984a4be49977089cff4034f9b3682bbaed4b3503..0f8f633eadf0a398596ac4dac1876e959454e952 100644 (file)
@@ -89,8 +89,8 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     /**
@@ -157,7 +157,7 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
                                            }
                                        } finally {
                                                if (res != null) {
-                                       res.releaseConnection();
+                                       res.close();
                                    }
                                        }
                                }
@@ -198,14 +198,14 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
                }
                } finally {
                        if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
                }
         //
                // Read the blob back to get the new dimension data
                //
         setupRead();
-        ClientResponse<String> readResponse = client.read(blobCsid);
+        Response readResponse = client.read(blobCsid);
         BlobsCommon blobsCommon = null;
         try {
                assertStatusCode(readResponse, testName);
@@ -213,7 +213,7 @@ public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonLi
             Assert.assertNotNull(blobsCommon);
         } finally {
                if (readResponse != null) {
-                       readResponse.releaseConnection();
+                       readResponse.close();
             }
         }
         
index 85cbcb0fc71f0441e37d3cccef44596ffbef6357..cdd26cd35d35b93e787715455f27e9165f4dd4ad 100644 (file)
@@ -23,13 +23,13 @@ public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonLis
         return getProxy().read(csid);
     }
     
-    public ClientResponse<CLT> readList() {
+    public Response readList() {
        CollectionSpaceProxy<CLT> proxy = (CollectionSpaceProxy<CLT>)getProxy();
        return proxy.readList();
     }    
     
     @Override
-    public ClientResponse<CLT> readIncludeDeleted(Boolean includeDeleted) {
+    public Response readIncludeDeleted(Boolean includeDeleted) {
        CollectionSpacePoxProxy<CLT> proxy = getProxy();
        return proxy.readIncludeDeleted(includeDeleted.toString());
     }
@@ -40,7 +40,7 @@ public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonLis
     }
 
     @Override
-    public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload) {
+    public Response update(String csid, PoxPayloadOut xmlPayload) {
         return getProxy().update(csid, xmlPayload.getBytes());
     }
     
index 69e24e09f220f639745195fd73023b8e1dfc9291..8304dfc89ec4d48d9734757d7a10e47bd0b387c3 100644 (file)
@@ -552,7 +552,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * .lang.String, java.lang.String)
      */
     @Override
-    public ClientResponse<CLT> readList(Long pageSize,
+    public Response readList(Long pageSize,
                Long pageNumber) {
         return getProxy().readList(pageSize, pageNumber);
     }
@@ -565,7 +565,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * .lang.String, java.lang.String)
      */
     @Override
-    public ClientResponse<CLT> readList(String sortBy, Long pageSize,
+    public Response readList(String sortBy, Long pageSize,
             Long pageNumber) {
         return getProxy().readList(sortBy, pageSize, pageNumber);
     }
index d88554a848bfbe0e5d98e472ada4e5a5ac23e132..298751101c7fcd202062a8486ff3d6198fecdd93 100644 (file)
@@ -182,7 +182,7 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
        
        public Response read(String csid);
 
-    public ClientResponse<RESPONSE_TYPE> update(String csid, REQUEST_TYPE payload);
+    public Response update(String csid, REQUEST_TYPE payload);
        
     /**
      * Read list.
@@ -191,11 +191,11 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
      * @param pageNumber the page number
      * @return the client response
      */
-    public ClientResponse<CLT> readList(
+    public Response readList(
                Long pageSize,
                Long pageNumber);
     
-    public ClientResponse<CLT> readList();
+    public Response readList(); // Formally, ClientResponse<CLT>
 
     /**
      * Read list.
@@ -205,7 +205,7 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
      * @param pageNumber the page number
      * @return the client response
      */
-    public ClientResponse<CLT> readList(
+    public Response readList(
             String sortBy,
             Long pageSize,
             Long pageNumber);
index a1f470806eb516a7de7f038e84d6585a2c789c35..95f2edfd0fe23171fbfe67181b40922471fb6759 100644 (file)
@@ -3,6 +3,7 @@ package org.collectionspace.services.client;
 import javax.ws.rs.GET;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -10,7 +11,7 @@ import org.jboss.resteasy.client.ClientResponse;
 
 public interface CollectionSpaceCommonListPoxProxy extends CollectionSpacePoxProxy<AbstractCommonList> {
     @GET
-    ClientResponse<AbstractCommonList> readList();
+    Response readList();
     
     @Override
        @GET
index 676e4ad238a91436467435e844bffcf547e722f2..0efbfb9c242d335668e36cfa388b11c8c85e6eae 100644 (file)
@@ -1,5 +1,7 @@
 package org.collectionspace.services.client;
 
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -14,12 +16,12 @@ public interface CollectionSpacePoxClient<LT extends AbstractCommonList, P exten
         * Common service calls
         */
     
-    public ClientResponse<String> readIncludeDeleted(String csid, Boolean includeDeleted);    
+    public Response readIncludeDeleted(String csid, Boolean includeDeleted);    
 
     /*
      * GET list with workflow 'deleted' state
      */
-    public ClientResponse<LT> readIncludeDeleted(Boolean includeDeleted);
+    public Response readIncludeDeleted(Boolean includeDeleted);
 
     public ClientResponse<LT> keywordSearchIncludeDeleted(String keywords, Boolean includeDeleted);
     
index 0b2b6e800de34e62d9d714579baa0aa8d6c865fa..3f17a9f20bcccdf00ef5c8f21b62bc52174b6a31 100644 (file)
@@ -35,12 +35,12 @@ public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends
        // (U)pdate
        @PUT
        @Path("/{csid}")
-       ClientResponse<String> update(@PathParam("csid") String csid, byte[] payload);
+       Response update(@PathParam("csid") String csid, byte[] payload);
 
        // (L)ist non-deleted items
        @GET
        @Produces({ "application/xml" })
-       ClientResponse<LT> readIncludeDeleted(
+       Response readIncludeDeleted(
                        @QueryParam(WorkflowClient.WORKFLOWSTATE_QUERY) String workflowState);
 
        /**
index 40b6201f71df6177e4747f2a5fbca5cd4b6c29b9..0532b507a5a9d09fae9fb9116abe8f70383fb57e 100644 (file)
@@ -76,7 +76,7 @@ public interface CollectionSpaceProxy<CLT> {
     
     @GET
     @Produces({"application/xml"})
-    ClientResponse<CLT> readList();
+    Response readList();
     
     /**
      * Read list.
@@ -87,7 +87,7 @@ public interface CollectionSpaceProxy<CLT> {
      */
     @GET
     @Produces({"application/xml"})
-    ClientResponse<CLT> readList(
+    Response readList(
             @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize,
            @QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber);
         
@@ -101,7 +101,7 @@ public interface CollectionSpaceProxy<CLT> {
      */
     @GET
     @Produces({"application/xml"})
-    ClientResponse<CLT> readList(
+    Response readList(
             @QueryParam(IClientQueryParams.ORDER_BY_PARAM) String sortBy,
             @QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize,
            @QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber);    
index 08578f359f70b8a49ae8fe8e874d8f25ce529419..7bd15d44c8957150b8a25b90b841b8a79b172ac4 100644 (file)
@@ -134,48 +134,58 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
        // Submit the request to the service and store the response.
         AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = 
                        (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
-       ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-       int statusCode = res.getStatus();
-
-       // Check the status code of the response: does it match
-       // the expected response(s)?
-       if (logger.isDebugEnabled()) {
-               logger.debug(testName + " read authority:" + knownResourceId + "/Item:"
-                               + knownItemResourceId + " status = " + statusCode);
-       }
-       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-       Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode());
-
-        AUTHORITY_ITEM_TYPE vitem = extractItemCommonPartValue(res);
-       Assert.assertNotNull(vitem);
-       // Try to Update with new parent vocab (use self, for test).
-       Assert.assertEquals(client.getInAuthority(vitem), knownResourceId,
-                       "VocabularyItem inAuthority does not match knownResourceId.");
-       client.setInAuthority(vitem, knownItemResourceId);
+       Response res = client.readItem(knownResourceId, knownItemResourceId);
+       AUTHORITY_ITEM_TYPE vitem = null;
+       try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                       logger.debug(testName + " read authority:" + knownResourceId + "/Item:"
+                                       + knownItemResourceId + " status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode());
+       
+               vitem = extractItemCommonPartValue(res);
+               Assert.assertNotNull(vitem);
+               // Try to Update with new parent vocab (use self, for test).
+               Assert.assertEquals(client.getInAuthority(vitem), knownResourceId,
+                               "VocabularyItem inAuthority does not match knownResourceId.");
+               client.setInAuthority(vitem, knownItemResourceId);
 
+       } finally {
+               res.close();
+       }
+       
        // Submit the updated resource to the service and store the response.
         PoxPayloadOut output = this.createItemRequestTypeInstance(vitem);
        res = client.updateItem(knownResourceId, knownItemResourceId, output);
-       statusCode = res.getStatus();
-
-       // Check the status code of the response: does it match the expected response(s)?
-       if (logger.isDebugEnabled()) {
-               logger.debug(testName + ": status = " + statusCode);
+       try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                       logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               // Retrieve the updated resource and verify that the parent did not change
+               res = client.readItem(knownResourceId, knownItemResourceId);
+               AUTHORITY_ITEM_TYPE updatedVocabularyItem = extractItemCommonPartValue(res);
+               Assert.assertNotNull(updatedVocabularyItem);
+       
+               // Verify that the updated resource received the correct data.
+               Assert.assertEquals(client.getInAuthority(updatedVocabularyItem),
+                               knownResourceId,
+                               "VocabularyItem allowed update to the parent (inAuthority).");
+       } finally {
+               res.close();
        }
-       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-       Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-       // Retrieve the updated resource and verify that the parent did not change
-       res = client.readItem(knownResourceId, knownItemResourceId);
-        AUTHORITY_ITEM_TYPE updatedVocabularyItem = extractItemCommonPartValue(res);
-       Assert.assertNotNull(updatedVocabularyItem);
-
-       // Verify that the updated resource received the correct data.
-       Assert.assertEquals(client.getInAuthority(updatedVocabularyItem),
-                       knownResourceId,
-                       "VocabularyItem allowed update to the parent (inAuthority).");
     }
     
     @Test(dataProvider = "testName",
@@ -220,19 +230,23 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         // Submit the request to the service and store the response.
         AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
         ClientResponse<String> res = client.readByName(getKnowResourceIdentifier());
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+               
+               AUTHORITY_COMMON_TYPE commonPart = extractCommonPartValue(res);
+               Assert.assertNotNull(commonPart);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-        
-        AUTHORITY_COMMON_TYPE commonPart = extractCommonPartValue(res);
-        Assert.assertNotNull(commonPart);
     }
     
     /**
@@ -242,10 +256,11 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
      * @return
      * @throws Exception
      */
-       public AUTHORITY_ITEM_TYPE extractItemCommonPartValue(ClientResponse<String> res) throws Exception {
+       public AUTHORITY_ITEM_TYPE extractItemCommonPartValue(Response res) throws Exception {
                AUTHORITY_ITEM_TYPE result = null;
                
-        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)
+                       this.getClientInstance();
                PayloadInputPart payloadInputPart = extractPart(res, client.getItemCommonPartName());
                if (payloadInputPart != null) {
                        result = (AUTHORITY_ITEM_TYPE) payloadInputPart.getBody();
@@ -263,18 +278,23 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         setupReadNonExistent();
 
         // Submit the request to the service and store the response.
-        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
-        ClientResponse<String> res = client.readItem(knownResourceId, NON_EXISTENT_ID);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)
+                       this.getClientInstance();
+        Response res = client.readItem(knownResourceId, NON_EXISTENT_ID);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
        
     @Test(dataProvider = "testName",
@@ -285,22 +305,26 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
 
         // Submit the request to the service and store the response.
         AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               AUTHORITY_ITEM_TYPE itemCommonPart = extractItemCommonPartValue(res);
+               Assert.assertNotNull(itemCommonPart);
+               Assert.assertEquals(client.getInAuthority(itemCommonPart), knownResourceId);
+               verifyReadItemInstance(itemCommonPart);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        AUTHORITY_ITEM_TYPE itemCommonPart = extractItemCommonPartValue(res);
-        Assert.assertNotNull(itemCommonPart);
-        Assert.assertEquals(client.getInAuthority(itemCommonPart), knownResourceId);
-        verifyReadItemInstance(itemCommonPart);
     }
     
     protected abstract void verifyReadItemInstance(AUTHORITY_ITEM_TYPE item) throws Exception;
@@ -312,7 +336,8 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         setupDelete();
 
         // Submit the request to the service and store the response.
-        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
+        AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client = (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)
+                       this.getClientInstance();
         Response res = client.deleteItem(knownResourceId, knownItemResourceId);
         int statusCode;
         try {
@@ -440,8 +465,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
         // Retrieve the contents of a resource to update.
         AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy> client =
                        (AuthorityClientImpl<AUTHORITY_ITEM_TYPE, AuthorityProxy>)this.getClientInstance();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         try {
                if (logger.isDebugEnabled()) {
                    logger.debug(testName + ": read status = " + res.getStatus());
@@ -463,7 +487,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
                                + objectAsXmlString(theUpdate));
                }
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
         // Submit the updated resource to the service and store the response.
@@ -486,7 +510,7 @@ public abstract class AbstractAuthorityServiceTest<AUTHORITY_COMMON_TYPE, AUTHOR
 
                compareUpdatedItemInstances(theUpdate, updatedVocabularyItem);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
     
index b4c1abce2779298a9bf9e8c949ddb22f3f7a39cc..c19f9de7e013f9515bd25a1dfe525231d6c087bd 100644 (file)
@@ -39,6 +39,18 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);
         }
     }
+    
+    @Override
+    protected long getSizeOfList(CLT list) {
+       return list.getTotalItems();            
+    }
+    
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<String> getEntityResponseType() {
+       return String.class;
+    }
        
        @Override
     public CPT extractCommonPartValue(PoxPayloadOut payloadOut) throws Exception {
@@ -53,8 +65,8 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
                 "Part or body of part " + client.getCommonPartName() + " was unexpectedly null.");
         
        return result;
-    }  
-       
+    }
+               
        @Override
        public PoxPayloadOut createRequestTypeInstance(CPT commonPartTypeInstance) {
                PoxPayloadOut result = null;
@@ -72,7 +84,7 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
             if (getLogger().isDebugEnabled()) {
                getLogger().debug("Reading part " + partLabel + " ...");
             }
-            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.readEntity(getEntityResponseType()));
             PayloadInputPart payloadInputPart = input.getPart(partLabel);
             Assert.assertNotNull(payloadInputPart,
                     "Part " + partLabel + " was unexpectedly null.");
index 6b6514d9b0571910f982e71249776eaaf688d72a..8c1e9b02ef8042eb8c87d1d3ed13e3554de6b5c7 100644 (file)
@@ -24,6 +24,8 @@
 package org.collectionspace.services.client.test;
 
 import java.io.File;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.TypeVariable;
 
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.workflow.WorkflowCommon;
@@ -35,13 +37,12 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.jboss.resteasy.client.ClientResponse;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
 
 /**
@@ -177,7 +178,10 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
        return result;
     }
     
-    @Override
+       abstract public Class<RESPONSE_TYPE> getEntityResponseType();
+    
+    @SuppressWarnings("unchecked")
+       @Override
     @Test(dataProvider = "testName", dependsOnMethods = {"create"})    
     public void read(String testName) throws Exception {
         // Perform setup.
@@ -197,9 +201,6 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
                Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                        invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, testExpectedStatusCode);
-       
-               RESPONSE_TYPE output = (RESPONSE_TYPE) res.getEntity();
-               Assert.assertNotNull(output);
                
                //
                // Now compare with the expected field values
@@ -294,7 +295,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     
     public CPT extractCommonPartValue(Response res) throws Exception {
        CPT result = null;
-       result = (CPT) res.getEntity();
+       result = (CPT) res.readEntity(getEntityResponseType());
        return result;
     }
     
@@ -444,8 +445,8 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
 
         // Submit the request to the service and store the response.
         CollectionSpaceClient client = this.getClientInstance();
-        ClientResponse<CLT> res = client.readList();
-        CLT list = res.getEntity();
+        Response res = client.readList();
+        CLT list = res.readEntity(this.getCommonListType());
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -569,7 +570,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
             int result = 0;
             while (trials < 30) {
                    CollectionSpacePoxClient client = this.assertPoxClient();
-                   ClientResponse<String> res = client.readIncludeDeleted(csid, Boolean.FALSE);
+                   Response res = client.readIncludeDeleted(csid, Boolean.FALSE);
                    result = res.getStatus();
                    if (result == STATUS_NOT_FOUND) {
                        logger.info("Workflow transition to 'deleted' is complete");
@@ -609,8 +610,9 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
             result = 0;
             while (trials < 30) {
                    CollectionSpacePoxClient client = this.assertPoxClient();
-                   ClientResponse<String> res = client.readIncludeDeleted(csid, Boolean.FALSE);
+                   Response res = client.readIncludeDeleted(csid, Boolean.FALSE);
                    result = res.getStatus();
+                   res.close();
                    if (result == STATUS_OK) {
                        logger.info("Workflow transition to 'project' is complete");
                        break;
@@ -755,18 +757,21 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
        // The only relevant ID may be the one used in update(), below.
         CollectionSpaceClient client = this.getClientInstance();
        REQUEST_TYPE multipart = createNonExistenceInstance(client.getCommonPartName(), NON_EXISTENT_ID);
-       ClientResponse<String> res =
-                       client.update(NON_EXISTENT_ID, multipart);
-       int statusCode = res.getStatus();
-
-       // Check the status code of the response: does it match
-       // the expected response(s)?
-       if (logger.isDebugEnabled()) {
-               logger.debug(testName + ": status = " + statusCode);
+       Response res = client.update(NON_EXISTENT_ID, multipart);
+       try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                       logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       } finally {
+               res.close();
        }
-       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-       Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
     
     // ---------------------------------------------------------------
@@ -812,8 +817,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
             long pageSize,
             long pageNumber,
             int expectedStatus) throws Exception {
-        ClientResponse<CLT> response =
-                client.readList(sortBy, pageSize, pageNumber);
+        Response response = client.readList(sortBy, pageSize, pageNumber);
         CLT result = null;
         try {
             int statusCode = response.getStatus();
@@ -827,7 +831,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
 
             result = this.getCommonList(response);
         } finally {
-            response.releaseConnection();
+            response.close();
         }
 
         return result;
@@ -956,7 +960,15 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         }
         return (CollectionSpacePoxClient) clientCandidate;
     }
+    
+    /*
+     * Must be overridden for CTL param
+     */
+    abstract protected long getSizeOfList(CLT list);
 
+    /*
+     * Return the number of items including those soft-deleted.
+     */
     protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
        long result = 0;
        // Perform setup.
@@ -966,21 +978,21 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
        // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
        //
        CollectionSpacePoxClient client = assertPoxClient();
-       ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
+       Response res = client.readIncludeDeleted(includeDeleted);
        try {
                //
                // Check the status code of the response: does it match
                // the expected response(s)?
                //
                assertStatusCode(res, testName);
-               AbstractCommonList list = res.getEntity();
+               CLT list = res.readEntity(getCommonListType());
                //
                // Now check that list size is correct
                //
-               result = list.getTotalItems();
+               result = getSizeOfList(list); //list.getTotalItems();
        } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
        }
 
index ff776163fadb222c9bf8f63145628b672a099a6a..16a2564e01c37e884fa02c2c0fc10e797e7faa21 100644 (file)
@@ -190,9 +190,8 @@ public abstract class BaseServiceTest<CLT> {
        return (Class<CLT>)AbstractCommonList.class;
     }
 
-    protected CLT getCommonList(
-            ClientResponse<CLT> response) {
-        return response.getEntity(getCommonListType());
+    protected CLT getCommonList(Response response) {
+        return response.readEntity(getCommonListType());
     }
     
     /**
index 609a27914a9791325dbf33c85e60b0e8fa28804e..630a02fafebc6134146da5a6788e9b9e178afb7e 100644 (file)
@@ -534,10 +534,10 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @param id the id
      * @return the client response
      */
-    private ClientResponse<String> updateRetrieve(String testName, String id) {
+    private Response updateRetrieve(String testName, String id) {
         setupRead();
         CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         int statusCode = res.getStatus();
         // Check the status code of the response: does it match
         // the expected response(s)?
@@ -561,14 +561,15 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @param id the id
      * @return the client response
      */
-    private ClientResponse<String> updateSend(String testName, String id,
+    private Response updateSend(String testName, String id,
             CollectionobjectsCommon collectionObjectCommon) {
         setupUpdate();
         PoxPayloadOut output = new PoxPayloadOut(CollectionObjectClient.SERVICE_PAYLOAD_NAME);
         PayloadOutputPart commonPart = output.addPart(collectionObjectCommon, MediaType.APPLICATION_XML_TYPE);
         CollectionObjectClient client = new CollectionObjectClient();
         commonPart.setLabel(client.getCommonPartName());
-        ClientResponse<String> res = client.update(knownResourceId, output);
+        
+        Response res = client.update(knownResourceId, output);
         int statusCode = res.getStatus();
         // Check the status code of the response: does it match
         // the expected response(s)?
@@ -578,7 +579,8 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
         Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                 invalidStatusCodeMessage(testRequestType, statusCode));
         Assert.assertEquals(statusCode, testExpectedStatusCode);
-        return res;
+        
+        return res; // Calling needs to make sure they call res.close();
     }
 
     // Failure outcomes
@@ -720,17 +722,20 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
         CollectionObjectClient client = new CollectionObjectClient();
         PoxPayloadOut multipart =
                 createInstance(client.getCommonPartName(), NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
+        try {
+               int statusCode = res.getStatus();
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
    /**
@@ -751,7 +756,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
                dependsOnMethods = {"CRUDTests"})
     public void updateWithRequiredValuesNullOrEmpty(String testName) throws Exception {
         // Read an existing record for updating.
-        ClientResponse<String> res = updateRetrieve(testName, knownResourceId);
+        Response res = updateRetrieve(testName, knownResourceId);
         CollectionobjectsCommon collectionObjectCommon = null;
         try {
                // Extract its common part.
@@ -1150,7 +1155,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<String> res = client.read(csid);
+        Response res = client.read(csid);
         CollectionobjectsCommon collectionObject = null;
         try {
                int statusCode = res.getStatus();
index 566e78f4f49c97004bea74365b139dd20bbbb8db..5d8df6075adc3ef30a1bb303033a354ef2d3b0d2 100644 (file)
@@ -86,8 +86,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 64f7ed344285ce49448d646e599d23e87f6a51d3..dff89419e605e0757204415ade45c402ee83fd57 100644 (file)
@@ -78,9 +78,8 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
@@ -263,14 +262,14 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
         // Submit the request to the service and store the response.
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -323,7 +322,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
         // Submit the request to the service and store the response.
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -337,7 +336,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -361,7 +360,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
         // Submit the request to the service and store the response.
         AbstractCommonList list = null;
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         assertStatusCode(res, testName);
         try {
             int statusCode = res.getStatus();
@@ -375,10 +374,10 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-            list = res.getEntity();
+            list = res.readEntity(getCommonListType());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -411,17 +410,17 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
         // Retrieve the contents of a resource to update.
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
             if (logger.isDebugEnabled()) {
                 logger.debug("got object to update with ID: " + knownResourceId);
             }
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -461,10 +460,10 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -509,7 +508,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
         // The only relevant ID may be the one used in update(), below.
         ConditioncheckClient client = new ConditioncheckClient();
         PoxPayloadOut multipart = createConditioncheckInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -523,7 +522,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index a9e0b0ff390a9137351669440d8460f3d468ac0f..20fed2f854a23fb5dd001d4cb8d9ce9ee8c70f99 100644 (file)
@@ -83,9 +83,8 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
 //    @Override
@@ -277,16 +276,16 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                ContactsCommon contact = (ContactsCommon) extractPart(input,
                        client.getCommonPartName(), ContactsCommon.class);
                Assert.assertNotNull(contact);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -304,10 +303,10 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         try {
                assertStatusCode(res, testName);
-               AbstractCommonList list = res.getEntity();
+               AbstractCommonList list = res.readEntity(getCommonListType());
        
                // Optionally output additional data about list members for debugging.
                boolean iterateThroughList = false;
@@ -316,7 +315,7 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -337,7 +336,7 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
         // First read the object that will be updated
         //
         ContactClient client = new ContactClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         ContactsCommon contact = null;
         try {
                assertStatusCode(res, testName);
@@ -345,13 +344,13 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
                if (logger.isDebugEnabled()) {
                    logger.debug("got object to update with ID: " + knownResourceId);
                }
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                contact = (ContactsCommon) extractPart(input,
                        client.getCommonPartName(), ContactsCommon.class);
                Assert.assertNotNull(contact);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -401,13 +400,13 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
         ContactsCommon updatedContact = null;
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                updatedContact = (ContactsCommon) extractPart(input,
                        client.getCommonPartName(), ContactsCommon.class);
                Assert.assertNotNull(updatedContact);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -545,18 +544,22 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
         ContactClient client = new ContactClient();
         PoxPayloadOut multipart =
                 ContactClientUtils.createContactInstance(NON_EXISTENT_ID, client.getCommonPartName());
-        ClientResponse<String> res =
+        Response res =
                 client.update(NON_EXISTENT_ID, multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
index 92c04129573465c054f8ea501db6dd11281b3ec0..c793cd5105fd6a809ccc7dbe0348636e23f2d14a 100644 (file)
@@ -26,6 +26,8 @@
  */
 package org.collectionspace.services.client;
 
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.dimension.DimensionsCommonList;
 import org.jboss.resteasy.client.ClientResponse;
 
@@ -60,7 +62,7 @@ public class DimensionClient extends AbstractPoxServiceClientImpl<DimensionsComm
         * Proxied service calls
         */
        
-    public ClientResponse<DimensionsCommonList> readList() {
+    public Response readList() {
        DimensionProxy proxy = (DimensionProxy)getProxy();
        return proxy.readList();
     }  
index b3a848674a457c0f45d38ba6eb7c41482f356d95..64ac3dfeafc520cf5a8562fbb13ff198db285bb5 100644 (file)
@@ -5,6 +5,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.dimension.DimensionsCommonList;
@@ -19,7 +20,7 @@ import org.jboss.resteasy.client.ClientResponse;
 public interface DimensionProxy extends CollectionSpacePoxProxy<DimensionsCommonList> {
     @GET
     @Produces({"application/xml"})
-    ClientResponse<DimensionsCommonList> readList();
+    Response readList();
 
        @Override
        @GET
index a7451657a42b7b32c02eea7ba4eda61b3cab2f72..9a08e4c14427be6565b0f992d81e99fae4fd7254 100644 (file)
@@ -68,9 +68,8 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
@@ -253,14 +252,14 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
         // Submit the request to the service and store the response.
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -301,7 +300,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
         // Submit the request to the service and store the response.
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -315,7 +314,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -339,7 +338,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
         // Submit the request to the service and store the response.
         AbstractCommonList list = null;
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         assertStatusCode(res, testName);
         try {
             int statusCode = res.getStatus();
@@ -353,10 +352,10 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-            list = res.getEntity();
+            list = res.readEntity(getCommonListType());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -389,17 +388,17 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
         // Retrieve the contents of a resource to update.
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
             if (logger.isDebugEnabled()) {
                 logger.debug("got object to update with ID: " + knownResourceId);
             }
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -439,10 +438,10 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -487,7 +486,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
         // The only relevant ID may be the one used in update(), below.
         ExhibitionClient client = new ExhibitionClient();
         PoxPayloadOut multipart = createExhibitionInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -501,7 +500,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 2acd4f4c6d39f63909f8772ff54f0f5d48007b81..7253152f1f7276e3e638fb0801bf3b1a120e3c04 100644 (file)
@@ -71,8 +71,8 @@ public class GroupServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
index 83f154f7e4c7784877f918819e0bb5d7f65381f8..6c60884fba84825919a48f715cb0a38716faeb18 100644 (file)
@@ -102,8 +102,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 08f7ac1bafd5e7042c4925857111fa419f10f1d3..237e090f0cc6a92511b305369b96622c580e659c 100644 (file)
 package org.collectionspace.services.client.test;
 
 import java.util.List;
+
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 
 import org.dom4j.Element;
-
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.IntakeClient;
 import org.collectionspace.services.client.PayloadInputPart;
@@ -40,11 +41,9 @@ import org.collectionspace.services.intake.CurrentLocationGroup;
 import org.collectionspace.services.intake.CurrentLocationGroupList;
 import org.collectionspace.services.intake.IntakesCommon;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.jboss.resteasy.client.ClientResponse;
 import org.testng.Assert;
 import org.testng.annotations.Test;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -264,13 +263,19 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Retrieve the contents of a resource to update.
         IntakeClient client = new IntakeClient();
-        ClientResponse<String> res = client.read(knownResourceId);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": read status = " + res.getStatus());
+        PoxPayloadIn input = null;
+        Response res = client.read(knownResourceId);
+        try {
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": read status = " + res.getStatus());
+               }
+               Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
+       
+               input = new PoxPayloadIn((String)res.getEntity());
+        } finally {
+               res.close();
         }
-        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
-
-        PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+        
         PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
         Element coreAsElement = null;
         if (payloadInputPart != null) {
@@ -307,21 +312,25 @@ public class IntakeServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Create an output payload to send to the service, and add the common part
         PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart corePart = output.addPart(
-                                               COLLECTIONSPACE_CORE_SCHEMA, coreAsElement);
+        PayloadOutputPart corePart = output.addPart(COLLECTIONSPACE_CORE_SCHEMA, coreAsElement);
         
         // Submit the request to the service and store the response.
         res = client.update(knownResourceId, output);
-        int statusCode = res.getStatus();
-        // Check the status code of the response: does it match the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        input = new PoxPayloadIn(res.getEntity());
+           try {
+               int statusCode = res.getStatus();
+               // Check the status code of the response: does it match the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               input = new PoxPayloadIn((String)res.getEntity());
+           } finally {
+               res.close();
+           }
+               
         PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
         Element updatedCoreAsElement = null;
         if (updatedCorePart != null) {
index 1f92cf1d00c778c8e3f2449c192b214a61ae8329..271d12c8533b9d8416eb28d7f855e61fc1b1f672 100644 (file)
@@ -104,8 +104,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 04f2c29785ae34af11e0da2150f57fdc410db3b2..f041f85a0641db41b8e626776b998fcab7745d7d 100644 (file)
@@ -105,8 +105,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 9432dfbc9e528b7841f9f0910db13c155b38f210..ce1afdfe48d7b639c9cae6e50b3a994e4e26991a 100644 (file)
@@ -95,8 +95,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 6d4df126d08e7a577eccca83ffc17b292d810406..3bacb0a2dbba34e0939dac1600f881a3e791d36f 100644 (file)
@@ -78,9 +78,8 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
@@ -263,14 +262,14 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Submit the request to the service and store the response.
         LoaninClient client = new LoaninClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -315,7 +314,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Submit the request to the service and store the response.
         LoaninClient client = new LoaninClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -329,7 +328,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -353,7 +352,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
         // Submit the request to the service and store the response.
         AbstractCommonList list = null;
         LoaninClient client = new LoaninClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         assertStatusCode(res, testName);
         try {
             int statusCode = res.getStatus();
@@ -367,10 +366,10 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-            list = res.getEntity();
+            list = res.readEntity(getCommonListType());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -403,17 +402,17 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Retrieve the contents of a resource to update.
         LoaninClient client = new LoaninClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
                assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
                if (logger.isDebugEnabled()) {
                 logger.debug("got object to update with ID: " + knownResourceId);
             }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -450,10 +449,10 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -494,7 +493,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
         // The only relevant ID may be the one used in update(), below.
         LoaninClient client = new LoaninClient();
         PoxPayloadOut multipart = createLoaninInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -508,7 +507,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 3db9abf68058c7751d19205e2bc6b70c22a895d7..03e44064974c5d79a1875f86ec7c66b908d6ded4 100644 (file)
@@ -97,8 +97,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 95a873b9d00ca16b0f974ac69bf6e590c2a6076a..b7397abe610244f277cfa96afaabe3ed5174ab4e 100644 (file)
@@ -74,9 +74,8 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
@@ -277,12 +276,12 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         LoansoutCommon loanoutCommon = null;
         try {
                assertStatusCode(res, testName);
                // Get the common part of the response and verify that it is not null.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
                if (payloadInputPart != null) {
                    loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
@@ -290,7 +289,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
                Assert.assertNotNull(loanoutCommon);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -329,17 +328,21 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.read(NON_EXISTENT_ID);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
@@ -358,14 +361,14 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         AbstractCommonList list = null;
         try {
                assertStatusCode(res, testName);
-               list = res.getEntity();
+               list = res.readEntity(getCommonListType());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         // Optionally output additional data about list members for debugging.
@@ -394,12 +397,12 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Retrieve the contents of a resource to update.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         LoansoutCommon loanoutCommon = null;
         try {
                assertStatusCode(res, testName);
                // Extract the common part from the response.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
                if (payloadInputPart != null) {
                    loanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
@@ -407,7 +410,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
                Assert.assertNotNull(loanoutCommon);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -442,7 +445,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
         try {
                assertStatusCode(res, testName);
                // Extract the updated common part from the response.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
                if (payloadInputPart != null) {
                    updatedLoanoutCommon = (LoansoutCommon) payloadInputPart.getBody();
@@ -450,7 +453,7 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
                Assert.assertNotNull(updatedLoanoutCommon);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -615,17 +618,21 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
         // The only relevant ID may be the one used in update(), below.
         LoanoutClient client = new LoanoutClient();
         PoxPayloadOut multipart = createLoanoutInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
     }
 
     // ---------------------------------------------------------------
index cf8b400c0ee626146cb61e1c2a7c15a2127215e2..896f9bcda721a166f425819b2700fbecf0482e50 100644 (file)
@@ -27,6 +27,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.LocationJAXBSchema;
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
@@ -42,12 +44,9 @@ import org.collectionspace.services.location.LocTermGroup;
 import org.collectionspace.services.location.LocTermGroupList;
 import org.collectionspace.services.location.LocationauthoritiesCommon;
 import org.collectionspace.services.location.LocationsCommon;
-
 import org.jboss.resteasy.client.ClientResponse;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.Test;
@@ -169,17 +168,17 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
 
         // Submit the request to the service and store the response.
         LocationAuthorityClient client = new LocationAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         LocationsCommon location = null;
         try {
             assertStatusCode(res, testName);        
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                location = (LocationsCommon) extractPart(input,
                        client.getItemCommonPartName(), LocationsCommon.class);
                Assert.assertNotNull(location);
            } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
            }
                
@@ -205,7 +204,7 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -259,7 +258,7 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
                        list = res.getEntity();
                } finally {
                        if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
                }
                
index 0a28ffc57825e6e2f7e76f73daa0438aff0ee460..c639cf44b5b02b479182085b9b86f48ffbff375a 100644 (file)
@@ -87,7 +87,7 @@ public class MediaClient extends AbstractCommonListPoxServiceClientImpl<MediaPro
      * @param media
      * @return
      */
-    public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload, String URI) {
+    public Response update(String csid, PoxPayloadOut xmlPayload, String URI) {
         return getProxy().update(csid, xmlPayload.getBytes());
 
     }
index 9ac5e6dac0105c334f25a340d0a24a0a60a39728..8e4596d9f7fbba6ab24a3eea757c4fe8334f1b6b 100644 (file)
@@ -84,7 +84,7 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 347757dc17f7f9ce1be94e26b9b1982d071fbb7d..52ec0a60c046c0f9b3b2af9df674c917b4151d8e 100644 (file)
@@ -96,8 +96,8 @@ public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonL
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     /**
index c1d896a9f092e8cf179d583f65c6d5fb9701f9b0..ebcb49a73299400397777d36e8092dd016bf0575 100644 (file)
@@ -92,8 +92,7 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 00569b780ad8a0a22553351dd058ed77f7536ed8..2c6e27093c4a857e92b46da8b7af14ead4a0b7f7 100644 (file)
@@ -90,8 +90,7 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
@@ -632,19 +631,19 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
 
         // Submit the request to the service and store the response.
         MovementClient client = new MovementClient();
-        ClientResponse<String> res = client.read(csid);
+        Response res = client.read(csid);
         MovementsCommon movementCommon = null;
         try {
                assertStatusCode(res, testName);
                // Extract and return the common part of the record.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
                if (payloadInputPart != null) {
                        movementCommon = (MovementsCommon) payloadInputPart.getBody();
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -685,7 +684,7 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
                list = res.getEntity();
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }        
 
index ed5c38e167ccd28ed365fcf27d8c72072074b9c4..2445fb38bfeff991642179eb8e1602d448dc30f9 100644 (file)
@@ -89,7 +89,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
index 66728a0642910fa4b4477d2e577588fad4a9fa4c..a42697e235fa1f84eb5fcc93cbf88e054a8ca1e7 100644 (file)
@@ -70,8 +70,8 @@ public class ObjectExitServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
index 379a133efee97f7b56bffd85f7de70efefe01f42..8c755b6784698848ae20928ee403ba4081ce9b65 100644 (file)
@@ -93,7 +93,7 @@ public class OrgAuthorityClientUtils {
     public static String getOrgRefName(String inAuthority, String csid, OrgAuthorityClient client){
        if(client==null)
                client = new OrgAuthorityClient();
-        ClientResponse<String> res = client.readItem(inAuthority, csid);
+        Response res = client.readItem(inAuthority, csid);
         try {
                int statusCode = res.getStatus();
                if(!READ_REQ.isValidStatusCode(statusCode)
@@ -102,7 +102,7 @@ public class OrgAuthorityClientUtils {
                }
                //FIXME: remove the following try catch once Aron fixes signatures
                try {
-                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                   PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                    OrganizationsCommon org = 
                        (OrganizationsCommon) CollectionSpaceClientUtils.extractPart(input,
                            client.getItemCommonPartName(), OrganizationsCommon.class);
@@ -114,7 +114,7 @@ public class OrgAuthorityClientUtils {
                    throw new RuntimeException(e);
                }
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
index 36d395fc317cddfe250e30afaec6cd5eb5983d38..f4c6431ec63a57fc8756def959ecfbe841a38ac5 100644 (file)
@@ -119,8 +119,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
+       protected AbstractCommonList getCommonList(Response response) {
        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
     }
 
@@ -299,11 +298,11 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
-        ClientResponse<String> res = orgAuthClient.readItem(knownResourceId, knownItemResourceId);
+        Response res = orgAuthClient.readItem(knownResourceId, knownItemResourceId);
         OrganizationsCommon organization = null;
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                organization = (OrganizationsCommon) extractPart(input,
                    orgAuthClient.getItemCommonPartName(), OrganizationsCommon.class);
                Assert.assertNotNull(organization);
@@ -312,9 +311,10 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
+        
         // Check one or more of the authority fields in the Organization item
         Assert.assertEquals(organization.getContactNames().getContactName().get(0),
                 organizationContactPersonRefName1);
@@ -333,7 +333,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
                list = res2.getEntity();
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
         
index a4d380f816d8f2d29b8730e6bd7d8c5d34bda6b0..cdda42991e19f59e1cb70db0417337dd4e31b926 100644 (file)
@@ -303,7 +303,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res = null;
+        Response res = null;
         if (CSID != null) {
             res = client.read(CSID);
         } else if (shortId != null) {
@@ -315,7 +315,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             assertStatusCode(res, testName);           
             //FIXME: remove the following try catch once Aron fixes signatures
             try {
-                PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                 OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
                         new OrgAuthorityClient().getCommonPartName(), OrgauthoritiesCommon.class);
                 if (logger.isDebugEnabled()) {
@@ -327,7 +327,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -391,7 +391,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
 
         // Submit the request to the service and store the response.
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res = null;
+        Response res = null;
         if (authCSID != null) {
             if (itemCSID != null) {
                 res = client.readItem(authCSID, itemCSID);
@@ -414,7 +414,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
         try {
             assertStatusCode(res, testName);
             // Check whether we've received a organization.
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
             OrganizationsCommon organization = (OrganizationsCommon) extractPart(input,
                     client.getItemCommonPartName(), OrganizationsCommon.class);
             Assert.assertNotNull(organization);
@@ -435,7 +435,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
 
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -461,18 +461,18 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
         // First read our known resource.
         //
         OrgAuthorityClient client = new OrgAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         OrganizationsCommon organization = null;
         try {
             assertStatusCode(res, testName);           
             // Check whether organization has expected displayName.
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
             organization = (OrganizationsCommon) extractPart(input,
                     client.getItemCommonPartName(), OrganizationsCommon.class);
             Assert.assertNotNull(organization);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -497,7 +497,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -535,7 +535,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             Assert.assertEquals(contact.getInItem(), knownItemResourceId);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -568,7 +568,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -621,7 +621,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             list = res.getEntity();
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -680,7 +680,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             list = res.getEntity();
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -738,7 +738,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             Assert.assertNotNull(contact);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -781,7 +781,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
                        "Data in updated object did not match submitted data.");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -830,7 +830,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -876,7 +876,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -942,9 +942,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             itemResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                    client.deleteContact(parentResourceId, itemResourceId, contactResourceId);
-            res.releaseConnection();
+            client.deleteContact(parentResourceId, itemResourceId, contactResourceId).close();
         }
         // Clean up item resources.
         for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
index 85dae979c5ac11468c235b84b333b953c2e82c9a..e5a5f0c429308186031b5beb0649878b037d92e3 100644 (file)
@@ -156,9 +156,8 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-                    ClientResponse<AbstractCommonList> response) {
-    return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+       return response.readEntity(AbstractCommonList.class);
     }
 
     private String getPartialTermCommon() {
index c3927d4a8bbcc61eabd9c41c11fd4cefc7715d77..e4e6663566d977373116c9bfeb60b9c0a28eb1ee 100644 (file)
@@ -115,9 +115,8 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+       protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
  
     @BeforeClass
index 8cc0a60576550bb1a63421086c6f2c4d3144a1da..7ca29cfe11bea5ed6cca8ad3f5f2843867f8a221 100644 (file)
@@ -1074,8 +1074,8 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
         setupRead();
-        ClientResponse<String> res =
-                client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
+        ClientResponse<String> res = client.readContact(knownResourceId, knownItemResourceId,
+                       knownContactResourceId);
         try {
             assertStatusCode(res, testName);
             if (logger.isDebugEnabled()) {
index 7341c4b3c153a714c1037c929180b5c274cdc968..b2ac7d84d9e153eae440622e56ddf2e91bdfbe8d 100644 (file)
@@ -113,7 +113,7 @@ public class PlaceAuthorityClientUtils {
                createPlaceInstance( placeAuthorityRefName,
                        placeMap, terms, client.getItemCommonPartName() );
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -130,7 +130,7 @@ public class PlaceAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -161,7 +161,7 @@ public class PlaceAuthorityClientUtils {
        PoxPayloadOut multipart = 
                createPlaceInstance(commonPartXML, client.getItemCommonPartName());
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -176,7 +176,7 @@ public class PlaceAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -227,7 +227,7 @@ public class PlaceAuthorityClientUtils {
        return refName;
     }
 
-    public static String extractId(ClientResponse<Response> res) {
+    public static String extractId(Response res) {
         MultivaluedMap<String, Object> mvm = res.getMetadata();
         String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
         if(logger.isDebugEnabled()){
index b18f512958f38fa30ab6673a465302405816401c..f5ee57955bfba0e835c5ad5710cda75a58d2ae91 100644 (file)
@@ -26,6 +26,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.PlaceJAXBSchema;
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
@@ -170,17 +173,17 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
 
         // Submit the request to the service and store the response.
         PlaceAuthorityClient client = new PlaceAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         PlacesCommon place= null;
         try {
             assertStatusCode(res, testName);        
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                place = (PlacesCommon) extractPart(input,
                        client.getItemCommonPartName(), PlacesCommon.class);
                Assert.assertNotNull(place);
            } finally {
                 if (res != null) {
-                res.releaseConnection();
+                res.close();
            }
         }
 
@@ -206,7 +209,7 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -260,7 +263,7 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
                        list = res.getEntity();
                } finally {
                        if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
                }
                
index 8fba32b9c92c5fc05206e33e3c0207e7ca4cb44e..25fea823225485f78d3ea76dba70fcc99b9dfb8e 100644 (file)
@@ -81,9 +81,8 @@ public class PublicItemServiceTest extends
         * getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
         */
        @Override
-       protected AbstractCommonList getCommonList(
-                       ClientResponse<AbstractCommonList> response) {
-               return response.getEntity(AbstractCommonList.class);
+       protected AbstractCommonList getCommonList(Response response) {
+               return response.readEntity(AbstractCommonList.class);
        }
 
        // ---------------------------------------------------------------
@@ -189,14 +188,14 @@ public class PublicItemServiceTest extends
 
                // Submit the request to the service and store the response.
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<String> res = client.read(knownResourceId);
+               Response res = client.read(knownResourceId);
                PoxPayloadIn input = null;
                try {
                        assertStatusCode(res, testName);
-                       input = new PoxPayloadIn(res.getEntity());
+                       input = new PoxPayloadIn((String)res.getEntity());
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
 
@@ -229,7 +228,7 @@ public class PublicItemServiceTest extends
 
                // Submit the request to the service and store the response.
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+               Response res = client.read(NON_EXISTENT_ID);
                try {
                        int statusCode = res.getStatus();
 
@@ -243,7 +242,7 @@ public class PublicItemServiceTest extends
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
        }
@@ -272,7 +271,7 @@ public class PublicItemServiceTest extends
                // Submit the request to the service and store the response.
                AbstractCommonList list = null;
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<AbstractCommonList> res = client.readList();
+               Response res = client.readList();
                assertStatusCode(res, testName);
                try {
                        int statusCode = res.getStatus();
@@ -286,10 +285,10 @@ public class PublicItemServiceTest extends
                                        invalidStatusCodeMessage(testRequestType, statusCode));
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-                       list = res.getEntity();
+                       list = res.readEntity(getCommonListType());
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
 
@@ -328,17 +327,17 @@ public class PublicItemServiceTest extends
 
                // Retrieve the contents of a resource to update.
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<String> res = client.read(knownResourceId);
+               Response res = client.read(knownResourceId);
                PoxPayloadIn input = null;
                try {
                        assertStatusCode(res, testName);
-                       input = new PoxPayloadIn(res.getEntity());
+                       input = new PoxPayloadIn((String)res.getEntity());
                        if (logger.isDebugEnabled()) {
                                logger.debug("got object to update with ID: " + knownResourceId);
                        }
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
 
@@ -379,10 +378,10 @@ public class PublicItemServiceTest extends
                        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                                        invalidStatusCodeMessage(testRequestType, statusCode));
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
-                       input = new PoxPayloadIn(res.getEntity());
+                       input = new PoxPayloadIn((String)res.getEntity());
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
 
@@ -427,7 +426,7 @@ public class PublicItemServiceTest extends
                // The only relevant ID may be the one used in update(), below.
                PublicItemClient client = new PublicItemClient();
                PoxPayloadOut multipart = createPublicItemInstance(NON_EXISTENT_ID);
-               ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
+               Response res = client.update(NON_EXISTENT_ID, multipart);
                try {
                        int statusCode = res.getStatus();
 
@@ -441,7 +440,7 @@ public class PublicItemServiceTest extends
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
        }
index 18a92de8dbaef8ac513fcf9da6d5a570b00410db..99283dd980c7e5c18847d486927051ce0afc4bff 100644 (file)
@@ -139,6 +139,8 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
     }
 
     private String createPerson(String firstName, String surName, String shortId, String authRefName) {
+       String result = null;
+       
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         Map<String, String> personInfo = new HashMap<String, String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
@@ -147,13 +149,19 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl<RelationsCom
         PoxPayloadOut multipart =
                 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                 authRefName, personInfo, null, personAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
-        int statusCode = res.getStatus();
-
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, STATUS_CREATED);
-        return extractId(res);
+        Response res = personAuthClient.createItem(personAuthCSID, multipart);
+        try {
+               int statusCode = res.getStatus();
+       
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, STATUS_CREATED);
+               result = extractId(res);
+        } finally {
+               res.close();
+        }
+        
+        return result;
     }    
     
     @Test(dataProvider="testName",
index 70ff0320d943a498f4e45c74880fa51305cfd1d4..2c74259bbbf78945ddef107be5e6914ffd2ca054 100644 (file)
@@ -91,8 +91,7 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         throw new UnsupportedOperationException(); //Since this test does not support lists, this method is not needed.
     }
 
@@ -112,22 +111,25 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
                 createAccountInstance("barney", "barney08", "barney@dinoland.com",
                 accountClient.getTenantId(), false);
         ClientResponse<Response> res = accountClient.create(account);
-        int statusCode = res.getStatus();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": barney status = " + statusCode);
-        }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        barneyAccountId = extractId(res);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": barneyAccountId=" + barneyAccountId);
+        try {
+               int statusCode = res.getStatus();
+       
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": barney status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               // Store the ID returned from this create operation
+               // for additional tests below.
+               barneyAccountId = extractId(res);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": barneyAccountId=" + barneyAccountId);
+               }
+        } finally {
+               res.close();
         }
-        res.releaseConnection();
 
     }
 
index 6ec64ffc6e9fa84c185fc35e31bbcb0779b53ffa..c9f079ec1c342a342aef55121b546c47bb01e7f7 100644 (file)
@@ -411,16 +411,16 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         DimensionClient client = new DimensionClient();
         //elmo allowed to read
         client.setAuth(true, "elmo2010", true, "elmo2010", true);
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
                        client.getCommonPartName(), DimensionsCommon.class);
                Assert.assertNotNull(dimension);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -435,12 +435,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         DimensionClient client = new DimensionClient();
         //lockedOut allowed to read
         client.setAuth(true, "lockedOut", true, "lockedOut", true);
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -467,12 +467,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         //
         PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
         PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
-        ClientResponse<String> res = client.update(knownResourceId, output);
+        Response res = client.update(knownResourceId, output);
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -489,7 +489,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -665,7 +665,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
index f962371a45a700e173a5ef08e0c8723a6fabf362..2e28b189a526f9ef657109d4297ad668c2b02d6e 100644 (file)
@@ -267,8 +267,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
+    protected AbstractCommonList getCommonList(Response response) {
         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
         throw new UnsupportedOperationException();
     }
@@ -369,15 +368,15 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         // Submit the request to the service and store the response.
         DimensionClient client = new DimensionClient();
         client.setAuth(true, userName, true, userName, true);
-        ClientResponse<String> res = client.read(id);
+        Response res = client.read(id);
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                result = (DimensionsCommon) extractPart(input,
                        client.getCommonPartName(), DimensionsCommon.class);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -412,12 +411,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         //
         PoxPayloadOut output = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME);
         PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dimension);
-        ClientResponse<String> res = client.update(TENANT_RESOURCE_2, output);
+        Response res = client.update(TENANT_RESOURCE_2, output);
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -578,7 +577,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
index 40f0f36a03ec59a99a83f3a06eeb176fa7603d1c..5ec63fdeaf51678f6682020e2cc9ab137432a8ea 100644 (file)
@@ -72,12 +72,12 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
     }
 
     @Override
-    protected AbstractCommonList getCommonList(ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
     
        public ServicegroupsCommon extractCommonPartValue(CollectionSpaceClient client,
-                       ClientResponse<String> res) throws Exception {
+                       Response res) throws Exception {
                
                ServicegroupsCommon result = null;
                PayloadInputPart payloadInputPart = extractPart(res, client.getCommonPartName());
@@ -90,12 +90,12 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
                return result;
        }
 
-    protected PayloadInputPart extractPart(ClientResponse<String> res, String partLabel)
+    protected PayloadInputPart extractPart(Response res, String partLabel)
             throws Exception {
             if (getLogger().isDebugEnabled()) {
                getLogger().debug("Reading part " + partLabel + " ...");
             }
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
             PayloadInputPart payloadInputPart = input.getPart(partLabel);
             Assert.assertNotNull(payloadInputPart,
                     "Part " + partLabel + " was unexpectedly null.");
@@ -110,7 +110,7 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
 
         // Submit the request to the service and store the response.
        CollectionSpaceClient client = this.getClientInstance();
-        ClientResponse<String> res = client.read(readGroupName);
+        Response res = client.read(readGroupName);
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -140,9 +140,15 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
 
         // Submit the request to the service and store the response.
         CollectionSpaceClient client = this.getClientInstance();
-        ClientResponse<AbstractCommonList> res = client.readList();
-        AbstractCommonList list = res.getEntity();
-        int statusCode = res.getStatus();
+        Response res = client.readList();
+        AbstractCommonList list = res.readEntity(getCommonListType());
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+        } finally {
+               res.close();
+        }
+        
 
         // Check the status code of the response: does it match
         // the expected response(s)?
@@ -159,6 +165,4 @@ public class ServiceGroupServiceTest extends BaseServiceTest<AbstractCommonList>
                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);
         }
     }
-    
-    
 }
index 886e799816e2baace6be891de63740f8c3e76306..c0f6c63c49d3110148e7e26d214477b489299c04 100644 (file)
@@ -167,7 +167,7 @@ public class TaxonomyAuthorityClientUtils {
                 createTaxonInstance(TaxonomyauthorityRefName,
                 taxonMap, terms, taxonAuthorGroupList, taxonCitationList, commonNameGroupList, client.getItemCommonPartName());
         String newID = null;
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        Response res = client.createItem(vcsid, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -184,7 +184,7 @@ public class TaxonomyAuthorityClientUtils {
             }
             newID = extractId(res);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
         return newID;
@@ -215,7 +215,7 @@ public class TaxonomyAuthorityClientUtils {
         PoxPayloadOut multipart =
                 createTaxonInstance(commonPartXML, client.getItemCommonPartName());
         String newID = null;
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        Response res = client.createItem(vcsid, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -230,7 +230,7 @@ public class TaxonomyAuthorityClientUtils {
             }
             newID = extractId(res);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
         return newID;
@@ -283,7 +283,7 @@ public class TaxonomyAuthorityClientUtils {
         return refName;
     }
 
-    public static String extractId(ClientResponse<Response> res) {
+    public static String extractId(Response res) {
         MultivaluedMap<String, Object> mvm = res.getMetadata();
         String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
         if (logger.isDebugEnabled()) {
index d04c3c3a896c033b4ed4212b5037118fe945bb5a..6b25f32601c966c9b1aa9b6e91031ea410db27ec 100644 (file)
@@ -198,12 +198,12 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
         //
         setupRead();
         TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         TaxonCommon taxon = null;
         try {
             assertStatusCode(res, testName);
             // Check whether Taxonomy has expected displayName.
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
             taxon = (TaxonCommon) extractPart(input,
                     client.getItemCommonPartName(), TaxonCommon.class);
             Assert.assertNotNull(taxon);
index cebe70b4ff8f094bd41adc6474a92a749ddafdd9..7f574aaf293c53c3b83e6beaf01ecee3f2d874d5 100644 (file)
@@ -68,9 +68,8 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
      */
     @Override
-    protected AbstractCommonList getCommonList(
-            ClientResponse<AbstractCommonList> response) {
-        return response.getEntity(AbstractCommonList.class);
+    protected AbstractCommonList getCommonList(Response response) {
+        return response.readEntity(AbstractCommonList.class);
     }
 
     // ---------------------------------------------------------------
@@ -253,14 +252,14 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -301,7 +300,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<String> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -315,7 +314,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -339,7 +338,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
         // Submit the request to the service and store the response.
         AbstractCommonList list = null;
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<AbstractCommonList> res = client.readList();
+        Response res = client.readList();
         assertStatusCode(res, testName);
         try {
             int statusCode = res.getStatus();
@@ -353,10 +352,10 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-            list = res.getEntity();
+            list = res.readEntity(getCommonListType());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -389,17 +388,17 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Retrieve the contents of a resource to update.
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         PoxPayloadIn input = null;
         try {
             assertStatusCode(res, testName);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
             if (logger.isDebugEnabled()) {
                 logger.debug("got object to update with ID: " + knownResourceId);
             }
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -439,10 +438,10 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -487,7 +486,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
         // The only relevant ID may be the one used in update(), below.
         ValuationcontrolClient client = new ValuationcontrolClient();
         PoxPayloadOut multipart = createValuationcontrolInstance(NON_EXISTENT_ID);
-        ClientResponse<String> res = client.update(NON_EXISTENT_ID, multipart);
+        Response res = client.update(NON_EXISTENT_ID, multipart);
         try {
             int statusCode = res.getStatus();
 
@@ -501,7 +500,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -650,8 +649,8 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
         valuationcontrolCommon.setValueNote(getUTF8DataFragment());
 
         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
-        PayloadOutputPart commonPart =
-                multipart.addPart(new ValuationcontrolClient().getCommonPartName(), valuationcontrolCommon);
+        PayloadOutputPart commonPart = multipart.addPart(new ValuationcontrolClient().getCommonPartName(),
+                       valuationcontrolCommon);
 
         if (logger.isDebugEnabled()) {
             logger.debug("to be created, valuationcontrol common");
index 5b39a29a4d33998a02f79ace0395409cf8df755d..56709df5fc531e5adc17858f0a9ceb605ec4437c 100644 (file)
@@ -67,6 +67,8 @@ public class VocabularyClientUtils {
     public static String createItemInVocabulary(String vcsid, 
                String vocabularyRefName, Map<String,String> itemMap,
                VocabularyClient client ) {
+       String result = null;
+       
        // Expected status code: 201 Created
        int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
        // Type of service request being tested
@@ -78,21 +80,26 @@ public class VocabularyClientUtils {
        }
        PoxPayloadOut multipart = createVocabularyItemInstance(null, //vocabularyRefName,
                                itemMap, client.getItemCommonPartName());
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
-
-       int statusCode = res.getStatus();
-
-       if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
-               throw new RuntimeException("Could not create Item: \"" + itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
-                               + "\" in personAuthority: \"" + vcsid //vocabularyRefName
-                               + "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
-       }
-       if(statusCode != EXPECTED_STATUS_CODE) {
-               throw new RuntimeException("Unexpected Status when creating Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
-                               + "\" in vocabularyAuthority: \"" + vcsid /*vocabularyRefName*/ + "\", Status:" + statusCode);
+       Response res = client.createItem(vcsid, multipart);
+
+       try {
+               int statusCode = res.getStatus();
+       
+               if (!REQUEST_TYPE.isValidStatusCode(statusCode)) {
+                       throw new RuntimeException("Could not create Item: \"" + itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
+                                       + "\" in personAuthority: \"" + vcsid //vocabularyRefName
+                                       + "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+               }
+               if (statusCode != EXPECTED_STATUS_CODE) {
+                       throw new RuntimeException("Unexpected Status when creating Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
+                                       + "\" in vocabularyAuthority: \"" + vcsid /*vocabularyRefName*/ + "\", Status:" + statusCode);
+               }
+               result = extractId(res);
+       } finally {
+               res.close();
        }
 
-       return extractId(res);
+       return result;
     }
 
     /**
@@ -112,7 +119,7 @@ public class VocabularyClientUtils {
                 requestType.validStatusCodesAsString();
     }
 
-    public static String extractId(ClientResponse<Response> res) {
+    public static String extractId(Response res) {
         MultivaluedMap<String, Object> mvm = res.getMetadata();
         String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
         if(logger.isDebugEnabled()){
index 6efc7126272aa967bb6bf92583d9495087a31157..8021b52c438325a1c59fdf672c3a97389ee1a904 100644 (file)
@@ -115,7 +115,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
         PoxPayloadOut multipart =
                 VocabularyClientUtils.createVocabularyItemInstance(null, //knownResourceRefName,
                 itemInfo, client.getItemCommonPartName());
-        ClientResponse<Response> res = client.createItem(knownResourceId, multipart);
+        Response res = client.createItem(knownResourceId, multipart);
         try {
                int statusCode = res.getStatus();
 
@@ -130,7 +130,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
             }
        } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -144,18 +144,18 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
         
         // Submit the request to the service and store the response.
         VocabularyClient client = new VocabularyClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         VocabularyitemsCommon vitem = null;
         try {
                assertStatusCode(res, testName);
                // Check whether Person has expected displayName.
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                vitem = (VocabularyitemsCommon) extractPart(input,
                        client.getItemCommonPartName(), VocabularyitemsCommon.class);
                Assert.assertNotNull(vitem);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -171,7 +171,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -187,7 +187,7 @@ public class VocabularyServiceTest extends AbstractAuthorityServiceTest<Vocabula
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 2b783d8fa7dcf27e1ed5ccf3cf13e2b74b901710..980d4d3d6eb528a670bb2b02f9c689e7397c5a50 100644 (file)
@@ -113,7 +113,7 @@ public class WorkAuthorityClientUtils {
             createWorkInstance( workAuthorityRefName,
                 workMap, terms, client.getItemCommonPartName() );
         String newID = null;
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        Response res = client.createItem(vcsid, multipart);
         try {
             int statusCode = res.getStatus();
     
@@ -130,7 +130,7 @@ public class WorkAuthorityClientUtils {
             }
             newID = extractId(res);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
         return newID;
@@ -161,7 +161,7 @@ public class WorkAuthorityClientUtils {
         PoxPayloadOut multipart = 
             createWorkInstance(commonPartXML, client.getItemCommonPartName());
         String newID = null;
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        Response res = client.createItem(vcsid, multipart);
         try {
             int statusCode = res.getStatus();
     
@@ -176,7 +176,7 @@ public class WorkAuthorityClientUtils {
             }
             newID = extractId(res);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
         return newID;
@@ -227,7 +227,7 @@ public class WorkAuthorityClientUtils {
         return refName;
     }
 
-    public static String extractId(ClientResponse<Response> res) {
+    public static String extractId(Response res) {
         MultivaluedMap<String, Object> mvm = res.getMetadata();
         String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
         if(logger.isDebugEnabled()){
index 9e071b77aa575a2fff3e462b0f47d5e995c437a5..096fc7265c34b462694531f32ce5b93ae7875219 100644 (file)
@@ -26,6 +26,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.WorkJAXBSchema;
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
@@ -168,52 +171,54 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
      * @throws Exception the exception
      */
     @Test(dataProvider="testName")
-    public void verifyIllegalItemDisplayName(String testName) throws Exception {
-        // Perform setup for read.
-        setupRead();
-
-        // Submit the request to the service and store the response.
-        WorkAuthorityClient client = new WorkAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
-        WorksCommon work = null;
-        try {
-            assertStatusCode(res, testName);        
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
-            work = (WorksCommon) extractPart(input,
-                    client.getItemCommonPartName(), WorksCommon.class);
-            Assert.assertNotNull(work);
-        } finally {
-                if (res != null) {
-                res.releaseConnection();
-        }
-        }
-
-        //
-        // Make an invalid UPDATE request, without a display name
-        //
-        WorkTermGroupList termList = work.getWorkTermGroupList();
-        Assert.assertNotNull(termList);
-        List<WorkTermGroup> terms = termList.getWorkTermGroup();
-        Assert.assertNotNull(terms);
-        Assert.assertTrue(terms.size() > 0);
-        terms.get(0).setTermDisplayName(null);
-        terms.get(0).setTermName(null);
-        
-        setupUpdateWithInvalidBody(); // we expect a failure
-        
-        // Submit the updated resource to the service and store the response.
-        PoxPayloadOut output = new PoxPayloadOut(WorkAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
-        PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(), work);
-        setupUpdateWithInvalidBody(); // we expected a failure here.
-        res = client.updateItem(knownResourceId, knownItemResourceId, output);
-        try {
-            assertStatusCode(res, testName);
-        } finally {
-            if (res != null) {
-                res.releaseConnection();
-            }
-        }
-    }
+       public void verifyIllegalItemDisplayName(String testName) throws Exception {
+               // Perform setup for read.
+               setupRead();
+
+               // Submit the request to the service and store the response.
+               WorkAuthorityClient client = new WorkAuthorityClient();
+               Response res = client.readItem(knownResourceId, knownItemResourceId);
+               WorksCommon work = null;
+               try {
+                       assertStatusCode(res, testName);
+                       PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
+                       work = (WorksCommon) extractPart(input,
+                                       client.getItemCommonPartName(), WorksCommon.class);
+                       Assert.assertNotNull(work);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+
+               //
+               // Make an invalid UPDATE request, without a display name
+               //
+               WorkTermGroupList termList = work.getWorkTermGroupList();
+               Assert.assertNotNull(termList);
+               List<WorkTermGroup> terms = termList.getWorkTermGroup();
+               Assert.assertNotNull(terms);
+               Assert.assertTrue(terms.size() > 0);
+               terms.get(0).setTermDisplayName(null);
+               terms.get(0).setTermName(null);
+
+               setupUpdateWithInvalidBody(); // we expect a failure
+
+               // Submit the updated resource to the service and store the response.
+               PoxPayloadOut output = new PoxPayloadOut(
+                               WorkAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+               PayloadOutputPart commonPart = output.addPart(
+                               client.getItemCommonPartName(), work);
+               setupUpdateWithInvalidBody(); // we expected a failure here.
+               res = client.updateItem(knownResourceId, knownItemResourceId, output);
+               try {
+                       assertStatusCode(res, testName);
+               } finally {
+                       if (res != null) {
+                               res.close();
+                       }
+               }
+       }
 
     /**
      * Read item list.
@@ -264,7 +269,7 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
             list = res.getEntity();
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }