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:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright © 2009 Regents of the University of California
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
15 * https://source.collectionspace.org/collection-space/LICENSE.txt
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.
23 package org.collectionspace.services.client.test;
25 import java.util.List;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
29 //import org.collectionspace.services.client.AbstractServiceClientImpl;
30 import org.collectionspace.services.client.CollectionObjectClient;
31 import org.collectionspace.services.client.CollectionObjectFactory;
32 import org.collectionspace.services.client.CollectionSpaceClient;
33 import org.collectionspace.services.collectionobject.BriefDescriptionList;
34 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
35 import org.collectionspace.services.collectionobject.domain.naturalhistory.CollectionobjectsNaturalhistory;
36 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
37 import org.collectionspace.services.collectionobject.ResponsibleDepartmentList;
38 import org.collectionspace.services.collectionobject.ObjectNameGroup;
39 import org.collectionspace.services.collectionobject.ObjectNameList;
40 import org.collectionspace.services.collectionobject.OtherNumber;
41 import org.collectionspace.services.collectionobject.OtherNumberList;
43 import org.collectionspace.services.jaxb.AbstractCommonList;
45 import org.jboss.resteasy.client.ClientResponse;
46 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
47 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
48 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
49 import org.testng.Assert;
50 import org.testng.annotations.Test;
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
56 * CollectionObjectServiceTest, carries out tests against a
57 * deployed and running CollectionObject Service.
59 * $LastChangedRevision$
62 public class CollectionObjectServiceTest extends AbstractServiceTestImpl {
65 private final String CLASS_NAME = CollectionObjectServiceTest.class.getName();
66 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
68 // Instance variables specific to this test.
69 /** The known resource id. */
70 private String knownResourceId = null;
72 private final String OBJECT_NAME_VALUE = "an object name";
75 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
78 protected String getServicePathComponent() {
79 return new CollectionObjectClient().getServicePathComponent();
83 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
86 protected CollectionSpaceClient getClientInstance() {
87 return new CollectionObjectClient();
91 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
94 protected AbstractCommonList getAbstractCommonList(
95 ClientResponse<AbstractCommonList> response) {
96 return response.getEntity(CollectionobjectsCommonList.class);
99 // ---------------------------------------------------------------
100 // CRUD tests : CREATE tests
101 // ---------------------------------------------------------------
104 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
107 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
108 public void create(String testName) throws Exception {
110 if (logger.isDebugEnabled()) {
111 logger.debug(testBanner(testName, CLASS_NAME));
113 // Perform setup, such as initializing the type of service request
114 // (e.g. CREATE, DELETE), its valid and expected status codes, and
115 // its associated HTTP method name (e.g. POST, DELETE).
118 // Submit the request to the service and store the response.
119 CollectionObjectClient client = new CollectionObjectClient();
120 String identifier = createIdentifier();
121 MultipartOutput multipart =
122 createCollectionObjectInstance(client.getCommonPartName(), identifier);
123 ClientResponse<Response> res = client.create(multipart);
124 int statusCode = res.getStatus();
126 // Check the status code of the response: does it match
127 // the expected response(s)?
130 // Does it fall within the set of valid status codes?
131 // Does it exactly match the expected status code?
132 if (logger.isDebugEnabled()) {
133 logger.debug(testName + ": status = " + statusCode);
135 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
136 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
137 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
139 // Store the ID returned from the first resource created
140 // for additional tests below.
141 if (knownResourceId == null) {
142 knownResourceId = extractId(res);
143 if (logger.isDebugEnabled()) {
144 logger.debug(testName + ": knownResourceId=" + knownResourceId);
148 // Store the IDs from every resource created by tests,
149 // so they can be deleted after tests have been run.
150 allResourceIdsCreated.add(extractId(res));
155 * Tests to diagnose and verify the fixed status of CSPACE-1026,
156 * "Whitespace at certain points in payload cause failure"
159 * Creates the from xml cambridge.
161 * @param testName the test name
162 * @throws Exception the exception
164 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
165 dependsOnMethods = {"create", "testSubmitRequest"})
166 public void createFromXmlCambridge(String testName) throws Exception {
168 createFromXmlFile(testName, "./test-data/testCambridge.xml", true);
169 testSubmitRequest(newId);
173 * Tests to diagnose and fix CSPACE-2242.
175 * This is a bug identified in release 0.8 in which value instances of a
176 * repeatable field are not stored when the first value instance of that
180 // Verify that record creation occurs successfully when the first value instance
181 // of a single, repeatable String scalar field is non-blank.
182 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
183 dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2242group"})
184 public void createFromXmlNonBlankFirstValueInstance(String testName) throws Exception {
185 if (logger.isDebugEnabled()) {
186 logger.debug(testBanner(testName, CLASS_NAME));
189 createFromXmlFile(testName, "./test-data/cspace-2242-first-value-instance-nonblank.xml", true);
190 CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
191 // Verify that at least one value instance of the repeatable field was successfully persisted.
192 BriefDescriptionList descriptionList = collectionObject.getBriefDescriptions();
193 List<String> descriptions = descriptionList.getBriefDescription();
194 Assert.assertTrue(descriptions.size() > 0);
197 // Verify that record creation occurs successfully when the first value instance
198 // of a single, repeatable String scalar field is blank.
199 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
200 dependsOnMethods = {"create", "testSubmitRequest"}, groups = {"cspace2242group"})
201 public void createFromXmlBlankFirstValueInstance(String testName) throws Exception {
202 if (logger.isDebugEnabled()) {
203 logger.debug(testBanner(testName, CLASS_NAME));
206 createFromXmlFile(testName, "./test-data/cspace-2242-first-value-instance-blank.xml", true);
207 CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId);
208 // Verify that at least one value instance of the repeatable field was successfully persisted.
209 BriefDescriptionList descriptionList = collectionObject.getBriefDescriptions();
210 List<String> descriptions = descriptionList.getBriefDescription();
211 Assert.assertTrue(descriptions.size() > 0);
215 * Creates the from xml rfw s1.
217 * @param testName the test name
218 * @throws Exception the exception
220 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
221 dependsOnMethods = {"create", "testSubmitRequest"})
222 public void createFromXmlRFWS1(String testName) throws Exception {
223 String testDataDir = System.getProperty("test-data.fileName");
225 //createFromXmlFile(testName, "./target/test-classes/test-data/repfield_whitesp1.xml", false);
226 createFromXmlFile(testName, testDataDir + "/repfield_whitesp1.xml", false);
227 testSubmitRequest(newId);
231 * Creates the from xml rfw s2.
233 * @param testName the test name
234 * @throws Exception the exception
236 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
237 dependsOnMethods = {"create", "testSubmitRequest"})
238 public void createFromXmlRFWS2(String testName) throws Exception {
239 String testDataDir = System.getProperty("test-data.fileName");
241 //createFromXmlFile(testName, "./target/test-classes/test-data/repfield_whitesp2.xml", false);
242 createFromXmlFile(testName, testDataDir + "/repfield_whitesp2.xml", false);
243 testSubmitRequest(newId);
247 * Creates the from xml rfw s3.
249 * @param testName the test name
250 * @throws Exception the exception
252 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
253 dependsOnMethods = {"create", "testSubmitRequest"})
254 public void createFromXmlRFWS3(String testName) throws Exception {
255 String testDataDir = System.getProperty("test-data.fileName");
257 //createFromXmlFile(testName, "./target/test-classes/test-data/repfield_whitesp3.xml", false);
258 createFromXmlFile(testName, testDataDir + "/repfield_whitesp3.xml", false);
259 testSubmitRequest(newId);
263 * Creates the from xml rfw s4.
265 * @param testName the test name
266 * @throws Exception the exception
268 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
269 dependsOnMethods = {"create", "testSubmitRequest"})
270 public void createFromXmlRFWS4(String testName) throws Exception {
271 String testDataDir = System.getProperty("test-data.fileName");
273 createFromXmlFile(testName, testDataDir + "/repfield_whitesp4.xml", false);
274 testSubmitRequest(newId);
278 * Tests to diagnose and verify the fixed status of CSPACE-1248,
279 * "Wedged records created!" (i.e. records with child repeatable
280 * fields, which contain null values, can be successfully created
281 * but an error occurs on trying to retrieve those records).
285 * Creates a CollectionObject resource with a null value repeatable field.
287 * @param testName the test name
288 * @throws Exception the exception
290 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
291 dependsOnMethods = {"create", "testSubmitRequest"})
292 public void createWithNullValueRepeatableField(String testName) throws Exception {
293 String testDataDir = System.getProperty("test-data.fileName");
295 createFromXmlFile(testName, testDataDir + "/repfield_null1.xml", false);
296 if (logger.isDebugEnabled()) {
297 logger.debug("Successfully created record with null value repeatable field.");
298 logger.debug("Attempting to retrieve just-created record ...");
300 testSubmitRequest(newId);
304 * @see org.collectionspace.services.client.test.ServiceTest#createList()
307 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
308 dependsOnMethods = {"create"})
309 public void createList(String testName) throws Exception {
310 this.createPaginatedList(testName, DEFAULT_LIST_SIZE);
314 // Placeholders until the three tests below can be uncommented.
315 // See Issue CSPACE-401.
317 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
320 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
321 public void createWithEmptyEntityBody(String testName) throws Exception {
322 //FIXME: Should this test really be empty?
326 * Test how the service handles XML that is not well formed,
327 * when sent in the payload of a Create request.
329 * @param testName The name of this test method. This name is supplied
330 * automatically, via reflection, by a TestNG 'data provider' in
334 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
335 public void createWithMalformedXml(String testName) throws Exception {
339 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
342 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
343 public void createWithWrongXmlSchema(String testName) throws Exception {
344 //FIXME: Should this test really be empty?
350 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
351 dependsOnMethods = {"create", "testSubmitRequest"})
352 public void createWithEmptyEntityBody(String testName) throwsException {
354 if (logger.isDebugEnabled()) {
355 logger.debug(testBanner(testName, CLASS_NAME));
358 setupCreateWithEmptyEntityBody();
360 // Submit the request to the service and store the response.
361 String method = REQUEST_TYPE.httpMethodName();
362 String url = getServiceRootURL();
363 String mediaType = MediaType.APPLICATION_XML;
364 final String entity = "";
365 int statusCode = submitRequest(method, url, mediaType, entity);
367 // Check the status code of the response: does it match
368 // the expected response(s)?
369 if(logger.isDebugEnabled()){
370 logger.debug(testName + ": url=" + url +
371 " status=" + statusCode);
373 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
374 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
375 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
379 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
380 dependsOnMethods = {"create", "testSubmitRequest"})
381 public void createWithMalformedXml(String testName) throws Exception {
383 if (logger.isDebugEnabled()) {
384 logger.debug(testBanner(testName, CLASS_NAME));
387 setupCreateWithMalformedXml();
389 // Submit the request to the service and store the response.
390 String method = REQUEST_TYPE.httpMethodName();
391 String url = getServiceRootURL();
392 String mediaType = MediaType.APPLICATION_XML;
393 final String entity = MALFORMED_XML_DATA; // Constant from base class.
394 int statusCode = submitRequest(method, url, mediaType, entity);
396 // Check the status code of the response: does it match
397 // the expected response(s)?
398 if(logger.isDebugEnabled()){
399 logger.debug(testName + ": url=" + url +
400 " status=" + statusCode);
402 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
403 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
404 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
408 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
409 dependsOnMethods = {"create", "testSubmitRequest"})
410 public void createWithWrongXmlSchema(String testName) throws Exception {
412 if (logger.isDebugEnabled()) {
413 logger.debug(testBanner(testName, CLASS_NAME));
416 setupCreateWithWrongXmlSchema();
418 // Submit the request to the service and store the response.
419 String method = REQUEST_TYPE.httpMethodName();
420 String url = getServiceRootURL();
421 String mediaType = MediaType.APPLICATION_XML;
422 final String entity = WRONG_XML_SCHEMA_DATA;
423 int statusCode = submitRequest(method, url, mediaType, entity);
425 // Check the status code of the response: does it match
426 // the expected response(s)?
427 if(logger.isDebugEnabled()){
428 logger.debug(testName + ": url=" + url +
429 " status=" + statusCode);
431 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
432 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
433 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
438 * Test how the service handles, in a Create request, payloads
439 * containing null values (or, in the case of String fields,
440 * empty String values) in one or more fields which must be
441 * present and are required to contain non-empty values.
443 * This is a test of code and/or configuration in the service's
444 * validation routine(s).
446 * @param testName The name of this test method. This name is supplied
447 * automatically, via reflection, by a TestNG 'data provider' in
451 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
452 public void createWithRequiredValuesNullOrEmpty(String testName) throws Exception {
453 if (logger.isDebugEnabled()) {
454 logger.debug(testBanner(testName, CLASS_NAME));
458 // Build a payload with invalid content, by omitting a
459 // field (objectNumber) which must be present, and in which
460 // a non-empty value is required, as enforced by the service's
461 // validation routine(s).
462 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
463 collectionObject.setTitle("a title");
465 ObjectNameList objNameList = new ObjectNameList();
466 List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
467 ObjectNameGroup objectNameGroup = new ObjectNameGroup();
468 objectNameGroup.setObjectName("an object name");
469 objNameGroups.add(objectNameGroup);
470 collectionObject.setObjectNameList(objNameList);
472 // Submit the request to the service and store the response.
473 CollectionObjectClient client = new CollectionObjectClient();
474 MultipartOutput multipart =
475 createCollectionObjectInstance(client.getCommonPartName(), collectionObject, null);
476 ClientResponse<Response> res = client.create(multipart);
477 int statusCode = res.getStatus();
479 // Read the response and verify that the create attempt failed.
480 if (logger.isDebugEnabled()) {
481 logger.debug(testName + ": status = " + statusCode);
483 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
484 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
485 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
487 // FIXME: Consider splitting off the following into its own test method.
489 // Build a payload with invalid content, by setting a value to the
490 // empty String, in a field that requires a non-empty value,
491 // as enforced by the service's validation routine(s).
492 collectionObject = new CollectionobjectsCommon();
493 collectionObject.setObjectNumber("");
494 collectionObject.setTitle("a title");
495 objNameList = new ObjectNameList();
496 objNameGroups = objNameList.getObjectNameGroup();
497 objectNameGroup = new ObjectNameGroup();
498 objectNameGroup.setObjectName(OBJECT_NAME_VALUE);
499 objNameGroups.add(objectNameGroup);
500 collectionObject.setObjectNameList(objNameList);
502 // Submit the request to the service and store the response.
504 createCollectionObjectInstance(client.getCommonPartName(), collectionObject, null);
505 res = client.create(multipart);
506 statusCode = res.getStatus();
508 // Read the response and verify that the create attempt failed.
509 if (logger.isDebugEnabled()) {
510 logger.debug(testName + ": status = " + statusCode);
512 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
513 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
514 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
519 // ---------------------------------------------------------------
520 // CRUD tests : READ tests
521 // ---------------------------------------------------------------
524 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
527 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
528 dependsOnMethods = {"create"})
529 public void read(String testName) throws Exception {
531 if (logger.isDebugEnabled()) {
532 logger.debug(testBanner(testName, CLASS_NAME));
537 // Submit the request to the service and store the response.
538 CollectionObjectClient client = new CollectionObjectClient();
539 ClientResponse<MultipartInput> res = client.read(knownResourceId);
540 int statusCode = res.getStatus();
542 // Check the status code of the response: does it match
543 // the expected response(s)?
544 if (logger.isDebugEnabled()) {
545 logger.debug(testName + ": status = " + statusCode);
547 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
548 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
549 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
551 MultipartInput input = (MultipartInput) res.getEntity();
553 if (logger.isDebugEnabled()) {
554 logger.debug(testName + ": Reading Common part ...");
556 CollectionobjectsCommon collectionObject =
557 (CollectionobjectsCommon) extractPart(input,
558 client.getCommonPartName(), CollectionobjectsCommon.class);
559 Assert.assertNotNull(collectionObject);
561 if (logger.isDebugEnabled()) {
562 logger.debug(testName + ": Reading Natural History part ...");
564 CollectionobjectsNaturalhistory conh =
565 (CollectionobjectsNaturalhistory) extractPart(input,
566 getNHPartName(), CollectionobjectsNaturalhistory.class);
567 Assert.assertNotNull(conh);
572 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
575 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
576 dependsOnMethods = {"read"})
577 public void readNonExistent(String testName) throws Exception {
579 if (logger.isDebugEnabled()) {
580 logger.debug(testBanner(testName, CLASS_NAME));
583 setupReadNonExistent();
585 // Submit the request to the service and store the response.
586 CollectionObjectClient client = new CollectionObjectClient();
587 ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
588 int statusCode = res.getStatus();
590 // Check the status code of the response: does it match
591 // the expected response(s)?
592 if (logger.isDebugEnabled()) {
593 logger.debug(testName + ": status = " + statusCode);
595 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
596 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
597 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
601 // ---------------------------------------------------------------
602 // CRUD tests : READ_LIST tests
603 // ---------------------------------------------------------------
606 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
609 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
610 dependsOnMethods = {"createList", "read"})
611 public void readList(String testName) throws Exception {
613 if (logger.isDebugEnabled()) {
614 logger.debug(testBanner(testName, CLASS_NAME));
619 // Submit the request to the service and store the response.
620 CollectionObjectClient client = new CollectionObjectClient();
621 ClientResponse<CollectionobjectsCommonList> res = client.readList();
622 CollectionobjectsCommonList list = res.getEntity();
623 int statusCode = res.getStatus();
625 // Check the status code of the response: does it match
626 // the expected response(s)?
627 if (logger.isDebugEnabled()) {
628 logger.debug(testName + ": status = " + statusCode);
630 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
631 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
632 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
634 // Optionally output additional data about list members for debugging.
635 boolean iterateThroughList = false;
636 if (iterateThroughList && logger.isDebugEnabled()) {
637 List<CollectionobjectsCommonList.CollectionObjectListItem> items =
638 list.getCollectionObjectListItem();
641 for (CollectionobjectsCommonList.CollectionObjectListItem item : items) {
642 logger.debug(testName + ": list-item[" + i + "] csid="
644 logger.debug(testName + ": list-item[" + i + "] objectNumber="
645 + item.getObjectNumber());
646 logger.debug(testName + ": list-item[" + i + "] URI="
656 // ---------------------------------------------------------------
657 // CRUD tests : UPDATE tests
658 // ---------------------------------------------------------------
661 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
664 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
665 dependsOnMethods = {"read"})
666 public void update(String testName) throws Exception {
668 if (logger.isDebugEnabled()) {
669 logger.debug(testBanner(testName, CLASS_NAME));
674 // Read an existing resource that will be updated.
675 ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
677 // Extract its common part.
678 CollectionObjectClient client = new CollectionObjectClient();
679 MultipartInput input = (MultipartInput) res.getEntity();
680 CollectionobjectsCommon collectionObject =
681 (CollectionobjectsCommon) extractPart(input,
682 client.getCommonPartName(), CollectionobjectsCommon.class);
683 Assert.assertNotNull(collectionObject);
685 // Change the content of one or more fields in the common part.
686 collectionObject.setObjectNumber("updated-" + collectionObject.getObjectNumber());
688 ObjectNameList objNameList = collectionObject.getObjectNameList();
689 List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
690 Assert.assertNotNull(objNameGroups);
691 Assert.assertTrue(objNameGroups.size() >= 1);
692 String objectName = objNameGroups.get(0).getObjectName();
693 Assert.assertEquals(objectName, OBJECT_NAME_VALUE);
694 String updatedObjectName = "updated-" + objectName;
695 objNameGroups.get(0).setObjectName(updatedObjectName);
696 collectionObject.setObjectNameList(objNameList);
698 if (logger.isDebugEnabled()) {
699 logger.debug("sparse update that will be sent in update request:");
700 logger.debug(objectAsXmlString(collectionObject,
701 CollectionobjectsCommon.class));
704 // Send the changed resource to be updated.
705 res = updateSend(testName, knownResourceId, collectionObject);
706 int statusCode = res.getStatus();
707 // Check the status code of the response: does it match the expected response(s)?
708 if (logger.isDebugEnabled()) {
709 logger.debug(testName + ": status = " + statusCode);
711 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
712 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
713 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
715 // Read the response and verify that the resource was correctly updated.
716 input = (MultipartInput) res.getEntity();
717 CollectionobjectsCommon updatedCollectionObject =
718 (CollectionobjectsCommon) extractPart(input,
719 client.getCommonPartName(), CollectionobjectsCommon.class);
720 Assert.assertNotNull(updatedCollectionObject);
722 objNameList = collectionObject.getObjectNameList();
723 objNameGroups = objNameList.getObjectNameGroup();
724 Assert.assertNotNull(objNameGroups);
725 Assert.assertTrue(objNameGroups.size() >= 1);
726 Assert.assertEquals(updatedObjectName,
727 objNameGroups.get(0).getObjectName(),
728 "Data in updated object did not match submitted data.");
735 * @param testName the test name
737 * @return the client response
739 private ClientResponse<MultipartInput> updateRetrieve(String testName, String id) {
740 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
741 CollectionObjectClient client = new CollectionObjectClient();
742 ClientResponse<MultipartInput> res = client.read(id);
743 if (logger.isDebugEnabled()) {
744 logger.debug("read in updateRetrieve for " + testName + " status = " + res.getStatus());
746 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS);
747 if (logger.isDebugEnabled()) {
748 logger.debug("got object to updateRetrieve for " + testName + " with ID: " + id);
756 * @param testName the test name
758 * @param collectionObject the collection object
759 * @return the client response
761 private ClientResponse<MultipartInput> updateSend(String testName, String id,
762 CollectionobjectsCommon collectionObject) {
763 MultipartOutput output = new MultipartOutput();
764 OutputPart commonPart = output.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
765 CollectionObjectClient client = new CollectionObjectClient();
766 commonPart.getHeaders().add("label", client.getCommonPartName());
767 ClientResponse<MultipartInput> res = client.update(knownResourceId, output);
772 // Placeholders until the three tests below can be uncommented.
773 // See Issue CSPACE-401.
775 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
778 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
779 dependsOnMethods = {"read"})
780 public void updateWithEmptyEntityBody(String testName) throws Exception {
781 //FIXME: Should this test really be empty?
785 * Test how the service handles XML that is not well formed,
786 * when sent in the payload of an Update request.
788 * @param testName The name of this test method. This name is supplied
789 * automatically, via reflection, by a TestNG 'data provider' in
793 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
794 dependsOnMethods = {"read"})
795 public void updateWithMalformedXml(String testName) throws Exception {
796 //FIXME: Should this test really be empty?
800 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
803 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
804 dependsOnMethods = {"read"})
805 public void updateWithWrongXmlSchema(String testName) throws Exception {
806 //FIXME: Should this test really be empty?
811 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
812 dependsOnMethods = {"create", "update", "testSubmitRequest"})
813 public void updateWithEmptyEntityBody(String testName) throws Exception {
815 if (logger.isDebugEnabled()) {
816 logger.debug(testBanner(testName, CLASS_NAME));
819 setupUpdateWithEmptyEntityBody();
821 // Submit the request to the service and store the response.
822 String method = REQUEST_TYPE.httpMethodName();
823 String url = getResourceURL(knownResourceId);
824 String mediaType = MediaType.APPLICATION_XML;
825 final String entity = "";
826 int statusCode = submitRequest(method, url, mediaType, entity);
828 // Check the status code of the response: does it match
829 // the expected response(s)?
830 if(logger.isDebugEnabled()){
831 logger.debug(testName + ": url=" + url +
832 " status=" + statusCode);
834 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
835 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
836 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
840 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
841 dependsOnMethods = {"create", "update", "testSubmitRequest"})
842 public void updateWithMalformedXml() throws Exception {
844 if (logger.isDebugEnabled()) {
845 logger.debug(testBanner(testName, CLASS_NAME));
848 setupUpdateWithMalformedXml();
850 // Submit the request to the service and store the response.
851 String method = REQUEST_TYPE.httpMethodName();
852 String url = getResourceURL(knownResourceId);
853 final String entity = MALFORMED_XML_DATA;
854 String mediaType = MediaType.APPLICATION_XML;
855 int statusCode = submitRequest(method, url, mediaType, entity);
857 // Check the status code of the response: does it match
858 // the expected response(s)?
859 if(logger.isDebugEnabled()){
860 logger.debug(testName + ": url=" + url +
861 " status=" + statusCode);
863 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
864 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
865 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
869 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
870 dependsOnMethods = {"create", "update", "testSubmitRequest"})
871 public void updateWithWrongXmlSchema(String testName) throws Exception {
873 if (logger.isDebugEnabled()) {
874 logger.debug(testBanner(testName, CLASS_NAME));
877 setupUpdateWithWrongXmlSchema();
879 // Submit the request to the service and store the response.
880 String method = REQUEST_TYPE.httpMethodName();
881 String url = getResourceURL(knownResourceId);
882 String mediaType = MediaType.APPLICATION_XML;
883 final String entity = WRONG_XML_SCHEMA_DATA;
884 int statusCode = submitRequest(method, url, mediaType, entity);
886 // Check the status code of the response: does it match
887 // the expected response(s)?
888 if(logger.isDebugEnabled()){
889 logger.debug(testName + ": url=" + url +
890 " status=" + statusCode);
892 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
893 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
894 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
899 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
902 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
903 dependsOnMethods = {"update", "testSubmitRequest"})
904 public void updateNonExistent(String testName) throws Exception {
906 if (logger.isDebugEnabled()) {
907 logger.debug(testBanner(testName, CLASS_NAME));
910 setupUpdateNonExistent();
912 // Submit the request to the service and store the response.
914 // Note: The ID used in this 'create' call may be arbitrary.
915 // The only relevant ID may be the one used in updateCollectionObject(), below.
916 CollectionObjectClient client = new CollectionObjectClient();
917 MultipartOutput multipart =
918 createCollectionObjectInstance(client.getCommonPartName(),
920 ClientResponse<MultipartInput> res =
921 client.update(NON_EXISTENT_ID, multipart);
922 int statusCode = res.getStatus();
924 // Check the status code of the response: does it match
925 // the expected response(s)?
926 if (logger.isDebugEnabled()) {
927 logger.debug(testName + ": status = " + statusCode);
929 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
930 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
931 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
935 * Test how the service handles, in an Update request, payloads
936 * containing null values (or, in the case of String fields,
937 * empty String values) in one or more fields in which non-empty
938 * values are required.
940 * This is a test of code and/or configuration in the service's
941 * validation routine(s).
943 * @param testName The name of this test method. This name is supplied
944 * automatically, via reflection, by a TestNG 'data provider' in
948 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
949 dependsOnMethods = {"read"})
950 public void updateWithRequiredValuesNullOrEmpty(String testName) throws Exception {
952 if (logger.isDebugEnabled()) {
953 logger.debug(testBanner(testName, CLASS_NAME));
957 if (logger.isDebugEnabled()) {
958 logger.debug(testName + " got object to update with ID: " + knownResourceId);
961 // Read an existing record for updating.
962 ClientResponse<MultipartInput> res = updateRetrieve(testName, knownResourceId);
964 CollectionObjectClient client = new CollectionObjectClient();
965 MultipartInput input = (MultipartInput) res.getEntity();
966 CollectionobjectsCommon collectionObject =
967 (CollectionobjectsCommon) extractPart(input,
968 client.getCommonPartName(), CollectionobjectsCommon.class);
969 Assert.assertNotNull(collectionObject);
971 // Update with invalid content, by setting a value to the
972 // empty String, in a field that requires a non-empty value,
973 // as enforced by the service's validation routine(s).
974 collectionObject.setObjectNumber("");
976 if (logger.isDebugEnabled()) {
977 logger.debug(testName + " updated object");
978 logger.debug(objectAsXmlString(collectionObject,
979 CollectionobjectsCommon.class));
982 // Submit the request to the service and store the response.
983 res = updateSend(testName, knownResourceId, collectionObject);
984 int statusCode = res.getStatus();
986 // Read the response and verify that the update attempt failed.
987 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
988 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
989 Assert.assertEquals(statusCode, Response.Status.BAD_REQUEST.getStatusCode());
993 // ---------------------------------------------------------------
994 // CRUD tests : DELETE tests
995 // ---------------------------------------------------------------
998 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
1001 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1002 dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
1003 public void delete(String testName) throws Exception {
1005 if (logger.isDebugEnabled()) {
1006 logger.debug(testBanner(testName, CLASS_NAME));
1011 // Submit the request to the service and store the response.
1012 CollectionObjectClient client = new CollectionObjectClient();
1013 ClientResponse<Response> res = client.delete(knownResourceId);
1014 int statusCode = res.getStatus();
1016 // Check the status code of the response: does it match
1017 // the expected response(s)?
1018 if (logger.isDebugEnabled()) {
1019 logger.debug(testName + ": status = " + statusCode);
1021 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1022 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1023 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1028 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
1031 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
1032 dependsOnMethods = {"delete"})
1033 public void deleteNonExistent(String testName) throws Exception {
1035 if (logger.isDebugEnabled()) {
1036 logger.debug(testBanner(testName, CLASS_NAME));
1039 setupDeleteNonExistent();
1041 // Submit the request to the service and store the response.
1042 CollectionObjectClient client = new CollectionObjectClient();
1043 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
1044 int statusCode = res.getStatus();
1046 // Check the status code of the response: does it match
1047 // the expected response(s)?
1048 if (logger.isDebugEnabled()) {
1049 logger.debug(testName + ": status = " + statusCode);
1051 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1052 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1053 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1056 // ---------------------------------------------------------------
1057 // Utility tests : tests of code used in tests above
1058 // ---------------------------------------------------------------
1060 * Tests the code for manually submitting data that is used by several
1061 * of the methods above.
1065 @Test(dependsOnMethods = {"create", "read"})
1066 public void testSubmitRequest() throws Exception {
1067 testSubmitRequest(knownResourceId);
1071 * Test submit request.
1073 * @param resourceId the resource id
1074 * @throws Exception the exception
1076 private void testSubmitRequest(String resourceId) throws Exception {
1078 // Expected status code: 200 OK
1079 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
1081 // Submit the request to the service and store the response.
1082 String method = ServiceRequestType.READ.httpMethodName();
1083 String url = getResourceURL(resourceId);
1084 int statusCode = submitRequest(method, url);
1086 // Check the status code of the response: does it match
1087 // the expected response(s)?
1088 if (logger.isDebugEnabled()) {
1089 logger.debug("testSubmitRequest: url=" + url
1090 + " status=" + statusCode);
1092 Assert.assertEquals(statusCode, EXPECTED_STATUS);
1096 // ---------------------------------------------------------------
1097 // Utility methods used by tests above
1098 // ---------------------------------------------------------------
1100 * Creates the collection object instance.
1102 * @param commonPartName the common part name
1103 * @param identifier the identifier
1104 * @return the multipart output
1106 private MultipartOutput createCollectionObjectInstance(String commonPartName,
1107 String identifier) {
1108 return createCollectionObjectInstance(commonPartName,
1109 "objectNumber-" + identifier,
1110 "objectName-" + identifier);
1114 * Creates the collection object instance.
1116 * @param commonPartName the common part name
1117 * @param objectNumber the object number
1118 * @param objectName the object name
1119 * @return the multipart output
1121 private MultipartOutput createCollectionObjectInstance(String commonPartName,
1122 String objectNumber, String objectName) {
1123 CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
1126 OtherNumber remNumber = new OtherNumber();
1127 remNumber.setNumberType("remNumber");
1128 remNumber.setNumberValue("2271966-" + System.currentTimeMillis());
1129 collectionObject.setRemNumber(remNumber);
1131 BriefDescriptionList descriptionList = new BriefDescriptionList();
1132 List<String> descriptions = descriptionList.getBriefDescription();
1133 descriptions.add("Papier mache bird cow mask with horns, "
1134 + "painted red with black and yellow spots. "
1135 + "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns).");
1136 descriptions.add("Papier mache bird cow mask with horns, "
1137 + "painted red with black and yellow spots. "
1138 + "Puerto Rico. ca. 8" high, 6" wide, projects 10" (with horns).");
1140 ResponsibleDepartmentList deptList = new ResponsibleDepartmentList();
1141 List<String> depts = deptList.getResponsibleDepartment();
1142 // @TODO Use properly formatted refNames for representative departments
1143 // in this example test record. The following are mere placeholders.
1144 depts.add("urn:org.collectionspace.services.department:Registrar");
1145 depts.add("urn:org.walkerart.department:Fine Art");
1147 OtherNumberList otherNumList = new OtherNumberList();
1148 List<OtherNumber> otherNumbers = otherNumList.getOtherNumber();
1150 OtherNumber otherNumber1 = new OtherNumber();
1151 otherNumber1.setNumberValue("101." + objectName);
1152 otherNumber1.setNumberType("integer");
1153 otherNumbers.add(otherNumber1);
1155 OtherNumber otherNumber2 = new OtherNumber();
1156 otherNumber2.setNumberValue("101.502.23.456." + objectName);
1157 otherNumber2.setNumberType("ipaddress");
1158 otherNumbers.add(otherNumber2);
1160 //FIXME: Title does not need to be set.
1161 collectionObject.setTitle("atitle");
1162 collectionObject.setResponsibleDepartments(deptList);
1163 collectionObject.setObjectNumber(objectNumber);
1165 collectionObject.setOtherNumberList(otherNumList);
1167 // FIXME this can be removed when the repeatable other number list
1168 // is supported by the application layers
1169 collectionObject.setOtherNumber("urn:org.walkerart.id:123");
1171 ObjectNameList objNameList = new ObjectNameList();
1172 List<ObjectNameGroup> objNameGroups = objNameList.getObjectNameGroup();
1173 ObjectNameGroup objectNameGroup = new ObjectNameGroup();
1174 objectNameGroup.setObjectName(OBJECT_NAME_VALUE);
1175 objNameGroups.add(objectNameGroup);
1176 collectionObject.setObjectNameList(objNameList);
1178 collectionObject.setAge(""); //test for null string
1179 collectionObject.setBriefDescriptions(descriptionList);
1181 CollectionobjectsNaturalhistory conh = new CollectionobjectsNaturalhistory();
1182 conh.setNhString("test-string");
1184 conh.setNhLong(9999);
1187 MultipartOutput multipart = createCollectionObjectInstance(commonPartName, collectionObject, conh);
1192 * Creates the collection object instance.
1194 * @param commonPartName the common part name
1195 * @param collectionObject the collection object
1196 * @param conh the conh
1197 * @return the multipart output
1199 private MultipartOutput createCollectionObjectInstance(String commonPartName,
1200 CollectionobjectsCommon collectionObject, CollectionobjectsNaturalhistory conh) {
1202 MultipartOutput multipart = CollectionObjectFactory.createCollectionObjectInstance(
1203 commonPartName, collectionObject, getNHPartName(), conh);
1204 if (logger.isDebugEnabled()) {
1205 logger.debug("to be created, collectionobject common");
1206 logger.debug(objectAsXmlString(collectionObject,
1207 CollectionobjectsCommon.class));
1211 if (logger.isDebugEnabled()) {
1212 logger.debug("to be created, collectionobject nhistory");
1213 logger.debug(objectAsXmlString(conh,
1214 CollectionobjectsNaturalhistory.class));
1222 * createCollectionObjectInstanceFromXml uses JAXB unmarshaller to retrieve
1223 * collectionobject from given file
1224 * @param commonPartName
1225 * @param commonPartFileName
1229 private MultipartOutput createCollectionObjectInstanceFromXml(String testName, String commonPartName,
1230 String commonPartFileName) throws Exception {
1232 CollectionobjectsCommon collectionObject =
1233 (CollectionobjectsCommon) getObjectFromFile(CollectionobjectsCommon.class,
1234 commonPartFileName);
1235 MultipartOutput multipart = new MultipartOutput();
1236 OutputPart commonPart = multipart.addPart(collectionObject,
1237 MediaType.APPLICATION_XML_TYPE);
1238 commonPart.getHeaders().add("label", commonPartName);
1240 if (logger.isDebugEnabled()) {
1241 logger.debug(testName + " to be created, collectionobject common");
1242 logger.debug(objectAsXmlString(collectionObject,
1243 CollectionobjectsCommon.class));
1250 * createCollectionObjectInstanceFromRawXml uses stringified collectionobject
1251 * retrieve from given file
1252 * @param commonPartName
1253 * @param commonPartFileName
1257 private MultipartOutput createCollectionObjectInstanceFromRawXml(String testName, String commonPartName,
1258 String commonPartFileName) throws Exception {
1260 MultipartOutput multipart = new MultipartOutput();
1261 String stringObject = getXmlDocumentAsString(commonPartFileName);
1262 if (logger.isDebugEnabled()) {
1263 logger.debug(testName + " to be created, collectionobject common " + "\n" + stringObject);
1265 OutputPart commonPart = multipart.addPart(stringObject,
1266 MediaType.APPLICATION_XML_TYPE);
1267 commonPart.getHeaders().add("label", commonPartName);
1274 * Gets the nH part name.
1276 * @return the nH part name
1278 private String getNHPartName() {
1279 return "collectionobjects_naturalhistory";
1283 * Creates the from xml file.
1285 * @param testName the test name
1286 * @param fileName the file name
1287 * @param useJaxb the use jaxb
1288 * @return the string
1289 * @throws Exception the exception
1291 private String createFromXmlFile(String testName, String fileName, boolean useJaxb) throws Exception {
1296 MultipartOutput multipart = null;
1298 CollectionObjectClient client = new CollectionObjectClient();
1300 multipart = createCollectionObjectInstanceFromXml(testName,
1301 client.getCommonPartName(), fileName);
1303 multipart = createCollectionObjectInstanceFromRawXml(testName,
1304 client.getCommonPartName(), fileName);
1306 ClientResponse<Response> res = client.create(multipart);
1307 int statusCode = res.getStatus();
1309 if (logger.isDebugEnabled()) {
1310 logger.debug(testName + ": status = " + statusCode);
1312 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1313 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1314 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1315 String newId = extractId(res);
1316 allResourceIdsCreated.add(newId);
1320 // FIXME: This duplicates code in read(), and should be consolidated.
1321 // This is an expedient to support reading and verifying the contents
1322 // of resources that have been created from test data XML files.
1323 private CollectionobjectsCommon readCollectionObjectCommonPart(String csid)
1326 String testName = "readCollectionObjectCommonPart";
1330 // Submit the request to the service and store the response.
1331 CollectionObjectClient client = new CollectionObjectClient();
1332 ClientResponse<MultipartInput> res = client.read(csid);
1333 int statusCode = res.getStatus();
1335 // Check the status code of the response: does it match
1336 // the expected response(s)?
1337 if (logger.isDebugEnabled()) {
1338 logger.debug(testName + ": status = " + statusCode);
1340 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
1341 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
1342 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
1344 MultipartInput input = (MultipartInput) res.getEntity();
1346 if (logger.isDebugEnabled()) {
1347 logger.debug(testName + ": Reading Common part ...");
1349 CollectionobjectsCommon collectionObject =
1350 (CollectionobjectsCommon) extractPart(input,
1351 client.getCommonPartName(), CollectionobjectsCommon.class);
1352 Assert.assertNotNull(collectionObject);
1354 return collectionObject;