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.ArrayList;
26 import java.util.List;
27 import javax.ws.rs.core.MediaType;
28 import javax.ws.rs.core.Response;
30 import org.collectionspace.services.client.CollectionSpaceClient;
31 import org.collectionspace.services.client.DimensionClient;
32 import org.collectionspace.services.client.DimensionFactory;
33 import org.collectionspace.services.dimension.DimensionsCommon;
34 import org.collectionspace.services.dimension.DimensionsCommonList;
35 import org.collectionspace.services.jaxb.AbstractCommonList;
37 import org.jboss.resteasy.client.ClientResponse;
39 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
40 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
41 import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
42 import org.testng.Assert;
43 //import org.testng.annotations.AfterClass;
44 import org.testng.annotations.Test;
46 import org.slf4j.Logger;
47 import org.slf4j.LoggerFactory;
50 * DimensionServiceTest, carries out tests against a
51 * deployed and running Dimension Service.
53 * $LastChangedRevision: 917 $
54 * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
56 public class DimensionServiceTest extends AbstractServiceTestImpl {
59 private final String CLASS_NAME = DimensionServiceTest.class.getName();
60 private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
62 // Instance variables specific to this test.
63 /** The SERVIC e_ pat h_ component. */
64 final String SERVICE_PATH_COMPONENT = "dimensions";
65 /** The known resource id. */
66 private String knownResourceId = null;
69 * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
72 protected CollectionSpaceClient getClientInstance() {
73 return new DimensionClient();
77 * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
80 protected AbstractCommonList getAbstractCommonList(
81 ClientResponse<AbstractCommonList> response) {
82 return response.getEntity(DimensionsCommonList.class);
85 // ---------------------------------------------------------------
86 // CRUD tests : CREATE tests
87 // ---------------------------------------------------------------
90 * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
93 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
94 public void create(String testName) throws Exception {
96 if (logger.isDebugEnabled()) {
97 logger.debug(testBanner(testName, CLASS_NAME));
99 // Perform setup, such as initializing the type of service request
100 // (e.g. CREATE, DELETE), its valid and expected status codes, and
101 // its associated HTTP method name (e.g. POST, DELETE).
104 // Submit the request to the service and store the response.
105 DimensionClient client = new DimensionClient();
106 String identifier = createIdentifier();
107 MultipartOutput multipart = createDimensionInstance(client.getCommonPartName(),
109 ClientResponse<Response> res = client.create(multipart);
111 int statusCode = res.getStatus();
113 // Check the status code of the response: does it match
114 // the expected response(s)?
117 // Does it fall within the set of valid status codes?
118 // Does it exactly match the expected status code?
119 if (logger.isDebugEnabled()) {
120 logger.debug(testName + ": status = " + statusCode);
122 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
123 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
124 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
126 // Store the ID returned from the first resource created
127 // for additional tests below.
128 if (knownResourceId == null) {
129 knownResourceId = extractId(res);
130 if (logger.isDebugEnabled()) {
131 logger.debug(testName + ": knownResourceId=" + knownResourceId);
135 // Store the IDs from every resource created by tests,
136 // so they can be deleted after tests have been run.
137 allResourceIdsCreated.add(extractId(res));
141 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
144 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
145 dependsOnMethods = {"create"})
146 public void createList(String testName) throws Exception {
147 for (int i = 0; i < 3; i++) {
153 // Placeholders until the three tests below can be uncommented.
154 // See Issue CSPACE-401.
156 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithEmptyEntityBody(java.lang.String)
159 public void createWithEmptyEntityBody(String testName) throws Exception {
160 //Should this really be empty?
164 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithMalformedXml(java.lang.String)
167 public void createWithMalformedXml(String testName) throws Exception {
168 //Should this really be empty?
172 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createWithWrongXmlSchema(java.lang.String)
175 public void createWithWrongXmlSchema(String testName) throws Exception {
176 //Should this really be empty?
181 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
182 dependsOnMethods = {"create", "testSubmitRequest"})
183 public void createWithEmptyEntityBody(String testName) throws Exception {
185 if (logger.isDebugEnabled()) {
186 logger.debug(testBanner(testName, CLASS_NAME));
189 setupCreateWithEmptyEntityBody(testName, logger);
191 // Submit the request to the service and store the response.
192 String method = REQUEST_TYPE.httpMethodName();
193 String url = getServiceRootURL();
194 String mediaType = MediaType.APPLICATION_XML;
195 final String entity = "";
196 int statusCode = submitRequest(method, url, mediaType, entity);
198 // Check the status code of the response: does it match
199 // the expected response(s)?
200 if(logger.isDebugEnabled()){
201 logger.debug("createWithEmptyEntityBody url=" + url +
202 " status=" + statusCode);
204 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
205 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
206 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
210 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
211 dependsOnMethods = {"create", "testSubmitRequest"})
212 public void createWithMalformedXml(String testName) throws Exception {
214 if (logger.isDebugEnabled()) {
215 logger.debug(testBanner(testName, CLASS_NAME));
218 setupCreateWithMalformedXml();
220 // Submit the request to the service and store the response.
221 String method = REQUEST_TYPE.httpMethodName();
222 String url = getServiceRootURL();
223 String mediaType = MediaType.APPLICATION_XML;
224 final String entity = MALFORMED_XML_DATA; // Constant from base class.
225 int statusCode = submitRequest(method, url, mediaType, entity);
227 // Check the status code of the response: does it match
228 // the expected response(s)?
229 if(logger.isDebugEnabled()){
230 logger.debug(testName + ": url=" + url +
231 " status=" + statusCode);
233 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
234 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
235 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
239 @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
240 dependsOnMethods = {"create", "testSubmitRequest"})
241 public void createWithWrongXmlSchema(String testName) throws Exception {
243 if (logger.isDebugEnabled()) {
244 logger.debug(testBanner(testName, CLASS_NAME));
247 setupCreateWithWrongXmlSchema();
249 // Submit the request to the service and store the response.
250 String method = REQUEST_TYPE.httpMethodName();
251 String url = getServiceRootURL();
252 String mediaType = MediaType.APPLICATION_XML;
253 final String entity = WRONG_XML_SCHEMA_DATA;
254 int statusCode = submitRequest(method, url, mediaType, entity);
256 // Check the status code of the response: does it match
257 // the expected response(s)?
258 if(logger.isDebugEnabled()){
259 logger.debug(testName + ": url=" + url +
260 " status=" + statusCode);
262 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
263 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
264 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
267 // ---------------------------------------------------------------
268 // CRUD tests : READ tests
269 // ---------------------------------------------------------------
272 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
275 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
276 dependsOnMethods = {"create"})
277 public void read(String testName) throws Exception {
279 if (logger.isDebugEnabled()) {
280 logger.debug(testBanner(testName, CLASS_NAME));
285 // Submit the request to the service and store the response.
286 DimensionClient client = new DimensionClient();
287 ClientResponse<MultipartInput> res = client.read(knownResourceId);
288 int statusCode = res.getStatus();
290 // Check the status code of the response: does it match
291 // the expected response(s)?
292 if (logger.isDebugEnabled()) {
293 logger.debug(testName + ": status = " + statusCode);
295 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
296 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
297 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
299 MultipartInput input = (MultipartInput) res.getEntity();
300 DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
301 client.getCommonPartName(), DimensionsCommon.class);
302 Assert.assertNotNull(dimension);
307 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
310 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
311 dependsOnMethods = {"read"})
312 public void readNonExistent(String testName) throws Exception {
314 if (logger.isDebugEnabled()) {
315 logger.debug(testBanner(testName, CLASS_NAME));
318 setupReadNonExistent();
320 // Submit the request to the service and store the response.
321 DimensionClient client = new DimensionClient();
322 ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
323 int statusCode = res.getStatus();
325 // Check the status code of the response: does it match
326 // the expected response(s)?
327 if (logger.isDebugEnabled()) {
328 logger.debug(testName + ": status = " + statusCode);
330 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
331 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
332 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
335 // ---------------------------------------------------------------
336 // CRUD tests : READ_LIST tests
337 // ---------------------------------------------------------------
340 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
343 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
344 dependsOnMethods = {"read"})
345 public void readList(String testName) throws Exception {
347 if (logger.isDebugEnabled()) {
348 logger.debug(testBanner(testName, CLASS_NAME));
353 // Submit the request to the service and store the response.
354 DimensionClient client = new DimensionClient();
355 ClientResponse<DimensionsCommonList> res = client.readList();
356 DimensionsCommonList list = res.getEntity();
357 int statusCode = res.getStatus();
359 // Check the status code of the response: does it match
360 // the expected response(s)?
361 if (logger.isDebugEnabled()) {
362 logger.debug(testName + ": status = " + statusCode);
364 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
365 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
366 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
368 // Optionally output additional data about list members for debugging.
369 boolean iterateThroughList = false;
370 if (iterateThroughList && logger.isDebugEnabled()) {
371 List<DimensionsCommonList.DimensionListItem> items =
372 list.getDimensionListItem();
374 for (DimensionsCommonList.DimensionListItem item : items) {
375 logger.debug(testName + ": list-item[" + i + "] csid="
377 logger.debug(testName + ": list-item[" + i + "] objectNumber="
378 + item.getDimension());
379 logger.debug(testName + ": list-item[" + i + "] URI="
389 // ---------------------------------------------------------------
390 // CRUD tests : UPDATE tests
391 // ---------------------------------------------------------------
394 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
397 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
398 dependsOnMethods = {"read"})
399 public void update(String testName) throws Exception {
401 if (logger.isDebugEnabled()) {
402 logger.debug(testBanner(testName, CLASS_NAME));
407 // Retrieve the contents of a resource to update.
408 DimensionClient client = new DimensionClient();
409 ClientResponse<MultipartInput> res =
410 client.read(knownResourceId);
411 if (logger.isDebugEnabled()) {
412 logger.debug(testName + ": read status = " + res.getStatus());
414 Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
416 if (logger.isDebugEnabled()) {
417 logger.debug("got object to update with ID: " + knownResourceId);
419 MultipartInput input = (MultipartInput) res.getEntity();
420 DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
421 client.getCommonPartName(), DimensionsCommon.class);
422 Assert.assertNotNull(dimension);
424 // Update the content of this resource.
425 dimension.setValue("updated-" + dimension.getValue());
426 dimension.setValueDate("updated-" + dimension.getValueDate());
427 if (logger.isDebugEnabled()) {
428 logger.debug("to be updated object");
429 logger.debug(objectAsXmlString(dimension, DimensionsCommon.class));
431 // Submit the request to the service and store the response.
432 MultipartOutput output = new MultipartOutput();
433 OutputPart commonPart = output.addPart(dimension, 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 DimensionsCommon updatedDimension =
449 (DimensionsCommon) extractPart(input,
450 client.getCommonPartName(), DimensionsCommon.class);
451 Assert.assertNotNull(updatedDimension);
453 Assert.assertEquals(updatedDimension.getValueDate(),
454 dimension.getValueDate(),
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(testName, logger);
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(testName, logger);
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 DimensionClient client = new DimensionClient();
593 MultipartOutput multipart = createDimensionInstance(client.getCommonPartName(),
595 ClientResponse<MultipartInput> res =
596 client.update(NON_EXISTENT_ID, multipart);
597 int statusCode = res.getStatus();
599 // Check the status code of the response: does it match
600 // the expected response(s)?
601 if (logger.isDebugEnabled()) {
602 logger.debug(testName + ": status = " + statusCode);
604 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
605 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
606 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
609 // ---------------------------------------------------------------
610 // CRUD tests : DELETE tests
611 // ---------------------------------------------------------------
614 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
617 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
618 dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
619 public void delete(String testName) throws Exception {
621 if (logger.isDebugEnabled()) {
622 logger.debug(testBanner(testName, CLASS_NAME));
627 // Submit the request to the service and store the response.
628 DimensionClient client = new DimensionClient();
629 ClientResponse<Response> res = client.delete(knownResourceId);
630 int statusCode = res.getStatus();
632 // Check the status code of the response: does it match
633 // the expected response(s)?
634 if (logger.isDebugEnabled()) {
635 logger.debug(testName + ": status = " + statusCode);
637 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
638 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
639 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
644 * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
647 @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
648 dependsOnMethods = {"delete"})
649 public void deleteNonExistent(String testName) throws Exception {
651 if (logger.isDebugEnabled()) {
652 logger.debug(testBanner(testName, CLASS_NAME));
655 setupDeleteNonExistent();
657 // Submit the request to the service and store the response.
658 DimensionClient client = new DimensionClient();
659 ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
660 int statusCode = res.getStatus();
662 // Check the status code of the response: does it match
663 // the expected response(s)?
664 if (logger.isDebugEnabled()) {
665 logger.debug(testName + ": status = " + statusCode);
667 Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
668 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
669 Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
672 // ---------------------------------------------------------------
673 // Utility tests : tests of code used in tests above
674 // ---------------------------------------------------------------
676 * Tests the code for manually submitting data that is used by several
677 * of the methods above.
679 @Test(dependsOnMethods = {"create", "read"})
680 public void testSubmitRequest() {
682 // Expected status code: 200 OK
683 final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
685 // Submit the request to the service and store the response.
686 String method = ServiceRequestType.READ.httpMethodName();
687 String url = getResourceURL(knownResourceId);
688 int statusCode = submitRequest(method, url);
690 // Check the status code of the response: does it match
691 // the expected response(s)?
692 if (logger.isDebugEnabled()) {
693 logger.debug("testSubmitRequest: url=" + url
694 + " status=" + statusCode);
696 Assert.assertEquals(statusCode, EXPECTED_STATUS);
700 // ---------------------------------------------------------------
701 // Utility methods used by tests above
702 // ---------------------------------------------------------------
704 * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
707 public String getServicePathComponent() {
708 return SERVICE_PATH_COMPONENT;
712 * Creates the dimension instance.
714 * @param identifier the identifier
715 * @return the multipart output
717 private MultipartOutput createDimensionInstance(String commonPartName, String identifier) {
718 return createDimensionInstance(commonPartName,
719 "dimensionType-" + identifier,
720 "entryNumber-" + identifier,
721 "entryDate-" + identifier);
725 * Creates the dimension instance.
727 * @param dimensionType the dimension type
728 * @param entryNumber the entry number
729 * @param entryDate the entry date
730 * @return the multipart output
732 private MultipartOutput createDimensionInstance(String commonPartName, String dimensionType, String entryNumber, String entryDate) {
733 DimensionsCommon dimension = new DimensionsCommon();
734 dimension.setDimension(dimensionType);
735 dimension.setValue(entryNumber);
736 dimension.setValueDate(entryDate);
737 MultipartOutput multipart = DimensionFactory.createDimensionInstance(
738 commonPartName, dimension);
740 if (logger.isDebugEnabled()) {
741 logger.debug("to be created, dimension common");
742 logger.debug(objectAsXmlString(dimension,
743 DimensionsCommon.class));