]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
66e478fd76a6e6c7946fb0aff16e46ac09127c9e
[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.account.client.test;
24
25 import java.util.List;
26 import javax.ws.rs.core.Response;
27
28 import org.collectionspace.services.client.AccountClient;
29 import org.collectionspace.services.client.CollectionSpaceClient;
30 import org.collectionspace.services.account.AccountsCommon;
31 import org.collectionspace.services.account.AccountsCommonList;
32 import org.collectionspace.services.account.Status;
33 import org.collectionspace.services.client.AccountFactory;
34 import org.collectionspace.services.client.test.AbstractServiceTestImpl;
35 import org.collectionspace.services.client.test.ServiceRequestType;
36 import org.collectionspace.services.jaxb.AbstractCommonList;
37 import org.jboss.resteasy.client.ClientResponse;
38
39 import org.testng.Assert;
40 import org.testng.annotations.Test;
41
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
44
45 /**
46  * AccountServiceTest, carries out tests against a
47  * deployed and running Account Service.
48  * 
49  * $LastChangedRevision: 917 $
50  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
51  */
52 public class AccountServiceTest extends AbstractServiceTestImpl {
53
54     /** The Constant logger. */
55     private final String CLASS_NAME = AccountServiceTest.class.getName();
56     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
57     // Instance variables specific to this test.
58     /** The known resource id. */
59     private String knownResourceId = null;
60     private String knownUserId = "barney";
61     private String knownUserPassword = "hithere08";
62     /** The add tenant. */
63     static boolean addTenant = true;
64
65     /*
66      * This method is called only by the parent class, AbstractServiceTestImpl
67      */
68     /* (non-Javadoc)
69      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
70      */
71     @Override
72     protected String getServicePathComponent() {
73         return new AccountClient().getServicePathComponent();
74     }
75
76     /* (non-Javadoc)
77      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
78      */
79     @Override
80     protected CollectionSpaceClient getClientInstance() {
81         return new AccountClient();
82     }
83
84     /* (non-Javadoc)
85      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
86      */
87     @Override
88     protected AbstractCommonList getAbstractCommonList(
89             ClientResponse<AbstractCommonList> response) {
90         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
91         throw new UnsupportedOperationException();
92     }
93
94     /* (non-Javadoc)
95      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
96      */
97     @Test(dataProvider = "testName")
98     @Override
99     public void readPaginatedList(String testName) throws Exception {
100         //FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
101     }
102
103     // ---------------------------------------------------------------
104     // CRUD tests : CREATE tests
105     // ---------------------------------------------------------------
106     // Success outcomes
107     /* (non-Javadoc)
108      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
109      */
110     @Override
111     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
112     public void create(String testName) throws Exception {
113
114         if (logger.isDebugEnabled()) {
115             logger.debug(testBanner(testName, CLASS_NAME));
116         }
117         // Perform setup, such as initializing the type of service request
118         // (e.g. CREATE, DELETE), its valid and expected status codes, and
119         // its associated HTTP method name (e.g. POST, DELETE).
120         setupCreate();
121
122         AccountClient client = new AccountClient();
123         // Submit the request to the service and store the response.
124         AccountsCommon account =
125                 createAccountInstance(knownUserId, knownUserId, knownUserPassword,
126                 "barney@dinoland.com", client.getTenantId(),
127                 true, false, true, true);
128         ClientResponse<Response> res = client.create(account);
129         int statusCode = res.getStatus();
130
131         // Check the status code of the response: does it match
132         // the expected response(s)?
133         //
134         // Specifically:
135         // Does it fall within the set of valid status codes?
136         // Does it exactly match the expected status code?
137         if (logger.isDebugEnabled()) {
138             logger.debug(testName + ": status = " + statusCode);
139         }
140         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
141                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
142         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
143
144         // Store the ID returned from this create operation
145         // for additional tests below.
146         knownResourceId = extractId(res);
147         if (logger.isDebugEnabled()) {
148             logger.debug(testName + ": knownResourceId=" + knownResourceId);
149         }
150     }
151
152     /**
153      * Creates the for unique user.
154      *
155      * @param testName the test name
156      * @throws Exception the exception
157      */
158     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
159     dependsOnMethods = {"create"})
160     public void createForUniqueUser(String testName) throws Exception {
161
162         if (logger.isDebugEnabled()) {
163             logger.debug(testBanner(testName, CLASS_NAME));
164         }
165         setupCreate();
166
167         // Submit the request to the service and store the response.
168         AccountClient client = new AccountClient();
169         AccountsCommon account =
170                 createAccountInstance("barney1", knownUserId, knownUserPassword,
171                 "barney@dinoland.com",
172                 client.getTenantId(), true, false, true, true);
173
174         ClientResponse<Response> res = client.create(account);
175         int statusCode = res.getStatus();
176         if (logger.isDebugEnabled()) {
177             logger.debug(testName + ": status = " + statusCode);
178         }
179         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
180                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
181         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
182     }
183
184     /**
185      * Creates the with invalid tenant.
186      *
187      * @param testName the test name
188      * @throws Exception the exception
189      */
190     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
191     dependsOnMethods = {"create"})
192     public void createWithInvalidTenant(String testName) throws Exception {
193
194         if (logger.isDebugEnabled()) {
195             logger.debug(testBanner(testName, CLASS_NAME));
196         }
197         setupCreate();
198
199         // Submit the request to the service and store the response.
200         AccountClient client = new AccountClient();
201         AccountsCommon account =
202                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
203                 client.getTenantId(), true, true, true, true);
204         ClientResponse<Response> res = client.create(account);
205         int statusCode = res.getStatus();
206         // Does it exactly match the expected status code?
207         if (logger.isDebugEnabled()) {
208             logger.debug(testName + ": status = " + statusCode);
209         }
210         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
211                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
212         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
213
214     }
215
216     /**
217      * Creates the without user.
218      *
219      * @param testName the test name
220      * @throws Exception the exception
221      */
222     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
223     dependsOnMethods = {"create"})
224     public void createWithoutUser(String testName) throws Exception {
225
226         if (logger.isDebugEnabled()) {
227             logger.debug(testBanner(testName, CLASS_NAME));
228         }
229         setupCreate();
230
231         // Submit the request to the service and store the response.
232         AccountClient client = new AccountClient();
233         AccountsCommon account =
234                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
235                 client.getTenantId(), true, false, false, true);
236         ClientResponse<Response> res = client.create(account);
237         int statusCode = res.getStatus();
238         // Does it exactly match the expected status code?
239         if (logger.isDebugEnabled()) {
240             logger.debug(testName + ": status = " + statusCode);
241         }
242         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
243                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
244         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
245     }
246
247     /**
248      * Creates the with invalid email.
249      *
250      * @param testName the test name
251      * @throws Exception the exception
252      */
253     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
254     dependsOnMethods = {"create"})
255     public void createWithInvalidEmail(String testName) throws Exception {
256
257         if (logger.isDebugEnabled()) {
258             logger.debug(testBanner(testName, CLASS_NAME));
259         }
260         setupCreate();
261
262         // Submit the request to the service and store the response.
263         AccountClient client = new AccountClient();
264         AccountsCommon account =
265                 createAccountInstance("babybop", "babybop", "hithere08", "babybop.dinoland.com",
266                 client.getTenantId(), true, false, true, true);
267         ClientResponse<Response> res = client.create(account);
268         int statusCode = res.getStatus();
269         // Does it exactly match the expected status code?
270         if (logger.isDebugEnabled()) {
271             logger.debug(testName + ": status = " + statusCode);
272         }
273         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
274                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
275         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
276     }
277
278     /**
279      * Creates the without screen name.
280      *
281      * @param testName the test name
282      * @throws Exception the exception
283      */
284     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
285     dependsOnMethods = {"create"})
286     public void createWithoutScreenName(String testName) throws Exception {
287
288         if (logger.isDebugEnabled()) {
289             logger.debug(testBanner(testName, CLASS_NAME));
290         }
291         setupCreate();
292
293         // Submit the request to the service and store the response.
294         AccountClient client = new AccountClient();
295         AccountsCommon account =
296                 createAccountInstance("babybop", "babybop", "hithere08", "babybop@dinoland.com",
297                 client.getTenantId(), false, false, true, true);
298         ClientResponse<Response> res = client.create(account);
299         int statusCode = res.getStatus();
300         // Does it exactly match the expected status code?
301         if (logger.isDebugEnabled()) {
302             logger.debug(testName + ": status = " + statusCode);
303         }
304         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
305                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
306         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
307     }
308
309     /**
310      * Creates the with invalid password.
311      *
312      * @param testName the test name
313      * @throws Exception the exception
314      */
315     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
316     dependsOnMethods = {"create"})
317     public void createWithInvalidPassword(String testName) throws Exception {
318
319         if (logger.isDebugEnabled()) {
320             logger.debug(testBanner(testName, CLASS_NAME));
321         }
322         setupCreate();
323
324         // Submit the request to the service and store the response.
325         AccountClient client = new AccountClient();
326         AccountsCommon account =
327                 createAccountInstance("babybop", "babybop", "shpswd", "babybop@dinoland.com",
328                 client.getTenantId(), true, false, true, true);
329         ClientResponse<Response> res = client.create(account);
330         int statusCode = res.getStatus();
331         // Does it exactly match the expected status code?
332         if (logger.isDebugEnabled()) {
333             logger.debug(testName + ": status = " + statusCode);
334         }
335         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
336                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
337         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
338     }
339
340     /**
341      * Creates the with most invalid.
342      *
343      * @param testName the test name
344      * @throws Exception the exception
345      */
346     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
347     dependsOnMethods = {"create"})
348     public void createWithMostInvalid(String testName) throws Exception {
349
350         if (logger.isDebugEnabled()) {
351             logger.debug(testBanner(testName, CLASS_NAME));
352         }
353         setupCreate();
354
355         // Submit the request to the service and store the response.
356         AccountClient client = new AccountClient();
357         AccountsCommon account =
358                 createAccountInstance("babybop", "babybop", "hithere08", "babybop/dinoland.com",
359                 client.getTenantId(), false, true, false, false);
360         ClientResponse<Response> res = client.create(account);
361         int statusCode = res.getStatus();
362         // Does it exactly match the expected status code?
363         if (logger.isDebugEnabled()) {
364             logger.debug(testName + ": status = " + statusCode);
365         }
366         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
367                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
368         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
369     }
370
371     //to not cause uniqueness violation for account, createList is removed
372     /* (non-Javadoc)
373      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
374      */
375     @Override
376     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
377     dependsOnMethods = {"create"})
378     public void createList(String testName) throws Exception {
379
380         if (logger.isDebugEnabled()) {
381             logger.debug(testBanner(testName, CLASS_NAME));
382         }
383         setupCreate();
384         // Submit the request to the service and store the response.
385         AccountClient client = new AccountClient();
386         AccountsCommon account1 =
387                 createAccountInstance("curious", "curious", "hithere08", "curious@george.com",
388                 client.getTenantId(), true, false, true, true);
389         ClientResponse<Response> res = client.create(account1);
390         int statusCode = res.getStatus();
391         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
392                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
393         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
394         allResourceIdsCreated.add(extractId(res));
395
396         AccountsCommon account2 =
397                 createAccountInstance("tom", "tom", "hithere09", "tom@jerry.com",
398                 client.getTenantId(), true, false, true, true);
399         res = client.create(account2);
400         statusCode = res.getStatus();
401         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
402                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
403         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
404         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
405         allResourceIdsCreated.add(extractId(res));
406
407         AccountsCommon account3 =
408                 createAccountInstance("mj", "mj", "hithere10", "mj@dinoland.com",
409                 client.getTenantId(), true, false, true, true);
410         res = client.create(account3);
411         statusCode = res.getStatus();
412         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
413                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
414         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
415         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
416         allResourceIdsCreated.add(extractId(res));
417     }
418
419     // Failure outcomes
420     // Placeholders until the three tests below can be uncommented.
421     // See Issue CSPACE-401.
422     /* (non-Javadoc)
423      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
424      */
425     @Override
426     public void createWithEmptyEntityBody(String testName) throws Exception {
427         //FIXME: Should this test really be empty?  If so, please comment accordingly.
428     }
429
430     /* (non-Javadoc)
431      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
432      */
433     @Override
434     public void createWithMalformedXml(String testName) throws Exception {
435         //FIXME: Should this test really be empty?  If so, please comment accordingly.
436     }
437
438     /* (non-Javadoc)
439      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
440      */
441     @Override
442     public void createWithWrongXmlSchema(String testName) throws Exception {
443         //FIXME: Should this test really be empty?  If so, please comment accordingly.
444     }
445
446     // ---------------------------------------------------------------
447     // CRUD tests : READ tests
448     // ---------------------------------------------------------------
449     // Success outcomes
450     /* (non-Javadoc)
451      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
452      */
453     @Override
454     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
455     dependsOnMethods = {"create"})
456     public void read(String testName) throws Exception {
457
458         if (logger.isDebugEnabled()) {
459             logger.debug(testBanner(testName, CLASS_NAME));
460         }
461         // Perform setup.
462         setupRead();
463
464         // Submit the request to the service and store the response.
465         AccountClient client = new AccountClient();
466         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
467         int statusCode = res.getStatus();
468
469         // Check the status code of the response: does it match
470         // the expected response(s)?
471         if (logger.isDebugEnabled()) {
472             logger.debug(testName + ": status = " + statusCode);
473         }
474         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
475                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
476         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
477
478         AccountsCommon output = (AccountsCommon) res.getEntity();
479         Assert.assertNotNull(output);
480     }
481
482     // Failure outcomes
483     /* (non-Javadoc)
484      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
485      */
486     @Override
487     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
488     dependsOnMethods = {"read"})
489     public void readNonExistent(String testName) throws Exception {
490
491         if (logger.isDebugEnabled()) {
492             logger.debug(testBanner(testName, CLASS_NAME));
493         }
494         // Perform setup.
495         setupReadNonExistent();
496
497         // Submit the request to the service and store the response.
498         AccountClient client = new AccountClient();
499         ClientResponse<AccountsCommon> res = client.read(NON_EXISTENT_ID);
500         int statusCode = res.getStatus();
501
502         // Check the status code of the response: does it match
503         // the expected response(s)?
504         if (logger.isDebugEnabled()) {
505             logger.debug(testName + ": status = " + statusCode);
506         }
507         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
508                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
509         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
510     }
511
512     // ---------------------------------------------------------------
513     // CRUD tests : READ_LIST tests
514     // ---------------------------------------------------------------
515     // Success outcomes
516     /* (non-Javadoc)
517      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
518      */
519     @Override
520     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
521     dependsOnMethods = {"createList", "read"})
522     public void readList(String testName) throws Exception {
523
524         if (logger.isDebugEnabled()) {
525             logger.debug(testBanner(testName, CLASS_NAME));
526         }
527         // Perform setup.
528         setupReadList();
529
530         // Submit the request to the service and store the response.
531         AccountClient client = new AccountClient();
532         ClientResponse<AccountsCommonList> res = client.readList();
533         AccountsCommonList list = res.getEntity();
534         int statusCode = res.getStatus();
535
536         // Check the status code of the response: does it match
537         // the expected response(s)?
538         if (logger.isDebugEnabled()) {
539             logger.debug(testName + ": status = " + statusCode);
540         }
541         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
542                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
543         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
544
545         // Optionally output additional data about list members for debugging.
546         boolean iterateThroughList = true;
547         if (iterateThroughList && logger.isDebugEnabled()) {
548             printList(testName, list);
549         }
550     }
551
552     /**
553      * Search screen name.
554      *
555      * @param testName the test name
556      * @throws Exception the exception
557      */
558     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
559     dependsOnMethods = {"createList", "read"})
560     public void searchScreenName(String testName) throws Exception {
561
562         if (logger.isDebugEnabled()) {
563             logger.debug(testBanner(testName, CLASS_NAME));
564         }
565         // Perform setup.
566         setupReadList();
567
568         // Submit the request to the service and store the response.
569         AccountClient client = new AccountClient();
570         ClientResponse<AccountsCommonList> res =
571                 client.readSearchList("tom", null, null);
572         AccountsCommonList list = res.getEntity();
573         int statusCode = res.getStatus();
574
575         // Check the status code of the response: does it match
576         // the expected response(s)?
577         if (logger.isDebugEnabled()) {
578             logger.debug(testName + ": status = " + statusCode);
579         }
580         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
581                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
582         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
583         Assert.assertEquals(1, list.getAccountListItem().size());
584         // Optionally output additional data about list members for debugging.
585         boolean iterateThroughList = true;
586         if (iterateThroughList && logger.isDebugEnabled()) {
587             printList(testName, list);
588         }
589     }
590
591     /**
592      * Search user id.
593      *
594      * @param testName the test name
595      * @throws Exception the exception
596      */
597     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
598     dependsOnMethods = {"createList", "read"})
599     public void searchUserId(String testName) throws Exception {
600
601         if (logger.isDebugEnabled()) {
602             logger.debug(testBanner(testName, CLASS_NAME));
603         }
604         // Perform setup.
605         setupReadList();
606
607         // Submit the request to the service and store the response.
608         AccountClient client = new AccountClient();
609         ClientResponse<AccountsCommonList> res =
610                 client.readSearchList(null, "tom", null);
611         AccountsCommonList list = res.getEntity();
612         int statusCode = res.getStatus();
613
614         // Check the status code of the response: does it match
615         // the expected response(s)?
616         if (logger.isDebugEnabled()) {
617             logger.debug(testName + ": status = " + statusCode);
618         }
619         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
620                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
621         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
622         Assert.assertEquals(1, list.getAccountListItem().size());
623         // Optionally output additional data about list members for debugging.
624         boolean iterateThroughList = true;
625         if (iterateThroughList && logger.isDebugEnabled()) {
626             printList(testName, list);
627         }
628     }
629
630     /**
631      * Search email.
632      *
633      * @param testName the test name
634      * @throws Exception the exception
635      */
636     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
637     dependsOnMethods = {"createList", "read"})
638     public void searchEmail(String testName) throws Exception {
639
640         if (logger.isDebugEnabled()) {
641             logger.debug(testBanner(testName, CLASS_NAME));
642         }
643         // Perform setup.
644         setupReadList();
645
646         // Submit the request to the service and store the response.
647         AccountClient client = new AccountClient();
648         ClientResponse<AccountsCommonList> res =
649                 client.readSearchList(null, null, "dinoland");
650         AccountsCommonList list = res.getEntity();
651         int statusCode = res.getStatus();
652
653         // Check the status code of the response: does it match
654         // the expected response(s)?
655         if (logger.isDebugEnabled()) {
656             logger.debug(testName + ": status = " + statusCode);
657         }
658         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
659                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
660         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
661         Assert.assertEquals(2, list.getAccountListItem().size());
662         // Optionally output additional data about list members for debugging.
663         boolean iterateThroughList = true;
664         if (iterateThroughList && logger.isDebugEnabled()) {
665             printList(testName, list);
666         }
667     }
668
669     /**
670      * Search screen name email.
671      *
672      * @param testName the test name
673      * @throws Exception the exception
674      */
675     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
676     dependsOnMethods = {"createList", "read"})
677     public void searchScreenNameEmail(String testName) throws Exception {
678
679         if (logger.isDebugEnabled()) {
680             logger.debug(testBanner(testName, CLASS_NAME));
681         }
682         // Perform setup.
683         setupReadList();
684
685         // Submit the request to the service and store the response.
686         AccountClient client = new AccountClient();
687         ClientResponse<AccountsCommonList> res =
688                 client.readSearchList("tom", null, "jerry");
689         AccountsCommonList list = res.getEntity();
690         int statusCode = res.getStatus();
691
692         // Check the status code of the response: does it match
693         // the expected response(s)?
694         if (logger.isDebugEnabled()) {
695             logger.debug(testName + ": status = " + statusCode);
696         }
697         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
698                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
699         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
700         Assert.assertEquals(1, list.getAccountListItem().size());
701         // Optionally output additional data about list members for debugging.
702         boolean iterateThroughList = true;
703         if (iterateThroughList && logger.isDebugEnabled()) {
704             printList(testName, list);
705         }
706     }
707
708     // Failure outcomes
709     // None at present.
710     // ---------------------------------------------------------------
711     // CRUD tests : UPDATE tests
712     // ---------------------------------------------------------------
713     // Success outcomes
714     /* (non-Javadoc)
715      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
716      */
717     @Override
718     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
719     dependsOnMethods = {"read", "readList", "readNonExistent"})
720     public void update(String testName) throws Exception {
721
722         if (logger.isDebugEnabled()) {
723             logger.debug(testBanner(testName, CLASS_NAME));
724         }
725         // Perform setup.
726         setupUpdate();
727
728         AccountClient client = new AccountClient();
729         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
730         if (logger.isDebugEnabled()) {
731             logger.debug(testName + ": read status = " + res.getStatus());
732         }
733         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
734
735         if (logger.isDebugEnabled()) {
736             logger.debug("got object to update with ID: " + knownResourceId);
737         }
738         AccountsCommon accountFound =
739                 (AccountsCommon) res.getEntity();
740         Assert.assertNotNull(accountFound);
741
742         //create a new account object to test partial updates
743         AccountsCommon accountToUpdate = new AccountsCommon();
744         accountToUpdate.setCsid(knownResourceId);
745         accountToUpdate.setUserId(accountFound.getUserId());
746         // Update the content of this resource.
747         accountToUpdate.setEmail("updated-" + accountFound.getEmail());
748         if (logger.isDebugEnabled()) {
749             logger.debug("updated object");
750             logger.debug(objectAsXmlString(accountFound,
751                     AccountsCommon.class));
752         }
753
754         // Submit the request to the service and store the response.
755         res = client.update(knownResourceId, accountToUpdate);
756         int statusCode = res.getStatus();
757         // Check the status code of the response: does it match the expected response(s)?
758         if (logger.isDebugEnabled()) {
759             logger.debug(testName + ": status = " + statusCode);
760         }
761         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
762                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
763         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
764
765         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
766         Assert.assertNotNull(accountUpdated);
767
768         Assert.assertEquals(accountUpdated.getEmail(),
769                 accountToUpdate.getEmail(),
770                 "Data in updated object did not match submitted data.");
771     }
772
773     /**
774      * Update password.
775      *
776      * @param testName the test name
777      * @throws Exception the exception
778      */
779     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
780     dependsOnMethods = {"update"})
781     public void updatePassword(String testName) throws Exception {
782
783         if (logger.isDebugEnabled()) {
784             logger.debug(testBanner(testName, CLASS_NAME));
785         }
786         // Perform setup.
787         setupUpdate();
788
789         AccountClient client = new AccountClient();
790         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
791         if (logger.isDebugEnabled()) {
792             logger.debug(testName + ": read status = " + res.getStatus());
793         }
794         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
795
796         if (logger.isDebugEnabled()) {
797             logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
798         }
799         AccountsCommon accountFound =
800                 (AccountsCommon) res.getEntity();
801         Assert.assertNotNull(accountFound);
802
803         //create a new account object to test partial updates
804         AccountsCommon accountToUpdate = new AccountsCommon();
805         accountToUpdate.setCsid(knownResourceId);
806         accountToUpdate.setUserId(accountFound.getUserId());
807         //change password
808         accountToUpdate.setPassword("imagination".getBytes());
809         if (logger.isDebugEnabled()) {
810             logger.debug(testName + ": updated object");
811             logger.debug(objectAsXmlString(accountToUpdate,
812                     AccountsCommon.class));
813         }
814
815         // Submit the request to the service and store the response.
816         res = client.update(knownResourceId, accountToUpdate);
817         int statusCode = res.getStatus();
818         // Check the status code of the response: does it match the expected response(s)?
819         if (logger.isDebugEnabled()) {
820             logger.debug(testName + ": status = " + statusCode);
821         }
822         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
823                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
824         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
825
826
827         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
828         Assert.assertNotNull(accountUpdated);
829
830 //        Assert.assertEquals(accountUpdated.getPassword(),
831 //                accountFound.getPassword(),
832 //                "Data in updated object did not match submitted data.");
833     }
834
835     /**
836      * Update password without user.
837      *
838      * @param testName the test name
839      * @throws Exception the exception
840      */
841     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
842     dependsOnMethods = {"update"})
843     public void updatePasswordWithoutUser(String testName) throws Exception {
844
845         if (logger.isDebugEnabled()) {
846             logger.debug(testBanner(testName, CLASS_NAME));
847         }
848         // Perform setup.
849         setupUpdate();
850
851         AccountsCommon accountToUpdate = new AccountsCommon();
852         accountToUpdate.setCsid(knownResourceId);
853         accountToUpdate.setUserId(null);
854         //change password
855         accountToUpdate.setPassword("imagination".getBytes());
856         if (logger.isDebugEnabled()) {
857             logger.debug(testName + " : updated object");
858             logger.debug(objectAsXmlString(accountToUpdate,
859                     AccountsCommon.class));
860         }
861
862         AccountClient client = new AccountClient();
863         // Submit the request to the service and store the response.
864         ClientResponse<AccountsCommon> res = client.update(knownResourceId, accountToUpdate);
865         int statusCode = res.getStatus();
866         // Check the status code of the response: does it match the expected response(s)?
867         if (logger.isDebugEnabled()) {
868             logger.debug(testName + ": status = " + statusCode);
869         }
870         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
871                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
872         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
873
874     }
875
876     /**
877      * Update invalid password.
878      *
879      * @param testName the test name
880      * @throws Exception the exception
881      */
882     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
883     dependsOnMethods = {"update"})
884     public void updateInvalidPassword(String testName) throws Exception {
885
886         if (logger.isDebugEnabled()) {
887             logger.debug(testBanner(testName, CLASS_NAME));
888         }
889         // Perform setup.
890         setupUpdate();
891         AccountClient client = new AccountClient();
892         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
893         if (logger.isDebugEnabled()) {
894             logger.debug(testName + ": read status = " + res.getStatus());
895         }
896         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
897
898         if (logger.isDebugEnabled()) {
899             logger.debug(testName + ": got object to update password with ID: " + knownResourceId);
900         }
901         AccountsCommon accountFound = (AccountsCommon) res.getEntity();
902
903         AccountsCommon accountToUpdate = new AccountsCommon();
904         accountToUpdate.setCsid(knownResourceId);
905         accountToUpdate.setUserId(accountFound.getUserId());
906         Assert.assertNotNull(accountToUpdate);
907
908         //change password
909         accountToUpdate.setPassword("abc123".getBytes());
910         if (logger.isDebugEnabled()) {
911             logger.debug(testName + ": updated object");
912             logger.debug(objectAsXmlString(accountToUpdate,
913                     AccountsCommon.class));
914         }
915
916         // Submit the request to the service and store the response.
917         res = client.update(knownResourceId, accountToUpdate);
918         int statusCode = res.getStatus();
919         // Check the status code of the response: does it match the expected response(s)?
920         if (logger.isDebugEnabled()) {
921             logger.debug(testName + ": status = " + statusCode);
922         }
923         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
924                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
925         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
926
927     }
928
929     /**
930      * Deactivate.
931      *
932      * @param testName the test name
933      * @throws Exception the exception
934      */
935     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
936     dependsOnMethods = {"updatePasswordWithoutUser"})
937     public void deactivate(String testName) throws Exception {
938
939         if (logger.isDebugEnabled()) {
940             logger.debug(testBanner(testName, CLASS_NAME));
941         }
942         // Perform setup.
943         setupUpdate();
944
945         AccountClient client = new AccountClient();
946         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
947         if (logger.isDebugEnabled()) {
948             logger.debug(testName + ": read status = " + res.getStatus());
949         }
950         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
951
952         if (logger.isDebugEnabled()) {
953             logger.debug("got object to update with ID: " + knownResourceId);
954         }
955         AccountsCommon accountFound = (AccountsCommon) res.getEntity();
956
957         //create a new account object to test partial updates
958         AccountsCommon accountToUpdate = new AccountsCommon();
959         accountToUpdate.setCsid(knownResourceId);
960         accountToUpdate.setUserId(accountFound.getUserId());
961
962         // Update the content of this resource.
963         accountToUpdate.setStatus(Status.INACTIVE);
964         if (logger.isDebugEnabled()) {
965             logger.debug("updated object");
966             logger.debug(objectAsXmlString(accountToUpdate,
967                     AccountsCommon.class));
968         }
969
970         // Submit the request to the service and store the response.
971         res = client.update(knownResourceId, accountToUpdate);
972         int statusCode = res.getStatus();
973         // Check the status code of the response: does it match the expected response(s)?
974         if (logger.isDebugEnabled()) {
975             logger.debug(testName + ": status = " + statusCode);
976         }
977         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
978                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
979         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
980
981         AccountsCommon accountUpdated = (AccountsCommon) res.getEntity();
982         Assert.assertNotNull(accountUpdated);
983
984         Assert.assertEquals(accountUpdated.getStatus(),
985                 accountToUpdate.getStatus(),
986                 "Data in updated object did not match submitted data.");
987
988     }
989
990     // Failure outcomes
991     // Placeholders until the three tests below can be uncommented.
992     // See Issue CSPACE-401.
993     /* (non-Javadoc)
994      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
995      */
996     @Override
997     public void updateWithEmptyEntityBody(String testName) throws Exception {
998         //FIXME: Should this test really be empty?  If so, please comment accordingly.
999     }
1000
1001     /* (non-Javadoc)
1002      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
1003      */
1004     @Override
1005     public void updateWithMalformedXml(String testName) throws Exception {
1006         //FIXME: Should this test really be empty?  If so, please comment accordingly.
1007     }
1008
1009     /* (non-Javadoc)
1010      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
1011      */
1012     @Override
1013     public void updateWithWrongXmlSchema(String testName) throws Exception {
1014         //FIXME: Should this test really be empty?  If so, please comment accordingly.
1015     }
1016
1017     /* (non-Javadoc)
1018      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
1019      */
1020     @Override
1021     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1022     dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
1023     public void updateNonExistent(String testName) throws Exception {
1024
1025         if (logger.isDebugEnabled()) {
1026             logger.debug(testBanner(testName, CLASS_NAME));
1027         }
1028         // Perform setup.
1029         setupUpdateNonExistent();
1030
1031         // Submit the request to the service and store the response.
1032         //
1033         // Note: The ID used in this 'create' call may be arbitrary.
1034         // The only relevant ID may be the one used in updateAccount(), below.
1035         AccountClient client = new AccountClient();
1036         AccountsCommon account =
1037                 createAccountInstance("simba", "simba", "tiger", "simba@lionking.com",
1038                 client.getTenantId(), true, false, true, true);
1039         ClientResponse<AccountsCommon> res =
1040                 client.update(NON_EXISTENT_ID, account);
1041         int statusCode = res.getStatus();
1042
1043         // Check the status code of the response: does it match
1044         // the expected response(s)?
1045         if (logger.isDebugEnabled()) {
1046             logger.debug(testName + ": status = " + statusCode);
1047         }
1048         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1049                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1050         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1051     }
1052
1053     /**
1054      * Update wrong user.
1055      *
1056      * @param testName the test name
1057      * @throws Exception the exception
1058      */
1059     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1060     dependsOnMethods = {"deactivate", "readNonExistent", "testSubmitRequest"})
1061     public void updateWrongUser(String testName) throws Exception {
1062
1063         if (logger.isDebugEnabled()) {
1064             logger.debug(testBanner(testName, CLASS_NAME));
1065         }
1066         setupUpdate();
1067
1068         // Submit the request to the service and store the response.
1069         //
1070         // Note: The ID used in this 'create' call may be arbitrary.
1071         // The only relevant ID may be the one used in updateAccount(), below.
1072         AccountClient client = new AccountClient();
1073         ClientResponse<AccountsCommon> res = client.read(knownResourceId);
1074         if (logger.isDebugEnabled()) {
1075             logger.debug(testName + ": read status = " + res.getStatus());
1076         }
1077         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
1078
1079         if (logger.isDebugEnabled()) {
1080             logger.debug("got object to update with ID: " + knownResourceId);
1081         }
1082         AccountsCommon accountToUpdate =
1083                 (AccountsCommon) res.getEntity();
1084         Assert.assertNotNull(accountToUpdate);
1085
1086         accountToUpdate.setUserId("barneyFake");
1087         if (logger.isDebugEnabled()) {
1088             logger.debug("updated object with wrongUser");
1089             logger.debug(objectAsXmlString(accountToUpdate,
1090                     AccountsCommon.class));
1091         }
1092
1093         res = client.update(knownResourceId, accountToUpdate);
1094         int statusCode = res.getStatus();
1095
1096         // Check the status code of the response: does it match
1097         // the expected response(s)?
1098         if (logger.isDebugEnabled()) {
1099             logger.debug(testName + ": status = " + statusCode);
1100         }
1101         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1102                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1103         Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
1104     }
1105
1106     // ---------------------------------------------------------------
1107     // CRUD tests : DELETE tests
1108     // ---------------------------------------------------------------
1109     // Success outcomes
1110     /* (non-Javadoc)
1111      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
1112      */
1113     @Override
1114     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1115     dependsOnMethods = {"testSubmitRequest", "updateWrongUser"})
1116     public void delete(String testName) throws Exception {
1117
1118         if (logger.isDebugEnabled()) {
1119             logger.debug(testBanner(testName, CLASS_NAME));
1120         }
1121         // Perform setup.
1122         setupDelete();
1123
1124         // Submit the request to the service and store the response.
1125         AccountClient client = new AccountClient();
1126         ClientResponse<Response> res = client.delete(knownResourceId);
1127         int statusCode = res.getStatus();
1128
1129         // Check the status code of the response: does it match
1130         // the expected response(s)?
1131         if (logger.isDebugEnabled()) {
1132             logger.debug(testName + ": status = " + statusCode);
1133         }
1134         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1135                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1136         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1137     }
1138
1139     // Failure outcomes
1140     /* (non-Javadoc)
1141      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
1142      */
1143     @Override
1144     @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1145     dependsOnMethods = {"delete"})
1146     public void deleteNonExistent(String testName) throws Exception {
1147
1148         if (logger.isDebugEnabled()) {
1149             logger.debug(testBanner(testName, CLASS_NAME));
1150         }
1151         // Perform setup.
1152         setupDeleteNonExistent();
1153
1154         // Submit the request to the service and store the response.
1155         AccountClient client = new AccountClient();
1156         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
1157         int statusCode = res.getStatus();
1158
1159         // Check the status code of the response: does it match
1160         // the expected response(s)?
1161         if (logger.isDebugEnabled()) {
1162             logger.debug(testName + ": status = " + statusCode);
1163         }
1164         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1165                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1166         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1167     }
1168
1169     // ---------------------------------------------------------------
1170     // Utility tests : tests of code used in tests above
1171     // ---------------------------------------------------------------
1172     /**
1173      * Tests the code for manually submitting data that is used by several
1174      * of the methods above.
1175      * @throws Exception 
1176      */
1177     @Test(dependsOnMethods = {"create", "read"})
1178     public void testSubmitRequest() throws Exception {
1179
1180         setupRead();
1181
1182         // Submit the request to the service and store the response.
1183         String method = ServiceRequestType.READ.httpMethodName();
1184         String url = getResourceURL(knownResourceId);
1185         int statusCode = submitRequest(method, url);
1186
1187         // Check the status code of the response: does it match
1188         // the expected response(s)?
1189         if (logger.isDebugEnabled()) {
1190             logger.debug("testSubmitRequest: url=" + url
1191                     + " status=" + statusCode);
1192         }
1193         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1194
1195     }
1196
1197     // ---------------------------------------------------------------
1198     // Utility methods used by tests above
1199     // ---------------------------------------------------------------
1200     /**
1201      * create account instance
1202      * @param screenName
1203      * @param userName
1204      * @param passwd
1205      * @param email
1206      * @param useScreenName
1207      * @param invalidTenant
1208      * @param useUser
1209      * @param usePassword
1210      * @return
1211      */
1212     AccountsCommon createAccountInstance(String screenName,
1213             String userName, String passwd, String email, String tenantId,
1214             boolean useScreenName, boolean invalidTenant, boolean useUser, boolean usePassword) {
1215
1216         AccountsCommon account = AccountFactory.createAccountInstance(screenName,
1217                 userName, passwd, email, tenantId, useScreenName,
1218                 invalidTenant, useUser, usePassword);
1219         if (logger.isDebugEnabled()) {
1220             logger.debug("to be created, account common");
1221             logger.debug(objectAsXmlString(account,
1222                     AccountsCommon.class));
1223         }
1224         return account;
1225
1226     }
1227
1228
1229     /**
1230      * Prints the list.
1231      *
1232      * @param testName the test name
1233      * @param list the list
1234      */
1235     private void printList(String testName, AccountsCommonList list) {
1236         List<AccountsCommonList.AccountListItem> items =
1237                 list.getAccountListItem();
1238         int i = 0;
1239
1240         for (AccountsCommonList.AccountListItem item : items) {
1241             logger.debug(testName + ": list-item[" + i + "] csid="
1242                     + item.getCsid());
1243             logger.debug(testName + ": list-item[" + i + "] screenName="
1244                     + item.getScreenName());
1245             logger.debug(testName + ": list-item[" + i + "] URI="
1246                     + item.getUri());
1247             i++;
1248
1249         }
1250     }
1251 }