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