]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
9873aa3f2b726d048144d482cbfedbba4378009b
[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
30 import javax.ws.rs.core.Response;
31
32 import org.collectionspace.services.authorization.perms.EffectType;
33 import org.collectionspace.services.authorization.perms.Permission;
34 import org.collectionspace.services.authorization.perms.PermissionAction;
35 import org.collectionspace.services.authorization.PermissionRole;
36 import org.collectionspace.services.authorization.PermissionValue;
37 import org.collectionspace.services.authorization.Role;
38 import org.collectionspace.services.authorization.RoleValue;
39 import org.collectionspace.services.client.CollectionSpaceClient;
40 import org.collectionspace.services.client.PermissionClient;
41 import org.collectionspace.services.client.PermissionFactory;
42 import org.collectionspace.services.client.PermissionRoleClient;
43 import org.collectionspace.services.client.PermissionRoleFactory;
44 import org.collectionspace.services.client.RoleClient;
45 import org.collectionspace.services.client.RoleFactory;
46 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
47
48 import org.testng.Assert;
49 import org.testng.annotations.Test;
50 import org.slf4j.Logger;
51 import org.slf4j.LoggerFactory;
52 import org.testng.annotations.AfterClass;
53 import org.testng.annotations.BeforeClass;
54
55 /**
56  * PermissionServiceTest, carries out tests against a
57  * deployed and running Permission, Role and PermissionRole Services.
58  * 
59  * $LastChangedRevision: 917 $
60  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
61  */
62 public class PermissionRoleServiceTest extends AbstractServiceTestImpl<PermissionRole, PermissionRole,
63                 PermissionRole, PermissionRole> {
64
65     /** The Constant logger. */
66     private final static String CLASS_NAME = PermissionRoleServiceTest.class.getName();
67     private final static Logger logger = LoggerFactory.getLogger(CLASS_NAME);
68
69     // Instance variables specific to this test.
70     final private static String TEST_MARKER = "_PermissionRoleServiceTest";
71     final private static String TEST_SERVICE_NAME = "fakeservice";
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     /*
78      * This method is called only by the parent class, AbstractServiceTestImpl
79      */
80
81     /* (non-Javadoc)
82      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
83      */
84     @Override
85     protected String getServicePathComponent() {
86         return new PermissionRoleClient().getServicePathComponent();
87     }
88     
89         @Override
90         protected String getServiceName() {
91         return PermissionClient.SERVICE_NAME; //Since we're a sub-resource of permission service return its name?
92         }
93         
94     /**
95      * The entity type expected from the JAX-RS Response object
96      */
97     public Class<PermissionRole> getEntityResponseType() {
98         return PermissionRole.class;
99     }
100         
101     /**
102      * Seed data.
103      */
104     @BeforeClass(alwaysRun = true)
105     public void seedData() {
106         String ra = TEST_SERVICE_NAME + TEST_MARKER;
107         String accPermId = createPermission(ra, EffectType.PERMIT);
108         PermissionValue pva = new PermissionValue();
109         pva.setResourceName(ra);
110         pva.setPermissionId(accPermId);
111         permValues.put(pva.getResourceName(), pva);
112
113         String rc = TEST_SERVICE_NAME + TEST_MARKER + NO_REL_SUFFIX;
114         String coPermId = createPermission(rc, EffectType.DENY);
115         PermissionValue pvc = new PermissionValue();
116         pvc.setResourceName(rc);
117         pvc.setPermissionId(coPermId);
118         permValues.put(pvc.getResourceName(), pvc);
119 //
120 //        String ri = "intakes";
121 //        String iPermId = createPermission(ri, EffectType.DENY);
122 //        PermissionValue pvi = new PermissionValue();
123 //        pvi.setResourceName(ri);
124 //        pvi.setPermissionId(iPermId);
125 //        permValues.put(pvi.getResourceName(), pvi);
126
127         String rn1 = "ROLE_CO1" + TEST_MARKER;
128         String r1RoleId = createRole(rn1);
129         RoleValue rv1 = new RoleValue();
130         rv1.setRoleId(r1RoleId);
131         rv1.setRoleName(rn1);
132         roleValues.put(rv1.getRoleName(), rv1);
133
134         String rn2 = "ROLE_CO2" + TEST_MARKER;
135         String r2RoleId = createRole(rn2);
136         RoleValue rv2 = new RoleValue();
137         rv2.setRoleId(r2RoleId);
138         rv2.setRoleName(rn2);
139         roleValues.put(rv2.getRoleName(), rv2);
140     }
141
142     /* (non-Javadoc)
143      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
144      */
145     @Override
146     protected CollectionSpaceClient getClientInstance() {
147         return new PermissionRoleClient();
148     }
149
150         @Override
151         protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
152         return new PermissionRoleClient(clientPropertiesFilename);
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         
193         Response res = client.create(pv.getPermissionId(), permRole);
194         try {
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         Response res = client.read(
270                 permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
271         try {
272             int statusCode = res.getStatus();
273
274             // Check the status code of the response: does it match
275             // the expected response(s)?
276             if (logger.isDebugEnabled()) {
277                 logger.debug(testName + ": status = " + statusCode);
278             }
279             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
280                     invalidStatusCodeMessage(testRequestType, statusCode));
281             Assert.assertEquals(statusCode, testExpectedStatusCode);
282
283             PermissionRole output = res.readEntity(PermissionRole.class);
284             Assert.assertNotNull(output);
285         } finally {
286             if (res != null) {
287                 res.close();
288             }
289         }
290
291     }
292
293     // Failure outcomes
294     /* (non-Javadoc)
295      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
296      */
297     @Override
298     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
299     public void readNonExistent(String testName) throws Exception {
300         // Perform setup.
301         setupReadNonExistent();
302
303         // Submit the request to the service and store the response.
304         PermissionRoleClient client = new PermissionRoleClient();
305         Response res = null;
306         try {
307             res = client.read(NON_EXISTENT_ID);
308             int statusCode = res.getStatus();
309
310             // Check the status code of the response: does it match
311             // the expected response(s)?
312             if (logger.isDebugEnabled()) {
313                 logger.debug(testName + ": status = " + statusCode);
314             }
315             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
316                     invalidStatusCodeMessage(testRequestType, statusCode));
317             Assert.assertEquals(statusCode, testExpectedStatusCode);
318         } finally {
319             if (res != null) {
320                 res.close();
321             }
322         }
323     }
324
325     @Test(dataProvider = "testName",
326                 dependsOnMethods = {"CRUDTests"})
327     public void readNoRelationship(String testName) throws Exception {
328         // Perform setup.
329         setupRead();
330
331         // Submit the request to the service and store the response.
332         PermissionRoleClient client = new PermissionRoleClient();
333         Response res = null;
334         try {
335             res = client.read(
336                     permValues.get(TEST_SERVICE_NAME + TEST_MARKER + NO_REL_SUFFIX).getPermissionId());
337             // Check the status code of the response: does it match
338             // the expected response(s)?
339             assertStatusCode(res, testName);
340             PermissionRole output = res.readEntity(PermissionRole.class);
341
342             String sOutput = objectAsXmlString(output, PermissionRole.class);
343             if (logger.isDebugEnabled()) {
344                 logger.debug(testName + " received " + sOutput);
345             }
346         } finally {
347             if (res != null) {
348                 res.close();
349             }
350         }
351
352     }
353     // ---------------------------------------------------------------
354     // CRUD tests : READ_LIST tests
355     // ---------------------------------------------------------------
356     // Success outcomes
357     /* (non-Javadoc)
358      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
359      */
360
361     @Override
362 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
363 //    dependsOnMethods = {"createList", "read"})
364     public void readList(String testName) throws Exception {
365         //Should this really be empty?
366     }
367
368     // Failure outcomes
369     // None at present.
370     // ---------------------------------------------------------------
371     // CRUD tests : UPDATE tests
372     // ---------------------------------------------------------------
373     // Success outcomes
374     /* (non-Javadoc)
375      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
376      */
377     @Override
378 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
379 //    dependsOnMethods = {"read", "readList", "readNonExistent"})
380     public void update(String testName) throws Exception {
381         //Should this really be empty?
382     }
383
384     // Failure outcomes
385     // Placeholders until the three tests below can be uncommented.
386     // See Issue CSPACE-401.
387     /* (non-Javadoc)
388      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
389      */
390     @Override
391     public void updateWithEmptyEntityBody(String testName) throws Exception {
392         //Should this really be empty?
393     }
394
395     /* (non-Javadoc)
396      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
397      */
398     @Override
399     public void updateWithMalformedXml(String testName) throws Exception {
400         //Should this really be empty?
401     }
402
403     /* (non-Javadoc)
404      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
405      */
406     @Override
407     public void updateWithWrongXmlSchema(String testName) throws Exception {
408         //Should this really be empty?
409     }
410
411     /* (non-Javadoc)
412      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
413      */
414     @Override
415 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
416 //    dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
417     public void updateNonExistent(String testName) throws Exception {
418         //Should this really be empty?
419     }
420
421     // ---------------------------------------------------------------
422     // CRUD tests : DELETE tests
423     // ---------------------------------------------------------------
424     // Success outcomes
425     /* (non-Javadoc)
426      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
427      */
428     @Override
429 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
430 //    dependsOnMethods = {"read"})
431     public void delete(String testName) throws Exception {
432         // Perform setup.
433         setupDelete();
434
435         //
436         //
437         //
438         PermissionRoleClient client = new PermissionRoleClient();
439         Response readResponse = client.read(
440                         permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
441         PermissionRole toDelete = null;
442         try {
443                 toDelete = readResponse.readEntity(PermissionRole.class);
444         } finally {
445                 readResponse.close();
446         }        
447
448         Response res = client.delete(
449                         toDelete.getPermission().get(0).getPermissionId(), toDelete);
450         try {
451             int statusCode = res.getStatus();
452             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
453                     invalidStatusCodeMessage(testRequestType, statusCode));
454             Assert.assertEquals(statusCode, testExpectedStatusCode);
455         } finally {
456             if (res != null) {
457                 res.close();
458             }
459         }
460         
461         //
462         // recreate 'TEST_SERVICE_NAME + TEST_MARKER' account and roles
463         //
464         create(testName);
465         setupDelete();
466      
467         //
468         // Lookup a know permission, and delete all of its role relationships
469         //
470         readResponse = client.read(
471                         permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId());
472         toDelete = null;
473         try {
474                 toDelete = readResponse.readEntity(PermissionRole.class);
475         } finally {
476                 readResponse.close();
477         }
478
479         Response deleteRes = client.delete(toDelete.getPermission().get(0).getPermissionId());
480         try {
481             int statusCode = deleteRes.getStatus();
482             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
483                     invalidStatusCodeMessage(testRequestType, statusCode));
484             Assert.assertEquals(statusCode, testExpectedStatusCode);
485         } finally {
486                 deleteRes.close();
487         }
488         
489     }
490
491     // Failure outcomes
492     /* (non-Javadoc)
493      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
494      */
495     @Override
496     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
497     public void deleteNonExistent(String testName) throws Exception {
498         //ignoring this test as the service side returns 200 now even if it does
499         //not find a record in the db
500     }
501     
502     // ---------------------------------------------------------------
503     // Search tests
504     // ---------------------------------------------------------------
505     
506     @Override
507     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
508     public void searchWorkflowDeleted(String testName) throws Exception {
509         // Fixme: null test for now, overriding test in base class
510     }
511
512     @Override
513     protected String getKnowResourceId() {
514         return permValues.get(TEST_SERVICE_NAME + TEST_MARKER).getPermissionId();
515     }
516     
517     // ---------------------------------------------------------------
518     // Utility methods used by tests above
519     // ---------------------------------------------------------------
520     /**
521      * create permRolerole instance
522      * @param pv permissionvalue
523      * @param rvs rolevalue array
524      * @param usePermId 
525      * @param useRoleId
526      * @return PermissionRole
527      */
528     public static PermissionRole createPermissionRoleInstance(PermissionValue pv,
529             Collection<RoleValue> rvs,
530             boolean usePermId,
531             boolean useRoleId) {
532
533         List<RoleValue> rvls = new ArrayList<RoleValue>();
534         rvls.addAll(rvs);
535         PermissionRole permRole = PermissionRoleFactory.createPermissionRoleInstance(
536                 pv, rvls, usePermId, useRoleId);
537         if (logger.isDebugEnabled()) {
538             logger.debug("to be created, permRole");
539             logger.debug(objectAsXmlString(permRole, PermissionRole.class));
540         }
541         return permRole;
542     }
543
544     /**
545      * Clean up.
546      */
547     @AfterClass(alwaysRun = true)
548     @Override
549     public void cleanUp() {
550         setupDelete();
551         String noTest = System.getProperty("noTestCleanup");
552         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
553             if (logger.isDebugEnabled()) {
554                 logger.debug("Skipping Cleanup phase ...");
555             }
556             return;
557         }
558         if (logger.isDebugEnabled()) {
559             logger.debug("Cleaning up temporary resources created for testing ...");
560         }
561
562         for (PermissionValue pv : permValues.values()) {
563             deletePermission(pv.getPermissionId());
564         }
565         for (RoleValue rv : roleValues.values()) {
566             deleteRole(rv.getRoleId());
567         }
568     }
569
570     /**
571      * Creates the permission.
572      *
573      * @param resName the res name
574      * @param effect the effect
575      * @return the string
576      */
577     private String createPermission(String resName, EffectType effect) {
578         if (logger.isDebugEnabled()) {
579             logger.debug(getTestBanner("createPermission"));
580         }
581         setupCreate();
582         PermissionClient permClient = new PermissionClient();
583         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
584         Permission permission = PermissionFactory.createPermissionInstance(resName,
585                 "default permissions for " + resName,
586                 actions, effect, true, true, true);
587         String id = null;
588         Response res = permClient.create(permission);
589         try {
590             int statusCode = res.getStatus();
591             if (logger.isDebugEnabled()) {
592                 logger.debug("createPermission: resName=" + resName
593                         + " status = " + statusCode);
594             }
595             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
596                     invalidStatusCodeMessage(testRequestType, statusCode));
597             Assert.assertEquals(statusCode, testExpectedStatusCode);
598             id = extractId(res);
599         } finally {
600             if (res != null) {
601                 res.close();
602             }
603         }
604         return id;
605     }
606
607     /**
608      * Delete permission.
609      *
610      * @param permId the perm id
611      */
612     private void deletePermission(String permId) {
613         if (logger.isDebugEnabled()) {
614             logger.debug(getTestBanner("deletePermission"));
615         }
616         setupDelete();
617         PermissionClient permClient = new PermissionClient();
618         Response res = permClient.delete(permId);
619         try {
620             int statusCode = res.getStatus();
621             if (logger.isDebugEnabled()) {
622                 logger.debug("deletePermission: delete permission id="
623                         + permId + " status=" + statusCode);
624             }
625             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
626                     invalidStatusCodeMessage(testRequestType, statusCode));
627             Assert.assertEquals(statusCode, testExpectedStatusCode);
628         } finally {
629             res.close();
630         }
631
632     }
633
634     /**
635      * Creates the role.
636      *
637      * @param roleName the role name
638      * @return the string
639      */
640     private String createRole(String roleName) {
641         if (logger.isDebugEnabled()) {
642             logger.debug(getTestBanner("createRole"));
643         }
644         setupCreate();
645         RoleClient roleClient = new RoleClient();
646
647         Role role = RoleFactory.createRoleInstance(roleName,
648                         roleName, //the display name
649                 "role for " + roleName, true);
650         Response res = null;
651         String id = null;
652         try {
653             res = roleClient.create(role);
654             int statusCode = res.getStatus();
655             if (logger.isDebugEnabled()) {
656                 logger.debug("createRole: name=" + roleName
657                         + " status = " + statusCode);
658             }
659             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
660                     invalidStatusCodeMessage(testRequestType, statusCode));
661             Assert.assertEquals(statusCode, testExpectedStatusCode);
662
663             id = extractId(res);
664         } finally {
665             res.close();
666         }
667         return id;
668     }
669
670     /**
671      * Delete role.
672      *
673      * @param roleId the role id
674      */
675     private void deleteRole(String roleId) {
676         if (logger.isDebugEnabled()) {
677             logger.debug(getTestBanner("deleteRole"));
678         }
679         setupDelete();
680         RoleClient roleClient = new RoleClient();
681         Response res = roleClient.delete(roleId);
682         try {
683             int statusCode = res.getStatus();
684             if (logger.isDebugEnabled()) {
685                 logger.debug("deleteRole: delete role id=" + roleId
686                         + " status=" + statusCode);
687             }
688             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
689                     invalidStatusCodeMessage(testRequestType, statusCode));
690             Assert.assertEquals(statusCode, testExpectedStatusCode);
691         } finally {
692             res.close();
693         }
694     }
695
696         @Override
697         protected PermissionRole createInstance(String commonPartName,
698                         String identifier) {
699                 // TODO Auto-generated method stub
700                 return null;
701         }
702
703         @Override
704         protected PermissionRole updateInstance(PermissionRole commonPartObject) {
705                 // TODO Auto-generated method stub
706                 return null;
707         }
708
709         @Override
710         protected void compareUpdatedInstances(PermissionRole original,
711                         PermissionRole updated) throws Exception {
712                 // TODO Auto-generated method stub
713                 
714         }
715
716         @Override
717         protected Class<PermissionRole> getCommonListType() {
718                 return PermissionRole.class;
719         }
720
721     /*
722      * For convenience and terseness, this test method is the base of the test execution dependency chain.  Other test methods may
723      * refer to this method in their @Test annotation declarations.
724      */
725     @Override
726     @Test(dataProvider = "testName",
727                 dependsOnMethods = {
728                         "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})    
729     public void CRUDTests(String testName) {
730         // Do nothing.  Simply here to for a TestNG execution order for our tests
731     }
732     
733         @Override
734         protected long getSizeOfList(PermissionRole list) {
735                 // TODO Auto-generated method stub
736                 throw new UnsupportedOperationException("Method getSizeOfList() is not implemented because this service does not support lists.");
737         }
738 }