]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
e18c9ab3343804e3f4ddd36fbc988fdd2febb502
[tmp/jakarta-migration.git] /
1 /**
2  * This document is a part of the source code and related artifacts
3  * for CollectionSpace, an open source collections management system
4  * for museums and related institutions:
5  *
6  * http://www.collectionspace.org
7  * http://wiki.collectionspace.org
8  *
9  * Copyright © 2009 Regents of the University of California
10  *
11  * Licensed under the Educational Community License (ECL), Version 2.0.
12  * You may not use this file except in compliance with this License.
13  *
14  * You may obtain a copy of the ECL 2.0 License at
15  * https://source.collectionspace.org/collection-space/LICENSE.txt
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 package org.collectionspace.services.account.client.test;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Hashtable;
28 import java.util.List;
29 import javax.ws.rs.core.Response;
30
31 import org.collectionspace.services.account.AccountsCommon;
32 import org.collectionspace.services.authorization.AccountRole;
33 import org.collectionspace.services.authorization.AccountValue;
34 import org.collectionspace.services.authorization.Role;
35 import org.collectionspace.services.authorization.RoleValue;
36 import org.collectionspace.services.client.AccountClient;
37 import org.collectionspace.services.client.AccountFactory;
38 import org.collectionspace.services.client.AccountRoleClient;
39 import org.collectionspace.services.client.AccountRoleFactory;
40 import org.collectionspace.services.client.CollectionSpaceClient;
41 import org.collectionspace.services.client.RoleClient;
42 import org.collectionspace.services.client.RoleFactory;
43 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
44 import org.collectionspace.services.client.test.ServiceRequestType;
45 import org.collectionspace.services.jaxb.AbstractCommonList;
46 import org.jboss.resteasy.client.ClientResponse;
47
48
49 import org.testng.Assert;
50 import org.testng.annotations.Test;
51
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
54 import org.testng.annotations.AfterClass;
55 import org.testng.annotations.BeforeClass;
56
57 /**
58  * AccountServiceTest, carries out tests against a
59  * deployed and running Account, Role and AccountRole Services.
60  * 
61  * $LastChangedRevision: 917 $
62  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
63  */
64 public class AccountRoleServiceTest extends AbstractServiceTestImpl {
65
66     /** The Constant logger. */
67     private final static String CLASS_NAME = AccountRoleServiceTest.class.getName();
68     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
69     
70     // Instance variables specific to this test.
71     /** The known resource id. */
72     private String knownResourceId = null;
73     
74     /** The all resource ids created. */
75     private List<String> allResourceIdsCreated = new ArrayList<String>();
76     
77     /** The acc values. */
78     private Hashtable<String, AccountValue> accValues = new Hashtable<String, AccountValue>();
79     
80     /** The role values. */
81     private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
82     /*
83      * This method is called only by the parent class, AbstractServiceTestImpl
84      */
85
86     /* (non-Javadoc)
87      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
88      */
89     @Override
90     protected String getServicePathComponent() {
91         return new AccountRoleClient().getServicePathComponent();
92     }
93
94     /**
95      * Seed data.
96      */
97     @BeforeClass(alwaysRun = true)
98     public void seedData() {
99         String userId = "acc-role-user1";
100         String accId = createAccount(userId, "acc-role-test@cspace.org");
101         AccountValue ava = new AccountValue();
102         ava.setScreenName(userId);
103         ava.setUserId(userId);
104         ava.setAccountId(accId);
105         accValues.put(ava.getScreenName(), ava);
106
107         String userId2 = "acc-role-user2";
108         String coAccId = createAccount(userId2, "acc-role-test@cspace.org");
109         AccountValue avc = new AccountValue();
110         avc.setScreenName(userId2);
111         avc.setUserId(userId2);
112         avc.setAccountId(coAccId);
113         accValues.put(avc.getScreenName(), avc);
114
115         String ri = "acc-role-user3";
116         String iAccId = createAccount(ri, "acc-role-test@cspace.org");
117         AccountValue avi = new AccountValue();
118         avi.setScreenName(ri);
119         avi.setUserId(ri);
120         avi.setAccountId(iAccId);
121         accValues.put(avi.getScreenName(), avi);
122
123         String rn1 = "ROLE_CO1";
124         String r1RoleId = createRole(rn1);
125         RoleValue rv1 = new RoleValue();
126         rv1.setRoleId(r1RoleId);
127         rv1.setRoleName(rn1);
128         roleValues.put(rv1.getRoleName(), rv1);
129
130         String rn2 = "ROLE_CO2";
131         String r2RoleId = createRole(rn2);
132         RoleValue rv2 = new RoleValue();
133         rv2.setRoleId(r2RoleId);
134         rv2.setRoleName(rn2);
135         roleValues.put(rv2.getRoleName(), rv2);
136     }
137
138     /* (non-Javadoc)
139      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
140      */
141     @Override
142     protected CollectionSpaceClient getClientInstance() {
143         return new AccountRoleClient();
144     }
145     
146     /* (non-Javadoc)
147      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
148      */
149     @Override
150         protected AbstractCommonList getAbstractCommonList(
151                         ClientResponse<AbstractCommonList> response) {
152         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
153         throw new UnsupportedOperationException();
154     }
155     
156         /* (non-Javadoc)
157          * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
158          */
159         @Test(dataProvider = "testName")
160         @Override
161     public void readPaginatedList(String testName) throws Exception {
162                 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
163         }    
164     
165     // ---------------------------------------------------------------
166     // CRUD tests : CREATE tests
167     // ---------------------------------------------------------------
168     // Success outcomes
169     /* (non-Javadoc)
170      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
171      */
172     @Override
173     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
174     public void create(String testName) throws Exception {
175
176         if (logger.isDebugEnabled()) {
177             testBanner(testName, CLASS_NAME);
178         }
179         // Perform setup, such as initializing the type of service request
180         // (e.g. CREATE, DELETE), its valid and expected status codes, and
181         // its associated HTTP method name (e.g. POST, DELETE).
182         setupCreate();
183
184         // Submit the request to the service and store the response.
185         AccountValue pv = accValues.get("acc-role-user1");
186         AccountRole accRole = createAccountRoleInstance(pv,
187                 roleValues.values(), true, true);
188         AccountRoleClient client = new AccountRoleClient();
189         ClientResponse<Response> res = client.create(pv.getAccountId(), accRole);
190         try {
191                 int statusCode = res.getStatus();
192         
193                 if (logger.isDebugEnabled()) {
194                     logger.debug(testName + ": status = " + statusCode);
195                 }
196                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
197                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
198                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
199         
200                 // Store the ID returned from this create operation
201                 // for additional tests below.
202                 //this is is not important in case of this relationship
203                 knownResourceId = extractId(res);
204                 if (logger.isDebugEnabled()) {
205                     logger.debug(testName + ": knownResourceId=" + knownResourceId);
206                 }
207         } finally {
208                 res.releaseConnection();
209         }
210     }
211
212     //to not cause uniqueness violation for accRole, createList is removed
213     /* (non-Javadoc)
214      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
215      */
216     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
217     dependsOnMethods = {"create"})
218     @Override
219     public void createList(String testName) throws Exception {
220         //FIXME: Should this test really be empty?  If so, please comment accordingly.
221     }
222
223     // Failure outcomes
224     // Placeholders until the three tests below can be uncommented.
225     // See Issue CSPACE-401.
226     /* (non-Javadoc)
227      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
228      */
229     @Override
230     public void createWithEmptyEntityBody(String testName) throws Exception {
231         //FIXME: Should this test really be empty?  If so, please comment accordingly.
232     }
233
234     /* (non-Javadoc)
235      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
236      */
237     @Override
238     public void createWithMalformedXml(String testName) throws Exception {
239         //FIXME: Should this test really be empty?  If so, please comment accordingly.
240     }
241
242     /* (non-Javadoc)
243      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
244      */
245     @Override
246     public void createWithWrongXmlSchema(String testName) throws Exception {
247         //FIXME: Should this test really be empty?  If so, please comment accordingly.
248     }
249
250     // ---------------------------------------------------------------
251     // CRUD tests : READ tests
252     // ---------------------------------------------------------------
253     // Success outcomes
254     /* (non-Javadoc)
255      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
256      */
257     @Override
258     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
259     dependsOnMethods = {"create"})
260     public void read(String testName) throws Exception {
261
262         if (logger.isDebugEnabled()) {
263             testBanner(testName, CLASS_NAME);
264         }
265         
266         // Perform setup.
267         setupRead();
268
269         // Submit the request to the service and store the response.
270         AccountRoleClient client = new AccountRoleClient();
271         ClientResponse<AccountRole> res = client.read(
272                 accValues.get("acc-role-user1").getAccountId(), "123");
273         int statusCode = res.getStatus();
274         try {
275                 // Check the status code of the response: does it match
276                 // the expected response(s)?
277                 if (logger.isDebugEnabled()) {
278                     logger.debug(testName + ": status = " + statusCode);
279                 }
280                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
281                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
282                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
283         
284                 AccountRole output = (AccountRole) res.getEntity();
285                 Assert.assertNotNull(output);
286         } finally {
287                 res.releaseConnection();
288         }
289     }
290
291     // Failure outcomes
292     /* (non-Javadoc)
293      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
294      */
295     @Override
296     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
297     public void readNonExistent(String testName) throws Exception {
298
299         if (logger.isDebugEnabled()) {
300             testBanner(testName, CLASS_NAME);
301         }
302         
303         // Perform setup.
304         setupReadNonExistent();
305
306         // Submit the request to the service and store the response.
307         AccountRoleClient client = new AccountRoleClient();
308         ClientResponse<AccountRole> res = client.read(this.NON_EXISTENT_ID, "123");
309         int statusCode = res.getStatus();
310         try {
311                 // Check the status code of the response: does it match
312                 // the expected response(s)?
313                 if (logger.isDebugEnabled()) {
314                     logger.debug(testName + ": status = " + statusCode);
315                 }
316                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
317                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
318                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
319         } finally {
320                 res.releaseConnection();
321         }
322     }
323
324     // ---------------------------------------------------------------
325     // CRUD tests : READ_LIST tests
326     // ---------------------------------------------------------------
327     // Success outcomes
328     /* (non-Javadoc)
329      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
330      */
331     @Override
332     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
333     dependsOnMethods = {"createList", "read"})
334     public void readList(String testName) throws Exception {
335         //FIXME: Should this test really be empty?  If so, please comment accordingly.
336     }
337
338     // Failure outcomes
339     // None at present.
340     // ---------------------------------------------------------------
341     // CRUD tests : UPDATE tests
342     // ---------------------------------------------------------------
343     // Success outcomes
344     /* (non-Javadoc)
345      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
346      */
347     @Override
348     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
349     dependsOnMethods = {"read", "readList", "readNonExistent"})
350     public void update(String testName) throws Exception {
351         //FIXME: Should this test really be empty?  If so, please comment accordingly.
352     }
353
354     // Failure outcomes
355     // Placeholders until the three tests below can be uncommented.
356     // See Issue CSPACE-401.
357     /* (non-Javadoc)
358      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
359      */
360     @Override
361     public void updateWithEmptyEntityBody(String testName) throws Exception {
362         //FIXME: Should this test really be empty?  If so, please comment accordingly.
363     }
364
365     /* (non-Javadoc)
366      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
367      */
368     @Override
369     public void updateWithMalformedXml(String testName) throws Exception {
370         //FIXME: Should this test really be empty?  If so, please comment accordingly.
371     }
372
373     /* (non-Javadoc)
374      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
375      */
376     @Override
377     public void updateWithWrongXmlSchema(String testName) throws Exception {
378         //FIXME: Should this test really be empty?  If so, please comment accordingly.
379     }
380
381     /* (non-Javadoc)
382      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
383      */
384     @Override
385     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
386     dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
387     public void updateNonExistent(String testName) throws Exception {
388         //FIXME: Should this test really be empty?  If so, please comment accordingly.
389     }
390
391     // ---------------------------------------------------------------
392     // CRUD tests : DELETE tests
393     // ---------------------------------------------------------------
394     // Success outcomes
395     /* (non-Javadoc)
396      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
397      */
398     @Override
399     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
400     dependsOnMethods = {"read"})
401     public void delete(String testName) throws Exception {
402         
403         if (logger.isDebugEnabled()) {
404             testBanner(testName, CLASS_NAME);
405         }
406         
407         // Perform setup.
408         setupDelete();
409
410         // Submit the request to the service and store the response.
411         AccountRoleClient client = new AccountRoleClient();
412         ClientResponse<Response> res = client.delete(
413                 accValues.get("acc-role-user1").getAccountId(), "123");
414         int statusCode = res.getStatus();
415         try {
416                 // Check the status code of the response: does it match
417                 // the expected response(s)?
418                 if (logger.isDebugEnabled()) {
419                     logger.debug(testName + ": status = " + statusCode);
420                 }
421                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
422                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
423                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
424         } finally {
425                 res.releaseConnection();
426         }
427     }
428
429     // Failure outcomes
430     /* (non-Javadoc)
431      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
432      */
433     @Override
434     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
435     public void deleteNonExistent(String testName) throws Exception {
436         //ignoring this test as the service side returns 200 now even if it does
437         //not find a record in the db
438     }
439
440     // ---------------------------------------------------------------
441     // Utility tests : tests of code used in tests above
442     // ---------------------------------------------------------------
443     /**
444      * Tests the code for manually submitting data that is used by several
445      * of the methods above.
446      * @throws Exception 
447      */
448     @Test(dependsOnMethods = {"create"})
449     public void testSubmitRequest() throws Exception {
450
451         // Expected status code: 200 OK
452         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
453
454         // Submit the request to the service and store the response.
455         String method = ServiceRequestType.READ.httpMethodName();
456         String url = getResourceURL(accValues.get("acc-role-user1").getAccountId());
457         int statusCode = submitRequest(method, url);
458
459         // Check the status code of the response: does it match
460         // the expected response(s)?
461         if (logger.isDebugEnabled()) {
462             logger.debug("testSubmitRequest: url=" + url
463                     + " status=" + statusCode);
464         }
465         Assert.assertEquals(statusCode, EXPECTED_STATUS);
466
467     }
468
469     // ---------------------------------------------------------------
470     // Utility methods used by tests above
471     // ---------------------------------------------------------------
472     /**
473      * Creates the account role instance.
474      *
475      * @param pv the pv
476      * @param rvs the rvs
477      * @param usePermId the use perm id
478      * @param useRoleId the use role id
479      * @return the account role
480      */
481     static public AccountRole createAccountRoleInstance(AccountValue pv,
482             Collection<RoleValue> rvs,
483             boolean usePermId,
484             boolean useRoleId) {
485
486         AccountRole accRole = AccountRoleFactory.createAccountRoleInstance(
487                 pv, rvs, usePermId, useRoleId);
488
489         if (logger.isDebugEnabled()) {
490             logger.debug("to be created, accRole common");
491             logger.debug(objectAsXmlString(accRole, AccountRole.class));
492         }
493         return accRole;
494     }
495
496     /**
497      * Clean up.
498      */
499     @AfterClass(alwaysRun = true)
500     @Override
501     public void cleanUp() {
502         
503         setupDelete();
504
505         String noTest = System.getProperty("noTestCleanup");
506         if(Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
507             if (logger.isDebugEnabled()) {
508                 logger.debug("Skipping Cleanup phase ...");
509             }
510             return;
511         }
512         if (logger.isDebugEnabled()) {
513             logger.debug("Cleaning up temporary resources created for testing ...");
514         }
515         
516         AccountRoleClient client = new AccountRoleClient();
517         for (String resourceId : allResourceIdsCreated) {
518             ClientResponse<Response> res = client.delete(resourceId, "123");
519             try {
520                     int statusCode = res.getStatus();
521                     if (logger.isDebugEnabled()) {
522                         logger.debug("clenaup: delete relationships for accission id="
523                                 + resourceId + " status=" + statusCode);
524                     }
525                     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
526                             invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
527                     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
528             } finally {
529                 res.releaseConnection();
530             }
531         }
532
533         for (AccountValue pv : accValues.values()) {
534             deleteAccount(pv.getAccountId());
535         }
536
537         for (RoleValue rv : roleValues.values()) {
538             deleteRole(rv.getRoleId());
539         }
540     }
541
542     /**
543      * Creates the account.
544      *
545      * @param userName the user name
546      * @param email the email
547      * @return the string
548      */
549     private String createAccount(String userName, String email) {
550         
551         if (logger.isDebugEnabled()) {
552             testBanner("createAccount");
553         }
554         
555         setupCreate();
556         
557         AccountClient accClient = new AccountClient();
558         AccountsCommon account = AccountFactory.createAccountInstance(
559                 userName, userName, userName, email,
560                 true, true, false, true, true);
561         ClientResponse<Response> res = accClient.create(account);
562         int statusCode = res.getStatus();
563         if (logger.isDebugEnabled()) {
564             logger.debug("createAccount: userName=" + userName
565                     + " status = " + statusCode);
566         }
567         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
568                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
569         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
570         res.releaseConnection();
571         return extractId(res);
572     }
573
574     /**
575      * Delete account.
576      *
577      * @param accId the acc id
578      */
579     private void deleteAccount(String accId) {
580         
581         if (logger.isDebugEnabled()) {
582             testBanner("deleteAccount");
583         }
584         
585         setupDelete();
586         
587         AccountClient accClient = new AccountClient();
588         ClientResponse<Response> res = accClient.delete(accId);
589         int statusCode = res.getStatus();
590         try {
591                 if (logger.isDebugEnabled()) {
592                     logger.debug("deleteAccount: delete account id="
593                             + accId + " status=" + statusCode);
594                 }
595                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
596                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
597                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
598         } finally {
599                 res.releaseConnection();
600         }
601     }
602
603     /**
604      * Creates the role.
605      *
606      * @param roleName the role name
607      * @return the string
608      */
609     private String createRole(String roleName) {
610         if (logger.isDebugEnabled()) {
611             testBanner("createRole");
612         }
613         setupCreate();
614         RoleClient roleClient = new RoleClient();
615
616         Role role = RoleFactory.createRoleInstance(roleName,
617                 "role for " + roleName, true);
618         ClientResponse<Response> res = roleClient.create(role);
619         int statusCode = res.getStatus();
620         if (logger.isDebugEnabled()) {
621             logger.debug("createRole: name=" + roleName
622                     + " status = " + statusCode);
623         }
624         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
625                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
626         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
627         res.releaseConnection();
628         return extractId(res);
629     }
630
631     /**
632      * Delete role.
633      *
634      * @param roleId the role id
635      */
636     private void deleteRole(String roleId) {
637         if (logger.isDebugEnabled()) {
638             testBanner("deleteRole");
639         }
640         setupDelete();
641         RoleClient roleClient = new RoleClient();
642         ClientResponse<Response> res = roleClient.delete(roleId);
643         int statusCode = res.getStatus();
644         try {
645                 if (logger.isDebugEnabled()) {
646                     logger.debug("deleteRole: delete role id=" + roleId
647                             + " status=" + statusCode);
648                 }
649                 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
650                         invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
651                 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
652         } finally {
653                 res.releaseConnection();
654         }
655     }
656 }