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