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.CollectionSpaceClient;
30 import org.collectionspace.services.client.IntakeClient;
31 import org.collectionspace.services.intake.IntakesCommon;
32 import org.collectionspace.services.intake.IntakesCommonList;
33 import org.collectionspace.services.jaxb.AbstractCommonList;
35 import org.jboss.resteasy.client.ClientResponse;
36 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
37 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
38 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
39 import org.testng.Assert;
40 //import org.testng.annotations.AfterClass;
41 import org.testng.annotations.Test;
43 import org.slf4j.Logger;
44 import org.slf4j.LoggerFactory;
47 * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
48 * IntakeServiceTest, carries out tests against a
49 * deployed and running Intake Service.
51 * $LastChangedRevision$
54 public class IntakeServiceTest extends AbstractServiceTestImpl {
57 private final String CLASS_NAME = IntakeServiceTest.class.getName();
58 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
60 // Instance variables specific to this test.
61 /** The service path component. */
62 final String SERVICE_PATH_COMPONENT = "intakes";
64 /** The known resource id. */
65 private String knownResourceId = null;
68 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
71 protected CollectionSpaceClient getClientInstance() {
72 return new IntakeClient();
76 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
79 protected AbstractCommonList getAbstractCommonList(
80 ClientResponse<AbstractCommonList> response) {
81 return response.getEntity(IntakesCommonList.class);
84 // ---------------------------------------------------------------
85 // CRUD tests : CREATE tests
86 // ---------------------------------------------------------------
89 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
92 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
93 public void create(String testName) throws Exception {
95 if (logger.isDebugEnabled()) {
96 logger.debug(testBanner(testName, CLASS_NAME));
98 // Perform setup, such as initializing the type of service request
99 // (e.g. CREATE, DELETE), its valid and expected status codes, and
100 // its associated HTTP method name (e.g. POST, DELETE).
103 // Submit the request to the service and store the response.
104 IntakeClient client = new IntakeClient();
105 String identifier = createIdentifier();
106 MultipartOutput multipart = createIntakeInstance(identifier);
107 ClientResponse<Response> res = client.create(multipart);
109 int statusCode = res.getStatus();
111 // Check the status code of the response: does it match
112 // the expected response(s)?
115 // Does it fall within the set of valid status codes?
116 // Does it exactly match the expected status code?
117 if(logger.isDebugEnabled()){
118 logger.debug(testName + ": status = " + statusCode);
120 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
121 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
122 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
124 // Store the ID returned from the first resource created
125 // for additional tests below.
126 if (knownResourceId == null){
127 knownResourceId = extractId(res);
128 if (logger.isDebugEnabled()) {
129 logger.debug(testName + ": knownResourceId=" + knownResourceId);
133 // Store the IDs from every resource created by tests,
134 // so they can be deleted after tests have been run.
135 allResourceIdsCreated.add(extractId(res));
139 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
142 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
143 dependsOnMethods = {"create"})
144 public void createList(String testName) throws Exception {
145 for(int i = 0; i < 3; i++){
151 // Placeholders until the three tests below can be uncommented.
152 // See Issue CSPACE-401.
154 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
157 public void createWithEmptyEntityBody(String testName) throws Exception {
158 //Should this really be empty?
162 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
165 public void createWithMalformedXml(String testName) throws Exception {
166 //Should this really be empty?
170 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
173 public void createWithWrongXmlSchema(String testName) throws Exception {
174 //Should this really be empty?
179 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
180 dependsOnMethods = {"create", "testSubmitRequest"})
181 public void createWithEmptyEntityBody(String testName) throws Exception {
183 if (logger.isDebugEnabled()) {
184 logger.debug(testBanner(testName, CLASS_NAME));
187 setupCreateWithEmptyEntityBody();
189 // Submit the request to the service and store the response.
190 String method = REQUEST_TYPE.httpMethodName();
191 String url = getServiceRootURL();
192 String mediaType = MediaType.APPLICATION_XML;
193 final String entity = "";
194 int statusCode = submitRequest(method, url, mediaType, entity);
196 // Check the status code of the response: does it match
197 // the expected response(s)?
198 if(logger.isDebugEnabled()){
199 logger.debug("createWithEmptyEntityBody url=" + url +
200 " status=" + statusCode);
202 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
203 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
204 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
208 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
209 dependsOnMethods = {"create", "testSubmitRequest"})
210 public void createWithMalformedXml(String testName) throws Exception {
212 if (logger.isDebugEnabled()) {
213 logger.debug(testBanner(testName, CLASS_NAME));
216 setupCreateWithMalformedXml();
218 // Submit the request to the service and store the response.
219 String method = REQUEST_TYPE.httpMethodName();
220 String url = getServiceRootURL();
221 String mediaType = MediaType.APPLICATION_XML;
222 final String entity = MALFORMED_XML_DATA; // Constant from base class.
223 int statusCode = submitRequest(method, url, mediaType, entity);
225 // Check the status code of the response: does it match
226 // the expected response(s)?
227 if(logger.isDebugEnabled()){
228 logger.debug(testName + ": url=" + url +
229 " status=" + statusCode);
231 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
232 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
233 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
237 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
238 dependsOnMethods = {"create", "testSubmitRequest"})
239 public void createWithWrongXmlSchema(String testName) throws Exception {
241 if (logger.isDebugEnabled()) {
242 logger.debug(testBanner(testName, CLASS_NAME));
245 setupCreateWithWrongXmlSchema(testName, logger);
247 // Submit the request to the service and store the response.
248 String method = REQUEST_TYPE.httpMethodName();
249 String url = getServiceRootURL();
250 String mediaType = MediaType.APPLICATION_XML;
251 final String entity = WRONG_XML_SCHEMA_DATA;
252 int statusCode = submitRequest(method, url, mediaType, entity);
254 // Check the status code of the response: does it match
255 // the expected response(s)?
256 if(logger.isDebugEnabled()){
257 logger.debug(testName + ": url=" + url +
258 " status=" + statusCode);
260 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
261 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
262 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
266 // ---------------------------------------------------------------
267 // CRUD tests : READ tests
268 // ---------------------------------------------------------------
271 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
274 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
275 dependsOnMethods = {"create"})
276 public void read(String testName) throws Exception {
278 if (logger.isDebugEnabled()) {
279 logger.debug(testBanner(testName, CLASS_NAME));
284 // Submit the request to the service and store the response.
285 IntakeClient client = new IntakeClient();
286 ClientResponse<MultipartInput> res = client.read(knownResourceId);
287 int statusCode = res.getStatus();
289 // Check the status code of the response: does it match
290 // the expected response(s)?
291 if(logger.isDebugEnabled()){
292 logger.debug(testName + ": status = " + statusCode);
294 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
295 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
296 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
298 MultipartInput input = (MultipartInput) res.getEntity();
299 IntakesCommon intake = (IntakesCommon) extractPart(input,
300 client.getCommonPartName(), IntakesCommon.class);
301 Assert.assertNotNull(intake);
306 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
309 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
310 dependsOnMethods = {"read"})
311 public void readNonExistent(String testName) throws Exception {
313 if (logger.isDebugEnabled()) {
314 logger.debug(testBanner(testName, CLASS_NAME));
317 setupReadNonExistent();
319 // Submit the request to the service and store the response.
320 IntakeClient client = new IntakeClient();
321 ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
322 int statusCode = res.getStatus();
324 // Check the status code of the response: does it match
325 // the expected response(s)?
326 if(logger.isDebugEnabled()){
327 logger.debug(testName + ": status = " + statusCode);
329 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
330 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
331 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
334 // ---------------------------------------------------------------
335 // CRUD tests : READ_LIST tests
336 // ---------------------------------------------------------------
339 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
342 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
343 dependsOnMethods = {"createList", "read"})
344 public void readList(String testName) throws Exception {
346 if (logger.isDebugEnabled()) {
347 logger.debug(testBanner(testName, CLASS_NAME));
352 // Submit the request to the service and store the response.
353 IntakeClient client = new IntakeClient();
354 ClientResponse<IntakesCommonList> res = client.readList();
355 IntakesCommonList list = res.getEntity();
356 int statusCode = res.getStatus();
358 // Check the status code of the response: does it match
359 // the expected response(s)?
360 if(logger.isDebugEnabled()){
361 logger.debug(testName + ": status = " + statusCode);
363 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
364 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
365 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
367 // Optionally output additional data about list members for debugging.
368 boolean iterateThroughList = false;
369 if(iterateThroughList && logger.isDebugEnabled()){
370 List<IntakesCommonList.IntakeListItem> items =
371 list.getIntakeListItem();
373 for(IntakesCommonList.IntakeListItem item : items){
374 logger.debug(testName + ": list-item[" + i + "] csid=" +
376 logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
377 item.getEntryNumber());
378 logger.debug(testName + ": list-item[" + i + "] URI=" +
388 // ---------------------------------------------------------------
389 // CRUD tests : UPDATE tests
390 // ---------------------------------------------------------------
393 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
396 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
397 dependsOnMethods = {"read"})
398 public void update(String testName) throws Exception {
400 if (logger.isDebugEnabled()) {
401 logger.debug(testBanner(testName, CLASS_NAME));
406 // Retrieve the contents of a resource to update.
407 IntakeClient client = new IntakeClient();
408 ClientResponse<MultipartInput> res =
409 client.read(knownResourceId);
410 if(logger.isDebugEnabled()){
411 logger.debug(testName + ": read status = " + res.getStatus());
413 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
415 if(logger.isDebugEnabled()){
416 logger.debug("got object to update with ID: " + knownResourceId);
418 MultipartInput input = (MultipartInput) res.getEntity();
419 IntakesCommon intake = (IntakesCommon) extractPart(input,
420 client.getCommonPartName(), IntakesCommon.class);
421 Assert.assertNotNull(intake);
423 // Update the content of this resource.
424 // Update the content of this resource.
425 intake.setEntryNumber("updated-" + intake.getEntryNumber());
426 intake.setEntryDate("updated-" + intake.getEntryDate());
427 if(logger.isDebugEnabled()){
428 logger.debug("to be updated object");
429 logger.debug(objectAsXmlString(intake, IntakesCommon.class));
431 // Submit the request to the service and store the response.
432 MultipartOutput output = new MultipartOutput();
433 OutputPart commonPart = output.addPart(intake, MediaType.APPLICATION_XML_TYPE);
434 commonPart.getHeaders().add("label", client.getCommonPartName());
436 res = client.update(knownResourceId, output);
437 int statusCode = res.getStatus();
438 // Check the status code of the response: does it match the expected response(s)?
439 if(logger.isDebugEnabled()){
440 logger.debug(testName + ": status = " + statusCode);
442 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
443 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
444 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
447 input = (MultipartInput) res.getEntity();
448 IntakesCommon updatedIntake =
449 (IntakesCommon) extractPart(input,
450 client.getCommonPartName(), IntakesCommon.class);
451 Assert.assertNotNull(updatedIntake);
453 Assert.assertEquals(updatedIntake.getEntryDate(),
454 intake.getEntryDate(),
455 "Data in updated object did not match submitted data.");
460 // Placeholders until the three tests below can be uncommented.
461 // See Issue CSPACE-401.
463 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithEmptyEntityBody(java.lang.String)
466 public void updateWithEmptyEntityBody(String testName) throws Exception {
467 //Should this really be empty?
471 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithMalformedXml(java.lang.String)
474 public void updateWithMalformedXml(String testName) throws Exception {
475 //Should this really be empty?
479 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateWithWrongXmlSchema(java.lang.String)
482 public void updateWithWrongXmlSchema(String testName) throws Exception {
483 //Should this really be empty?
488 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
489 dependsOnMethods = {"create", "update", "testSubmitRequest"})
490 public void updateWithEmptyEntityBody(String testName) throws Exception {
492 if (logger.isDebugEnabled()) {
493 logger.debug(testBanner(testName, CLASS_NAME));
496 setupUpdateWithEmptyEntityBody();
498 // Submit the request to the service and store the response.
499 String method = REQUEST_TYPE.httpMethodName();
500 String url = getResourceURL(knownResourceId);
501 String mediaType = MediaType.APPLICATION_XML;
502 final String entity = "";
503 int statusCode = submitRequest(method, url, mediaType, entity);
505 // Check the status code of the response: does it match
506 // the expected response(s)?
507 if(logger.isDebugEnabled()){
508 logger.debug(testName + ": url=" + url +
509 " status=" + statusCode);
511 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
512 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
513 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
517 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
518 dependsOnMethods = {"create", "update", "testSubmitRequest"})
519 public void updateWithMalformedXml(String testName) throws Exception {
521 if (logger.isDebugEnabled()) {
522 logger.debug(testBanner(testName, CLASS_NAME));
525 setupUpdateWithMalformedXml();
527 // Submit the request to the service and store the response.
528 String method = REQUEST_TYPE.httpMethodName();
529 String url = getResourceURL(knownResourceId);
530 String mediaType = MediaType.APPLICATION_XML;
531 final String entity = MALFORMED_XML_DATA;
532 int statusCode = submitRequest(method, url, mediaType, entity);
534 // Check the status code of the response: does it match
535 // the expected response(s)?
536 if(logger.isDebugEnabled()){
537 logger.debug(testName + ": url=" + url +
538 " status=" + statusCode);
540 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
541 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
542 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
546 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
547 dependsOnMethods = {"create", "update", "testSubmitRequest"})
548 public void updateWithWrongXmlSchema(String testName) throws Exception {
550 if (logger.isDebugEnabled()) {
551 logger.debug(testBanner(testName, CLASS_NAME));
554 setupUpdateWithWrongXmlSchema();
556 // Submit the request to the service and store the response.
557 String method = REQUEST_TYPE.httpMethodName();
558 String url = getResourceURL(knownResourceId);
559 String mediaType = MediaType.APPLICATION_XML;
560 final String entity = WRONG_XML_SCHEMA_DATA;
561 int statusCode = submitRequest(method, url, mediaType, entity);
563 // Check the status code of the response: does it match
564 // the expected response(s)?
565 if(logger.isDebugEnabled()){
566 logger.debug(testName + ": url=" + url +
567 " status=" + statusCode);
569 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
570 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
571 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
576 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#updateNonExistent(java.lang.String)
579 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
580 dependsOnMethods = {"update", "testSubmitRequest"})
581 public void updateNonExistent(String testName) throws Exception {
583 if (logger.isDebugEnabled()) {
584 logger.debug(testBanner(testName, CLASS_NAME));
587 setupUpdateNonExistent();
589 // Submit the request to the service and store the response.
590 // Note: The ID used in this 'create' call may be arbitrary.
591 // The only relevant ID may be the one used in update(), below.
592 IntakeClient client = new IntakeClient();
593 MultipartOutput multipart = createIntakeInstance(NON_EXISTENT_ID);
594 ClientResponse<MultipartInput> res =
595 client.update(NON_EXISTENT_ID, multipart);
596 int statusCode = res.getStatus();
598 // Check the status code of the response: does it match
599 // the expected response(s)?
600 if(logger.isDebugEnabled()){
601 logger.debug(testName + ": status = " + statusCode);
603 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
604 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
605 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
608 // ---------------------------------------------------------------
609 // CRUD tests : DELETE tests
610 // ---------------------------------------------------------------
613 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
616 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
617 dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
618 public void delete(String testName) throws Exception {
620 if (logger.isDebugEnabled()) {
621 logger.debug(testBanner(testName, CLASS_NAME));
626 // Submit the request to the service and store the response.
627 IntakeClient client = new IntakeClient();
628 ClientResponse<Response> res = client.delete(knownResourceId);
629 int statusCode = res.getStatus();
631 // Check the status code of the response: does it match
632 // the expected response(s)?
633 if(logger.isDebugEnabled()){
634 logger.debug(testName + ": status = " + statusCode);
636 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
637 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
638 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
643 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
646 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
647 dependsOnMethods = {"delete"})
648 public void deleteNonExistent(String testName) throws Exception {
650 if (logger.isDebugEnabled()) {
651 logger.debug(testBanner(testName, CLASS_NAME));
654 setupDeleteNonExistent();
656 // Submit the request to the service and store the response.
657 IntakeClient client = new IntakeClient();
658 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
659 int statusCode = res.getStatus();
661 // Check the status code of the response: does it match
662 // the expected response(s)?
663 if(logger.isDebugEnabled()){
664 logger.debug(testName + ": status = " + statusCode);
666 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
667 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
668 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
671 // ---------------------------------------------------------------
672 // Utility tests : tests of code used in tests above
673 // ---------------------------------------------------------------
675 * Tests the code for manually submitting data that is used by several
676 * of the methods above.
678 @Test(dependsOnMethods = {"create", "read"})
679 public void testSubmitRequest() {
681 // Expected status code: 200 OK
682 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
684 // Submit the request to the service and store the response.
685 String method = ServiceRequestType.READ.httpMethodName();
686 String url = getResourceURL(knownResourceId);
687 int statusCode = submitRequest(method, url);
689 // Check the status code of the response: does it match
690 // the expected response(s)?
691 if(logger.isDebugEnabled()){
692 logger.debug("testSubmitRequest: url=" + url +
693 " status=" + statusCode);
695 Assert.assertEquals(statusCode, EXPECTED_STATUS);
699 // ---------------------------------------------------------------
700 // Utility methods used by tests above
701 // ---------------------------------------------------------------
703 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
706 public String getServicePathComponent() {
707 return SERVICE_PATH_COMPONENT;
711 * Creates the intake instance.
713 * @param identifier the identifier
714 * @return the multipart output
716 private MultipartOutput createIntakeInstance(String identifier) {
717 return createIntakeInstance(
718 "entryNumber-" + identifier,
719 "entryDate-" + identifier,
720 "depositor-" + identifier);
724 * Creates the intake instance.
726 * @param entryNumber the entry number
727 * @param entryDate the entry date
728 * @param depositor the depositor
729 * @return the multipart output
731 private MultipartOutput createIntakeInstance(String entryNumber,
734 IntakesCommon intake = new IntakesCommon();
735 intake.setEntryNumber(entryNumber);
736 intake.setEntryDate(entryDate);
737 intake.setDepositor(depositor);
738 MultipartOutput multipart = new MultipartOutput();
739 OutputPart commonPart =
740 multipart.addPart(intake, MediaType.APPLICATION_XML_TYPE);
741 commonPart.getHeaders().add("label", new IntakeClient().getCommonPartName());
743 if(logger.isDebugEnabled()){
744 logger.debug("to be created, intake common");
745 logger.debug(objectAsXmlString(intake, IntakesCommon.class));