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