]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
575a9e758b4eeba9e8c41a6eaa5558a134b44b79
[tmp/jakarta-migration.git] /
1 /**
2  * This document is a part of the source code and related artifacts
3  * for CollectionSpace, an open source collections management system
4  * for museums and related institutions:
5  *
6  * http://www.collectionspace.org
7  * http://wiki.collectionspace.org
8  *
9  * Copyright © 2009 Regents of the University of California
10  *
11  * Licensed under the Educational Community License (ECL), Version 2.0.
12  * You may not use this file except in compliance with this License.
13  *
14  * You may obtain a copy of the ECL 2.0 License at
15  * https://source.collectionspace.org/collection-space/LICENSE.txt
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 package org.collectionspace.services.client.test;
24
25 import java.util.ArrayList;
26 import java.util.List;
27 import javax.ws.rs.core.MediaType;
28 import javax.ws.rs.core.Response;
29
30 import org.collectionspace.services.client.DimensionClient;
31 import org.collectionspace.services.dimension.DimensionsCommon;
32 import org.collectionspace.services.dimension.DimensionsCommonList;
33
34 import org.jboss.resteasy.client.ClientResponse;
35
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;
42
43 import org.slf4j.Logger;
44 import org.slf4j.LoggerFactory;
45
46 /**
47  * DimensionServiceTest, carries out tests against a
48  * deployed and running Dimension Service.
49  *
50  * $LastChangedRevision: 917 $
51  * $LastChangedDate: 2009-11-06 12:20:28 -0800 (Fri, 06 Nov 2009) $
52  */
53 public class DimensionServiceTest extends AbstractServiceTestImpl {
54
55    private final Logger logger =
56        LoggerFactory.getLogger(DimensionServiceTest.class);
57
58     // Instance variables specific to this test.
59     final String SERVICE_PATH_COMPONENT = "dimensions";
60     private String knownResourceId = null;
61     private List<String> allResourceIdsCreated = new ArrayList();
62
63     // ---------------------------------------------------------------
64     // CRUD tests : CREATE tests
65     // ---------------------------------------------------------------
66     // Success outcomes
67     @Override
68     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
69     public void create(String testName) throws Exception {
70
71         // Perform setup, such as initializing the type of service request
72         // (e.g. CREATE, DELETE), its valid and expected status codes, and
73         // its associated HTTP method name (e.g. POST, DELETE).
74         setupCreate(testName);
75
76         // Submit the request to the service and store the response.
77         DimensionClient client = new DimensionClient();
78         String identifier = createIdentifier();
79         MultipartOutput multipart = createDimensionInstance(identifier);
80         ClientResponse<Response> res = client.create(multipart);
81
82         int statusCode = res.getStatus();
83
84         // Check the status code of the response: does it match
85         // the expected response(s)?
86         //
87         // Specifically:
88         // Does it fall within the set of valid status codes?
89         // Does it exactly match the expected status code?
90         if(logger.isDebugEnabled()){
91             logger.debug(testName + ": status = " + statusCode);
92         }
93         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
94                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
95         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
96
97         // Store the ID returned from the first resource created
98         // for additional tests below.
99         if (knownResourceId == null){
100             knownResourceId = extractId(res);
101             if (logger.isDebugEnabled()) {
102                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
103             }
104         }
105
106         // Store the IDs from every resource created by tests,
107         // so they can be deleted after tests have been run.
108         allResourceIdsCreated.add(extractId(res));
109     }
110
111     @Override
112     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
113         dependsOnMethods = {"create"})
114     public void createList(String testName) throws Exception {
115         for(int i = 0; i < 3; i++){
116             create(testName);
117         }
118     }
119
120     // Failure outcomes
121     // Placeholders until the three tests below can be uncommented.
122     // See Issue CSPACE-401.
123     @Override
124     public void createWithEmptyEntityBody(String testName) throws Exception {
125     }
126
127     @Override
128     public void createWithMalformedXml(String testName) throws Exception {
129     }
130
131     @Override
132     public void createWithWrongXmlSchema(String testName) throws Exception {
133     }
134
135     /*
136     @Override
137     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
138         dependsOnMethods = {"create", "testSubmitRequest"})
139     public void createWithEmptyEntityBody(String testName) throws Exception {
140
141     // Perform setup.
142     setupCreateWithEmptyEntityBody(testName);
143
144     // Submit the request to the service and store the response.
145     String method = REQUEST_TYPE.httpMethodName();
146     String url = getServiceRootURL();
147     String mediaType = MediaType.APPLICATION_XML;
148     final String entity = "";
149     int statusCode = submitRequest(method, url, mediaType, entity);
150
151     // Check the status code of the response: does it match
152     // the expected response(s)?
153     if(logger.isDebugEnabled()){
154         logger.debug("createWithEmptyEntityBody url=" + url +
155             " status=" + statusCode);
156      }
157     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
158     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
159     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
160     }
161
162     @Override
163     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
164         dependsOnMethods = {"create", "testSubmitRequest"})
165     public void createWithMalformedXml(String testName) throws Exception {
166
167     // Perform setup.
168     setupCreateWithMalformedXml(testName);
169
170     // Submit the request to the service and store the response.
171     String method = REQUEST_TYPE.httpMethodName();
172     String url = getServiceRootURL();
173     String mediaType = MediaType.APPLICATION_XML;
174     final String entity = MALFORMED_XML_DATA; // Constant from base class.
175     int statusCode = submitRequest(method, url, mediaType, entity);
176
177     // Check the status code of the response: does it match
178     // the expected response(s)?
179     if(logger.isDebugEnabled()){
180         logger.debug(testName + ": url=" + url +
181             " status=" + statusCode);
182      }
183     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
184     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
185     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
186     }
187
188     @Override
189     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
190         dependsOnMethods = {"create", "testSubmitRequest"})
191     public void createWithWrongXmlSchema(String testName) throws Exception {
192
193     // Perform setup.
194     setupCreateWithWrongXmlSchema(testName);
195
196     // Submit the request to the service and store the response.
197     String method = REQUEST_TYPE.httpMethodName();
198     String url = getServiceRootURL();
199     String mediaType = MediaType.APPLICATION_XML;
200     final String entity = WRONG_XML_SCHEMA_DATA;
201     int statusCode = submitRequest(method, url, mediaType, entity);
202
203     // Check the status code of the response: does it match
204     // the expected response(s)?
205     if(logger.isDebugEnabled()){
206         logger.debug(testName + ": url=" + url +
207             " status=" + statusCode);
208      }
209     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
210     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
211     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
212     }
213      */
214
215     // ---------------------------------------------------------------
216     // CRUD tests : READ tests
217     // ---------------------------------------------------------------
218     // Success outcomes
219     @Override
220     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
221         dependsOnMethods = {"create"})
222     public void read(String testName) throws Exception {
223
224         // Perform setup.
225         setupRead(testName);
226
227         // Submit the request to the service and store the response.
228         DimensionClient client = new DimensionClient();
229         ClientResponse<MultipartInput> res = client.read(knownResourceId);
230         int statusCode = res.getStatus();
231
232         // Check the status code of the response: does it match
233         // the expected response(s)?
234         if(logger.isDebugEnabled()){
235             logger.debug(testName + ": status = " + statusCode);
236         }
237         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
238                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
239         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
240
241         MultipartInput input = (MultipartInput) res.getEntity();
242         DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
243                 client.getCommonPartName(), DimensionsCommon.class);
244         Assert.assertNotNull(dimension);
245     }
246
247     // Failure outcomes
248     @Override
249     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
250         dependsOnMethods = {"read"})
251     public void readNonExistent(String testName) throws Exception {
252
253         // Perform setup.
254         setupReadNonExistent(testName);
255
256         // Submit the request to the service and store the response.
257         DimensionClient client = new DimensionClient();
258         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
259         int statusCode = res.getStatus();
260
261         // Check the status code of the response: does it match
262         // the expected response(s)?
263         if(logger.isDebugEnabled()){
264             logger.debug(testName + ": status = " + statusCode);
265         }
266         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
267                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
268         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
269     }
270
271     // ---------------------------------------------------------------
272     // CRUD tests : READ_LIST tests
273     // ---------------------------------------------------------------
274     // Success outcomes
275     @Override
276     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
277         dependsOnMethods = {"read"})
278     public void readList(String testName) throws Exception {
279
280         // Perform setup.
281         setupReadList(testName);
282
283         // Submit the request to the service and store the response.
284         DimensionClient client = new DimensionClient();
285         ClientResponse<DimensionsCommonList> res = client.readList();
286         DimensionsCommonList list = res.getEntity();
287         int statusCode = res.getStatus();
288
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);
293         }
294         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
295                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
296         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
297
298         // Optionally output additional data about list members for debugging.
299         boolean iterateThroughList = false;
300         if(iterateThroughList && logger.isDebugEnabled()){
301             List<DimensionsCommonList.DimensionListItem> items =
302                     list.getDimensionListItem();
303             int i = 0;
304             for(DimensionsCommonList.DimensionListItem item : items){
305                 logger.debug(testName + ": list-item[" + i + "] csid=" +
306                         item.getCsid());
307                 logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
308                         item.getDimension());
309                 logger.debug(testName + ": list-item[" + i + "] URI=" +
310                         item.getUri());
311                 i++;
312             }
313         }
314
315     }
316
317     // Failure outcomes
318     // None at present.
319     // ---------------------------------------------------------------
320     // CRUD tests : UPDATE tests
321     // ---------------------------------------------------------------
322     // Success outcomes
323     @Override
324     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
325         dependsOnMethods = {"read"})
326     public void update(String testName) throws Exception {
327
328         // Perform setup.
329         setupUpdate(testName);
330
331         // Retrieve the contents of a resource to update.
332         DimensionClient client = new DimensionClient();
333         ClientResponse<MultipartInput> res =
334                 client.read(knownResourceId);
335         if(logger.isDebugEnabled()){
336             logger.debug(testName + ": read status = " + res.getStatus());
337         }
338         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
339
340         if(logger.isDebugEnabled()){
341             logger.debug("got object to update with ID: " + knownResourceId);
342         }
343         MultipartInput input = (MultipartInput) res.getEntity();
344         DimensionsCommon dimension = (DimensionsCommon) extractPart(input,
345                 client.getCommonPartName(), DimensionsCommon.class);
346         Assert.assertNotNull(dimension);
347
348         // Update the content of this resource.
349         dimension.setValue("updated-" + dimension.getValue());
350         dimension.setValueDate("updated-" + dimension.getValueDate());
351         if(logger.isDebugEnabled()){
352             logger.debug("to be updated object");
353             logger.debug(objectAsXmlString(dimension, DimensionsCommon.class));
354         }
355         // Submit the request to the service and store the response.
356         MultipartOutput output = new MultipartOutput();
357         OutputPart commonPart = output.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
358         commonPart.getHeaders().add("label", client.getCommonPartName());
359
360         res = client.update(knownResourceId, output);
361         int statusCode = res.getStatus();
362         // Check the status code of the response: does it match the expected response(s)?
363         if(logger.isDebugEnabled()){
364             logger.debug(testName + ": status = " + statusCode);
365         }
366         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
367                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
368         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
369
370
371         input = (MultipartInput) res.getEntity();
372         DimensionsCommon updatedDimension =
373                 (DimensionsCommon) extractPart(input,
374                         client.getCommonPartName(), DimensionsCommon.class);
375         Assert.assertNotNull(updatedDimension);
376
377         Assert.assertEquals(updatedDimension.getValueDate(),
378                 dimension.getValueDate(),
379                 "Data in updated object did not match submitted data.");
380
381     }
382
383     // Failure outcomes
384     // Placeholders until the three tests below can be uncommented.
385     // See Issue CSPACE-401.
386     @Override
387     public void updateWithEmptyEntityBody(String testName) throws Exception{
388     }
389     @Override
390     public void updateWithMalformedXml(String testName) throws Exception {
391     }
392     @Override
393     public void updateWithWrongXmlSchema(String testName) throws Exception {
394     }
395
396     /*
397     @Override
398     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
399         dependsOnMethods = {"create", "update", "testSubmitRequest"})
400     public void updateWithEmptyEntityBody(String testName) throws Exception {
401
402     // Perform setup.
403     setupUpdateWithEmptyEntityBody(testName);
404
405     // Submit the request to the service and store the response.
406     String method = REQUEST_TYPE.httpMethodName();
407     String url = getResourceURL(knownResourceId);
408     String mediaType = MediaType.APPLICATION_XML;
409     final String entity = "";
410     int statusCode = submitRequest(method, url, mediaType, entity);
411
412     // Check the status code of the response: does it match
413     // the expected response(s)?
414     if(logger.isDebugEnabled()){
415         logger.debug(testName + ": url=" + url +
416             " status=" + statusCode);
417      }
418     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
419     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
420     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
421     }
422
423     @Override
424     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
425         dependsOnMethods = {"create", "update", "testSubmitRequest"})
426     public void updateWithMalformedXml(String testName) throws Exception {
427
428     // Perform setup.
429     setupUpdateWithMalformedXml(testName);
430
431     // Submit the request to the service and store the response.
432     String method = REQUEST_TYPE.httpMethodName();
433     String url = getResourceURL(knownResourceId);
434     String mediaType = MediaType.APPLICATION_XML;
435     final String entity = MALFORMED_XML_DATA;
436     int statusCode = submitRequest(method, url, mediaType, entity);
437
438     // Check the status code of the response: does it match
439     // the expected response(s)?
440     if(logger.isDebugEnabled()){
441         logger.debug(testName + ": url=" + url +
442          " status=" + statusCode);
443      }
444     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
445     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
446     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
447     }
448
449     @Override
450     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
451         dependsOnMethods = {"create", "update", "testSubmitRequest"})
452     public void updateWithWrongXmlSchema(String testName) throws Exception {
453
454     // Perform setup.
455     setupUpdateWithWrongXmlSchema(testName);
456
457     // Submit the request to the service and store the response.
458     String method = REQUEST_TYPE.httpMethodName();
459     String url = getResourceURL(knownResourceId);
460     String mediaType = MediaType.APPLICATION_XML;
461     final String entity = WRONG_XML_SCHEMA_DATA;
462     int statusCode = submitRequest(method, url, mediaType, entity);
463
464     // Check the status code of the response: does it match
465     // the expected response(s)?
466     if(logger.isDebugEnabled()){
467         logger.debug(testName + ": url=" + url +
468         " status=" + statusCode);
469      }
470     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
471     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
472     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
473     }
474      */
475
476     @Override
477     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
478         dependsOnMethods = {"update", "testSubmitRequest"})
479     public void updateNonExistent(String testName) throws Exception {
480
481         // Perform setup.
482         setupUpdateNonExistent(testName);
483
484         // Submit the request to the service and store the response.
485         // Note: The ID used in this 'create' call may be arbitrary.
486         // The only relevant ID may be the one used in update(), below.
487         DimensionClient client = new DimensionClient();
488         MultipartOutput multipart = createDimensionInstance(NON_EXISTENT_ID);
489         ClientResponse<MultipartInput> res =
490                 client.update(NON_EXISTENT_ID, multipart);
491         int statusCode = res.getStatus();
492
493         // Check the status code of the response: does it match
494         // the expected response(s)?
495         if(logger.isDebugEnabled()){
496             logger.debug(testName + ": status = " + statusCode);
497         }
498         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
499                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
500         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
501     }
502
503     // ---------------------------------------------------------------
504     // CRUD tests : DELETE tests
505     // ---------------------------------------------------------------
506     // Success outcomes
507     @Override
508     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
509         dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
510     public void delete(String testName) throws Exception {
511
512         // Perform setup.
513         setupDelete(testName);
514
515         // Submit the request to the service and store the response.
516         DimensionClient client = new DimensionClient();
517         ClientResponse<Response> res = client.delete(knownResourceId);
518         int statusCode = res.getStatus();
519
520         // Check the status code of the response: does it match
521         // the expected response(s)?
522         if(logger.isDebugEnabled()){
523             logger.debug(testName + ": status = " + statusCode);
524         }
525         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
526                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
527         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
528     }
529
530     // Failure outcomes
531     @Override
532     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
533         dependsOnMethods = {"delete"})
534     public void deleteNonExistent(String testName) throws Exception {
535
536         // Perform setup.
537         setupDeleteNonExistent(testName);
538
539         // Submit the request to the service and store the response.
540         DimensionClient client = new DimensionClient();
541         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
542         int statusCode = res.getStatus();
543
544         // Check the status code of the response: does it match
545         // the expected response(s)?
546         if(logger.isDebugEnabled()){
547             logger.debug(testName + ": status = " + statusCode);
548         }
549         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
550                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
551         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
552     }
553
554     // ---------------------------------------------------------------
555     // Utility tests : tests of code used in tests above
556     // ---------------------------------------------------------------
557     /**
558      * Tests the code for manually submitting data that is used by several
559      * of the methods above.
560      */
561     @Test(dependsOnMethods = {"create", "read"})
562     public void testSubmitRequest() {
563
564         // Expected status code: 200 OK
565         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
566
567         // Submit the request to the service and store the response.
568         String method = ServiceRequestType.READ.httpMethodName();
569         String url = getResourceURL(knownResourceId);
570         int statusCode = submitRequest(method, url);
571
572         // Check the status code of the response: does it match
573         // the expected response(s)?
574         if(logger.isDebugEnabled()){
575             logger.debug("testSubmitRequest: url=" + url +
576                 " status=" + statusCode);
577         }
578         Assert.assertEquals(statusCode, EXPECTED_STATUS);
579
580     }
581
582     // ---------------------------------------------------------------
583     // Cleanup of resources created during testing
584     // ---------------------------------------------------------------
585
586     /**
587      * Deletes all resources created by tests, after all tests have been run.
588      *
589      * This cleanup method will always be run, even if one or more tests fail.
590      * For this reason, it attempts to remove all resources created
591      * at any point during testing, even if some of those resources
592      * may be expected to be deleted by certain tests.
593      */
594     @AfterClass(alwaysRun=true)
595     public void cleanUp() {
596         if (logger.isDebugEnabled()) {
597             logger.debug("Cleaning up temporary resources created for testing ...");
598         }
599         DimensionClient client = new DimensionClient();
600         for (String resourceId : allResourceIdsCreated) {
601             // Note: Any non-success responses are ignored and not reported.
602             ClientResponse<Response> res = client.delete(resourceId);
603         }
604     }
605
606     // ---------------------------------------------------------------
607     // Utility methods used by tests above
608     // ---------------------------------------------------------------
609     @Override
610     public String getServicePathComponent() {
611         return SERVICE_PATH_COMPONENT;
612     }
613
614     private MultipartOutput createDimensionInstance(String identifier) {
615         return createDimensionInstance(
616                         "dimensionType-" + identifier,
617                 "entryNumber-" + identifier,
618                 "entryDate-" + identifier);
619     }
620
621     private MultipartOutput createDimensionInstance(String dimensionType, String entryNumber, String entryDate) {
622         DimensionsCommon dimension = new DimensionsCommon();
623         dimension.setDimension(dimensionType);
624         dimension.setValue(entryNumber);
625         dimension.setValueDate(entryDate);
626         MultipartOutput multipart = new MultipartOutput();
627         OutputPart commonPart =
628             multipart.addPart(dimension, MediaType.APPLICATION_XML_TYPE);
629         commonPart.getHeaders().add("label", new DimensionClient().getCommonPartName());
630
631         if(logger.isDebugEnabled()){
632             logger.debug("to be created, dimension common");
633             logger.debug(objectAsXmlString(dimension, DimensionsCommon.class));
634         }
635
636         return multipart;
637     }
638 }