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