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