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