]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2e6a60295de8f640b285e9fc22c5635fd2b63df9
[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.List;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
28
29 import org.collectionspace.services.client.RelationClient;
30 import org.collectionspace.services.relation.RelationsCommon;
31 import org.collectionspace.services.relation.RelationsCommonList;
32 import org.collectionspace.services.relation.RelationshipType;
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.Test;
41
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
44
45 /**
46  * RelationServiceTest, carries out tests against a
47  * deployed and running Relation Service.
48  * 
49  * $LastChangedRevision$
50  * $LastChangedDate$
51  */
52 public class RelationServiceTest extends AbstractServiceTest {
53
54    private final Logger logger =
55         LoggerFactory.getLogger(RelationServiceTest.class);
56
57     private RelationClient client = new RelationClient();
58     final String SERVICE_PATH_COMPONENT = "relations";
59     private String knownResourceId = null;
60
61     // ---------------------------------------------------------------
62     // CRUD tests : CREATE tests
63     // ---------------------------------------------------------------
64     // Success outcomes
65     @Override
66     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class)
67     public void create(String testName) throws Exception {
68
69         // Perform setup, such as initializing the type of service request
70         // (e.g. CREATE, DELETE), its valid and expected status codes, and
71         // its associated HTTP method name (e.g. POST, DELETE).
72         setupCreate(testName);
73
74         // Submit the request to the service and store the response.
75         String identifier = createIdentifier();
76         MultipartOutput multipart = createRelationInstance(identifier);
77         ClientResponse<Response> res = client.create(multipart);
78         int statusCode = res.getStatus();
79
80         // Check the status code of the response: does it match
81         // the expected response(s)?
82         //
83         // Does it fall within the set of valid status codes?
84         // Does it exactly match the expected status code?
85         if(logger.isDebugEnabled()){
86             logger.debug(testName + ": status = " + statusCode);
87         }
88         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
89                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
90         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
91
92         // Store the ID returned from this create operation for
93         // additional tests below.
94         knownResourceId = extractId(res);
95         if(logger.isDebugEnabled()){
96             logger.debug("create: knownResourceId=" + knownResourceId);
97         }
98     }
99
100     @Override
101     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
102         dependsOnMethods = {"create"})
103     public void createList(String testName) throws Exception {
104         for(int i = 0; i < 3; i++){
105             create(testName);
106         }
107     }
108
109     // Failure outcomes
110     // Placeholders until the three tests below can be uncommented.
111     // See Issue CSPACE-401.
112     public void createWithEmptyEntityBody(String testName) throws Exception {
113     }
114
115     public void createWithMalformedXml(String testName) throws Exception {
116     }
117
118     public void createWithWrongXmlSchema(String testName) throws Exception {
119     }
120
121     /*
122     @Override
123     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
124         dependsOnMethods = {"create", "testSubmitRequest"})
125     public void createWithEmptyEntityBody(String testName) throws Exception {
126     
127     // Perform setup.
128     setupCreateWithEmptyEntityBody(testName);
129
130     // Submit the request to the service and store the response.
131     String method = REQUEST_TYPE.httpMethodName();
132     String url = getServiceRootURL();
133     String mediaType = MediaType.APPLICATION_XML;
134     final String entity = "";
135     int statusCode = submitRequest(method, url, mediaType, entity);
136
137     // Check the status code of the response: does it match
138     // the expected response(s)?
139     if(logger.isDebugEnabled()){
140         logger.debug(testName + ": url=" + url +
141             " status=" + statusCode);
142      }
143     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
144     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
145     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
146     }
147
148     @Override
149     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
150         dependsOnMethods = {"create", "testSubmitRequest"})
151     public void createWithMalformedXml(String testName) throws Exception {
152     
153     // Perform setup.
154     setupCreateWithMalformedXml(testName);
155
156     // Submit the request to the service and store the response.
157     String method = REQUEST_TYPE.httpMethodName();
158     String url = getServiceRootURL();
159     String mediaType = MediaType.APPLICATION_XML;
160     final String entity = MALFORMED_XML_DATA; // Constant from base class.
161     int statusCode = submitRequest(method, url, mediaType, entity);
162
163     // Check the status code of the response: does it match
164     // the expected response(s)?
165     if(logger.isDebugEnabled()){
166         logger.debug(testName + ": url=" + url +
167             " status=" + statusCode);
168      }
169     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
170     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
171     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
172     }
173
174     @Override
175     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
176         dependsOnMethods = {"create", "testSubmitRequest"})
177     public void createWithWrongXmlSchema(String testName) throws Exception {
178     
179     // Perform setup.
180     setupCreateWithWrongXmlSchema(testName);
181
182     // Submit the request to the service and store the response.
183     String method = REQUEST_TYPE.httpMethodName();
184     String url = getServiceRootURL();
185     String mediaType = MediaType.APPLICATION_XML;
186     final String entity = WRONG_XML_SCHEMA_DATA;
187     int statusCode = submitRequest(method, url, mediaType, entity);
188
189     // Check the status code of the response: does it match
190     // the expected response(s)?
191     if(logger.isDebugEnabled()){
192       logger.debug(testName + ": url=" + url +
193           " status=" + statusCode);
194      }
195     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
196     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
197     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
198     }
199      */
200
201     // ---------------------------------------------------------------
202     // CRUD tests : READ tests
203     // ---------------------------------------------------------------
204     // Success outcomes
205     @Override
206     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
207         dependsOnMethods = {"create"})
208     public void read(String testName) throws Exception {
209
210         // Perform setup.
211         setupRead(testName);
212
213         // Submit the request to the service and store the response.
214         ClientResponse<MultipartInput> res = client.read(knownResourceId);
215         int statusCode = res.getStatus();
216
217         // Check the status code of the response: does it match
218         // the expected response(s)?
219         if(logger.isDebugEnabled()){
220             logger.debug(testName + ": status = " + statusCode);
221         }
222         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
223                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
224         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
225
226         // Verify that the resource identifier ...
227         MultipartInput input = (MultipartInput) res.getEntity();
228         RelationsCommon relation = (RelationsCommon) extractPart(input,
229                 client.getCommonPartName(), RelationsCommon.class);
230         Assert.assertNotNull(relation);
231
232     }
233
234     // Failure outcomes
235     @Override
236     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
237         dependsOnMethods = {"read"})
238     public void readNonExistent(String testName) throws Exception {
239
240         // Perform setup.
241         setupReadNonExistent(testName);
242
243         // Submit the request to the service and store the response.
244         ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
245         int statusCode = res.getStatus();
246
247         // Check the status code of the response: does it match
248         // the expected response(s)?
249         if(logger.isDebugEnabled()){
250             logger.debug(testName + ": status = " + statusCode);
251         }
252         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
253                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
254         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
255     }
256
257     // ---------------------------------------------------------------
258     // CRUD tests : READ_LIST tests
259     // ---------------------------------------------------------------
260     // Success outcomes
261     @Override
262     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
263         dependsOnMethods = {"createList", "read"})
264     public void readList(String testName) throws Exception {
265
266         // Perform setup.
267         setupReadList(testName);
268
269         // Submit the request to the service and store the response.
270         ClientResponse<RelationsCommonList> res = client.readList();
271         RelationsCommonList list = res.getEntity();
272         int statusCode = res.getStatus();
273
274         // Check the status code of the response: does it match
275         // the expected response(s)?
276         if(logger.isDebugEnabled()){
277             logger.debug(testName + ": status = " + statusCode);
278         }
279         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
280                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
281         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
282
283         // Optionally output additional data about list members for debugging.
284         boolean iterateThroughList = false;
285         if(iterateThroughList && logger.isDebugEnabled()){
286             List<RelationsCommonList.RelationListItem> items =
287                     list.getRelationListItem();
288             int i = 0;
289             for(RelationsCommonList.RelationListItem item : items){
290                 logger.debug(testName + ": list-item[" + i + "] csid=" +
291                         item.getCsid());
292                 logger.debug(testName + ": list-item[" + i + "] URI=" +
293                         item.getUri());
294                 i++;
295             }
296         }
297
298     }
299
300     // Failure outcomes
301     // None at present.
302
303     // ---------------------------------------------------------------
304     // CRUD tests : UPDATE tests
305     // ---------------------------------------------------------------
306
307     // Success outcomes
308     @Override
309     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
310         dependsOnMethods = {"read"})
311     public void update(String testName) throws Exception {
312
313         // Perform setup.
314         setupUpdate(testName);
315
316         // Retrieve an existing resource that we can update.
317         ClientResponse<MultipartInput> res =
318                 client.read(knownResourceId);
319         if(logger.isDebugEnabled()){
320             logger.debug(testName + ": read status = " + res.getStatus());
321         }
322         Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
323         if(logger.isDebugEnabled()){
324             logger.debug("Got object to update with ID: " + knownResourceId);
325         }
326         MultipartInput input = (MultipartInput) res.getEntity();
327         RelationsCommon relation = (RelationsCommon) extractPart(input,
328                 client.getCommonPartName(), RelationsCommon.class);
329         Assert.assertNotNull(relation);
330
331         // Update the content of this resource.
332         relation.setDocumentId1("updated-" + relation.getDocumentId1());
333         relation.setDocumentType1("updated-" + relation.getDocumentType1());
334         relation.setDocumentId2("updated-" + relation.getDocumentId2());
335         relation.setDocumentType2("updated-" + relation.getDocumentType2());
336         if(logger.isDebugEnabled()){
337             logger.debug("updated object");
338             logger.debug(objectAsXmlString(relation, RelationsCommon.class));
339         }
340
341         // Submit the request to the service and store the response.
342         MultipartOutput output = new MultipartOutput();
343         OutputPart commonPart = output.addPart(relation, MediaType.APPLICATION_XML_TYPE);
344         commonPart.getHeaders().add("label", client.getCommonPartName());
345         res = client.update(knownResourceId, output);
346         int statusCode = res.getStatus();
347
348         // Check the status code of the response: does it match the expected response(s)?
349         if(logger.isDebugEnabled()){
350             logger.debug(testName + ": status = " + statusCode);
351         }
352         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
353                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
354         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
355
356         input = (MultipartInput) res.getEntity();
357         RelationsCommon updatedObject = (RelationsCommon) extractPart(
358                 input, client.getCommonPartName(),
359                 RelationsCommon.class);
360         Assert.assertNotNull(updatedObject);
361
362         final String msg =
363                 "Data in updated object did not match submitted data.";
364         Assert.assertEquals(
365                 updatedObject.getDocumentId1(), relation.getDocumentId1(), msg);
366         Assert.assertEquals(
367                 updatedObject.getDocumentType1(), relation.getDocumentType1(), msg);
368         Assert.assertEquals(
369                 updatedObject.getDocumentId2(), relation.getDocumentId2(), msg);
370         Assert.assertEquals(
371                 updatedObject.getDocumentType2(), relation.getDocumentType2(), msg);
372
373     }
374
375     // Failure outcomes
376     // Placeholders until the three tests below can be uncommented.
377     // See Issue CSPACE-401.
378     public void updateWithEmptyEntityBody(String testName) throws Exception {
379     }
380
381     public void updateWithMalformedXml(String testName) throws Exception {
382     }
383
384     public void updateWithWrongXmlSchema(String testName) throws Exception {
385     }
386
387     /*
388     @Override
389     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
390         dependsOnMethods = {"create", "update", "testSubmitRequest"})
391     public void updateWithEmptyEntityBody(String testName) throws Exception {
392     
393     // Perform setup.
394     setupUpdateWithEmptyEntityBody(testName);
395
396     // Submit the request to the service and store the response.
397     String method = REQUEST_TYPE.httpMethodName();
398     String url = getResourceURL(knownResourceId);
399     String mediaType = MediaType.APPLICATION_XML;
400     final String entity = "";
401     int statusCode = submitRequest(method, url, mediaType, entity);
402
403     // Check the status code of the response: does it match
404     // the expected response(s)?
405     if(logger.isDebugEnabled()){
406        logger.debug(testName + ": url=" + url +
407            " status=" + statusCode);
408      }
409     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
410     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
411     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
412     }
413
414     @Override
415     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
416         dependsOnMethods = {"create", "update", "testSubmitRequest"})
417     public void updateWithMalformedXml(String testName) throws Exception {
418
419     // Perform setup.
420     setupUpdateWithMalformedXml(testName);
421
422     // Submit the request to the service and store the response.
423     String method = REQUEST_TYPE.httpMethodName();
424     String url = getResourceURL(knownResourceId);
425     String mediaType = MediaType.APPLICATION_XML;
426     final String entity = MALFORMED_XML_DATA; // Constant from abstract base class.
427     int statusCode = submitRequest(method, url, mediaType, entity);
428
429     // Check the status code of the response: does it match
430     // the expected response(s)?
431     if(logger.isDebugEnabled()){
432         logger.debug(testName + ": url=" + url +
433         " status=" + statusCode);
434      }
435     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
436     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
437     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
438     }
439
440     @Override
441     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
442         dependsOnMethods = {"create", "update", "testSubmitRequest"})
443     public void updateWithWrongXmlSchema(String testName) throws Exception {
444     
445     // Perform setup.
446     setupUpdateWithWrongXmlSchema(testName);
447
448     // Submit the request to the service and store the response.
449     String method = REQUEST_TYPE.httpMethodName();
450     String url = getResourceURL(knownResourceId);
451     String mediaType = MediaType.APPLICATION_XML;
452     final String entity = WRONG_XML_SCHEMA_DATA; // Constant from abstract base class.
453     int statusCode = submitRequest(method, url, mediaType, entity);
454
455     // Check the status code of the response: does it match
456     // the expected response(s)?
457     if(logger.isDebugEnabled()){
458         logger.debug(testName + ": url=" + url +
459         " status=" + statusCode);
460      }
461     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
462     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
463     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
464     }
465      */
466
467     @Override
468     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
469         dependsOnMethods = {"update", "testSubmitRequest"})
470     public void updateNonExistent(String testName) throws Exception {
471
472         // Perform setup.
473         setupUpdateNonExistent(testName);
474
475         // Submit the request to the service and store the response.
476         // Note: The ID used in this 'create' call may be arbitrary.
477         // The only relevant ID may be the one used in update(), below.
478         MultipartOutput multipart = createRelationInstance(NON_EXISTENT_ID);
479         ClientResponse<MultipartInput> res =
480                 client.update(NON_EXISTENT_ID, multipart);
481         int statusCode = res.getStatus();
482
483         // Check the status code of the response: does it match
484         // the expected response(s)?
485         if(logger.isDebugEnabled()){
486             logger.debug(testName + ": status = " + statusCode);
487         }
488         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
489                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
490         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
491     }
492
493     // ---------------------------------------------------------------
494     // CRUD tests : DELETE tests
495     // ---------------------------------------------------------------
496     // Success outcomes
497     @Override
498     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
499         dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
500     public void delete(String testName) throws Exception {
501
502         // Perform setup.
503         setupDelete(testName);
504
505         // Submit the request to the service and store the response.
506         ClientResponse<Response> res = client.delete(knownResourceId);
507         int statusCode = res.getStatus();
508
509         // Check the status code of the response: does it match
510         // the expected response(s)?
511         if(logger.isDebugEnabled()){
512             logger.debug(testName + ": status = " + statusCode);
513         }
514         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
515                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
516         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
517     }
518
519     // Failure outcomes
520     @Override
521     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
522         dependsOnMethods = {"delete"})
523     public void deleteNonExistent(String testName) throws Exception {
524
525         // Perform setup.
526         setupDeleteNonExistent(testName);
527
528         // Submit the request to the service and store the response.
529         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
530         int statusCode = res.getStatus();
531
532         // Check the status code of the response: does it match
533         // the expected response(s)?
534         if(logger.isDebugEnabled()){
535             logger.debug(testName + ": status = " + statusCode);
536         }
537         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
538                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
539         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
540     }
541
542     // ---------------------------------------------------------------
543     // RELATE_OBJECT tests
544     // ---------------------------------------------------------------
545     @Test(dependsOnMethods = {"create"})
546     public void relateObjects() {
547     }
548
549     // ---------------------------------------------------------------
550     // Utility tests : tests of code used in tests above
551     // ---------------------------------------------------------------
552     /**
553      * Tests the code for manually submitting data that is used by several
554      * of the methods above.
555      */
556     @Test(dependsOnMethods = {"create", "read"})
557     public void testSubmitRequest() {
558
559         // Expected status code: 200 OK
560         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
561
562         // Submit the request to the service and store the response.
563         String method = ServiceRequestType.READ.httpMethodName();
564         String url = getResourceURL(knownResourceId);
565         int statusCode = submitRequest(method, url);
566
567         // Check the status code of the response: does it match
568         // the expected response(s)?
569         if(logger.isDebugEnabled()){
570             logger.debug("testSubmitRequest: url=" + url +
571                 " status=" + statusCode);
572         }
573         Assert.assertEquals(statusCode, EXPECTED_STATUS);
574
575     }
576
577     // ---------------------------------------------------------------
578     // Utility methods used by tests above
579     // ---------------------------------------------------------------
580     @Override
581     public String getServicePathComponent() {
582         return SERVICE_PATH_COMPONENT;
583     }
584
585     private MultipartOutput createRelationInstance(String identifier) {
586         RelationsCommon relation = new RelationsCommon();
587         fillRelation(relation, identifier);
588
589         MultipartOutput multipart = new MultipartOutput();
590         OutputPart commonPart =
591                 multipart.addPart(relation, MediaType.APPLICATION_XML_TYPE);
592         commonPart.getHeaders().add("label", client.getCommonPartName());
593         if(logger.isDebugEnabled()){
594           logger.debug("to be created, relation common");
595           logger.debug(objectAsXmlString(relation, RelationsCommon.class));
596         }
597         return multipart;
598     }
599
600     /**
601      * Fills the relation.
602      * 
603      * @param identifier the identifier
604      * 
605      * @return the relation
606      */
607     private void fillRelation(RelationsCommon relation, String identifier) {
608         fillRelation(relation, "Subject-" + identifier,
609                 "SubjectType-" + identifier + "-type",
610                 "Object-" + identifier,
611                 "ObjectType-" + identifier + "-type",
612                 RelationshipType.COLLECTIONOBJECT_INTAKE);
613     }
614
615     /**
616      * Fills the relation.
617      * 
618      * @param documentId1 the document id1
619      * @param documentType1 the document type1
620      * @param documentId2 the document id2
621      * @param documentType2 the document type2
622      * @param rt the rt
623      * 
624      * @return the relation
625      */
626     private void fillRelation(RelationsCommon relation,
627             String documentId1, String documentType1,
628             String documentId2, String documentType2,
629             RelationshipType rt) {
630         relation.setDocumentId1(documentId1);
631         relation.setDocumentType1(documentType1);
632         relation.setDocumentId2(documentId2);
633         relation.setDocumentType2(documentType2);
634
635         relation.setRelationshipType(rt);
636     }
637 }