]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
40cafab478c47b5fdd4d18ba4a8c038569d9698f
[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 permRoles and
21  * limitations under the License.
22  */
23 package org.collectionspace.services.authorization.client.test;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Date;
28 import java.util.Hashtable;
29 import java.util.List;
30 import javax.ws.rs.core.Response;
31 import org.collectionspace.services.authorization.perms.EffectType;
32
33 import org.collectionspace.services.authorization.perms.Permission;
34 import org.collectionspace.services.authorization.perms.PermissionAction;
35 import org.collectionspace.services.authorization.PermissionRole;
36 import org.collectionspace.services.authorization.PermissionValue;
37 import org.collectionspace.services.authorization.Role;
38 import org.collectionspace.services.authorization.RoleValue;
39 import org.collectionspace.services.client.CollectionSpaceClient;
40 import org.collectionspace.services.client.PermissionClient;
41 import org.collectionspace.services.client.PermissionFactory;
42 import org.collectionspace.services.client.RolePermissionClient;
43 import org.collectionspace.services.client.PermissionRoleFactory;
44 import org.collectionspace.services.client.RoleClient;
45 import org.collectionspace.services.client.RoleFactory;
46 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
47 import org.collectionspace.services.client.test.ServiceRequestType;
48 import org.jboss.resteasy.client.ClientResponse;
49
50 import org.testng.Assert;
51 import org.testng.annotations.Test;
52
53 import org.slf4j.Logger;
54 import org.slf4j.LoggerFactory;
55 import org.testng.annotations.AfterClass;
56 import org.testng.annotations.BeforeClass;
57
58 /**
59  * PermissionServiceTest, carries out tests against a
60  * deployed and running Permission, Role and PermissionRole Services.
61  * 
62  * $LastChangedRevision: 917 $
63  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
64  */
65 public class RolePermissionServiceTest extends AbstractServiceTestImpl<PermissionRole, PermissionRole,
66                 PermissionRole, PermissionRole> {
67
68     /** The Constant logger. */
69     private final static String CLASS_NAME = RolePermissionServiceTest.class.getName();
70     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
71     // Instance variables specific to this test.
72     final private static String TEST_MARKER = "_RolePermissionServiceTest";
73     final private static String TEST_ROLE_NAME = "ROLE";
74     final private static String NO_REL_SUFFIX = "-no-rel";
75     /** The perm values. */
76     private Hashtable<String, PermissionValue> permValues = new Hashtable<String, PermissionValue>();
77     /** The role values. */
78     private Hashtable<String, RoleValue> roleValues = new Hashtable<String, RoleValue>();
79     private Date now = new Date();
80
81     /* (non-Javadoc)
82      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
83      */
84     @Override
85     protected String getServicePathComponent() {
86         return new RolePermissionClient().getServicePathComponent();
87     }
88     
89     @Override
90     public String getServiceName() { 
91         return RoleClient.SERVICE_NAME; // RolePermission is a sub-resource of 'roles' resource.
92     }
93     
94     private String getRoleName() {
95         return TEST_ROLE_NAME + TEST_MARKER + now.toString();
96     }
97
98     /**
99      * Seed data.
100      */
101     @BeforeClass(alwaysRun = true)
102     public void seedData() {
103
104         String rn1 = getRoleName();
105         String r1RoleId = createRole(rn1);
106         RoleValue rv1 = new RoleValue();
107         rv1.setRoleId(r1RoleId);
108         rv1.setRoleName(rn1);
109         roleValues.put(rv1.getRoleName(), rv1);
110
111         String rn2 = getRoleName() + NO_REL_SUFFIX;
112         String r2RoleId = createRole(rn2);
113         RoleValue rv2 = new RoleValue();
114         rv2.setRoleId(r2RoleId);
115         rv2.setRoleName(rn2);
116         roleValues.put(rv2.getRoleName(), rv2);
117
118         String ra1 = "fooService" + TEST_MARKER;
119         String permId1 = createPermission(ra1, EffectType.PERMIT);
120         PermissionValue pva1 = new PermissionValue();
121         pva1.setResourceName(ra1);
122         pva1.setPermissionId(permId1);
123         permValues.put(pva1.getResourceName(), pva1);
124
125         String ra2 = "barService" + TEST_MARKER;
126         String permId2 = createPermission(ra1, EffectType.PERMIT);
127         PermissionValue pva2 = new PermissionValue();
128         pva2.setResourceName(ra2);
129         pva2.setPermissionId(permId2);
130         permValues.put(pva2.getResourceName(), pva2);
131     }
132
133     /* (non-Javadoc)
134      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
135      */
136     @Override
137     protected CollectionSpaceClient getClientInstance() {
138         return new RolePermissionClient();
139     }
140
141     /* (non-Javadoc)
142      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
143      */
144 //    @Test(dataProvider = "testName")
145     @Override
146     public void readPaginatedList(String testName) throws Exception {
147         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
148     }
149     
150     // ---------------------------------------------------------------
151     // CRUD tests : CREATE tests
152     // ---------------------------------------------------------------
153     // Success outcomes
154     /* (non-Javadoc)
155      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
156      */
157
158     @Override
159 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
160     public void create(String testName) throws Exception {
161         // Perform setup, such as initializing the type of service request
162         // (e.g. CREATE, DELETE), its valid and expected status codes, and
163         // its associated HTTP method name (e.g. POST, DELETE).
164         setupCreate();
165
166         // Submit the request to the service and store the response.
167         RoleValue rv = roleValues.get(getRoleName());
168         PermissionRole permRole = createPermissionRoleInstance(rv,
169                 permValues.values(), true, true);
170         RolePermissionClient client = new RolePermissionClient();
171         ClientResponse<Response> res = null;
172         try {
173             res = client.create(rv.getRoleId(), permRole);
174             int statusCode = res.getStatus();
175             if (logger.isDebugEnabled()) {
176                 logger.debug(testName + ": status = " + statusCode);
177             }
178             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
179                     invalidStatusCodeMessage(testRequestType, statusCode));
180             Assert.assertEquals(statusCode, testExpectedStatusCode);
181
182             knownResourceId = extractId(res); //This is meaningless in this test, see getKnowResourceId() method for details
183             if (logger.isDebugEnabled()) {
184                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
185             }
186         } finally {
187             if (res != null) {
188                 res.releaseConnection();
189             }
190         }
191     }
192
193     //to not cause uniqueness violation for permRole, createList is removed
194     /* (non-Javadoc)
195      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
196      */
197     @Override
198 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
199 //      dependsOnMethods = {"create"})
200     public void createList(String testName) throws Exception {
201         //Should this really be empty?
202     }
203
204     // Failure outcomes
205     // Placeholders until the three tests below can be uncommented.
206     // See Issue CSPACE-401.
207     /* (non-Javadoc)
208      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
209      */
210     @Override
211     public void createWithEmptyEntityBody(String testName) throws Exception {
212         //Should this really be empty?
213     }
214
215     /* (non-Javadoc)
216      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
217      */
218     @Override
219     public void createWithMalformedXml(String testName) throws Exception {
220         //Should this really be empty?
221     }
222
223     /* (non-Javadoc)
224      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
225      */
226     @Override
227     public void createWithWrongXmlSchema(String testName) throws Exception {
228         //Should this really be empty?
229     }
230
231     // ---------------------------------------------------------------
232     // CRUD tests : READ tests
233     // ---------------------------------------------------------------
234     // Success outcomes
235     /* (non-Javadoc)
236      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
237      */
238     @Override
239 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
240 //      dependsOnMethods = {"create"})
241     public void read(String testName) throws Exception {
242         // Perform setup.
243         setupRead();
244
245         // Submit the request to the service and store the response.
246         RolePermissionClient client = new RolePermissionClient();
247         ClientResponse<PermissionRole> res = null;
248         try {
249             res = client.read(roleValues.get(getRoleName()).getRoleId());
250             int statusCode = res.getStatus();
251
252             // Check the status code of the response: does it match
253             // the expected response(s)?
254             if (logger.isDebugEnabled()) {
255                 logger.debug(testName + ": status = " + statusCode);
256             }
257             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
258                     invalidStatusCodeMessage(testRequestType, statusCode));
259             Assert.assertEquals(statusCode, testExpectedStatusCode);
260
261             PermissionRole output = (PermissionRole) res.getEntity();
262             Assert.assertNotNull(output);
263         } finally {
264             if (res != null) {
265                 res.releaseConnection();
266             }
267         }
268     }
269
270     // Failure outcomes
271     /* (non-Javadoc)
272      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
273      */
274     @Override
275 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
276     public void readNonExistent(String testName) throws Exception {
277         // Perform setup.
278         setupReadNonExistent();
279
280         // Submit the request to the service and store the response.
281         RolePermissionClient client = new RolePermissionClient();
282         ClientResponse<PermissionRole> res = null;
283         try {
284
285             res = client.read(NON_EXISTENT_ID);
286             int statusCode = res.getStatus();
287
288             // Check the status code of the response: does it match
289             // the expected response(s)?
290             if (logger.isDebugEnabled()) {
291                 logger.debug(testName + ": status = " + statusCode);
292             }
293             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
294                     invalidStatusCodeMessage(testRequestType, statusCode));
295             Assert.assertEquals(statusCode, testExpectedStatusCode);
296         } finally {
297             if (res != null) {
298                 res.releaseConnection();
299             }
300         }
301     }
302
303     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
304     public void readNoRelationship(String testName) throws Exception {
305         setupRead();
306         // Submit the request to the service and store the response.
307         RolePermissionClient client = new RolePermissionClient();
308         ClientResponse<PermissionRole> res = null;
309         try {
310
311             res = client.read(roleValues.get(getRoleName() + NO_REL_SUFFIX).getRoleId());
312             int statusCode = res.getStatus();
313
314             // Check the status code of the response: does it match
315             // the expected response(s)?
316             if (logger.isDebugEnabled()) {
317                 logger.debug(testName + ": status = " + statusCode);
318             }
319             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
320                     invalidStatusCodeMessage(testRequestType, statusCode));
321             Assert.assertEquals(statusCode, Response.Status.OK.getStatusCode());
322             PermissionRole output = (PermissionRole) res.getEntity();
323
324             String sOutput = objectAsXmlString(output, PermissionRole.class);
325             if (logger.isDebugEnabled()) {
326                 logger.debug(testName + " received " + sOutput);
327             }
328         } finally {
329             if (res != null) {
330                 res.releaseConnection();
331             }
332         }
333     }
334
335     // ---------------------------------------------------------------
336     // CRUD tests : READ_LIST tests
337     // ---------------------------------------------------------------
338     // Success outcomes
339     /* (non-Javadoc)
340      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
341      */
342     @Override
343 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
344 //      dependsOnMethods = {"createList", "read"})
345     public void readList(String testName) throws Exception {
346         //Should this really be empty?
347     }
348
349     // Failure outcomes
350     // None at present.
351     // ---------------------------------------------------------------
352     // CRUD tests : UPDATE tests
353     // ---------------------------------------------------------------
354     // Success outcomes
355     /* (non-Javadoc)
356      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
357      */
358     @Override
359 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
360 //      dependsOnMethods = {"read", "readList", "readNonExistent"})
361     public void update(String testName) throws Exception {
362         //Should this really be empty?
363     }
364
365     // Failure outcomes
366     // Placeholders until the three tests below can be uncommented.
367     // See Issue CSPACE-401.
368     /* (non-Javadoc)
369      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
370      */
371     @Override
372     public void updateWithEmptyEntityBody(String testName) throws Exception {
373         //Should this really be empty?
374     }
375
376     /* (non-Javadoc)
377      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
378      */
379     @Override
380     public void updateWithMalformedXml(String testName) throws Exception {
381         //Should this really be empty?
382     }
383
384     /* (non-Javadoc)
385      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
386      */
387     @Override
388     public void updateWithWrongXmlSchema(String testName) throws Exception {
389         //Should this really be empty?
390     }
391
392     /* (non-Javadoc)
393      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
394      */
395     @Override
396 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
397 //    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
398     public void updateNonExistent(String testName) throws Exception {
399         //Should this really be empty?
400     }
401
402     // ---------------------------------------------------------------
403     // CRUD tests : DELETE tests
404     // ---------------------------------------------------------------
405     // Success outcomes
406     /* (non-Javadoc)
407      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
408      */
409     @Override
410 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
411 //    dependsOnMethods = {"read"})
412     public void delete(String testName) throws Exception {
413         // Perform setup.
414         setupDelete();
415                 
416         // Submit the request to the service and store the response.
417         RolePermissionClient client = new RolePermissionClient();
418         RoleValue rv = roleValues.get(getRoleName());
419         ClientResponse<Response> delRes = null;
420         try {
421                 delRes = client.delete(rv.getRoleId());
422             int statusCode = delRes.getStatus();
423             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
424                     invalidStatusCodeMessage(testRequestType, statusCode));
425             Assert.assertEquals(statusCode, testExpectedStatusCode);
426         } finally {
427             if (delRes != null) {
428                 delRes.releaseConnection();
429             }
430         }
431
432         // reset for next delete
433         create(testName);
434         setupDelete();
435         
436         rv = roleValues.get(getRoleName());
437         ClientResponse<PermissionRole> readResponse = client.read(rv.getRoleId());
438         PermissionRole toDelete = readResponse.getEntity();
439         readResponse.releaseConnection();        
440         
441         rv = toDelete.getRole().get(0);
442         ClientResponse<Response> res = null;
443         try {
444             res = client.delete(
445                     rv.getRoleId(), toDelete);
446             int statusCode = res.getStatus();
447             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
448                     invalidStatusCodeMessage(testRequestType, statusCode));
449             Assert.assertEquals(statusCode, testExpectedStatusCode);
450         } finally {
451             if (res != null) {
452                 res.releaseConnection();
453             }
454         }
455     }
456
457     // Failure outcomes
458     /* (non-Javadoc)
459      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
460      */
461     @Override
462 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
463     public void deleteNonExistent(String testName) throws Exception {
464         //ignoring this test as the service side returns 200 now even if it does
465         //not find a record in the db
466     }
467     
468     // ---------------------------------------------------------------
469     // Search tests
470     // ---------------------------------------------------------------
471     
472     @Override
473 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
474     public void searchWorkflowDeleted(String testName) throws Exception {
475         // Fixme: null test for now, overriding test in base class
476     }
477
478     // ---------------------------------------------------------------
479     // Utility tests : tests of code used in tests above
480     // ---------------------------------------------------------------
481     /**
482      * Tests the code for manually submitting data that is used by several
483      * of the methods above.
484      */
485     @Override
486 //    @Test(dependsOnMethods = {"create"}) //FIXME: REM - This is not a test of a submit to the permroles service, but to just authorization/roles
487     public void testSubmitRequest() {
488
489         // Expected status code: 200 OK
490         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
491
492         // Submit the request to the service and store the response.
493         String method = ServiceRequestType.READ.httpMethodName();
494         String url = getResourceURL(roleValues.get(getRoleName()).getRoleId());
495         int statusCode = submitRequest(method, url);
496
497         // Check the status code of the response: does it match
498         // the expected response(s)?
499         if (logger.isDebugEnabled()) {
500             logger.debug("testSubmitRequest: url=" + url
501                     + " status=" + statusCode);
502         }
503         Assert.assertEquals(statusCode, EXPECTED_STATUS);
504     }
505
506     // ---------------------------------------------------------------
507     // Utility methods used by tests above
508     // ---------------------------------------------------------------
509     /**
510      * create PermissionRole instance
511      * @param rv rolevalue
512      * @param pvs permission value array
513      * @param usePermId 
514      * @param useRoleId
515      * @return PermissionRole
516      */
517     public static PermissionRole createPermissionRoleInstance(RoleValue rv,
518             Collection<PermissionValue> pvs,
519             boolean usePermId,
520             boolean useRoleId) {
521         List<PermissionValue> pvls = new ArrayList<PermissionValue>();
522         pvls.addAll(pvs);
523         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
524                 rv, pvls, usePermId, useRoleId);
525         if (logger.isDebugEnabled()) {
526             logger.debug("" +
527                     "permRole");
528             logger.debug(objectAsXmlString(permRole, PermissionRole.class));
529         }
530         return permRole;
531     }
532
533     /**
534      * Clean up.
535      */
536     @AfterClass(alwaysRun = true)
537     @Override
538     public void cleanUp() {
539         setupDelete();
540         String noTest = System.getProperty("noTestCleanup");
541         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
542             if (logger.isDebugEnabled()) {
543                 logger.debug("Skipping Cleanup phase ...");
544             }
545             return;
546         }
547         if (logger.isDebugEnabled()) {
548             logger.debug("Cleaning up temporary resources created for testing ...");
549         }
550         for (PermissionValue pv : permValues.values()) {
551             deletePermission(pv.getPermissionId());
552         }
553         for (RoleValue rv : roleValues.values()) {
554             deleteRole(rv.getRoleId());
555         }
556     }
557
558     /**
559      * Creates the permission.
560      *
561      * @param resName the res name
562      * @param effect the effect
563      * @return the string
564      */
565     private String createPermission(String resName, EffectType effect) {
566         setupCreate();
567         PermissionClient permClient = new PermissionClient();
568         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
569         Permission permission = PermissionFactory.createPermissionInstance(resName,
570                 "default permissions for " + resName,
571                 actions, effect, true, true, true);
572         ClientResponse<Response> res = null;
573         String id = null;
574         try {
575             res = permClient.create(permission);
576             int statusCode = res.getStatus();
577             if (logger.isDebugEnabled()) {
578                 logger.debug("createPermission: resName=" + resName
579                         + " status = " + statusCode);
580             }
581             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
582                     invalidStatusCodeMessage(testRequestType, statusCode));
583             Assert.assertEquals(statusCode, testExpectedStatusCode);
584             id = extractId(res);
585         } finally {
586             if (res != null) {
587                 res.releaseConnection();
588             }
589         }
590         return id;
591     }
592
593     /**
594      * Delete permission.
595      *
596      * @param permId the perm id
597      */
598     private void deletePermission(String permId) {
599         setupDelete();
600         PermissionClient permClient = new PermissionClient();
601
602         ClientResponse<Response> res = null;
603         try {
604             res = permClient.delete(permId);
605             int statusCode = res.getStatus();
606             if (logger.isDebugEnabled()) {
607                 logger.debug("deletePermission: delete permission id="
608                         + permId + " status=" + statusCode);
609             }
610             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
611                     invalidStatusCodeMessage(testRequestType, statusCode));
612             Assert.assertEquals(statusCode, testExpectedStatusCode);
613
614         } finally {
615             if (res != null) {
616                 res.releaseConnection();
617             }
618         }
619     }
620
621     /**
622      * Creates the role.
623      *
624      * @param roleName the role name
625      * @return the string
626      */
627     private String createRole(String roleName) {
628         setupCreate();
629         RoleClient roleClient = new RoleClient();
630
631         Role role = RoleFactory.createRoleInstance(roleName,
632                         roleName, //the display name
633                 "role for " + roleName, true);
634         role.setRoleGroup("something");
635         ClientResponse<Response> res = null;
636         String id = null;
637         try {
638             res = roleClient.create(role);
639             int statusCode = res.getStatus();
640             if (logger.isDebugEnabled()) {
641                 logger.debug("createRole: name=" + roleName
642                         + " status = " + statusCode);
643             }
644             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
645                     invalidStatusCodeMessage(testRequestType, statusCode));
646             Assert.assertEquals(statusCode, testExpectedStatusCode);
647             id = extractId(res);
648         } finally {
649             if (res != null) {
650                 res.releaseConnection();
651             }
652         }
653         return id;
654     }
655
656     /**
657      * Delete role.
658      *
659      * @param roleId the role id
660      */
661     private void deleteRole(String roleId) {
662         setupDelete();
663         RoleClient roleClient = new RoleClient();
664         ClientResponse<Response> res = null;
665         try {
666             res = roleClient.delete(roleId);
667             int statusCode = res.getStatus();
668             if (logger.isDebugEnabled()) {
669                 logger.debug("deleteRole: delete role id=" + roleId
670                         + " status=" + statusCode);
671             }
672             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
673                     invalidStatusCodeMessage(testRequestType, statusCode));
674             Assert.assertEquals(statusCode, testExpectedStatusCode);
675         } finally {
676             res.releaseConnection();
677         }
678
679     }
680
681         @Override
682         protected PermissionRole createInstance(String commonPartName,
683                         String identifier) {
684                 // TODO Auto-generated method stub
685                 return null;
686         }
687
688         @Override
689         protected PermissionRole updateInstance(PermissionRole commonPartObject) {
690                 // TODO Auto-generated method stub
691                 return null;
692         }
693
694         @Override
695         protected void compareUpdatedInstances(PermissionRole original,
696                         PermissionRole updated) throws Exception {
697                 // TODO Auto-generated method stub
698                 
699         }
700
701         @Override
702         protected Class<PermissionRole> getCommonListType() {
703                 // TODO Auto-generated method stub
704                 return null;
705         }
706
707     @Override
708     protected String getKnowResourceId() {
709         return roleValues.get(getRoleName()).getRoleId();
710     }
711         
712     /*
713      * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
714      * refer to this method in their @Test annotation declarations.
715      */
716     @Override
717     @Test(dataProvider = "testName",
718                 dependsOnMethods = {
719                         "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
720     public void CRUDTests(String testName) {
721         // Do nothing.  Simply here to for a TestNG execution order for our tests
722     }   
723 }