]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
dff89419e605e0757204415ade45c402ee83fd57
[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.Response;
28
29 import org.collectionspace.services.client.AbstractCommonListUtils;
30 import org.collectionspace.services.client.CollectionSpaceClient;
31 import org.collectionspace.services.client.ConditioncheckClient;
32 import org.collectionspace.services.client.PayloadInputPart;
33 import org.collectionspace.services.client.PayloadOutputPart;
34 import org.collectionspace.services.client.PoxPayloadIn;
35 import org.collectionspace.services.client.PoxPayloadOut;
36 import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
37 import org.collectionspace.services.jaxb.AbstractCommonList;
38 import org.collectionspace.services.conditioncheck.ConditionchecksCommon;
39 import org.collectionspace.services.conditioncheck.HazardGroupList;
40 import org.collectionspace.services.conditioncheck.HazardGroup;
41
42 import org.jboss.resteasy.client.ClientResponse;
43 import org.testng.Assert;
44
45 import org.slf4j.Logger;
46 import org.slf4j.LoggerFactory;
47
48 /**
49  * ConditioncheckServiceTest, carries out tests against a
50  * deployed and running Conditioncheck (aka Condition Checks) Service.
51  */
52 public class ConditioncheckServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, ConditionchecksCommon> {
53
54     /** The logger. */
55     private final String CLASS_NAME = ConditioncheckServiceTest.class.getName();
56     private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
57     // Instance variables specific to this test.
58     /** The service path component. */
59     final String SERVICE_NAME = "conditionchecks";
60     final String SERVICE_PATH_COMPONENT = "conditionchecks";
61     private String CONDITIONCHECKER_REF_NAME =
62             "urn:cspace:org.collectionspace.demo:personauthorities:name(TestPersonAuth):item:name(HarryLender)'Harry Lender'";
63     private String CONDITIONCHECK_HAZARD = 
64             "urn:cspace:core.collectionspace.org:vocabularies:name(TestTermList):item:name(hazard1)'multi-dimensional'";
65     private String CONDITIONCHECK_HAZARD_NOTE = "Object needs to be extinguished occasionally.";
66     private final static String CURRENT_DATE_UTC =
67             GregorianCalendarDateTimeUtils.timestampUTC();
68
69     /* (non-Javadoc)
70      * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
71      */
72     @Override
73     protected CollectionSpaceClient getClientInstance() {
74         return new ConditioncheckClient();
75     }
76
77     /* (non-Javadoc)
78      * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse)
79      */
80     @Override
81     protected AbstractCommonList getCommonList(Response response) {
82         return response.readEntity(AbstractCommonList.class);
83     }
84
85     // ---------------------------------------------------------------
86     // CRUD tests : CREATE tests
87     // ---------------------------------------------------------------
88     
89     // Success outcomes
90     
91     /* (non-Javadoc)
92      * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String)
93      */
94     @Override
95 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
96     public void create(String testName) throws Exception {
97         // Perform setup, such as initializing the type of service request
98         // (e.g. CREATE, DELETE), its valid and expected status codes, and
99         // its associated HTTP method name (e.g. POST, DELETE).
100         setupCreate();
101
102         // Submit the request to the service and store the response.
103         ConditioncheckClient client = new ConditioncheckClient();
104         String identifier = createIdentifier();
105         PoxPayloadOut multipart = createConditioncheckInstance(identifier);
106         String newID = null;
107         Response res = client.create(multipart);
108         try {
109             int statusCode = res.getStatus();
110
111             // Check the status code of the response: does it match
112             // the expected response(s)?
113             //
114             // Specifically:
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);
119             }
120             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
121                     invalidStatusCodeMessage(testRequestType, statusCode));
122             Assert.assertEquals(statusCode, testExpectedStatusCode);
123
124             newID = extractId(res);
125         } finally {
126             if (res != null) {
127                 res.close();
128             }
129         }
130
131         // Store the ID returned from the first resource created
132         // for additional tests below.
133         if (knownResourceId == null) {
134             knownResourceId = newID;
135             if (logger.isDebugEnabled()) {
136                 logger.debug(testName + ": knownResourceId=" + knownResourceId);
137             }
138         }
139
140         // Store the IDs from every resource created by tests,
141         // so they can be deleted after tests have been run.
142         allResourceIdsCreated.add(newID);
143     }
144
145     /* (non-Javadoc)
146      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
147      */
148     @Override
149 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
150 //    dependsOnMethods = {"create"})
151     public void createList(String testName) throws Exception {
152         for (int i = 0; i < 3; i++) {
153             create(testName);
154         }
155     }
156
157
158     /*
159     @Override
160     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
161     dependsOnMethods = {"create", "testSubmitRequest"})
162     public void createWithEmptyEntityBody(String testName) throws Exception {
163     
164     if (logger.isDebugEnabled()) {
165     logger.debug(testBanner(testName, CLASS_NAME));
166     }
167     // Perform setup.
168     setupCreateWithEmptyEntityBody();
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 = "";
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("createWithEmptyEntityBody 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 createWithMalformedXml(String testName) throws Exception {
192     
193     if (logger.isDebugEnabled()) {
194     logger.debug(testBanner(testName, CLASS_NAME));
195     }
196     // Perform setup.
197     setupCreateWithMalformedXml(testName, logger);
198     
199     // Submit the request to the service and store the response.
200     String method = REQUEST_TYPE.httpMethodName();
201     String url = getServiceRootURL();
202     String mediaType = MediaType.APPLICATION_XML;
203     final String entity = MALFORMED_XML_DATA; // Constant from base class.
204     int statusCode = submitRequest(method, url, mediaType, entity);
205     
206     // Check the status code of the response: does it match
207     // the expected response(s)?
208     if(logger.isDebugEnabled()){
209     logger.debug(testName + ": url=" + url +
210     " status=" + statusCode);
211     }
212     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
213     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
214     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
215     }
216     
217     @Override
218     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
219     dependsOnMethods = {"create", "testSubmitRequest"})
220     public void createWithWrongXmlSchema(String testName) throws Exception {
221     
222     if (logger.isDebugEnabled()) {
223     logger.debug(testBanner(testName, CLASS_NAME));
224     }
225     // Perform setup.
226     setupCreateWithWrongXmlSchema(testName, logger);
227     
228     // Submit the request to the service and store the response.
229     String method = REQUEST_TYPE.httpMethodName();
230     String url = getServiceRootURL();
231     String mediaType = MediaType.APPLICATION_XML;
232     final String entity = WRONG_XML_SCHEMA_DATA;
233     int statusCode = submitRequest(method, url, mediaType, entity);
234     
235     // Check the status code of the response: does it match
236     // the expected response(s)?
237     if(logger.isDebugEnabled()){
238     logger.debug(testName + ": url=" + url +
239     " status=" + statusCode);
240     }
241     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
242     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
243     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
244     }
245      */
246     
247     // ---------------------------------------------------------------
248     // CRUD tests : READ tests
249     // ---------------------------------------------------------------
250     
251     // Success outcomes
252     
253     /* (non-Javadoc)
254      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String)
255      */
256     @Override
257 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
258 //    dependsOnMethods = {"create"})
259     public void read(String testName) throws Exception {
260         // Perform setup.
261         setupRead();
262
263         // Submit the request to the service and store the response.
264         ConditioncheckClient client = new ConditioncheckClient();
265         Response res = client.read(knownResourceId);
266         PoxPayloadIn input = null;
267         try {
268             assertStatusCode(res, testName);
269             input = new PoxPayloadIn((String)res.getEntity());
270         } finally {
271             if (res != null) {
272                 res.close();
273             }
274         }
275
276         // Get the common part of the response and verify that it is not null.
277         PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
278         ConditionchecksCommon conditioncheckCommon = null;
279         if (payloadInputPart != null) {
280             conditioncheckCommon = (ConditionchecksCommon) payloadInputPart.getBody();
281         }
282         Assert.assertNotNull(conditioncheckCommon);
283
284         // Check selected fields.
285         HazardGroupList hazardGroupList = conditioncheckCommon.getHazardGroupList();
286         Assert.assertNotNull(hazardGroupList);
287         List<HazardGroup> hazardGroups = hazardGroupList.getHazardGroup();
288         Assert.assertNotNull(hazardGroups);
289         String hazard = hazardGroups.get(0).getHazard();
290         Assert.assertEquals(hazard, CONDITIONCHECK_HAZARD);
291         String hazardNote = hazardGroups.get(0).getHazardNote();
292         Assert.assertEquals(hazardNote, CONDITIONCHECK_HAZARD_NOTE);
293         String hazardDate = hazardGroups.get(0).getHazardDate();
294         Assert.assertEquals(hazardDate, CURRENT_DATE_UTC);
295         String conditionChecker = conditioncheckCommon.getConditionChecker();
296         Assert.assertEquals(conditionChecker, CONDITIONCHECKER_REF_NAME);
297
298         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
299         String conditionCheckNote = conditioncheckCommon.getConditionCheckNote();
300
301         if (logger.isDebugEnabled()) {
302             logger.debug("UTF-8 data sent=" + getUTF8DataFragment() + "\n"
303                     + "UTF-8 data received=" + conditionCheckNote);
304         }
305
306         Assert.assertEquals(conditionCheckNote, getUTF8DataFragment(),
307                 "UTF-8 data retrieved '" + conditionCheckNote
308                 + "' does not match expected data '" + getUTF8DataFragment());
309     }
310
311     // Failure outcomes
312     
313     /* (non-Javadoc)
314      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String)
315      */
316     @Override
317 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
318 //    dependsOnMethods = {"read"})
319     public void readNonExistent(String testName) throws Exception {
320         // Perform setup.
321         setupReadNonExistent();
322
323         // Submit the request to the service and store the response.
324         ConditioncheckClient client = new ConditioncheckClient();
325         Response res = client.read(NON_EXISTENT_ID);
326         try {
327             int statusCode = res.getStatus();
328
329             // Check the status code of the response: does it match
330             // the expected response(s)?
331             if (logger.isDebugEnabled()) {
332                 logger.debug(testName + ": status = " + statusCode);
333             }
334             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
335                     invalidStatusCodeMessage(testRequestType, statusCode));
336             Assert.assertEquals(statusCode, testExpectedStatusCode);
337         } finally {
338             if (res != null) {
339                 res.close();
340             }
341         }
342     }
343
344     // ---------------------------------------------------------------
345     // CRUD tests : READ_LIST tests
346     // ---------------------------------------------------------------
347     
348     // Success outcomes
349     
350     /* (non-Javadoc)
351      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String)
352      */
353     @Override
354 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
355 //    dependsOnMethods = {"createList", "read"})
356     public void readList(String testName) throws Exception {
357         // Perform setup.
358         setupReadList();
359
360         // Submit the request to the service and store the response.
361         AbstractCommonList list = null;
362         ConditioncheckClient client = new ConditioncheckClient();
363         Response res = client.readList();
364         assertStatusCode(res, testName);
365         try {
366             int statusCode = res.getStatus();
367
368             // Check the status code of the response: does it match
369             // the expected response(s)?
370             if (logger.isDebugEnabled()) {
371                 logger.debug(testName + ": status = " + statusCode);
372             }
373             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
374                     invalidStatusCodeMessage(testRequestType, statusCode));
375             Assert.assertEquals(statusCode, testExpectedStatusCode);
376
377             list = res.readEntity(getCommonListType());
378         } finally {
379             if (res != null) {
380                 res.close();
381             }
382         }
383
384         // Optionally output additional data about list members for debugging.
385         boolean iterateThroughList = true;
386         if(iterateThroughList && logger.isDebugEnabled()){
387             AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName);
388         }
389
390     }
391
392     // Failure outcomes
393     // None at present.
394     
395     // ---------------------------------------------------------------
396     // CRUD tests : UPDATE tests
397     // ---------------------------------------------------------------
398     
399     // Success outcomes
400     
401     /* (non-Javadoc)
402      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String)
403      */
404     @Override
405 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
406 //    dependsOnMethods = {"read"})
407     public void update(String testName) throws Exception {
408         // Perform setup.
409         setupRead();
410
411         // Retrieve the contents of a resource to update.
412         ConditioncheckClient client = new ConditioncheckClient();
413         Response res = client.read(knownResourceId);
414         PoxPayloadIn input = null;
415         try {
416             assertStatusCode(res, testName);
417             input = new PoxPayloadIn((String)res.getEntity());
418             if (logger.isDebugEnabled()) {
419                 logger.debug("got object to update with ID: " + knownResourceId);
420             }
421         } finally {
422             if (res != null) {
423                 res.close();
424             }
425         }
426
427         // Extract the common part from the response.
428         PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName());
429         ConditionchecksCommon conditioncheckCommon = null;
430         if (payloadInputPart != null) {
431             conditioncheckCommon = (ConditionchecksCommon) payloadInputPart.getBody();
432         }
433         Assert.assertNotNull(conditioncheckCommon);
434
435         // Update the content of this resource.
436         conditioncheckCommon.setConditionCheckRefNumber("updated-" + conditioncheckCommon.getConditionCheckRefNumber());
437
438         String conditionCheckNote = conditioncheckCommon.getConditionCheckNote();
439         conditioncheckCommon.setConditionCheckNote("updated-conditionCheckNote-" + conditionCheckNote);
440
441         if (logger.isDebugEnabled()) {
442             logger.debug("to be updated object");
443             logger.debug(objectAsXmlString(conditioncheckCommon, ConditionchecksCommon.class));
444         }
445
446         setupUpdate();
447         
448         // Submit the updated common part in an update request to the service
449         // and store the response.
450         PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
451         PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), conditioncheckCommon);
452         res = client.update(knownResourceId, output);
453         try {
454             assertStatusCode(res, testName);
455             int statusCode = res.getStatus();
456             // Check the status code of the response: does it match the expected response(s)?
457             if (logger.isDebugEnabled()) {
458                 logger.debug(testName + ": status = " + statusCode);
459             }
460             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
461                     invalidStatusCodeMessage(testRequestType, statusCode));
462             Assert.assertEquals(statusCode, testExpectedStatusCode);
463             input = new PoxPayloadIn((String)res.getEntity());
464         } finally {
465             if (res != null) {
466                 res.close();
467             }
468         }
469
470         // Extract the updated common part from the response.
471         payloadInputPart = input.getPart(client.getCommonPartName());
472         ConditionchecksCommon updatedConditioncheckCommon = null;
473         if (payloadInputPart != null) {
474             updatedConditioncheckCommon = (ConditionchecksCommon) payloadInputPart.getBody();
475         }
476         Assert.assertNotNull(updatedConditioncheckCommon);
477
478         // Check selected fields in the updated common part.
479         Assert.assertEquals(updatedConditioncheckCommon.getConditionCheckRefNumber(),
480                 conditioncheckCommon.getConditionCheckRefNumber(),
481                 "Data in updated object did not match submitted data.");
482
483         // Check the values of fields containing Unicode UTF-8 (non-Latin-1) characters.
484         String originalConditionCheckNote = conditioncheckCommon.getConditionCheckNote();
485         String updatedConditionCheckNote = updatedConditioncheckCommon.getConditionCheckNote();
486         
487         Assert.assertEquals(updatedConditionCheckNote, originalConditionCheckNote,
488                 "Data in updated object did not match submitted data.");
489
490         if(logger.isDebugEnabled()){
491             logger.debug("UTF-8 data sent=" + originalConditionCheckNote + "\n"
492                     + "UTF-8 data received=" + updatedConditionCheckNote);
493         }
494         Assert.assertTrue(updatedConditionCheckNote.contains(getUTF8DataFragment()),
495                 "UTF-8 data retrieved '" + updatedConditionCheckNote
496                 + "' does not match expected data '" + getUTF8DataFragment());
497     }
498
499     @Override
500 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
501 //    dependsOnMethods = {"update", "testSubmitRequest"})
502     public void updateNonExistent(String testName) throws Exception {
503         // Perform setup.
504         setupUpdateNonExistent();
505
506         // Submit the request to the service and store the response.
507         // Note: The ID used in this 'create' call may be arbitrary.
508         // The only relevant ID may be the one used in update(), below.
509         ConditioncheckClient client = new ConditioncheckClient();
510         PoxPayloadOut multipart = createConditioncheckInstance(NON_EXISTENT_ID);
511         Response res = client.update(NON_EXISTENT_ID, multipart);
512         try {
513             int statusCode = res.getStatus();
514
515             // Check the status code of the response: does it match
516             // the expected response(s)?
517             if (logger.isDebugEnabled()) {
518                 logger.debug(testName + ": status = " + statusCode);
519             }
520             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
521                     invalidStatusCodeMessage(testRequestType, statusCode));
522             Assert.assertEquals(statusCode, testExpectedStatusCode);
523         } finally {
524             if (res != null) {
525                 res.close();
526             }
527         }
528     }
529
530     // ---------------------------------------------------------------
531     // CRUD tests : DELETE tests
532     // ---------------------------------------------------------------
533     
534     // Success outcomes
535     
536     /* (non-Javadoc)
537      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String)
538      */
539     @Override
540 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
541 //    dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
542     public void delete(String testName) throws Exception {
543         // Perform setup.
544         setupDelete();
545
546         // Submit the request to the service and store the response.
547         ConditioncheckClient client = new ConditioncheckClient();
548         Response res = client.delete(knownResourceId);
549         try {
550             int statusCode = res.getStatus();
551
552             // Check the status code of the response: does it match
553             // the expected response(s)?
554             if (logger.isDebugEnabled()) {
555                 logger.debug(testName + ": status = " + statusCode);
556             }
557             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
558                     invalidStatusCodeMessage(testRequestType, statusCode));
559             Assert.assertEquals(statusCode, testExpectedStatusCode);
560         } finally {
561             if (res != null) {
562                 res.close();
563             }
564         }
565     }
566
567     // Failure outcomes
568     
569     /* (non-Javadoc)
570      * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
571      */
572     @Override
573 //    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
574 //    dependsOnMethods = {"delete"})
575     public void deleteNonExistent(String testName) throws Exception {
576         // Perform setup.
577         setupDeleteNonExistent();
578
579         // Submit the request to the service and store the response.
580         ConditioncheckClient client = new ConditioncheckClient();
581         Response res = client.delete(NON_EXISTENT_ID);
582         try {
583             int statusCode = res.getStatus();
584
585             // Check the status code of the response: does it match
586             // the expected response(s)?
587             if (logger.isDebugEnabled()) {
588                 logger.debug(testName + ": status = " + statusCode);
589             }
590             Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
591                     invalidStatusCodeMessage(testRequestType, statusCode));
592             Assert.assertEquals(statusCode, testExpectedStatusCode);
593         } finally {
594             if (res != null) {
595                 res.close();
596             }
597         }
598     }
599
600     // ---------------------------------------------------------------
601     // Utility tests : tests of code used in tests above
602     // ---------------------------------------------------------------
603     
604     /**
605      * Tests the code for manually submitting data that is used by several
606      * of the methods above.
607      */
608 //    @Test(dependsOnMethods = {"create", "read"})
609     public void testSubmitRequest() {
610
611         // Expected status code: 200 OK
612         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
613
614         // Submit the request to the service and store the response.
615         String method = ServiceRequestType.READ.httpMethodName();
616         String url = getResourceURL(knownResourceId);
617         int statusCode = submitRequest(method, url);
618
619         // Check the status code of the response: does it match
620         // the expected response(s)?
621         if (logger.isDebugEnabled()) {
622             logger.debug("testSubmitRequest: url=" + url
623                     + " status=" + statusCode);
624         }
625         Assert.assertEquals(statusCode, EXPECTED_STATUS);
626
627     }
628
629     // ---------------------------------------------------------------
630     // Utility methods used by tests above
631     // ---------------------------------------------------------------
632     
633     @Override
634     public String getServiceName() {
635         return SERVICE_NAME;
636     }
637
638     /* (non-Javadoc)
639      * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
640      */
641     @Override
642     public String getServicePathComponent() {
643         return SERVICE_PATH_COMPONENT;
644     }
645
646     @Override
647     protected PoxPayloadOut createInstance(String identifier) {
648         return createConditioncheckInstance(identifier);
649     }
650
651     /**
652      * Creates the conditioncheck instance.
653      *
654      * @param identifier the identifier
655      * @return the multipart output
656      */
657     //private PoxPayloadOut createConditioncheckInstance(String identifier) {
658     //    return createConditioncheckInstance("conditionCheckRefNumber-" + identifier);
659     //}
660
661     /**
662      * Creates the conditioncheck instance.
663      *
664      * @param conditioncheckRefNumber the conditioncheck number
665      * @return the multipart output
666      */
667     private PoxPayloadOut createConditioncheckInstance(String conditionCheckRefNumber) {
668
669         ConditionchecksCommon conditioncheckCommon = new ConditionchecksCommon();
670         conditioncheckCommon.setConditionCheckRefNumber(conditionCheckRefNumber);
671         conditioncheckCommon.setConditionChecker(CONDITIONCHECKER_REF_NAME);
672         conditioncheckCommon.setConditionCheckNote(getUTF8DataFragment());
673
674         HazardGroupList hazardGroupList = new HazardGroupList();
675         List<HazardGroup> hazardGroups = hazardGroupList.getHazardGroup();
676         HazardGroup hazardGroup = new HazardGroup();
677         hazardGroup.setHazard(CONDITIONCHECK_HAZARD);
678         hazardGroup.setHazardDate(CURRENT_DATE_UTC);
679         hazardGroup.setHazardNote(CONDITIONCHECK_HAZARD_NOTE);
680         hazardGroups.add(hazardGroup);
681         conditioncheckCommon.setHazardGroupList(hazardGroupList);
682
683         PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
684         PayloadOutputPart commonPart =
685                 multipart.addPart(new ConditioncheckClient().getCommonPartName(), conditioncheckCommon);
686
687         if (logger.isDebugEnabled()) {
688             logger.debug("to be created, conditioncheck common");
689             logger.debug(objectAsXmlString(conditioncheckCommon, ConditionchecksCommon.class));
690         }
691
692         return multipart;
693     }
694
695     @Override
696     public void CRUDTests(String testName) {
697         // TODO Auto-generated method stub
698         
699     }
700
701     @Override
702     protected PoxPayloadOut createInstance(String commonPartName,
703             String identifier) {
704         PoxPayloadOut result = createConditioncheckInstance(identifier);
705         return result;
706     }
707
708     @Override
709     protected ConditionchecksCommon updateInstance(ConditionchecksCommon commonPartObject) {
710         // TODO Auto-generated method stub
711         return null;
712     }
713
714     @Override
715     protected void compareUpdatedInstances(ConditionchecksCommon original,
716             ConditionchecksCommon updated) throws Exception {
717         // TODO Auto-generated method stub
718         
719     }
720 }