]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6281: Replacing refs of now deprecated ClientResponse<T> with javax.ws.rs...
authorremillet <remillet@yahoo.com>
Wed, 5 Aug 2015 00:10:25 +0000 (17:10 -0700)
committerremillet <remillet@yahoo.com>
Wed, 5 Aug 2015 00:10:25 +0000 (17:10 -0700)
63 files changed:
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591Multiple.java
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591OneInst.java
services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/I1591OneInstOneClose.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/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/RolePermissionServiceTest.java
services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java
services/batch/service/src/main/java/org/collectionspace/services/batch/UriInfoImpl.java [new file with mode: 0644]
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java
services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java
services/citation/client/src/test/java/org/collectionspace/services/client/test/CitationAuthorityServiceTest.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/AuthorityClient.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityProxy.java
services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.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/CollectionObjectAuthRefsTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java
services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java
services/concept/client/src/main/java/org/collectionspace/services/client/ConceptAuthorityClientUtils.java
services/concept/client/src/test/java/org/collectionspace/services/client/test/ConceptAuthorityServiceTest.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/exhibition/client/src/test/java/org/collectionspace/services/client/test/ExhibitionServiceTest.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/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/main/java/org/collectionspace/services/client/LocationAuthorityClientUtils.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.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/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/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.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/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java
services/publicitem/client/src/test/java/org/collectionspace/services/client/test/PublicItemServiceTest.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/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/work/client/src/test/java/org/collectionspace/services/client/test/WorkAuthorityServiceTest.java

index 5e6c9f67fbc9b8d61892ebdbe59b8e268687177a..bbc28b2d7382fe1e97504750ed6d8ddde32e5929 100644 (file)
@@ -112,34 +112,31 @@ public class I1591Multiple extends CollectionSpacePerformanceTest {
      * @param numberOfObjects The number of CollectionObject resources to create.
      * @return A list of the resource IDs of the newly-created object resources.
      */
-    public String[] createCollectionObjects(int numberOfObjects) {
-
-            long identifier = 0;
-            int i = 0;
-
-            try {
-                for (i = 0; i <= numberOfObjects; i++) {
-                    identifier = System.currentTimeMillis();
-                    coList[i] = createCollectionObject(identifier);
-                    if (logger.isDebugEnabled() == true) {
-                        logger.debug("Created CollectionObject #: " + i);
-                    }
-                }
-            } catch (AssertionError e) {
-                if (logger.isDebugEnabled() == true) {
-                    logger.debug("FAILURE: Created " + i +
-                        " of " + numberOfObjects +
-                        " before failing.");
-                }
-                Assert.assertTrue(false);
-            }
-
-            return coList;
-    }
+       public String[] createCollectionObjects(int numberOfObjects) {
+               long identifier = 0;
+               int i = 0;
+
+               try {
+                       for (i = 0; i <= numberOfObjects; i++) {
+                               identifier = System.currentTimeMillis();
+                               coList[i] = createCollectionObject(identifier);
+                               if (logger.isDebugEnabled() == true) {
+                                       logger.debug("Created CollectionObject #: " + i);
+                               }
+                       }
+               } catch (AssertionError e) {
+                       if (logger.isDebugEnabled() == true) {
+                               logger.debug("FAILURE: Created " + i + " of " + numberOfObjects
+                                               + " before failing.");
+                       }
+                       Assert.assertTrue(false);
+               }
+
+               return coList;
+       }
 
     @AfterClass(alwaysRun=true)
     public void cleanUp() {
-
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         String resourceId = "";
 
@@ -149,11 +146,10 @@ public class I1591Multiple extends CollectionSpacePerformanceTest {
 
         for (int i = 0; i < coList.length; i++) {
             resourceId = coList[i];
-            ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
+            collectionObjectClient.delete(resourceId).close();
             if (logger.isDebugEnabled() == true) {
                 logger.debug("Deleted CollectionObject #: " + i);
             }
-            res.releaseConnection();
         }
         
         if (logger.isDebugEnabled()) {
index e20b3f77fc9b50df6bb7c02c8d51e5d81d786232..99478a8132983189d15bb0c908c02641aa09c34d 100644 (file)
@@ -128,11 +128,10 @@ public class I1591OneInst extends CollectionSpacePerformanceTest {
 
         for (int i = 0; i < coList.length; i++) {
             resourceId = coList[i];
-            ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
+            collectionObjectClient.delete(resourceId).close();;
             if (logger.isDebugEnabled() == true) {
                 logger.debug("Deleted CollectionObject #: " + i);
             }
-            res.releaseConnection();
         }
 
         if (logger.isDebugEnabled()) {
index e2418267c71e2d56b268c771e467e394c721ff89..6bd225505b784f8751c4230ada637d68ab24db37 100644 (file)
@@ -124,11 +124,10 @@ public class I1591OneInstOneClose extends CollectionSpacePerformanceTest {
 
         for (int i = 0; i < coList.length; i++) {
             resourceId = coList[i];
-            ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
+            collectionObjectClient.delete(resourceId).close();
             if (logger.isDebugEnabled() == true) {
                 logger.debug("Deleted CollectionObject #: " + i);
             }
-            res.releaseConnection();
         }
 
         if (logger.isDebugEnabled()) {
index 56357790340b9b6c8b59d4d03f55c6de39482ef5..216f0cc38e3dc541e692a2b49251e8f4367b370f 100644 (file)
@@ -321,8 +321,7 @@ public class PerformanceTest extends CollectionSpacePerformanceTest {
      */
     private void deleteCollectionObject(CollectionObjectClient collectionObjectClient,
             String resourceId) {
-        ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
-        res.releaseConnection();
+       collectionObjectClient.delete(resourceId).close();
     }
 
     /**
index e006e29f4476d76173f34ae0a63562b700b2842b..9850d1ab9b1095157aeb3967cf29979437c682f0 100644 (file)
@@ -362,14 +362,14 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
         }
 
         setupDelete();        
-        res = client.delete(toDelete.getAccount().get(0).getAccountId()); // delete form #2
+        Response deleteRes = client.delete(toDelete.getAccount().get(0).getAccountId()); // delete form #2
         try {
-            int statusCode = res.getStatus();
+            int statusCode = deleteRes.getStatus();
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               deleteRes.close();
         }
     }
 
@@ -384,7 +384,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
         testSetup(testExpectedStatusCode, testRequestType);
 
        AccountRoleClient client = new AccountRoleClient();
-       ClientResponse<Response> res = client.delete(prebuiltAdminCSID);
+       Response res = client.delete(prebuiltAdminCSID);
        try {
                int statusCode = res.getStatus();
                Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
@@ -392,7 +392,7 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
                Assert.assertEquals(statusCode, testExpectedStatusCode);
        } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
        }
     }
@@ -537,12 +537,12 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
     private void deleteAccount(String accId) {
         AccountClient accClient = new AccountClient();
         setupDelete();
-        ClientResponse<Response> res = accClient.delete(accId);
+        Response res = accClient.delete(accId);
         try {
                assertStatusCode(res, "DeleteAccount");
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
     }
@@ -582,12 +582,12 @@ public class AccountRoleServiceTest extends AbstractServiceTestImpl<AccountRole,
     private void deleteRole(String roleId) {
         setupDelete();
         RoleClient roleClient = new RoleClient();
-        ClientResponse<Response> res = roleClient.delete(roleId);
+        Response res = roleClient.delete(roleId);
         try {
                assertStatusCode(res, "DeleteRole");
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
     }
index fca3d94245ebfe56e3e2800c63c5fd6c1cc6ea52..aaecd2c2e5e34de717cfda97d7aacab80f87b108 100644 (file)
@@ -208,17 +208,23 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                 term.setTermDisplayName(termName);
                 term.setTermName(termName);
                 personTerms.add(term);
+        String result = null;
+        
                PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-               PoxPayloadOut multipart = 
-                       PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
+               PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                                        authRefName, personInfo, personTerms, 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;
        }
 
        // Success outcomes
@@ -230,19 +236,19 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
 
                // Submit the request to the service and store the response.
                AcquisitionClient acquisitionClient = new AcquisitionClient();
-               ClientResponse<String> res = acquisitionClient.read(knownResourceId);
+               Response res = acquisitionClient.read(knownResourceId);
                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());
                        acquisition = (AcquisitionsCommon) extractPart(input,
                                        acquisitionClient.getCommonPartName(), AcquisitionsCommon.class);
                        Assert.assertNotNull(acquisition);
                } finally {
                        if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
                }
 
@@ -277,21 +283,21 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                //
                // Get the auth refs and check them
                //
-               ClientResponse<AuthorityRefList> res2 = acquisitionClient.getAuthorityRefs(knownResourceId);
+               res =   acquisitionClient.getAuthorityRefs(knownResourceId);
                AuthorityRefList list = null;
                try {
-                       assertStatusCode(res2, testName);
-                       list = res2.getEntity();
+                       assertStatusCode(res, testName);
+                       list = (AuthorityRefList)res.getEntity();
                        Assert.assertNotNull(list);
                } finally {
-                       if (res2 != null) {
-                               res2.releaseConnection();
+                       if (res != null) {
+                               res.close();
             }
                }
 
                List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
                int numAuthRefsFound = items.size();
-               if (logger.isDebugEnabled()){
+               if (logger.isDebugEnabled()) {
                        logger.debug("Expected " + NUM_AUTH_REFS_EXPECTED +
                                        " authority references, found " + numAuthRefsFound);
                }
@@ -345,19 +351,16 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest<AbstractCommonList>
                AcquisitionClient acquisitionClient = new AcquisitionClient();
                for (String resourceId : acquisitionIdsCreated) {
                        // Note: Any non-success responses are ignored and not reported.
-                       ClientResponse<Response> res = acquisitionClient.delete(resourceId);
-                       res.releaseConnection();
+                       acquisitionClient.delete(resourceId).close();
                }
                PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
                // Delete persons before PersonAuth
                for (String resourceId : personIdsCreated) {
                        // Note: Any non-success responses are ignored and not reported.
-                       ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
-                       res.releaseConnection();
+                       personAuthClient.deleteItem(personAuthCSID, resourceId).close();
                }
                // Note: Any non-success response is ignored and not reported.
-               ClientResponse<Response> res = personAuthClient.delete(personAuthCSID);
-               res.releaseConnection();
+               personAuthClient.delete(personAuthCSID).close();
        }
 
        // ---------------------------------------------------------------
index 14c08f28380b324e4d44aab2eac44448df589d18..1f947f34e366789af979d7f0d9201032de6f981a 100644 (file)
@@ -637,8 +637,13 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
-        int statusCode = res.getStatus();
+        Response res = client.delete(knownResourceId);
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+        } finally {
+               res.close();
+        }
 
         // Check the status code of the response: does it match
         // the expected response(s)?
@@ -663,8 +668,13 @@ public class AcquisitionServiceTest extends AbstractPoxServiceTestImpl<AbstractC
 
         // Submit the request to the service and store the response.
         AcquisitionClient client = new AcquisitionClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
-        int statusCode = res.getStatus();
+        Response res = client.delete(NON_EXISTENT_ID);
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+        } finally {
+               res.close();
+        }
 
         // Check the status code of the response: does it match
         // the expected response(s)?
index 39804c57f60ecd01a7895490884435648b4c8eb0..78649e079ab2fd067c0494026d968c3f3a43a7c9 100644 (file)
@@ -471,14 +471,14 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
                readResponse.releaseConnection();
         }
 
-        res = client.delete(toDelete.getPermission().get(0).getPermissionId());
+        Response deleteRes = client.delete(toDelete.getPermission().get(0).getPermissionId());
         try {
-            int statusCode = res.getStatus();
+            int statusCode = deleteRes.getStatus();
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+               deleteRes.close();
         }
         
     }
@@ -612,9 +612,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
         }
         setupDelete();
         PermissionClient permClient = new PermissionClient();
-        ClientResponse<Response> res = null;
+        Response res = permClient.delete(permId);
         try {
-            res = permClient.delete(permId);
             int statusCode = res.getStatus();
             if (logger.isDebugEnabled()) {
                 logger.debug("deletePermission: delete permission id="
@@ -624,7 +623,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
     }
@@ -676,9 +675,8 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
         }
         setupDelete();
         RoleClient roleClient = new RoleClient();
-        ClientResponse<Response> res = null;
+        Response res = roleClient.delete(roleId);
         try {
-            res = roleClient.delete(roleId);
             int statusCode = res.getStatus();
             if (logger.isDebugEnabled()) {
                 logger.debug("deleteRole: delete role id=" + roleId
@@ -688,7 +686,7 @@ public class PermissionRoleServiceTest extends AbstractServiceTestImpl<Permissio
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
     }
 
index 40cafab478c47b5fdd4d18ba4a8c038569d9698f..23f9794c27aca941aa64c79dca80a32b389c1388 100644 (file)
@@ -416,16 +416,15 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
         // Submit the request to the service and store the response.
         RolePermissionClient client = new RolePermissionClient();
         RoleValue rv = roleValues.get(getRoleName());
-        ClientResponse<Response> delRes = null;
+        Response delRes = client.delete(rv.getRoleId());
         try {
-               delRes = client.delete(rv.getRoleId());
             int statusCode = delRes.getStatus();
             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (delRes != null) {
-               delRes.releaseConnection();
+               delRes.close();
             }
         }
 
@@ -599,9 +598,8 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
         setupDelete();
         PermissionClient permClient = new PermissionClient();
 
-        ClientResponse<Response> res = null;
+        Response res = permClient.delete(permId);
         try {
-            res = permClient.delete(permId);
             int statusCode = res.getStatus();
             if (logger.isDebugEnabled()) {
                 logger.debug("deletePermission: delete permission id="
@@ -613,7 +611,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
 
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -647,7 +645,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
             id = extractId(res);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         return id;
@@ -661,7 +659,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
     private void deleteRole(String roleId) {
         setupDelete();
         RoleClient roleClient = new RoleClient();
-        ClientResponse<Response> res = null;
+        Response res = null;
         try {
             res = roleClient.delete(roleId);
             int statusCode = res.getStatus();
@@ -673,7 +671,7 @@ public class RolePermissionServiceTest extends AbstractServiceTestImpl<Permissio
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
 
     }
index bf3720bb82ba0529bd31e280c499a0a92749e0aa..c6842fb98c0aa65deffa38a3123a3a27bc057451 100644 (file)
@@ -101,30 +101,33 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
-        Role role = createRoleInstance(knownRoleName,
-                "all users are required to be in this role",
+        Role role = createRoleInstance(knownRoleName, "All users are required to be in this role",
                 true);
         ClientResponse<Response> res = client.create(role);
-        int statusCode = res.getStatus();
-
-        // Check the status code of the response: does it match
-        // the expected response(s)?
-        //
-        // Specifically:
-        // Does it fall within the set of valid status codes?
-        // Does it exactly match the expected status code?
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": status = " + statusCode);
-        }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        knownResourceId = extractId(res);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": knownResourceId=" + knownResourceId);
+        try {
+               int statusCode = res.getStatus();
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               //
+               // Specifically:
+               // Does it fall within the set of valid status codes?
+               // Does it exactly match the expected status code?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               // Store the ID returned from this create operation
+               // for additional tests below.
+               knownResourceId = extractId(res);
+               //allResourceIdsCreated.add(knownResourceId);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": knownResourceId=" + knownResourceId);
+               }
+        } finally {
+               res.close();
         }
     }
     
@@ -381,26 +384,30 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<Role> res = client.read(verifyResourceId);
-        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);
+       
+               Role output = (Role) res.getEntity();
+               Assert.assertNotNull(output);
+       
+               //FIXME: Tenant ID of "1" should not be hard coded
+               String roleNameToVerify = "ROLE_" +
+                       "1_" +
+                       verifyRoleName.toUpperCase();
+               Assert.assertEquals(output.getRoleName(), roleNameToVerify,
+                       "RoleName fix did not work!");
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        Role output = (Role) res.getEntity();
-        Assert.assertNotNull(output);
-
-        //FIXME: Tenant ID of "1" should not be hard coded
-        String roleNameToVerify = "ROLE_" +
-               "1_" +
-               verifyRoleName.toUpperCase();
-        Assert.assertEquals(output.getRoleName(), roleNameToVerify,
-                "RoleName fix did not work!");
     }
     // Failure outcomes
     /* (non-Javadoc)
@@ -417,16 +424,19 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
         ClientResponse<Role> 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);
+        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);
     }
 
     // ---------------------------------------------------------------
@@ -458,7 +468,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -494,7 +504,7 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -531,71 +541,84 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
         RoleClient client = new RoleClient();
         // Submit the request to the service and store the response.
         ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
-        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 {
+               // Check the status code of the response: does it match the expected response(s)?
+            int statusCode = res.getStatus();
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+       
+               Role roleUpdated = (Role) res.getEntity();
+               Assert.assertNotNull(roleUpdated);
+       
+               Assert.assertEquals(roleUpdated.getDescription(),
+                       roleToUpdate.getDescription(),
+                       "Data in updated object did not match submitted data.");
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-
-        Role roleUpdated = (Role) res.getEntity();
-        Assert.assertNotNull(roleUpdated);
-
-        Assert.assertEquals(roleUpdated.getDescription(),
-                roleToUpdate.getDescription(),
-                "Data in updated object did not match submitted data.");
     }
     
     @Test(dataProvider = "testName",
                dependsOnMethods = {"CRUDTests"})
        public void verifyProtectionReadOnly(String testName) throws Exception {
-
+       // Setup to create a new role
        setupCreate();
-
-        // Submit the request to the service and store the response.
-        RoleClient client = new RoleClient();
-        Role role = createRoleInstance(knownRoleName+"_PT", "Just a temp", true);
+       Role role = createRoleInstance(knownRoleName+"_PT", "Just a temp", true);
         role.setMetadataProtection(RoleClient.IMMUTABLE);
         role.setPermsProtection(RoleClient.IMMUTABLE);
+        //
+        // Submit the create request to the service and store the response.
+        //
+        RoleClient client = new RoleClient();        
         ClientResponse<Response> res = client.create(role);
-        int statusCode = res.getStatus();
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        // Store the ID returned from this create operation
-        // for additional tests below.
-        String testResourceId = extractId(res);
-        allResourceIdsCreated.add(testResourceId);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": testResourceId=" + testResourceId);
+        String testResourceId = null;
+        try {
+            int statusCode = res.getStatus();
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+               // Store the ID returned from this create operation
+               // for additional tests below.
+               testResourceId = extractId(res);
+               allResourceIdsCreated.add(testResourceId);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": testResourceId=" + testResourceId);
+               }
+        } finally {
+               res.close();
         }
+        
+        // Next, read back the role we just created.
         setupRead();
-
         // Submit the request to the service and store the response.
         ClientResponse<Role> roleRes = client.read(testResourceId);
-        statusCode = roleRes.getStatus();
-
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        Role roleRead = (Role) roleRes.getEntity();
-        Assert.assertNotNull(roleRead);
-        String mdProtection = roleRead.getMetadataProtection();
-        String permsProtection = roleRead.getPermsProtection();
-        if (logger.isTraceEnabled()) {
-            logger.trace(testName + ": metadataProtection=" + mdProtection);
-            logger.trace(testName + ": permsProtection=" + permsProtection);
+        try {
+            int statusCode = roleRes.getStatus();
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+               Role roleRead = (Role) roleRes.getEntity();
+               Assert.assertNotNull(roleRead);
+               String mdProtection = roleRead.getMetadataProtection();
+               String permsProtection = roleRead.getPermsProtection();
+               if (logger.isTraceEnabled()) {
+                   logger.trace(testName + ": metadataProtection=" + mdProtection);
+                   logger.trace(testName + ": permsProtection=" + permsProtection);
+               }
+               Assert.assertFalse(role.getMetadataProtection().equals(mdProtection),
+                               "Role allowed create to set the metadata protection flag.");
+               Assert.assertFalse(role.getPermsProtection().equals(permsProtection),
+                               "Role allowed create to set the perms protection flag.");
+        } finally {
+               res.close();
         }
-       Assert.assertFalse(role.getMetadataProtection().equals(mdProtection),
-                       "Role allowed create to set the metadata protection flag.");
-       Assert.assertFalse(role.getPermsProtection().equals(permsProtection),
-                       "Role allowed create to set the perms protection flag.");
-        
+        // Finally, update the role with changes and verify
        setupUpdate();
 
        Role roleToUpdate = createRoleInstance(knownRoleName+"_PT", "Just a temp", true);
@@ -604,31 +627,33 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
 
        // Submit the request to the service and store the response.
        roleRes = client.update(testResourceId, roleToUpdate);
-       statusCode = roleRes.getStatus();
-       // Check the status code of the response: does it match the expected response(s)?
-       if (logger.isDebugEnabled()) {
-               logger.debug(testName + ": status = " + statusCode);
+       try {
+               // Check the status code of the response: does it match the expected response(s)?
+               int statusCode = roleRes.getStatus();
+               if (logger.isDebugEnabled()) {
+                       logger.debug(testName + ": status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                               invalidStatusCodeMessage(testRequestType, statusCode));
+               Assert.assertEquals(statusCode, testExpectedStatusCode);
+       
+       
+               Role roleUpdated = (Role) roleRes.getEntity();
+               Assert.assertNotNull(roleUpdated);
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + "Updated role: ");
+                   org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory();            
+                   logger.debug(objectAsXmlString(objectFactory.createRole(roleUpdated),
+                           Role.class));            
+               }
+       
+               Assert.assertFalse(RoleClient.IMMUTABLE.equalsIgnoreCase(roleUpdated.getMetadataProtection()),
+                               "Role allowed update of the metadata protection flag.");
+               Assert.assertFalse(RoleClient.IMMUTABLE.equalsIgnoreCase(roleUpdated.getPermsProtection()),
+                               "Role allowed update of the perms protection flag.");
+       } finally {
+               res.close();
        }
-       Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                       invalidStatusCodeMessage(testRequestType, statusCode));
-       Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-
-       Role roleUpdated = (Role) roleRes.getEntity();
-       Assert.assertNotNull(roleUpdated);
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + "Updated role: ");
-            org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory();            
-            logger.debug(objectAsXmlString(objectFactory.createRole(roleUpdated),
-                    Role.class));            
-        }
-
-       Assert.assertFalse(
-                       RoleClient.IMMUTABLE.equalsIgnoreCase(roleUpdated.getMetadataProtection()),
-                       "Role allowed update of the metadata protection flag.");
-       Assert.assertFalse(
-                       RoleClient.IMMUTABLE.equalsIgnoreCase(roleUpdated.getPermsProtection()),
-                       "Role allowed update of the perms protection flag.");
     }
 
        @Test(dataProvider = "testName",
@@ -652,15 +677,18 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
         RoleClient client = new RoleClient();
         // Submit the request to the service and store the response.
         ClientResponse<Role> res = client.update(knownResourceId, roleToUpdate);
-        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, Response.Status.BAD_REQUEST.getStatusCode());
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
-
     }
 
     // Failure outcomes
@@ -711,16 +739,20 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
                 true);
         ClientResponse<Role> res =
                 client.update(NON_EXISTENT_ID, role);
-        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);
     }
 
     // ---------------------------------------------------------------
@@ -756,17 +788,21 @@ public class RoleServiceTest extends AbstractServiceTestImpl<RolesList, Role, Ro
 
         // Submit the request to the service and store the response.
         RoleClient client = new RoleClient();
-        ClientResponse<Response> res = client.delete(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.delete(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);
     }
     
     // ---------------------------------------------------------------
diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/UriInfoImpl.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/UriInfoImpl.java
new file mode 100644 (file)
index 0000000..237c156
--- /dev/null
@@ -0,0 +1,315 @@
+package org.collectionspace.services.batch;
+
+import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
+import org.jboss.resteasy.specimpl.PathSegmentImpl;
+import org.jboss.resteasy.util.Encode;
+
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class UriInfoImpl implements UriInfo
+{
+   private String path;
+   private String encodedPath;
+   private MultivaluedMap<String, String> queryParameters;
+   private MultivaluedMap<String, String> encodedQueryParameters;
+   private MultivaluedMap<String, String> pathParameters;
+   private MultivaluedMap<String, String> encodedPathParameters;
+   private MultivaluedMap<String, PathSegment[]> pathParameterPathSegments;
+   private MultivaluedMap<String, PathSegment[]> encodedPathParameterPathSegments;
+
+   private List<PathSegment> pathSegments;
+   private List<PathSegment> encodedPathSegments;
+   private URI absolutePath;
+   private URI absolutePathWithQueryString;
+   private URI baseURI;
+   private List<String> matchedUris;
+   private List<String> encodedMatchedUris;
+   private List<Object> ancestors;
+
+
+   public UriInfoImpl(URI absolutePath, URI baseUri, String encodedPath, String queryString, List<PathSegment> encodedPathSegments)
+   {
+      /*
+      logger.info("**** URIINFO encodedPath: " + encodedPath);
+      for (PathSegment segment : encodedPathSegments)
+      {
+         logger.info("   Segment: " + segment.getPath());
+      }
+      */
+      this.encodedPath = encodedPath;
+      this.path = Encode.decodePath(encodedPath);
+      //System.out.println("path: " + path);
+      //System.out.println("encodedPath: " + encodedPath);
+
+      this.absolutePath = absolutePath;
+      this.encodedPathSegments = encodedPathSegments;
+      this.baseURI = baseUri;
+
+      extractParameters(queryString);
+      this.pathSegments = new ArrayList<PathSegment>(encodedPathSegments.size());
+      for (PathSegment segment : encodedPathSegments)
+      {
+         pathSegments.add(new PathSegmentImpl(((PathSegmentImpl) segment).getOriginal(), true));
+      }
+      if (queryString == null)
+      {
+         this.absolutePathWithQueryString = absolutePath;
+      }
+      else
+      {
+         this.absolutePathWithQueryString = URI.create(absolutePath.toString() + "?" + queryString);
+      }
+   }
+
+   public String getPath()
+   {
+      return path;
+   }
+
+   public String getPath(boolean decode)
+   {
+      if (decode) return getPath();
+      return encodedPath;
+   }
+
+   public List<PathSegment> getPathSegments()
+   {
+      return pathSegments;
+   }
+
+   public List<PathSegment> getPathSegments(boolean decode)
+   {
+      if (decode) return getPathSegments();
+      return encodedPathSegments;
+   }
+
+   public URI getRequestUri()
+   {
+      return absolutePathWithQueryString;
+   }
+
+   public UriBuilder getRequestUriBuilder()
+   {
+      return UriBuilder.fromUri(absolutePathWithQueryString);
+   }
+
+   public URI getAbsolutePath()
+   {
+      return absolutePath;
+   }
+
+   public UriBuilder getAbsolutePathBuilder()
+   {
+      return UriBuilder.fromUri(absolutePath);
+   }
+
+   public URI getBaseUri()
+   {
+      return baseURI;
+   }
+
+   public UriBuilder getBaseUriBuilder()
+   {
+      return UriBuilder.fromUri(baseURI);
+   }
+
+   public MultivaluedMap<String, String> getPathParameters()
+   {
+      if (pathParameters == null)
+      {
+         pathParameters = new MultivaluedMapImpl<String, String>();
+      }
+      return pathParameters;
+   }
+
+   public void addEncodedPathParameter(String name, String value)
+   {
+      getEncodedPathParameters().add(name, value);
+      String value1 = Encode.decodePath(value);
+      getPathParameters().add(name, value1);
+   }
+
+   private MultivaluedMap<String, String> getEncodedPathParameters()
+   {
+      if (encodedPathParameters == null)
+      {
+         encodedPathParameters = new MultivaluedMapImpl<String, String>();
+      }
+      return encodedPathParameters;
+   }
+
+   public MultivaluedMap<String, PathSegment[]> getEncodedPathParameterPathSegments()
+   {
+      if (encodedPathParameterPathSegments == null)
+      {
+         encodedPathParameterPathSegments = new MultivaluedMapImpl<String, PathSegment[]>();
+      }
+      return encodedPathParameterPathSegments;
+   }
+
+   public MultivaluedMap<String, PathSegment[]> getPathParameterPathSegments()
+   {
+      if (pathParameterPathSegments == null)
+      {
+         pathParameterPathSegments = new MultivaluedMapImpl<String, PathSegment[]>();
+      }
+      return pathParameterPathSegments;
+   }
+
+   public MultivaluedMap<String, String> getPathParameters(boolean decode)
+   {
+      if (decode) return getPathParameters();
+      return getEncodedPathParameters();
+   }
+
+   public MultivaluedMap<String, String> getQueryParameters()
+   {
+      if (queryParameters == null)
+      {
+         queryParameters = new MultivaluedMapImpl<String, String>();
+      }
+      return queryParameters;
+   }
+
+   protected MultivaluedMap<String, String> getEncodedQueryParameters()
+   {
+      if (encodedQueryParameters == null)
+      {
+         this.encodedQueryParameters = new MultivaluedMapImpl<String, String>();
+      }
+      return encodedQueryParameters;
+   }
+
+
+   public MultivaluedMap<String, String> getQueryParameters(boolean decode)
+   {
+      if (decode) return getQueryParameters();
+      else return getEncodedQueryParameters();
+   }
+
+   protected void extractParameters(String queryString)
+   {
+      if (queryString == null || queryString.equals("")) return;
+
+      String[] params = queryString.split("&");
+
+      for (String param : params)
+      {
+         if (param.indexOf('=') >= 0)
+         {
+            String[] nv = param.split("=", 2);
+            try
+            {
+               String name = URLDecoder.decode(nv[0], "UTF-8");
+               String val = nv.length > 1 ? nv[1] : "";
+               getEncodedQueryParameters().add(name, val);
+               getQueryParameters().add(name, URLDecoder.decode(val, "UTF-8"));
+            }
+            catch (UnsupportedEncodingException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+         else
+         {
+            try
+            {
+               String name = URLDecoder.decode(param, "UTF-8");
+               getEncodedQueryParameters().add(name, "");
+               getQueryParameters().add(name, "");
+            }
+            catch (UnsupportedEncodingException e)
+            {
+               throw new RuntimeException(e);
+            }
+         }
+      }
+   }
+
+   public List<String> getMatchedURIs(boolean decode)
+   {
+      if (decode)
+      {
+         if (matchedUris == null) matchedUris = new ArrayList<String>();
+         return matchedUris;
+      }
+      else
+      {
+         if (encodedMatchedUris == null) encodedMatchedUris = new ArrayList<String>();
+         return encodedMatchedUris;
+      }
+   }
+
+   public List<String> getMatchedURIs()
+   {
+      return getMatchedURIs(true);
+   }
+
+   public List<Object> getMatchedResources()
+   {
+      if (ancestors == null) ancestors = new ArrayList<Object>();
+      return ancestors;
+   }
+
+
+   public void pushCurrentResource(Object resource)
+   {
+      if (ancestors == null) ancestors = new ArrayList<Object>();
+      ancestors.add(0, resource);
+   }
+
+   public void popCurrentResource()
+   {
+      if (ancestors != null && ancestors.size() > 0)
+      {
+         ancestors.remove(0);
+      }
+   }
+
+   public void pushMatchedURI(String encoded, String decoded)
+   {
+      if (encodedMatchedUris == null) encodedMatchedUris = new ArrayList<String>();
+      encodedMatchedUris.add(0, encoded);
+
+      if (matchedUris == null) matchedUris = new ArrayList<String>();
+      matchedUris.add(0, decoded);
+   }
+
+   public void popMatchedURI()
+   {
+      if (encodedMatchedUris != null && encodedMatchedUris.size() > 0)
+      {
+         encodedMatchedUris.remove(0);
+      }
+      if (matchedUris != null && matchedUris.size() > 0)
+      {
+         matchedUris.remove(0);
+      }
+   }
+
+@Override
+public URI relativize(URI arg0) {
+       // TODO Auto-generated method stub
+       return null;
+}
+
+@Override
+public URI resolve(URI arg0) {
+       // TODO Auto-generated method stub
+       return null;
+}
+
+}
index c91bcad956f82504009965cc0b4a68a9219dda17..96a88e2967e9dad864286eb661bbbafe88666f97 100644 (file)
@@ -166,13 +166,13 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         personTerms.add(term);
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                        authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+        Response res = personAuthClient.createItem(personAuthCSID, multipart);
         try {
                assertStatusCode(res, "createPerson (not a surefire test)");
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -189,17 +189,17 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     public void readAndCheckAuthRefs(String testName) throws Exception {
         testSetup(STATUS_OK, ServiceRequestType.READ);
         BlobClient blobClient = new BlobClient();
-        ClientResponse<String> res = blobClient.read(knownResourceId);
+        Response res = blobClient.read(knownResourceId);
         BlobsCommon blob = null;
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                blob = (BlobsCommon) extractPart(input, blobClient.getCommonPartName(), BlobsCommon.class);
                Assert.assertNotNull(blob);
                logger.debug(objectAsXmlString(blob, BlobsCommon.class));
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -207,10 +207,10 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         Assert.assertEquals(blob.getName(), blobName);
 
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = blobClient.getAuthorityRefs(knownResourceId);
+        res = blobClient.getAuthorityRefs(knownResourceId);
         try {
-               assertStatusCode(res2, testName);
-               AuthorityRefList list = res2.getEntity();
+               assertStatusCode(res, testName);
+               AuthorityRefList list = (AuthorityRefList)res.getEntity();
                List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
                int numAuthRefsFound = items.size();
                logger.debug("Authority references, found " + numAuthRefsFound);
@@ -227,8 +227,8 @@ public class BlobAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                    }
                }
         } finally {
-               if (res2 != null) {
-                       res2.releaseConnection();
+               if (res != null) {
+                       res.close();
             }
         }
     }
index 30c54f5c062bb6efefc8e2f2485dc3a88d4f2075..7cee06e85ded769668f8a09896606a873d0c1d2e 100644 (file)
@@ -85,7 +85,7 @@ public class CitationAuthorityClientUtils {
        PoxPayloadOut multipart = 
                createCitationInstance(commonPartXML, client.getItemCommonPartName());
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -100,7 +100,7 @@ public class CitationAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -120,7 +120,7 @@ public class CitationAuthorityClientUtils {
        return createItemInAuthority(vcsid, commonPartXML, client );
     }    
 
-    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 77d06abc908fd475a5647c276f96b7b7120d81bd..98f99d3f20af84d3e29a7c3956b146fc3b8c0852 100644 (file)
@@ -265,13 +265,13 @@ public class CitationAuthorityServiceTest extends AbstractAuthorityServiceTest<C
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.delete(resourceId).releaseConnection();
+            client.delete(resourceId).close();
         }
     }
 
index 91fc655d5386480803f741c24ac9fcd8cab0c017..85cbcb0fc71f0441e37d3cccef44596ffbef6357 100644 (file)
@@ -19,7 +19,7 @@ public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonLis
     }
                
     @Override
-       public ClientResponse<String> read(String csid) {
+       public Response read(String csid) {
         return getProxy().read(csid);
     }
     
index 2b6d0c5f9b8b5da1d743fe6a3a4902edce4cc16a..69e24e09f220f639745195fd73023b8e1dfc9291 100644 (file)
@@ -513,7 +513,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * @see org.collectionspace.services.client.AbstractServiceClientImpl#delete(java.lang.String)
      */
     @Override
-       public ClientResponse<Response> delete(String csid) {
+       public Response delete(String csid) {
         return getProxy().delete(csid);
     }
 
@@ -523,7 +523,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * @see org.collectionspace.services.client.BlobProxy#getAuthorityRefs(java.lang.String)
      */
     @Override
-       public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+       public Response getAuthorityRefs(String csid) { // Response.getEntity returns AuthorityRefList type
         return getProxy().getAuthorityRefs(csid);
     }
     
index affb581bd554510ceeaa4e4b6de780dd3bea2ddd..85596a5cea77740b581c797f7ca2611bd8ec508d 100644 (file)
@@ -31,10 +31,10 @@ public interface AuthorityClient<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>
     void setInAuthority(AUTHORITY_ITEM_TYPE item, String inAuthorityCsid);
        
     //(C)reate Item
-    ClientResponse<Response> createItem(String vcsid, PoxPayloadOut poxPayloadOut);
+    Response createItem(String vcsid, PoxPayloadOut poxPayloadOut);
 
     //(R)ead Item
-    ClientResponse<String> readItem(String vcsid, String csid);
+    Response readItem(String vcsid, String csid);
     
     //(R)ead Item
     ClientResponse<String> readItem(String vcsid, String csid, Boolean includeDeleted);    
@@ -43,7 +43,7 @@ public interface AuthorityClient<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>
     ClientResponse<String> updateItem(String vcsid, String csid, PoxPayloadOut poxPayloadOut);
 
     //(D)elete Item
-    ClientResponse<Response> deleteItem(String vcsid, String csid);
+    Response deleteItem(String vcsid, String csid);
     
     // Get a list of objects that
     ClientResponse<AuthorityRefDocList> getReferencingObjects(
index 7d8443a21a9ff72c6760caf5ef6edacc2911384c..d8e1d3de72b937ff6826d03cfa722d76dfc59f17 100644 (file)
@@ -21,13 +21,13 @@ public abstract class AuthorityClientImpl<AUTHORITY_ITEM_TYPE, P extends Authori
 
        //(C)reate Item
        @Override
-    public ClientResponse<Response> createItem(String vcsid, PoxPayloadOut poxPayloadOut) {
+    public Response createItem(String vcsid, PoxPayloadOut poxPayloadOut) {
        return getProxy().createItem(vcsid, poxPayloadOut.getBytes());
     }
 
     //(R)ead Item
     @Override
-       public ClientResponse<String> readItem(String vcsid, String csid) {
+       public Response readItem(String vcsid, String csid) {
        return getProxy().readItem(vcsid, csid, INCLUDE_DELETE_TRUE);
     }
     
@@ -44,7 +44,7 @@ public abstract class AuthorityClientImpl<AUTHORITY_ITEM_TYPE, P extends Authori
 
     //(D)elete Item
     @Override
-       public ClientResponse<Response> deleteItem(String vcsid, String csid) {
+       public Response deleteItem(String vcsid, String csid) {
        return getProxy().deleteItem(vcsid, csid);
     }
     
index 37f16e4587a2469842aa91b0f4c5f04248902f15..0d9ccdf12b81c6dc1623fce47d9f9ccf706d618b 100644 (file)
@@ -47,7 +47,7 @@ public interface AuthorityProxy extends CollectionSpaceCommonListPoxProxy {
     //(D)elete Item
     @DELETE
     @Path("/{vcsid}/items/{csid}")
-    ClientResponse<Response> deleteItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid);
+    Response deleteItem(@PathParam("vcsid") String vcsid, @PathParam("csid") String csid);
     
     /**
      * Get a list of objects that reference a given authority term.
index 5f3e557724d41f817a7cd900e808138c4692e843..d88554a848bfbe0e5d98e472ada4e5a5ac23e132 100644 (file)
@@ -180,7 +180,7 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
 
        public Response create(REQUEST_TYPE payload);
        
-       public ClientResponse<RESPONSE_TYPE> read(String csid);
+       public Response read(String csid);
 
     public ClientResponse<RESPONSE_TYPE> update(String csid, REQUEST_TYPE payload);
        
@@ -226,7 +226,7 @@ public interface CollectionSpaceClient<CLT, REQUEST_TYPE, RESPONSE_TYPE, P exten
      * @param csid the csid
      * @return the authority refs
      */
-    public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid);
+    public Response getAuthorityRefs(String csid); // Response.getEntity returns AuthorityRefList type
     
     /**
      * Delete.
index e8aade4eac62946bb8b6ff823af899c59a2b63d9..0b2b6e800de34e62d9d714579baa0aa8d6c865fa 100644 (file)
@@ -23,7 +23,7 @@ public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends
        // (R)ead
        @GET
        @Path("/{csid}")
-       ClientResponse<String> read(@PathParam("csid") String csid);
+       Response read(@PathParam("csid") String csid); // Returned entity type in response is String
 
        // (R)ead
        @GET
index 2ed0b68304e3802e75518df65dd15d974985f547..40b6201f71df6177e4747f2a5fbca5cd4b6c29b9 100644 (file)
@@ -50,7 +50,7 @@ public interface CollectionSpaceProxy<CLT> {
     //(D)elete
     @DELETE
     @Path("/{csid}")
-    ClientResponse<Response> delete(@PathParam("csid") String csid);
+    Response delete(@PathParam("csid") String csid);
        
     // List Authority References
     @GET
index f878f897e2084d21d1fa2a170fd16d0dbd2500ce..08578f359f70b8a49ae8fe8e874d8f25ce529419 100644 (file)
@@ -313,8 +313,13 @@ 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<Response> res = client.deleteItem(knownResourceId, knownItemResourceId);
-        int statusCode = res.getStatus();
+        Response res = client.deleteItem(knownResourceId, knownItemResourceId);
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+        } finally {
+               res.close();
+        }
 
         // Check the status code of the response: does it match
         // the expected response(s)?
@@ -386,8 +391,13 @@ 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<Response> res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
-        int statusCode = res.getStatus();
+        Response res = client.deleteItem(knownResourceId, NON_EXISTENT_ID);
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+        } finally {
+               res.close();
+        }
 
         // Check the status code of the response: does it match
         // the expected response(s)?
index 5d228ee662798e283cd18c41e434fbd972ecdbc9..b4c1abce2779298a9bf9e8c949ddb22f3f7a39cc 100644 (file)
@@ -1,5 +1,7 @@
 package org.collectionspace.services.client.test;
 
+import javax.ws.rs.core.Response;
+
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PayloadInputPart;
 import org.collectionspace.services.client.PayloadOutputPart;
@@ -7,7 +9,6 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
-
 import org.jboss.resteasy.client.ClientResponse;
 import org.testng.Assert;
 
@@ -19,7 +20,7 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
                extends AbstractServiceTestImpl<CLT, CPT, PoxPayloadOut, String> {
                
        @Override
-       public CPT extractCommonPartValue(ClientResponse<String> res) throws Exception {
+       public CPT extractCommonPartValue(Response res) throws Exception {
                CPT result = null;
                
                CollectionSpaceClient client = getClientInstance();
@@ -66,12 +67,12 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends 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.");
index 6d6550f44e2f0076cff594946d081ec9979deaa7..6b6514d9b0571910f982e71249776eaaf688d72a 100644 (file)
@@ -185,26 +185,30 @@ 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<RESPONSE_TYPE> res = client.read(getKnowResourceId());
-        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(getKnowResourceId());
+        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);
+       
+               RESPONSE_TYPE output = (RESPONSE_TYPE) res.getEntity();
+               Assert.assertNotNull(output);
+               
+               //
+               // Now compare with the expected field values
+               //
+               REQUEST_TYPE expectedResult = createInstance("read_test");
+               compareReadInstances(extractCommonPartValue(expectedResult), extractCommonPartValue(res));
+        } finally {
+               res.close();
         }
-        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
-        //
-        REQUEST_TYPE expectedResult = createInstance("read_test");
-        compareReadInstances(extractCommonPartValue(expectedResult), extractCommonPartValue(res));
     }
     
     @Override
@@ -238,7 +242,7 @@ 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<RESPONSE_TYPE> res = client.read(NON_EXISTENT_ID);
+        Response res = client.read(NON_EXISTENT_ID);
         int statusCode = res.getStatus();
         try {
             // Check the status code of the response: does it match
@@ -250,7 +254,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
     }
 
@@ -288,7 +292,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     
 //    protected abstract Class<CPT> getCommonPartTypeClass();
     
-    public CPT extractCommonPartValue(ClientResponse<RESPONSE_TYPE> res) throws Exception {
+    public CPT extractCommonPartValue(Response res) throws Exception {
        CPT result = null;
        result = (CPT) res.getEntity();
        return result;
@@ -322,18 +326,24 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
 
         // Retrieve the contents of a resource to update.
        CollectionSpaceClient client = this.getClientInstance();
-        ClientResponse<RESPONSE_TYPE> res = client.read(getKnowResourceId());
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": read status = " + res.getStatus());
-        }
-        Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("Got object to update with CSID= " + getKnowResourceId());
+        Response res = client.read(getKnowResourceId());
+        CPT commonPartObject = null;
+        try {
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": read status = " + res.getStatus());
+               }
+               Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
+       
+               if (logger.isDebugEnabled()) {
+                   logger.debug("Got object to update with CSID= " + getKnowResourceId());
+               }
+       
+               commonPartObject = this.extractCommonPartValue(res);
+               Assert.assertNotNull(commonPartObject);
+        } finally {
+               res.close();
         }
-
-        CPT commonPartObject = this.extractCommonPartValue(res);
-        Assert.assertNotNull(commonPartObject);
+        
         CPT theUpdate = updateInstance(commonPartObject);
         if (logger.isDebugEnabled()) {
             logger.debug("\n\nTo be updated fields: CSID = "  + getKnowResourceId() + "\n"
@@ -343,17 +353,22 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         // Submit the request to the service and store the response.
         REQUEST_TYPE output = this.createRequestTypeInstance(theUpdate);
         res = client.update(getKnowResourceId(), 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);
+        CPT updatedCommonPartObject = 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);
+       
+               updatedCommonPartObject = this.extractCommonPartValue(res);
+               Assert.assertNotNull(updatedCommonPartObject);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        CPT updatedCommonPartObject = this.extractCommonPartValue(res);
-        Assert.assertNotNull(updatedCommonPartObject);
 
         compareUpdatedInstances(theUpdate, updatedCommonPartObject);
     }
@@ -1049,13 +1064,16 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
         AuthorityClient client = (AuthorityClient) getClientInstance();
         String identifier = createIdentifier();
         PoxPayloadOut multipart = createItemInstance(parentCsid, identifier);
-        ClientResponse<Response> res = client.createItem(parentCsid, multipart);
-
-        int statusCode = res.getStatus();
-        Assert.assertEquals(statusCode, STATUS_CREATED);
-
-        result = extractId(res);
-        allResourceItemIdsCreated.put(result, parentCsid);
+        Response res = client.createItem(parentCsid, multipart);
+        try {
+               int statusCode = res.getStatus();
+               Assert.assertEquals(statusCode, STATUS_CREATED);
+       
+               result = extractId(res);
+               allResourceItemIdsCreated.put(result, parentCsid);
+        } finally {
+               res.close();
+        }
 
         return result;
     }
index 6852ab9c8618b13516917e5f4497fd31b4b67bbe..ff776163fadb222c9bf8f63145628b672a099a6a 100644 (file)
@@ -754,7 +754,7 @@ public abstract class BaseServiceTest<CLT> {
                 String itemResourceId = entry.getKey();
                 String authorityResourceId = entry.getValue();
                 // Note: Any non-success responses are ignored and not reported.
-                authorityClient.deleteItem(authorityResourceId, itemResourceId).releaseConnection();
+                authorityClient.deleteItem(authorityResourceId, itemResourceId).close();
             }
         }
         //
index dc5eeb6a68d617530ddbb7d5d94c96dcda66e6da..a4e8a655defddd975b9e450e26c3d1ec49ad8956 100644 (file)
@@ -145,7 +145,6 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
                         + "\r\n ownerRefName: "+ownerRefName
                         + "\r\n fieldCollectionSourceRefName: "+fieldCollectionSourceRefName
                         + "\r\n fieldCollectorRefName: "+fieldCollectorRefName;
-        StringBuffer buff = new StringBuffer();
 
         return result;
     }
@@ -247,6 +246,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      * @return the CSID of the newly-created person record
      */
     protected String createPerson(String firstName, String surName, String shortIdentifier ) {
+       String result = null;
+       
         Map<String, String> personInfo = new HashMap<String,String>();
         personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
         personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
@@ -258,16 +259,21 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
         term.setTermName(termName);
         personTerms.add(term);
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
-       PoxPayloadOut multipart =
-               PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+       PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                                personAuthRefName, personInfo, personTerms, 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;
     }
 
     /**
@@ -351,6 +357,8 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
      * @return the CSID of the newly-created organization record
      */
     protected String createOrganization(String shortName, String foundingPlace, String shortIdentifier ) {
+       String result = null;
+       
         Map<String, String> orgInfo = new HashMap<String,String>();
         orgInfo.put(OrganizationJAXBSchema.FOUNDING_PLACE, foundingPlace);
         orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
@@ -364,13 +372,19 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
        PoxPayloadOut multipart =
                OrgAuthorityClientUtils.createOrganizationInstance(orgAuthRefName, orgInfo, orgTerms, orgAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
-        int statusCode = res.getStatus();
-
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, STATUS_CREATED);
-       return extractId(res);
+        Response res = orgAuthClient.createItem(orgAuthCSID, 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;
     }
     
    /**
@@ -417,30 +431,30 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
         // First read the object
         //
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
-        ClientResponse<String> res = collectionObjectClient.read(knownResourceId);
+        Response res = collectionObjectClient.read(knownResourceId);
         CollectionobjectsCommon collectionObject = null;
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                collectionObject = (CollectionobjectsCommon) extractPart(input,
                                collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
                Assert.assertNotNull(collectionObject);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
         // Next, get all of the auth refs and check that the expected number is returned
         //
-        ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
+        res = collectionObjectClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
-               assertStatusCode(res2, testName);        
-               list = res2.getEntity();
+               assertStatusCode(res, testName);        
+               list = (AuthorityRefList)res.getEntity();
         } finally {
-               if (res2 != null) {
-                       res2.releaseConnection();
+               if (res != null) {
+                       res.close();
             }
         }
         
@@ -510,24 +524,24 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest<AbstractCommon
         CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
         for (String resourceId : collectionObjectIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            collectionObjectClient.delete(resourceId).releaseConnection();
+            collectionObjectClient.delete(resourceId).close();
         }
         // Note: Any non-success response is ignored and not reported.
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete persons before PersonAuth
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
+            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
-        personAuthClient.delete(personAuthCSID).releaseConnection();
+        personAuthClient.delete(personAuthCSID).close();
         // Note: Any non-success response is ignored and not reported.
         OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
         // Delete organizations before OrgAuth
         for (String resourceId : orgIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            orgAuthClient.deleteItem(orgAuthCSID, resourceId).releaseConnection();
+            orgAuthClient.deleteItem(orgAuthCSID, resourceId).close();
         }
-        orgAuthClient.delete(orgAuthCSID).releaseConnection();
+        orgAuthClient.delete(orgAuthCSID).close();
     }
 
     // ---------------------------------------------------------------
index 94d44e92184ccea579aaaf9fde9fda41fd227960..b133d33ddfe5ccb63dbcd7aa4c0f201c75e3e25b 100644 (file)
@@ -165,22 +165,26 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                        CollectionObjectJAXBSchema.DISTINGUISHING_FEATURES;
                String propertyValue = theKeyword;
                ClientResponse<AbstractCommonList> res = doAdvancedSearch(propertyName, propertyValue, "=");
-               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);
+       
+                       // Verify that the number of resources matched by the search
+                       // is identical to the expected result
+                       long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
+                       long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
+                       Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
+               } finally {
+                       res.close();
                }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-               // Verify that the number of resources matched by the search
-               // is identical to the expected result
-               long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
-               long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
-               Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
        }
 
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, groups = { "oneKeyword" })
@@ -199,22 +203,26 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
 
                // Send the search request and receive a response
                ClientResponse<AbstractCommonList> res = doSearch(KEYWORD);
-               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);
+       
+                       // Verify that the number of resources matched by the search
+                       // is identical to the expected result
+                       long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
+                       long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
+                       Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
+               } finally {
+                       res.close();
                }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-               // Verify that the number of resources matched by the search
-               // is identical to the expected result
-               long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
-               long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
-               Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
        }
 
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
@@ -238,44 +246,51 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
 
                // Send the search request and receive a response
                ClientResponse<AbstractCommonList> res = doSearch(TWO_KEYWORDS);
-               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);
+       
+                       // Verify that the number of resources matched by the search
+                       // is identical to the expected result
+                       long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
+                       long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
+                       Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
+               } finally {
+                       res.close();
                }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-               // Verify that the number of resources matched by the search
-               // is identical to the expected result
-               long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
-               long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
-               Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
 
                // Search using a single term
 
                // Send the search request and receive a response
                res = doSearch(TWO_KEYWORDS.get(0));
-               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);
+       
+                       // Verify that the number of resources matched by the search
+                       // is identical to the expected result
+                       long NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
+                       long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
+                       Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
+               } finally {
+                       res.close();
                }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-               // Verify that the number of resources matched by the search
-               // is identical to the expected result
-               NUM_MATCHES_EXPECTED = numKeywordRetrievableResources;
-               numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
-               Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
-
        }
 
        @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
@@ -394,23 +409,27 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
 
                // Send the search request and receive a response
                ClientResponse<AbstractCommonList> res = doSearch(NON_EXISTENT_KEYWORD);
-               int statusCode = res.getStatus();
+               int statusCode;
+               try {
+                       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);
+                       // 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);
+       
+                       // Verify that the number of resources matched by the search
+                       // is identical to the expected result
+                       long NUM_MATCHES_EXPECTED = 0;
+                       long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
+                       Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
+               } finally {
+                       res.close();
                }
-               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                               invalidStatusCodeMessage(testRequestType, statusCode));
-               Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-               // Verify that the number of resources matched by the search
-               // is identical to the expected result
-               long NUM_MATCHES_EXPECTED = 0;
-               long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED, testName);
-               Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED);
-
        }
 
        // ---------------------------------------------------------------
@@ -440,7 +459,7 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
                for (String resourceId : allResourceIdsCreated) {
                        // Note: Any non-success responses are ignored and not reported.
-                       collectionObjectClient.delete(resourceId).releaseConnection();
+                       collectionObjectClient.delete(resourceId).close();
                }
        }
 
@@ -496,9 +515,9 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                }
                PoxPayloadOut multipart = new PoxPayloadOut(
                                CollectionObjectClient.SERVICE_PAYLOAD_NAME);
-               PayloadOutputPart commonPart = multipart.addPart(collectionObject,
-                               MediaType.APPLICATION_XML_TYPE);
+               PayloadOutputPart commonPart = multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
                commonPart.setLabel(new CollectionObjectClient().getCommonPartName());
+               
                return multipart;
        }
 
@@ -528,8 +547,8 @@ public class CollectionObjectSearchTest extends BaseServiceTest<AbstractCommonLi
                String whereClause = propertyName + operator +
                        "'" + propertyValue + "'";
                CollectionObjectClient client = new CollectionObjectClient();
-               ClientResponse<AbstractCommonList> res = client
-                               .advancedSearchIncludeDeleted(whereClause, false); // NOT_INCLUDING_DELETED_RESOURCES
+               ClientResponse<AbstractCommonList> res = client.advancedSearchIncludeDeleted(whereClause, false); // NOT_INCLUDING_DELETED_RESOURCES
+       
                return res;
        }
 
index 00fc275061a54a29e9a70fb428f04df9ddc59218..609a27914a9791325dbf33c85e60b0e8fa28804e 100644 (file)
@@ -550,6 +550,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
         if(logger.isDebugEnabled()){
             logger.debug("got object to update with ID: " + knownResourceId);
         }
+        
         return res;
     }
 
@@ -756,7 +757,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
                // Extract its common part.
                collectionObjectCommon = extractCommonPartValue(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
         // Update the common part with invalid content, by setting a value to
@@ -784,7 +785,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
                        invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
@@ -822,7 +823,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         CollectionObjectClient client = new CollectionObjectClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        Response res = client.delete(NON_EXISTENT_ID);
         try {
                int statusCode = res.getStatus();
        
@@ -835,7 +836,7 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
                        invalidStatusCodeMessage(testRequestType, statusCode));
                Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
@@ -1104,7 +1105,6 @@ public class CollectionObjectServiceTest extends AbstractPoxServiceTestImpl<Abst
      * @throws Exception the exception
      */
     private String createFromXmlFile(String testName, String fileName, boolean useJaxb) throws Exception {
-  
         // Perform setup.
         setupCreate();
 
@@ -1151,20 +1151,25 @@ 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);
-        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);
+        CollectionobjectsCommon collectionObject = 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);
+       
+               // Extract the common part.
+               collectionObject = extractCommonPartValue(res);
+               Assert.assertNotNull(collectionObject);
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, testExpectedStatusCode);
-
-        // Extract the common part.
-        CollectionobjectsCommon collectionObject = extractCommonPartValue(res);
-        Assert.assertNotNull(collectionObject);
 
         return collectionObject;
      }
index 39bbdc7a0743f51e6af8120c2b600423c065ca15..5b3f20fd0ad8a8b5b469f833b1a6065cbb3de458 100644 (file)
@@ -84,7 +84,7 @@ public class ConceptAuthorityClientUtils {
        PoxPayloadOut multipart = 
                createConceptInstance(commonPartXML, client.getItemCommonPartName());
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -99,7 +99,7 @@ public class ConceptAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -119,7 +119,7 @@ public class ConceptAuthorityClientUtils {
        return createItemInAuthority(vcsid, commonPartXML, client );
     }    
 
-    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 e3462f9dcc9ebfc275f5bf076b08f2729638ac51..ad5361596a547bcd2b94376108684c39b9ab2103 100644 (file)
@@ -273,13 +273,13 @@ public class ConceptAuthorityServiceTest extends AbstractAuthorityServiceTest<Co
            parentResourceId = entry.getValue();
            // Note: Any non-success responses from the delete operation
            // below are ignored and not reported.
-           client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+           client.deleteItem(parentResourceId, itemResourceId).close();
        }
        // Clean up parent resources.
        for (String resourceId : allResourceIdsCreated) {
            // Note: Any non-success responses from the delete operation
            // below are ignored and not reported.
-           client.delete(resourceId).releaseConnection();
+           client.delete(resourceId).close();
        }
    }
 
index 7d8a018d1fd1f7fdef7e0db85ac5f88a1a26d44c..566e78f4f49c97004bea74365b139dd20bbbb8db 100644 (file)
@@ -172,6 +172,8 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
     }
     
     protected 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);
@@ -183,16 +185,21 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
         term.setTermDisplayName(termName);
         term.setTermName(termName);
         personTerms.add(term);
-        PoxPayloadOut multipart =
-            PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
+        PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                     authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
-        int statusCode = res.getStatus();
+      
+        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();
+        }
 
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        Assert.assertEquals(statusCode, STATUS_CREATED);
-        return extractId(res);
+        return result;
     }
 
     // Success outcomes
@@ -204,12 +211,12 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
 
         // Submit the request to the service and store the response.
         ConditioncheckClient conditioncheckClient = new ConditioncheckClient();
-        ClientResponse<String> res = conditioncheckClient.read(knownResourceId);
+        Response res = conditioncheckClient.read(knownResourceId);
         ConditionchecksCommon conditioncheckCommon = 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());
             conditioncheckCommon = (ConditionchecksCommon) extractPart(input,
                 conditioncheckClient.getCommonPartName(), ConditionchecksCommon.class);
             Assert.assertNotNull(conditioncheckCommon);
@@ -218,7 +225,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
             }
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -226,15 +233,15 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
         Assert.assertEquals(conditioncheckCommon.getConditionChecker(), conditionCheckerRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = conditioncheckClient.getAuthorityRefs(knownResourceId);
+        Response res2 = conditioncheckClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
             assertStatusCode(res2, testName);
-            list = res2.getEntity();
+            list = (AuthorityRefList)res2.getEntity();
             Assert.assertNotNull(list);
         } finally {
             if (res2 != null) {
-                res2.releaseConnection();
+                res2.close();
             }
         }
         
@@ -298,9 +305,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
         
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            ClientResponse<Response> response = 
-                personAuthClient.deleteItem(personAuthCSID, resourceId); // alternative to personAuthClient.deleteItem().releaseConnection();
-            response.releaseConnection();
+               personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
         
         // Delete PersonAuthority resource(s).
@@ -309,11 +314,9 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest<AbstractCommonLi
             personAuthClient.delete(personAuthCSID);
             // Delete Condition Checks resource(s).
             ConditioncheckClient conditioncheckClient = new ConditioncheckClient();
-            ClientResponse<Response> response = null;
             for (String resourceId : conditioncheckIdsCreated) {
                 // Note: Any non-success responses are ignored and not reported.
-                response = conditioncheckClient.delete(resourceId); // alternative to conditioncheckClient.delete(resourceId).releaseConnection();
-                response.releaseConnection();
+                conditioncheckClient.delete(resourceId).close(); 
             }
         }
     }
index e8cd3b9337edaa38a6459a8b7731d53a5aedfa9e..64f7ed344285ce49448d646e599d23e87f6a51d3 100644 (file)
@@ -546,7 +546,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
         // Submit the request to the service and store the response.
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
             int statusCode = res.getStatus();
 
@@ -560,7 +560,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -579,7 +579,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
 
         // Submit the request to the service and store the response.
         ConditioncheckClient client = new ConditioncheckClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        Response res = client.delete(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -593,7 +593,7 @@ public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<Abstra
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index c98c10d3954b60a04f356ccb917d750317b1805c..a9e0b0ff390a9137351669440d8460f3d468ac0f 100644 (file)
@@ -572,17 +572,21 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
-        ClientResponse<Response> res = client.delete(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.delete(knownResourceId);
+        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);
     }
 
     // Failure outcomes
@@ -595,17 +599,21 @@ public class ContactServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         ContactClient client = new ContactClient();
-        ClientResponse<Response> res = client.delete(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.delete(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);
     }
 
     // ---------------------------------------------------------------
index 20287fb8d3c9ce2265e124a887762d3121a2a85c..a7451657a42b7b32c02eea7ba4eda61b3cab2f72 100644 (file)
@@ -524,7 +524,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
         // Submit the request to the service and store the response.
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
             int statusCode = res.getStatus();
 
@@ -538,7 +538,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -557,7 +557,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
 
         // Submit the request to the service and store the response.
         ExhibitionClient client = new ExhibitionClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        Response res = client.delete(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -571,7 +571,7 @@ public class ExhibitionServiceTest extends AbstractPoxServiceTestImpl<AbstractCo
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index d6e5277674cae5b5704db7558695217a4b8c6c53..83f154f7e4c7784877f918819e0bb5d7f65381f8 100644 (file)
@@ -208,6 +208,8 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     }
     
     protected 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);
@@ -222,13 +224,19 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         PoxPayloadOut multipart = 
                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                                authRefName, personInfo, personTerms, 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;
     }
 
     // Success outcomes
@@ -240,10 +248,10 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
         // Submit the request to the service and store the response.
         IntakeClient intakeClient = new IntakeClient();
-        ClientResponse<String> res = intakeClient.read(knownResourceId);
+        Response res = intakeClient.read(knownResourceId);
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                IntakesCommon intake = (IntakesCommon) extractPart(input,
                                intakeClient.getCommonPartName(), IntakesCommon.class);
                Assert.assertNotNull(intake);
@@ -253,19 +261,19 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                Assert.assertEquals(intake.getInsurers().getInsurer().get(0), insurerRefName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = intakeClient.getAuthorityRefs(knownResourceId);
+        res = intakeClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
-               assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               assertStatusCode(res, testName);
+               list = (AuthorityRefList)res.getEntity();
         } finally {
-               if (res2 != null) {
-                       res2.releaseConnection();
+               if (res != null) {
+                       res.close();
             }
         }
         
@@ -325,14 +333,14 @@ public class IntakeAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         IntakeClient intakeClient = new IntakeClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : intakeIdsCreated) {
-            intakeClient.delete(resourceId).releaseConnection();
+            intakeClient.delete(resourceId).close();
         }
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         // Delete persons before PersonAuth
         for (String resourceId : personIdsCreated) {
-            personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
+            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
-        personAuthClient.delete(personAuthCSID).releaseConnection();
+        personAuthClient.delete(personAuthCSID).close();
     }
 
     // ---------------------------------------------------------------
index 02284dbd9b46704a673afb3a88cb43ae6caffd52..1f92cf1d00c778c8e3f2449c192b214a61ae8329 100644 (file)
@@ -226,7 +226,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
                 OrgAuthorityClientUtils.createOrganizationInstance(null, //orgAuthRefName
                 orgInfo, orgTerms, orgAuthClient.getItemCommonPartName());
 
-        ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);
+        Response res = orgAuthClient.createItem(orgAuthCSID, multipart);
         int statusCode = res.getStatus();
 
         Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
@@ -244,16 +244,15 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
         
         // Get the auth ref docs and check them
        OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
-       ClientResponse<AuthorityRefDocList> refDocListResp =
-               orgAuthClient.getReferencingObjects(orgAuthCSID, currentOwnerOrgCSID);
+       Response refDocListResp = orgAuthClient.getReferencingObjects(orgAuthCSID, currentOwnerOrgCSID);
        AuthorityRefDocList list = null;
        try {
           assertStatusCode(refDocListResp, testName);
-          list = refDocListResp.getEntity();
+          list = (AuthorityRefDocList)refDocListResp.getEntity();
           Assert.assertNotNull(list);
        } finally {
           if (refDocListResp != null) {
-                  refDocListResp.releaseConnection();
+                  refDocListResp.close();
            }
        }
 
@@ -310,17 +309,15 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonL
         IntakeClient intakeClient = new IntakeClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : intakeIdsCreated) {
-            ClientResponse<Response> res = intakeClient.delete(resourceId);
-            res.releaseConnection();
+            intakeClient.delete(resourceId).close();
         }
         // Delete persons before PersonAuth
         OrgAuthorityClient personAuthClient = new OrgAuthorityClient();
         for (String resourceId : orgIdsCreated) {
-            ClientResponse<Response> res = personAuthClient.deleteItem(orgAuthCSID, resourceId);
-            res.releaseConnection();
+            personAuthClient.deleteItem(orgAuthCSID, resourceId).close();
         }
         if (orgAuthCSID != null) {
-               personAuthClient.delete(orgAuthCSID).releaseConnection();
+               personAuthClient.delete(orgAuthCSID).close();
         }
     }
 
index 9f81cccb3f77cbb2b96a8f11fefea843439905bb..04f2c29785ae34af11e0da2150f57fdc410db3b2 100644 (file)
@@ -226,6 +226,8 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
     }
 
     protected 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);
@@ -240,13 +242,19 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
         PoxPayloadOut multipart =
                 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                 authRefName, personInfo, personTerms, 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;
     }
 
     // Success outcomes
@@ -266,7 +274,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
                list = res.getEntity();
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -417,17 +425,15 @@ public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
         IntakeClient intakeClient = new IntakeClient();
         // Note: Any non-success responses are ignored and not reported.
         for (String resourceId : intakeIdsCreated) {
-            ClientResponse<Response> res = intakeClient.delete(resourceId);
-            res.releaseConnection();
+            intakeClient.delete(resourceId).close();
         }
         // Delete persons before PersonAuth
         PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
         for (String resourceId : personIdsCreated) {
-            ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
-            res.releaseConnection();
+            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
         if (personAuthCSID != null) {
-            personAuthClient.delete(personAuthCSID).releaseConnection();
+            personAuthClient.delete(personAuthCSID).close();
         }
     }
 
index 7322af4d27ca418b6e71c607faec492688614534..9432dfbc9e528b7841f9f0910db13c155b38f210 100644 (file)
@@ -210,6 +210,8 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     }
     
     protected 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);
@@ -224,13 +226,19 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
        PoxPayloadOut multipart =
                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, 
                                authRefName, personInfo, personTerms, 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; 
     }
 
     // Success outcomes
@@ -242,12 +250,12 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
         // Submit the request to the service and store the response.
         LoaninClient loaninClient = new LoaninClient();
-        ClientResponse<String> res = loaninClient.read(knownResourceId);
+        Response res = loaninClient.read(knownResourceId);
         LoansinCommon loaninCommon = 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());
                loaninCommon = (LoansinCommon) extractPart(input,
                    loaninClient.getCommonPartName(), LoansinCommon.class);
                Assert.assertNotNull(loaninCommon);
@@ -256,7 +264,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -269,15 +277,15 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         Assert.assertEquals(loaninCommon.getBorrowersAuthorizer(), borrowersAuthorizerRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = loaninClient.getAuthorityRefs(knownResourceId);
+        Response res2 = loaninClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
                assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               list = (AuthorityRefList)res2.getEntity();
                Assert.assertNotNull(list);
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
         
@@ -341,9 +349,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-               ClientResponse<Response> response = 
-                       personAuthClient.deleteItem(personAuthCSID, resourceId); // alternative to personAuthClient.deleteItem().releaseConnection();
-               response.releaseConnection();
+                       personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
         
         // Delete PersonAuthority resource(s).
@@ -352,11 +358,9 @@ public class LoaninAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                personAuthClient.delete(personAuthCSID);
                // Delete Loans In resource(s).
                LoaninClient loaninClient = new LoaninClient();
-               ClientResponse<Response> response = null;
                for (String resourceId : loaninIdsCreated) {
                    // Note: Any non-success responses are ignored and not reported.
-                   response = loaninClient.delete(resourceId); // alternative to loaninClient.delete(resourceId).releaseConnection();
-                   response.releaseConnection();
+                   loaninClient.delete(resourceId).close();
                }
         }
     }
index 75a223331776a0ea28bed4fe020999e8329e5ae8..6d4df126d08e7a577eccca83ffc17b292d810406 100644 (file)
@@ -531,7 +531,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Submit the request to the service and store the response.
         LoaninClient client = new LoaninClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
             int statusCode = res.getStatus();
 
@@ -545,7 +545,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -564,7 +564,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
 
         // Submit the request to the service and store the response.
         LoaninClient client = new LoaninClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        Response res = client.delete(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -578,7 +578,7 @@ public class LoaninServiceTest extends AbstractPoxServiceTestImpl<AbstractCommon
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index a881a3921e2aae406dc79112074b77af2cb41dc0..3db9abf68058c7751d19205e2bc6b70c22a895d7 100644 (file)
@@ -205,6 +205,8 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
     }
     
     protected 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);
@@ -219,13 +221,19 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         PoxPayloadOut multipart =
                PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                                authRefName, personInfo, personTerms, 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; 
     }
 
     // Success outcomes
@@ -237,12 +245,12 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
         // Submit the request to the service and store the response.
         LoanoutClient loanoutClient = new LoanoutClient();
-        ClientResponse<String> res = loanoutClient.read(knownResourceId);
+        Response res = loanoutClient.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());
                loanoutCommon = (LoansoutCommon) extractPart(input,
                    loanoutClient.getCommonPartName(), LoansoutCommon.class);
                Assert.assertNotNull(loanoutCommon);
@@ -251,7 +259,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -262,14 +270,14 @@ public class LoanoutAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         Assert.assertEquals(loanoutCommon.getLendersContact(), lendersContactRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = loanoutClient.getAuthorityRefs(knownResourceId);
+        Response res2 = loanoutClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
                assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               list = (AuthorityRefList)res2.getEntity();
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
 
index 41d46a08cda1f67db625b987e35f3eaccb517134..95a873b9d00ca16b0f974ac69bf6e590c2a6076a 100644 (file)
@@ -644,17 +644,21 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<Response> res = client.delete(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.delete(knownResourceId);
+        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);
     }
 
     // Failure outcomes
@@ -670,17 +674,21 @@ public class LoanoutServiceTest extends AbstractPoxServiceTestImpl<AbstractCommo
 
         // Submit the request to the service and store the response.
         LoanoutClient client = new LoanoutClient();
-        ClientResponse<Response> res = client.delete(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.delete(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);
     }
 
     // ---------------------------------------------------------------
index d1355888896bd9a88a01df828aea0f6bdcb4b8e4..fbc3e3a946305b28c58940d6985f92cc94fc8639 100644 (file)
@@ -138,7 +138,7 @@ public class LocationAuthorityClientUtils {
                createLocationInstance( locationAuthorityRefName,
                        locationMap, terms, client.getItemCommonPartName() );
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -155,7 +155,7 @@ public class LocationAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -186,7 +186,7 @@ public class LocationAuthorityClientUtils {
        PoxPayloadOut multipart = 
                createLocationInstance(commonPartXML, client.getItemCommonPartName());
        String newID = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
         try {
                int statusCode = res.getStatus();
        
@@ -201,7 +201,7 @@ public class LocationAuthorityClientUtils {
                }
                newID = extractId(res);
         } finally {
-               res.releaseConnection();
+               res.close();
         }
 
        return newID;
@@ -252,7 +252,7 @@ public class LocationAuthorityClientUtils {
        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 55c909eed44bf3323a23767339396605150fd340..cf8b400c0ee626146cb61e1c2a7c15a2127215e2 100644 (file)
@@ -347,13 +347,13 @@ public class LocationAuthorityServiceTest extends AbstractAuthorityServiceTest<L
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.delete(resourceId).releaseConnection();
+            client.delete(resourceId).close();
         }
     }
 
index 0d05432f2a6b30eb3529aa34ddf3b6b44855ce3b..9ac5e6dac0105c334f25a340d0a24a0a60a39728 100644 (file)
@@ -166,13 +166,13 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         personTerms.add(term);
         PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(
                        personAuthCSID, authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+        Response res = personAuthClient.createItem(personAuthCSID, multipart);
         try {
                assertStatusCode(res, "createPerson (not a surefire test)");
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -191,18 +191,18 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         testSetup(STATUS_OK, ServiceRequestType.READ);
 
         MediaClient mediaClient = new MediaClient();
-        ClientResponse<String> res = mediaClient.read(knownResourceId);
+        Response res = mediaClient.read(knownResourceId);
         PoxPayloadIn input = null;
         MediaCommon media = null;
         try {
                assertStatusCode(res, testName);
-               input = new PoxPayloadIn(res.getEntity());
+               input = new PoxPayloadIn((String)res.getEntity());
                media = (MediaCommon) extractPart(input, mediaClient.getCommonPartName(), MediaCommon.class);
                Assert.assertNotNull(media);
                logger.debug(objectAsXmlString(media, MediaCommon.class));
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -210,14 +210,14 @@ public class MediaAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         Assert.assertEquals(media.getTitle(), title);
 
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = mediaClient.getAuthorityRefs(knownResourceId);
+        Response res2 = mediaClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
                assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               list = (AuthorityRefList)res2.getEntity();
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
         
index 73f373e169e97f7a364e24de43365d313880f3db..c1d896a9f092e8cf179d583f65c6d5fb9701f9b0 100644 (file)
@@ -222,12 +222,12 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
 
         // Submit the request to the service and store the response.
         MovementClient movementClient = new MovementClient();
-        ClientResponse<String> res = movementClient.read(knownResourceId);
+        Response res = movementClient.read(knownResourceId);
         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(movementClient.getCommonPartName());
                if (payloadInputPart != null) {
                        movementCommon = (MovementsCommon) payloadInputPart.getBody();
@@ -238,7 +238,7 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
                }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         // Check a couple of fields
@@ -246,14 +246,14 @@ public class MovementAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
         Assert.assertEquals(movementCommon.getMovementContact(), movementContactRefName);
         
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = movementClient.getAuthorityRefs(knownResourceId);
+        Response res2 = movementClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
             assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               list = (AuthorityRefList)res2.getEntity();
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
         
index 54841b467c00207c01fc07239cee930aa270580b..00569b780ad8a0a22553351dd058ed77f7536ed8 100644 (file)
@@ -516,7 +516,7 @@ public class MovementSortByTest extends BaseServiceTest<AbstractCommonList> {
         MovementClient movementClient = new MovementClient();
         for (String resourceId : movementIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            movementClient.delete(resourceId).releaseConnection();
+            movementClient.delete(resourceId).close();
         }
     }
 
index a98bbf47a9c3eb7249fe08c3fb943c317a0f1391..ed5c38e167ccd28ed365fcf27d8c72072074b9c4 100644 (file)
@@ -181,13 +181,13 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         PoxPayloadOut multipart =
                 PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
                     authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
-        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+        Response res = personAuthClient.createItem(personAuthCSID, multipart);
         try {
                assertStatusCode(res, "createPerson (not a surefire test)");
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -199,17 +199,17 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
     public void readAndCheckAuthRefs(String testName) throws Exception {
         testSetup(STATUS_OK, ServiceRequestType.READ);
         ObjectExitClient objectexitClient = new ObjectExitClient();
-        ClientResponse<String> res = objectexitClient.read(knownResourceId);
+        Response res = objectexitClient.read(knownResourceId);
         ObjectexitCommon objectexit = null;
         try {
                assertStatusCode(res, testName);
-               PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+               PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                objectexit = (ObjectexitCommon) extractPart(input, objectexitClient.getCommonPartName(), ObjectexitCommon.class);
                Assert.assertNotNull(objectexit);
                logger.debug(objectAsXmlString(objectexit, ObjectexitCommon.class));
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -218,14 +218,14 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest<AbstractCommonList>
         Assert.assertEquals(objectexit.getExitNumber(), exitNumber);
 
         // Get the auth refs and check them
-        ClientResponse<AuthorityRefList> res2 = objectexitClient.getAuthorityRefs(knownResourceId);
+        Response res2 = objectexitClient.getAuthorityRefs(knownResourceId);
         AuthorityRefList list = null;
         try {
                assertStatusCode(res2, testName);
-               list = res2.getEntity();
+               list = (AuthorityRefList)res2.getEntity();
         } finally {
                if (res2 != null) {
-                       res2.releaseConnection();
+                       res2.close();
             }
         }
         List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
index e07bbed734a4eafc6ce96d1a7e59db6837a45d76..379a133efee97f7b56bffd85f7de70efefe01f42 100644 (file)
@@ -59,7 +59,7 @@ public class OrgAuthorityClientUtils {
     public static String getAuthorityRefName(String csid, OrgAuthorityClient client){
        if(client==null)
                client = new OrgAuthorityClient();
-        ClientResponse<String> res = client.read(csid);
+        Response res = client.read(csid);
         try {
                int statusCode = res.getStatus();
                if(!READ_REQ.isValidStatusCode(statusCode)
@@ -68,7 +68,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());
                    OrgauthoritiesCommon orgAuthority = 
                        (OrgauthoritiesCommon) CollectionSpaceClientUtils.extractPart(input,
                            client.getCommonPartName(), OrgauthoritiesCommon.class);
@@ -80,7 +80,7 @@ public class OrgAuthorityClientUtils {
                    throw new RuntimeException(e);
                }
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
@@ -176,7 +176,7 @@ public class OrgAuthorityClientUtils {
                createOrganizationInstance(orgAuthorityRefName, 
                                orgInfo, terms, orgRepeatablesInfo, client.getItemCommonPartName());
 
-       ClientResponse<Response> res = client.createItem(inAuthority, multipart);
+       Response res = client.createItem(inAuthority, multipart);
        String result;
        try {   
                int statusCode = res.getStatus();
@@ -193,7 +193,7 @@ public class OrgAuthorityClientUtils {
        
                result = extractId(res);
        } finally {
-               res.releaseConnection();
+               res.close();
        }
        
        return result;
@@ -319,7 +319,7 @@ public class OrgAuthorityClientUtils {
      * @param res the res
      * @return the string
      */
-    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 9b3b6275fa91470888975b27e855c5eafedd0656..36d395fc317cddfe250e30afaec6cd5eb5983d38 100644 (file)
@@ -269,7 +269,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
                        null, personInfo, personTerms, personAuthClient.getItemCommonPartName());
         
        String result = null;
-       ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+       Response res = personAuthClient.createItem(personAuthCSID, multipart);
        try {
                int statusCode = res.getStatus();
        
@@ -278,7 +278,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
                Assert.assertEquals(statusCode, STATUS_CREATED);
                result = extractId(res);
        } finally {
-               res.releaseConnection();
+               res.close();
        }
        
        return result;
@@ -392,12 +392,12 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
         // Delete Person resource(s) (before PersonAuthority resources).
         for (String resourceId : personIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            personAuthClient.deleteItem(personAuthCSID, resourceId).releaseConnection();
+            personAuthClient.deleteItem(personAuthCSID, resourceId).close();
         }
         // Delete PersonAuthority resource(s).
         // Note: Any non-success response is ignored and not reported.
         if(personAuthCSID!=null) {
-               personAuthClient.delete(personAuthCSID).releaseConnection();
+               personAuthClient.delete(personAuthCSID).close();
         }
         
         String parentResourceId;
@@ -409,14 +409,14 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest<AbstractCommonList
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.delete(resourceId).releaseConnection();
+            client.delete(resourceId).close();
         }
     }
 }
index 9c99d348628002bc18169d795f8ee0d21bd3b9b2..a4d380f816d8f2d29b8730e6bd7d8c5d34bda6b0 100644 (file)
@@ -952,9 +952,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest<Orgaut
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                    client.deleteItem(parentResourceId, itemResourceId);
-            res.releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         super.cleanUp();
index 23c963b705807a4a52856673443c5a8534e45b26..da32fafc7ceec5e3f6268023b875e90da40a1b2c 100644 (file)
@@ -68,7 +68,7 @@ public class PersonAuthorityClientUtils {
        if (client == null) {
                client = new PersonAuthorityClient();
        }
-        ClientResponse<String> res = client.read(csid);
+        Response res = client.read(csid);
         try {
                int statusCode = res.getStatus();
                if(!READ_REQ.isValidStatusCode(statusCode)
@@ -77,7 +77,7 @@ public class PersonAuthorityClientUtils {
                }
                //FIXME: remove the following try catch once Aron fixes signatures
                try {
-                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                   PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                    PersonauthoritiesCommon personAuthority = 
                        (PersonauthoritiesCommon) CollectionSpaceClientUtils.extractPart(input,
                            client.getCommonPartName(), PersonauthoritiesCommon.class);
@@ -89,7 +89,7 @@ public class PersonAuthorityClientUtils {
                    throw new RuntimeException(e);
                }
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
@@ -102,7 +102,7 @@ public class PersonAuthorityClientUtils {
        if ( client == null) {
                client = new PersonAuthorityClient();
        }
-        ClientResponse<String> res = client.readItem(inAuthority, csid);
+        Response res = client.readItem(inAuthority, csid);
         try {
                int statusCode = res.getStatus();
                if(!READ_REQ.isValidStatusCode(statusCode)
@@ -111,7 +111,7 @@ public class PersonAuthorityClientUtils {
                }
                //FIXME: remove the following try catch once Aron fixes signatures
                try {
-                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                   PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
                    PersonsCommon person = 
                        (PersonsCommon) CollectionSpaceClientUtils.extractPart(input,
                            client.getItemCommonPartName(), PersonsCommon.class);
@@ -123,7 +123,7 @@ public class PersonAuthorityClientUtils {
                    throw new RuntimeException(e);
                }
         } finally {
-               res.releaseConnection();
+               res.close();
         }
     }
 
@@ -306,7 +306,7 @@ public class PersonAuthorityClientUtils {
                        personMap, terms, personRepeatablesMap, client.getItemCommonPartName());
        
        String result = null;
-       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       Response res = client.createItem(vcsid, multipart);
        try {
                int statusCode = res.getStatus();
        
@@ -322,7 +322,7 @@ public class PersonAuthorityClientUtils {
        
                result = extractId(res);
        } finally {
-               res.releaseConnection();
+               res.close();
        }
        
        return result;
index 5d0013f6df3925fd35e3bf0c510d27342cddf319..85dae979c5ac11468c235b84b333b953c2e82c9a 100644 (file)
@@ -518,14 +518,13 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                client.deleteItem(parentResourceId, itemResourceId);
-            res.releaseConnection();
+            Response res = client.deleteItem(parentResourceId, itemResourceId);
+            res.close();
         }
         // Clean up authority resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses are ignored and not reported.
-            client.delete(resourceId).releaseConnection();
+            client.delete(resourceId).close();
         }
     }
 
@@ -651,12 +650,12 @@ public class PersonAuthoritySearchTest extends BaseServiceTest<AbstractCommonLis
                 partialTermPersonMap, partialTerms, partialTermRepeatablesMap, client.getItemCommonPartName() );
 
         String newID = null;
-        ClientResponse<Response> res = client.createItem(authorityCsid, multipart);
+        Response res = client.createItem(authorityCsid, multipart);
         try {
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
index 217e1722ebce8658fded2ba20f784629d18d5b1e..c3927d4a8bbcc61eabd9c41c11fd4cefc7715d77 100644 (file)
@@ -219,13 +219,13 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
                        personMap, terms, personRepeatablesMap, client.getItemCommonPartName() );
 
         String newID = null;
-        ClientResponse<Response> res = client.createItem(authId, multipart);
+        Response res = client.createItem(authId, multipart);
         try {
             assertStatusCode(res, "createItem");
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -348,9 +348,9 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest<AbstractComm
         PersonAuthorityClient client = new PersonAuthorityClient();
         // Clean up item resources.
         for (String itemId : allItemIdsCreated) {
-            client.deleteItem(authId, itemId).releaseConnection();
+            client.deleteItem(authId, itemId).close();
         }
-        client.delete(authId).releaseConnection();
+        client.delete(authId).close();
     }
 
 
index 1269e3c1779e43973cbaf773e45e4c5d0deb9245..8cc0a60576550bb1a63421086c6f2c4d3144a1da 100644 (file)
@@ -286,14 +286,14 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
                 PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
                 terms, itemRepeatableFieldProperties, client.getItemCommonPartName());
         setupCreate();
-        ClientResponse<Response> res = client.createItem(vcsid, multipart);
+        Response res = client.createItem(vcsid, multipart);
         String newID = null;
         try {
                assertStatusCode(res, testName);
             newID = PersonAuthorityClientUtils.extractId(res);
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
 
@@ -444,14 +444,14 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
                 NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
 
         // Send the request and receive a response
-        ClientResponse<Response> res = client.createItem(knownResourceId, multipart);
+        Response res = client.createItem(knownResourceId, multipart);
         // Check the status code of the response: does it match
         // the expected response(s)?
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
     }
@@ -517,7 +517,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
     protected void readInternal(String testName, String CSID, String shortId) {
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<String> res = null;
+        Response res = null;
         setupRead();
         if (CSID != null) {
             res = client.read(CSID);
@@ -530,7 +530,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             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());
                 PersonauthoritiesCommon personAuthority = (PersonauthoritiesCommon) extractPart(input,
                         client.getCommonPartName(), PersonauthoritiesCommon.class);
                 Assert.assertNotNull(personAuthority);
@@ -539,7 +539,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             }
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -593,7 +593,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
         setupRead();
-        ClientResponse<String> res = null;
+        Response res = null;
         if (authCSID != null) {
             if (itemCSID != null) {
                 res = client.readItem(authCSID, itemCSID);
@@ -613,10 +613,11 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         } else {
             Assert.fail("readInternal: Internal error. One of authCSID or authShortId must be non-null");
         }
+
         try {
             assertStatusCode(res, testName);
             // Check whether we've received a person.
-            PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+            PoxPayloadIn input = new PoxPayloadIn((String)res.getEntity());
             PersonsCommon person = (PersonsCommon) extractPart(input,
                     client.getItemCommonPartName(), PersonsCommon.class);
             Assert.assertNotNull(person);
@@ -636,7 +637,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             Assert.assertNotNull(groups.get(0));
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -658,14 +659,14 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
 
         // Submit the request to the service and store the response.
         PersonAuthorityClient client = new PersonAuthorityClient();
-        ClientResponse<String> res = client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         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();
             }
         }
         //
@@ -692,7 +693,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -918,16 +919,16 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
         setupRead();
-        ClientResponse<String> res = client.read(knownResourceId);
+        Response res = client.read(knownResourceId);
         try {
             assertStatusCode(res, testName);
             if (logger.isDebugEnabled()) {
                 logger.debug("got PersonAuthority to update with ID: " + knownResourceId);
             }
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -951,10 +952,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         try {
             assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -983,8 +984,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         PersonAuthorityClient client = new PersonAuthorityClient();
         PoxPayloadIn input = null;
         setupRead();
-        ClientResponse<String> res =
-                client.readItem(knownResourceId, knownItemResourceId);
+        Response res = client.readItem(knownResourceId, knownItemResourceId);
         try {
             assertStatusCode(res, testName);
             if (logger.isDebugEnabled()) {
@@ -992,10 +992,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
                         + knownItemResourceId
                         + " in PersonAuthority: " + knownResourceId);
             }
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -1032,10 +1032,10 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
         try {
             assertStatusCode(res, testName);
             // Retrieve the updated resource and verify that its contents exist.
-            input = new PoxPayloadIn(res.getEntity());
+            input = new PoxPayloadIn((String)res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -1087,7 +1087,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             input = new PoxPayloadIn(res.getEntity());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -1124,7 +1124,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             input = new PoxPayloadIn(res.getEntity());;
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         ContactsCommon updatedContact = (ContactsCommon) extractPart(input,
@@ -1179,7 +1179,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
     }
@@ -1223,7 +1223,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                       res.releaseConnection();
+                       res.close();
                }
         }
     }
@@ -1291,7 +1291,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             // below are ignored and not reported.
             ClientResponse<Response> res =
                     client.deleteContact(parentResourceId, itemResourceId, contactResourceId);
-            res.releaseConnection();
+            res.close();
         }
         // Clean up item resources.
         for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
@@ -1299,9 +1299,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest<Per
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                    client.deleteItem(parentResourceId, itemResourceId);
-            res.releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         super.cleanUp();
index 503e44431c6e56fd3ce05e8f60b4f0c138001ffe..b18f512958f38fa30ab6673a465302405816401c 100644 (file)
@@ -348,13 +348,13 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-           client.delete(resourceId).releaseConnection();
+           client.delete(resourceId).close();
         }
     }
 
index 60401bf9ea1d8202d54551ee31731803bd5569c5..8fba32b9c92c5fc05206e33e3c0207e7ca4cb44e 100644 (file)
@@ -469,7 +469,7 @@ public class PublicItemServiceTest extends
 
                // Submit the request to the service and store the response.
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<Response> res = client.delete(knownResourceId);
+               Response res = client.delete(knownResourceId);
                try {
                        int statusCode = res.getStatus();
 
@@ -483,7 +483,7 @@ public class PublicItemServiceTest extends
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
        }
@@ -506,7 +506,7 @@ public class PublicItemServiceTest extends
 
                // Submit the request to the service and store the response.
                PublicItemClient client = new PublicItemClient();
-               ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+               Response res = client.delete(NON_EXISTENT_ID);
                try {
                        int statusCode = res.getStatus();
 
@@ -520,7 +520,7 @@ public class PublicItemServiceTest extends
                        Assert.assertEquals(statusCode, testExpectedStatusCode);
                } finally {
                        if (res != null) {
-                               res.releaseConnection();
+                               res.close();
                        }
                }
        }
index c5f4e40ca8add086c632b65134ac0f56f9e4a77c..70ff0320d943a498f4e45c74880fa51305cfd1d4 100644 (file)
@@ -381,22 +381,31 @@ public class AuthenticationServiceTest extends BaseServiceTest<AbstractCommonLis
         AccountClient accountClient = new AccountClient();
         // accountClient.setAuth(true, "test", true, "test", true);
         // Submit the request to the service and store the response.
-        ClientResponse<Response> res = accountClient.delete(barneyAccountId);
-        int statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": barney status = " + statusCode);
+        
+        Response res = accountClient.delete(barneyAccountId);
+        int statusCode;
+        try {
+               statusCode = res.getStatus();
+            if (logger.isDebugEnabled()) {
+                logger.debug(testName + ": barney status = " + statusCode);
+            }
+            Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                    invalidStatusCodeMessage(testRequestType, statusCode));
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-
+        
         res = accountClient.delete(georgeAccountId);
-        statusCode = res.getStatus();
-        if (logger.isDebugEnabled()) {
-            logger.debug(testName + ": george status = " + statusCode);
+        try {
+               statusCode = res.getStatus();
+               if (logger.isDebugEnabled()) {
+                   logger.debug(testName + ": george status = " + statusCode);
+               }
+               Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+                       invalidStatusCodeMessage(testRequestType, statusCode));
+        } finally {
+               res.close();
         }
-        Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
-                invalidStatusCodeMessage(testRequestType, statusCode));
-        res.releaseConnection();
     }
     
     // ---------------------------------------------------------------
index 2d9bb5981136107b2bcbb0ae6a8d912970de82a0..6ec64ffc6e9fa84c185fc35e31bbcb0779b53ffa 100644 (file)
@@ -513,12 +513,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         //
         // Try to make a DELETE request
         //
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -532,12 +532,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         // Submit the request to the service and store the response.
         DimensionClient client = new DimensionClient();
 
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
                assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -675,12 +675,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
     private void deletePermission(String permId) {
         setupDelete();
         PermissionClient permClient = new PermissionClient();
-        ClientResponse<Response> res = permClient.delete(permId);
+        Response res = permClient.delete(permId);
         try {
                assertStatusCode(res, "DeletePermission");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -699,7 +699,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -709,12 +709,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
     private void deleteRole(String roleId) {
         setupDelete();
         RoleClient roleClient = new RoleClient();
-        ClientResponse<Response> res = roleClient.delete(roleId);
+        Response res = roleClient.delete(roleId);
         try {
                assertStatusCode(res, "DeleteRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -733,7 +733,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -743,12 +743,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
     private void deleteAccount(String accId) {
         setupDelete();
         AccountClient accClient = new AccountClient();
-        ClientResponse<Response> res = accClient.delete(accId);
+        Response res = accClient.delete(accId);
         try {
                assertStatusCode(res, "DeleteAccount");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -768,7 +768,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -784,12 +784,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         AccountRoleClient client = new AccountRoleClient();
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
-        ClientResponse<Response> res = client.delete(av.getAccountId());
+        Response res = client.delete(av.getAccountId());
         try {
                assertStatusCode(res, "DeleteAccountRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -809,7 +809,7 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -828,12 +828,12 @@ public class AuthorizationServiceTest extends BaseServiceTest<AbstractCommonList
         PermissionRoleClient client = new PermissionRoleClient();
         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
                 pv, rvls, true, true);
-        ClientResponse<Response> res = client.delete(pv.getPermissionId());
+        Response res = client.delete(pv.getPermissionId());
         try {
                assertStatusCode(res, "DeletePermissionRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 56a4cd762a0cd05cc98fd82064b709de0c24d5f1..f962371a45a700e173a5ef08e0c8723a6fabf362 100644 (file)
@@ -447,12 +447,12 @@ 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<Response> res = client.delete(id);
+        Response res = client.delete(id);
         try {
                result = assertStatusCode(res, testName);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -473,7 +473,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         DimensionClient client = new DimensionClient();
         //TENANT_2_USER of TENANT_2 is not allowed to delete the resource of TENANT_1
         client.setAuth(true, TENANT_2_USER, true, TENANT_2_USER, true);
-        ClientResponse<Response> res = client.delete(TENANT_RESOURCE_1);
+        Response res = client.delete(TENANT_RESOURCE_1);
         try {
                int statusCode = res.getStatus();
                // Check the status code of the response: does it match
@@ -488,7 +488,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                Assert.assertEquals(statusCode, Response.Status.NOT_FOUND.getStatusCode());
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -590,12 +590,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         PermissionClient permClient = new PermissionClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
         permClient.setAuth(true, ui.userName, true, ui.password, true);
-        ClientResponse<Response> res = permClient.delete(permId);
+        Response res = permClient.delete(permId);
         try {
                assertStatusCode(res, "DeletePermission");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -617,7 +617,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -629,12 +629,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         RoleClient roleClient = new RoleClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
         roleClient.setAuth(true, ui.userName, true, ui.password, true);
-        ClientResponse<Response> res = roleClient.delete(roleId);
+        Response res = roleClient.delete(roleId);
         try {
                assertStatusCode(res, "DeleteRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -655,7 +655,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -667,12 +667,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         AccountClient accClient = new AccountClient();
         UserInfo ui = tenantAdminUsers.get(tenantId);
         accClient.setAuth(true, ui.userName, true, ui.password, true);
-        ClientResponse<Response> res = accClient.delete(accId);
+        Response res = accClient.delete(accId);
         try {
                assertStatusCode(res, "DeleteAccount");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -694,7 +694,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                result = extractId(res);
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
 
@@ -712,12 +712,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         client.setAuth(true, ui.userName, true, ui.password, true);
         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
                 av, rvs, true, true);
-        ClientResponse<Response> res = client.delete(av.getAccountId());
+        Response res = client.delete(av.getAccountId());
         try {
                assertStatusCode(res, "DeleteAccountRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -740,7 +740,7 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
                result = extractId(res);
         }  finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         
@@ -757,12 +757,12 @@ public class MultiTenancyTest extends BaseServiceTest<AbstractCommonList> {
         client.setAuth(true, ui.userName, true, ui.password, true);
         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
                 pv, rvls, true, true);
-        ClientResponse<Response> res = client.delete(pv.getPermissionId());
+        Response res = client.delete(pv.getPermissionId());
         try {
                assertStatusCode(res, "DeletePermissionRole");
         } finally {
                if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 8dda0d3075ec15fb74cee813056cd5f213c78e2a..d04c3c3a896c033b4ed4212b5037118fe945bb5a 100644 (file)
@@ -209,7 +209,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
             Assert.assertNotNull(taxon);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
         //
@@ -230,7 +230,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
         try {
             assertStatusCode(res, testName);
         } finally {
-            res.releaseConnection();
+            res.close();
         }
     }
 
@@ -288,8 +288,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
                     invalidStatusCodeMessage(testRequestType, statusCode));
             Assert.assertEquals(statusCode, testExpectedStatusCode);
 
-            List<AbstractCommonList.ListItem> items =
-                    list.getListItem();
+            List<AbstractCommonList.ListItem> items = list.getListItem();
             int nItemsReturned = items.size();
             // There will be 'nItemsToCreateInList'
             // items created by the createItemList test,
@@ -313,7 +312,7 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
                 AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
             }
         } finally {
-            res.releaseConnection();
+            res.close();
         }
     }
 
@@ -373,16 +372,14 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res =
-                    client.deleteItem(parentResourceId, itemResourceId);
-            res.releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
+        
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            ClientResponse<Response> res = client.delete(resourceId);
-            res.releaseConnection();
+            client.delete(resourceId).close();
         }
     }
 
@@ -438,10 +435,8 @@ public class TaxonomyAuthorityServiceTest extends AbstractAuthorityServiceTest<T
             String identifier) {
         String shortId = identifier;
         String displayName = "displayName-" + shortId;
-        String baseRefName =
-                TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
-        PoxPayloadOut multipart =
-                TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
+        String baseRefName = TaxonomyAuthorityClientUtils.createTaxonomyAuthRefName(shortId, null);
+        PoxPayloadOut multipart = TaxonomyAuthorityClientUtils.createTaxonomyAuthorityInstance(
                 displayName, shortId, commonPartName);
         return multipart;
     }
index c7d103f196b391acb6eaf6dbce8c1ecabe1710df..cebe70b4ff8f094bd41adc6474a92a749ddafdd9 100644 (file)
@@ -524,7 +524,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<Response> res = client.delete(knownResourceId);
+        Response res = client.delete(knownResourceId);
         try {
             int statusCode = res.getStatus();
 
@@ -538,7 +538,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
@@ -557,7 +557,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
 
         // Submit the request to the service and store the response.
         ValuationcontrolClient client = new ValuationcontrolClient();
-        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        Response res = client.delete(NON_EXISTENT_ID);
         try {
             int statusCode = res.getStatus();
 
@@ -571,7 +571,7 @@ public class ValuationcontrolServiceTest extends AbstractPoxServiceTestImpl<Abst
             Assert.assertEquals(statusCode, testExpectedStatusCode);
         } finally {
             if (res != null) {
-                res.releaseConnection();
+                res.close();
             }
         }
     }
index 34d0130d85184c50f8987f408afa6507b0d31300..9e071b77aa575a2fff3e462b0f47d5e995c437a5 100644 (file)
@@ -352,13 +352,13 @@ public class WorkAuthorityServiceTest extends AbstractAuthorityServiceTest<Worka
             parentResourceId = entry.getValue();
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-            client.deleteItem(parentResourceId, itemResourceId).releaseConnection();
+            client.deleteItem(parentResourceId, itemResourceId).close();
         }
         // Clean up parent resources.
         for (String resourceId : allResourceIdsCreated) {
             // Note: Any non-success responses from the delete operation
             // below are ignored and not reported.
-        client.delete(resourceId).releaseConnection();
+        client.delete(resourceId).close();
         }
     }