]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
bf0c00ae66f73f592c5fdf56f9a8a85cbf95fc7f
[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 permissions 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.List;
27 import javax.ws.rs.core.Response;
28 //import org.collectionspace.services.authorization.ActionType;
29 import org.collectionspace.services.authorization.EffectType;
30
31 import org.collectionspace.services.client.CollectionSpaceClient;
32 import org.collectionspace.services.client.PermissionClient;
33 import org.collectionspace.services.authorization.Permission;
34 import org.collectionspace.services.authorization.PermissionAction;
35 import org.collectionspace.services.authorization.PermissionsList;
36 import org.collectionspace.services.client.PermissionFactory;
37 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
38 import org.collectionspace.services.client.test.ServiceRequestType;
39 import org.collectionspace.services.jaxb.AbstractCommonList;
40 import org.jboss.resteasy.client.ClientResponse;
41
42 import org.testng.Assert;
43 import org.testng.annotations.Test;
44
45 import org.slf4j.Logger;
46 import org.slf4j.LoggerFactory;
47 import org.testng.annotations.AfterClass;
48
49 /**
50  * PermissionServiceTest, carries out tests against a
51  * deployed and running Permission Service.
52  * 
53  * $LastChangedRevision: 917 $
54  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
55  */
56 public class PermissionServiceTest extends AbstractServiceTestImpl {
57
58     static private final Logger logger =
59             LoggerFactory.getLogger(PermissionServiceTest.class);
60     // Instance variables specific to this test.
61     private String knownResourceId = null;
62     private List<String> allResourceIdsCreated = new ArrayList<String>();
63     boolean addTenant = true;
64     /*
65      * This method is called only by the parent class, AbstractServiceTestImpl
66      */
67
68     @Override
69     protected String getServicePathComponent() {
70         return new PermissionClient().getServicePathComponent();
71     }
72
73     /* (non-Javadoc)
74      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
75      */
76     @Override
77     protected CollectionSpaceClient getClientInstance() {
78         return new PermissionClient();
79     }
80     
81     /* (non-Javadoc)
82      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
83      */
84     @Override
85         protected AbstractCommonList getAbstractCommonList(
86                         ClientResponse<AbstractCommonList> response) {
87         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
88         throw new UnsupportedOperationException();
89     }
90     
91         @Test(dataProvider = "testName")
92         @Override
93     public void readPaginatedList(String testName) throws Exception {
94                 //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
95         }    
96
97         // ---------------------------------------------------------------
98     // CRUD tests : CREATE tests
99     // ---------------------------------------------------------------
100     // Success outcomes
101     @Override
102     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
103     public void create(String testName) throws Exception {
104
105         // Perform setup, such as initializing the type of service request
106         // (e.g. CREATE, DELETE), its valid and expected status codes, and
107         // its associated HTTP method name (e.g. POST, DELETE).
108         setupCreate(testName);
109
110         // Submit the request to the service and store the response.
111         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
112         Permission permission = createPermissionInstance("accounts",
113                 "default permissions for account",
114                 actions,
115                 EffectType.PERMIT,
116                 true,
117                 true,
118                 true);
119         PermissionClient client = new PermissionClient();
120         ClientResponse<Response> res = client.create(permission);
121         int statusCode = res.getStatus();
122
123         // Check the status code of the response: does it match
124         // the expected response(s)?
125         //
126         // Specifically:
127         // Does it fall within the set of valid status codes?
128         // Does it exactly match the expected status code?
129         if (logger.isDebugEnabled()) {
130             logger.debug(testName + ": status = " + statusCode);
131         }
132         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
133                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
134         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
135
136         // Store the ID returned from this create operation
137         // for additional tests below.
138         knownResourceId = extractId(res);
139         if (logger.isDebugEnabled()) {
140             logger.debug(testName + ": knownResourceId=" + knownResourceId);
141         }
142     }
143
144     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
145     dependsOnMethods = {"create"})
146     public void createWithoutResourceName(String testName) throws Exception {
147
148         setupCreate(testName);
149
150         // Submit the request to the service and store the response.
151         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
152         Permission permission = createPermissionInstance(null,
153                 "default permissions for account",
154                 actions,
155                 EffectType.PERMIT,
156                 false,
157                 true,
158                 true);
159         PermissionClient client = new PermissionClient();
160         ClientResponse<Response> res = client.create(permission);
161         int statusCode = res.getStatus();
162         // Does it exactly match the expected status code?
163         if (logger.isDebugEnabled()) {
164             logger.debug(testName + ": status = " + statusCode);
165         }
166         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
167                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
168         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
169     }
170
171     //to not cause uniqueness violation for permission, createList is removed
172     @Override
173     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
174     dependsOnMethods = {"create"})
175     public void createList(String testName) throws Exception {
176
177         setupCreate(testName);
178         // Submit the request to the service and store the response.
179         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
180         Permission permission1 = createPermissionInstance("collectionobjects",
181                 "default permissions for collectionobjects",
182                 actions,
183                 EffectType.PERMIT,
184                 true,
185                 true,
186                 true);
187         PermissionClient client = new PermissionClient();
188         ClientResponse<Response> res = client.create(permission1);
189         int statusCode = res.getStatus();
190         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
191                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
192         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
193         allResourceIdsCreated.add(extractId(res));
194
195         Permission permission2 = createPermissionInstance("acquisitions",
196                 "default permissions for acquisitions",
197                 actions,
198                 EffectType.PERMIT,
199                 true,
200                 true,
201                 true);
202         res = client.create(permission2);
203         statusCode = res.getStatus();
204         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
205                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
206         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
207         allResourceIdsCreated.add(extractId(res));
208
209         Permission permission3 = createPermissionInstance("ids",
210                 "default permissions for id service",
211                 actions,
212                 EffectType.PERMIT,
213                 true,
214                 true,
215                 true);
216         res = client.create(permission3);
217         statusCode = res.getStatus();
218         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
219                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
220         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
221         allResourceIdsCreated.add(extractId(res));
222     }
223
224     // Failure outcomes
225     // Placeholders until the three tests below can be uncommented.
226     // See Issue CSPACE-401.
227     @Override
228     public void createWithEmptyEntityBody(String testName) throws Exception {
229         //FIXME: Should this test really be empty?  If so, please comment accordingly.
230     }
231
232     @Override
233     public void createWithMalformedXml(String testName) throws Exception {
234         //FIXME: Should this test really be empty?  If so, please comment accordingly.
235     }
236
237     @Override
238     public void createWithWrongXmlSchema(String testName) throws Exception {
239         //FIXME: Should this test really be empty?  If so, please comment accordingly.
240     }
241
242     // ---------------------------------------------------------------
243     // CRUD tests : READ tests
244     // ---------------------------------------------------------------
245     // Success outcomes
246     @Override
247     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
248     dependsOnMethods = {"create"})
249     public void read(String testName) throws Exception {
250
251         // Perform setup.
252         setupRead(testName);
253
254         // Submit the request to the service and store the response.
255         PermissionClient client = new PermissionClient();
256         ClientResponse<Permission> res = client.read(knownResourceId);
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(REQUEST_TYPE.isValidStatusCode(statusCode),
265                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
266         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
267
268         Permission output = (Permission) res.getEntity();
269         Assert.assertNotNull(output);
270     }
271
272     // Failure outcomes
273     @Override
274     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
275     dependsOnMethods = {"read"})
276     public void readNonExistent(String testName) throws Exception {
277
278         // Perform setup.
279         setupReadNonExistent(testName);
280
281         // Submit the request to the service and store the response.
282         PermissionClient client = new PermissionClient();
283         ClientResponse<Permission> res = client.read(NON_EXISTENT_ID);
284         int statusCode = res.getStatus();
285
286         // Check the status code of the response: does it match
287         // the expected response(s)?
288         if (logger.isDebugEnabled()) {
289             logger.debug(testName + ": status = " + statusCode);
290         }
291         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
292                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
293         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
294     }
295
296     // ---------------------------------------------------------------
297     // CRUD tests : READ_LIST tests
298     // ---------------------------------------------------------------
299     // Success outcomes
300     @Override
301     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
302     dependsOnMethods = {"createList", "read"})
303     public void readList(String testName) throws Exception {
304
305         // Perform setup.
306         setupReadList(testName);
307
308         // Submit the request to the service and store the response.
309         PermissionClient client = new PermissionClient();
310         ClientResponse<PermissionsList> res = client.readList();
311         PermissionsList list = res.getEntity();
312         int statusCode = res.getStatus();
313
314         // Check the status code of the response: does it match
315         // the expected response(s)?
316         if (logger.isDebugEnabled()) {
317             logger.debug(testName + ": status = " + statusCode);
318         }
319         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
320                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
321         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
322
323         // Optionally output additional data about list members for debugging.
324         boolean iterateThroughList = true;
325         if (iterateThroughList && logger.isDebugEnabled()) {
326             printList(testName, list);
327         }
328     }
329
330     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
331     dependsOnMethods = {"createList", "read"})
332     public void searchResourceName(String testName) throws Exception {
333
334         // Perform setup.
335         setupReadList(testName);
336
337         // Submit the request to the service and store the response.
338         PermissionClient client = new PermissionClient();
339         ClientResponse<PermissionsList> res = client.readSearchList("acquisition");
340         PermissionsList list = res.getEntity();
341         int statusCode = res.getStatus();
342         // Check the status code of the response: does it match
343         // the expected response(s)?
344         if (logger.isDebugEnabled()) {
345             logger.debug(testName + ": status = " + statusCode);
346         }
347         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
348                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
349         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
350         int EXPECTED_ITEMS = 1;
351         if (logger.isDebugEnabled()) {
352             logger.debug(testName + ": received = " + list.getPermissions().size()
353                     + " expected=" + EXPECTED_ITEMS);
354         }
355         Assert.assertEquals(EXPECTED_ITEMS, list.getPermissions().size());
356         // Optionally output additional data about list members for debugging.
357         boolean iterateThroughList = true;
358         if (iterateThroughList && logger.isDebugEnabled()) {
359             printList(testName, list);
360         }
361     }
362
363     // Failure outcomes
364     // None at present.
365     // ---------------------------------------------------------------
366     // CRUD tests : UPDATE tests
367     // ---------------------------------------------------------------
368     // Success outcomes
369     @Override
370     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
371     dependsOnMethods = {"read", "readList", "readNonExistent"})
372     public void update(String testName) throws Exception {
373
374         // Perform setup.
375         setupUpdate(testName);
376
377         Permission permToUpdate = new Permission();
378         permToUpdate.setCsid(knownResourceId);
379         // Update the content of this resource.
380         permToUpdate.setResourceName("updated-resource");
381         if (logger.isDebugEnabled()) {
382             logger.debug("updated object");
383             logger.debug(objectAsXmlString(permToUpdate,
384                     Permission.class));
385         }
386         PermissionClient client = new PermissionClient();
387         // Submit the request to the service and store the response.
388         ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
389         int statusCode = res.getStatus();
390         // Check the status code of the response: does it match the expected response(s)?
391         if (logger.isDebugEnabled()) {
392             logger.debug(testName + ": status = " + statusCode);
393         }
394         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
395                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
396         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
397
398
399         Permission permUpdated = (Permission) res.getEntity();
400         Assert.assertNotNull(permUpdated);
401
402         Assert.assertEquals(permUpdated.getResourceName(),
403                 permToUpdate.getResourceName(),
404                 "Data in updated object did not match submitted data.");
405     }
406
407     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
408     dependsOnMethods = {"update"})
409     public void updateActions(String testName) throws Exception {
410
411         // Perform setup.
412         setupUpdate(testName);
413
414         Permission permToUpdate = new Permission();
415         permToUpdate.setCsid(knownResourceId);
416         // Update the content of this resource.
417         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
418         int default_actions = actions.size();
419         actions.remove(0);
420         actions.remove(0);
421         int toUpdate_actions = actions.size();
422         if (logger.isDebugEnabled()) {
423             logger.debug(testName + " no. of actions default=" + default_actions
424                     + " to update =" + toUpdate_actions);
425         }
426         permToUpdate.setActions(actions);
427         if (logger.isDebugEnabled()) {
428             logger.debug(testName + " updated object\n"
429                     + objectAsXmlString(permToUpdate, Permission.class));
430         }
431         PermissionClient client = new PermissionClient();
432         // Submit the request to the service and store the response.
433         ClientResponse<Permission> res = client.update(knownResourceId, permToUpdate);
434         int statusCode = res.getStatus();
435         // Check the status code of the response: does it match the expected response(s)?
436         if (logger.isDebugEnabled()) {
437             logger.debug(testName + ": status = " + statusCode);
438         }
439         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
440                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
441         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
442
443         Permission permUpdated = (Permission) res.getEntity();
444         Assert.assertNotNull(permUpdated);
445         int updated_actions = permToUpdate.getActions().size();
446         if (logger.isDebugEnabled()) {
447             logger.debug(testName + " no. of actions to update=" + toUpdate_actions
448                     + " updated =" + updated_actions);
449         }
450         Assert.assertEquals(toUpdate_actions,
451                 updated_actions,
452                 "Data in updated object did not match submitted data.");
453     }
454     // Failure outcomes
455     // Placeholders until the three tests below can be uncommented.
456     // See Issue CSPACE-401.
457
458     @Override
459     public void updateWithEmptyEntityBody(String testName) throws Exception {
460         //FIXME: Should this test really be empty?  If so, please comment accordingly.
461     }
462
463     @Override
464     public void updateWithMalformedXml(String testName) throws Exception {
465         //FIXME: Should this test really be empty?  If so, please comment accordingly.
466     }
467
468     @Override
469     public void updateWithWrongXmlSchema(String testName) throws Exception {
470         //FIXME: Should this test really be empty?  If so, please comment accordingly.
471     }
472
473     @Override
474     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
475     dependsOnMethods = {"readNonExistent", "testSubmitRequest"})
476     public void updateNonExistent(String testName) throws Exception {
477
478         // Perform setup.
479         setupUpdateNonExistent(testName);
480
481         // Submit the request to the service and store the response.
482         //
483         // Note: The ID used in this 'create' call may be arbitrary.
484         // The only relevant ID may be the one used in updatePermission(), below.
485         PermissionClient client = new PermissionClient();
486         List<PermissionAction> actions = PermissionFactory.createDefaultActions();
487         Permission permission = createPermissionInstance("acquisitions",
488                 "default permissions for acquisitions",
489                 actions,
490                 EffectType.PERMIT,
491                 true,
492                 true,
493                 true);
494         ClientResponse<Permission> res =
495                 client.update(NON_EXISTENT_ID, permission);
496         int statusCode = res.getStatus();
497
498         // Check the status code of the response: does it match
499         // the expected response(s)?
500         if (logger.isDebugEnabled()) {
501             logger.debug(testName + ": status = " + statusCode);
502         }
503         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
504                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
505         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
506     }
507
508     // ---------------------------------------------------------------
509     // CRUD tests : DELETE tests
510     // ---------------------------------------------------------------
511     // Success outcomes
512     @Override
513     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
514     dependsOnMethods = {"updateActions"})
515     public void delete(String testName) throws Exception {
516
517         // Perform setup.
518         setupDelete(testName);
519
520         // Submit the request to the service and store the response.
521         PermissionClient client = new PermissionClient();
522         ClientResponse<Response> res = client.delete(knownResourceId);
523         int statusCode = res.getStatus();
524
525         // Check the status code of the response: does it match
526         // the expected response(s)?
527         if (logger.isDebugEnabled()) {
528             logger.debug(testName + ": status = " + statusCode);
529         }
530         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
531                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
532         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
533     }
534
535     // Failure outcomes
536     @Override
537     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
538     dependsOnMethods = {"delete"})
539     public void deleteNonExistent(String testName) throws Exception {
540
541         // Perform setup.
542         setupDeleteNonExistent(testName);
543
544         // Submit the request to the service and store the response.
545         PermissionClient client = new PermissionClient();
546         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
547         int statusCode = res.getStatus();
548
549         // Check the status code of the response: does it match
550         // the expected response(s)?
551         if (logger.isDebugEnabled()) {
552             logger.debug(testName + ": status = " + statusCode);
553         }
554         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
555                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
556         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
557     }
558
559     // ---------------------------------------------------------------
560     // Utility tests : tests of code used in tests above
561     // ---------------------------------------------------------------
562     /**
563      * Tests the code for manually submitting data that is used by several
564      * of the methods above.
565      */
566     @Test(dependsOnMethods = {"create", "read"})
567     public void testSubmitRequest() throws Exception {
568
569         // Expected status code: 200 OK
570         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
571
572         // Submit the request to the service and store the response.
573         String method = ServiceRequestType.READ.httpMethodName();
574         String url = getResourceURL(knownResourceId);
575         int statusCode = submitRequest(method, url);
576
577         // Check the status code of the response: does it match
578         // the expected response(s)?
579         if (logger.isDebugEnabled()) {
580             logger.debug("testSubmitRequest: url=" + url
581                     + " status=" + statusCode);
582         }
583         Assert.assertEquals(statusCode, EXPECTED_STATUS);
584
585     }
586
587     // ---------------------------------------------------------------
588     // Utility methods used by tests above
589     // ---------------------------------------------------------------
590     /**
591      * create permission instance
592      * @param resourceName
593      * @param description
594      * @param actionList list of actions for this permission
595      * @param effect effect of the permission
596      * @param useResourceName
597      * @param useAction
598      * @param useEffect
599      * @return
600      */
601     public static Permission createPermissionInstance(String resourceName,
602             String description,
603             List<PermissionAction> actionList,
604             EffectType effect,
605             boolean useResourceName,
606             boolean useAction,
607             boolean useEffect) {
608
609         Permission permission = PermissionFactory.createPermissionInstance(resourceName,
610                 description, actionList, effect,
611                 useResourceName, useAction, useEffect);
612
613         if (logger.isDebugEnabled()) {
614             logger.debug("to be created, permission common");
615             logger.debug(objectAsXmlString(permission, Permission.class));
616         }
617         return permission;
618     }
619
620     @AfterClass(alwaysRun = true)
621     public void cleanUp() {
622         setupDelete("delete");
623         String noTest = System.getProperty("noTestCleanup");
624         if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
625             if (logger.isDebugEnabled()) {
626                 logger.debug("Skipping Cleanup phase ...");
627             }
628             return;
629         }
630         if (logger.isDebugEnabled()) {
631             logger.debug("Cleaning up temporary resources created for testing ...");
632         }
633         PermissionClient client = new PermissionClient();
634         for (String resourceId : allResourceIdsCreated) {
635             ClientResponse<Response> res = client.delete(resourceId);
636             int statusCode = res.getStatus();
637             Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
638                     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
639             Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
640         }
641     }
642
643     private int printList(String testName, PermissionsList list) {
644
645         int i = 0;
646
647         for (Permission permission : list.getPermissions()) {
648             logger.debug(testName + " permission csid=" + permission.getCsid()
649                     + " name=" + permission.getResourceName()
650                     + " desc=" + permission.getDescription());
651             i++;
652         }
653         return i;
654     }
655 }