]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
d502f88a754f8c36ac12fc03a3172eb1106c71ce
[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             verbose("updated object", relation, RelationsCommon.class);
338         }
339
340         // Submit the request to the service and store the response.
341         MultipartOutput output = new MultipartOutput();
342         OutputPart commonPart = output.addPart(relation, MediaType.APPLICATION_XML_TYPE);
343         commonPart.getHeaders().add("label", client.getCommonPartName());
344         res = client.update(knownResourceId, output);
345         int statusCode = res.getStatus();
346
347         // Check the status code of the response: does it match the expected response(s)?
348         if(logger.isDebugEnabled()){
349             logger.debug(testName + ": status = " + statusCode);
350         }
351         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
352                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
353         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
354
355         input = (MultipartInput) res.getEntity();
356         RelationsCommon updatedObject = (RelationsCommon) extractPart(
357                 input, client.getCommonPartName(),
358                 RelationsCommon.class);
359         Assert.assertNotNull(updatedObject);
360
361         final String msg =
362                 "Data in updated object did not match submitted data.";
363         Assert.assertEquals(
364                 updatedObject.getDocumentId1(), relation.getDocumentId1(), msg);
365         Assert.assertEquals(
366                 updatedObject.getDocumentType1(), relation.getDocumentType1(), msg);
367         Assert.assertEquals(
368                 updatedObject.getDocumentId2(), relation.getDocumentId2(), msg);
369         Assert.assertEquals(
370                 updatedObject.getDocumentType2(), relation.getDocumentType2(), msg);
371
372     }
373
374     // Failure outcomes
375     // Placeholders until the three tests below can be uncommented.
376     // See Issue CSPACE-401.
377     public void updateWithEmptyEntityBody(String testName) throws Exception {
378     }
379
380     public void updateWithMalformedXml(String testName) throws Exception {
381     }
382
383     public void updateWithWrongXmlSchema(String testName) throws Exception {
384     }
385
386     /*
387     @Override
388     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
389         dependsOnMethods = {"create", "update", "testSubmitRequest"})
390     public void updateWithEmptyEntityBody(String testName) throws Exception {
391     
392     // Perform setup.
393     setupUpdateWithEmptyEntityBody(testName);
394
395     // Submit the request to the service and store the response.
396     String method = REQUEST_TYPE.httpMethodName();
397     String url = getResourceURL(knownResourceId);
398     String mediaType = MediaType.APPLICATION_XML;
399     final String entity = "";
400     int statusCode = submitRequest(method, url, mediaType, entity);
401
402     // Check the status code of the response: does it match
403     // the expected response(s)?
404     if(logger.isDebugEnabled()){
405        logger.debug(testName + ": url=" + url +
406            " status=" + statusCode);
407      }
408     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
409     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
410     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
411     }
412
413     @Override
414     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
415         dependsOnMethods = {"create", "update", "testSubmitRequest"})
416     public void updateWithMalformedXml(String testName) throws Exception {
417
418     // Perform setup.
419     setupUpdateWithMalformedXml(testName);
420
421     // Submit the request to the service and store the response.
422     String method = REQUEST_TYPE.httpMethodName();
423     String url = getResourceURL(knownResourceId);
424     String mediaType = MediaType.APPLICATION_XML;
425     final String entity = MALFORMED_XML_DATA; // Constant from abstract base class.
426     int statusCode = submitRequest(method, url, mediaType, entity);
427
428     // Check the status code of the response: does it match
429     // the expected response(s)?
430     if(logger.isDebugEnabled()){
431         logger.debug(testName + ": url=" + url +
432         " status=" + statusCode);
433      }
434     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
435     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
436     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
437     }
438
439     @Override
440     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
441         dependsOnMethods = {"create", "update", "testSubmitRequest"})
442     public void updateWithWrongXmlSchema(String testName) throws Exception {
443     
444     // Perform setup.
445     setupUpdateWithWrongXmlSchema(testName);
446
447     // Submit the request to the service and store the response.
448     String method = REQUEST_TYPE.httpMethodName();
449     String url = getResourceURL(knownResourceId);
450     String mediaType = MediaType.APPLICATION_XML;
451     final String entity = WRONG_XML_SCHEMA_DATA; // Constant from abstract base class.
452     int statusCode = submitRequest(method, url, mediaType, entity);
453
454     // Check the status code of the response: does it match
455     // the expected response(s)?
456     if(logger.isDebugEnabled()){
457         logger.debug(testName + ": url=" + url +
458         " status=" + statusCode);
459      }
460     Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
461     invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
462     Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
463     }
464      */
465
466     @Override
467     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
468         dependsOnMethods = {"update", "testSubmitRequest"})
469     public void updateNonExistent(String testName) throws Exception {
470
471         // Perform setup.
472         setupUpdateNonExistent(testName);
473
474         // Submit the request to the service and store the response.
475         // Note: The ID used in this 'create' call may be arbitrary.
476         // The only relevant ID may be the one used in update(), below.
477         MultipartOutput multipart = createRelationInstance(NON_EXISTENT_ID);
478         ClientResponse<MultipartInput> res =
479                 client.update(NON_EXISTENT_ID, multipart);
480         int statusCode = res.getStatus();
481
482         // Check the status code of the response: does it match
483         // the expected response(s)?
484         if(logger.isDebugEnabled()){
485             logger.debug(testName + ": status = " + statusCode);
486         }
487         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
488                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
489         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
490     }
491
492     // ---------------------------------------------------------------
493     // CRUD tests : DELETE tests
494     // ---------------------------------------------------------------
495     // Success outcomes
496     @Override
497     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
498         dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
499     public void delete(String testName) throws Exception {
500
501         // Perform setup.
502         setupDelete(testName);
503
504         // Submit the request to the service and store the response.
505         ClientResponse<Response> res = client.delete(knownResourceId);
506         int statusCode = res.getStatus();
507
508         // Check the status code of the response: does it match
509         // the expected response(s)?
510         if(logger.isDebugEnabled()){
511             logger.debug(testName + ": status = " + statusCode);
512         }
513         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
514                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
515         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
516     }
517
518     // Failure outcomes
519     @Override
520     @Test(dataProvider="testName", dataProviderClass=AbstractServiceTest.class,
521         dependsOnMethods = {"delete"})
522     public void deleteNonExistent(String testName) throws Exception {
523
524         // Perform setup.
525         setupDeleteNonExistent(testName);
526
527         // Submit the request to the service and store the response.
528         ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
529         int statusCode = res.getStatus();
530
531         // Check the status code of the response: does it match
532         // the expected response(s)?
533         if(logger.isDebugEnabled()){
534             logger.debug(testName + ": status = " + statusCode);
535         }
536         Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
537                 invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
538         Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
539     }
540
541     // ---------------------------------------------------------------
542     // RELATE_OBJECT tests
543     // ---------------------------------------------------------------
544     @Test(dependsOnMethods = {"create"})
545     public void relateObjects() {
546     }
547
548     // ---------------------------------------------------------------
549     // Utility tests : tests of code used in tests above
550     // ---------------------------------------------------------------
551     /**
552      * Tests the code for manually submitting data that is used by several
553      * of the methods above.
554      */
555     @Test(dependsOnMethods = {"create", "read"})
556     public void testSubmitRequest() {
557
558         // Expected status code: 200 OK
559         final int EXPECTED_STATUS = Response.Status.OK.getStatusCode();
560
561         // Submit the request to the service and store the response.
562         String method = ServiceRequestType.READ.httpMethodName();
563         String url = getResourceURL(knownResourceId);
564         int statusCode = submitRequest(method, url);
565
566         // Check the status code of the response: does it match
567         // the expected response(s)?
568         if(logger.isDebugEnabled()){
569             logger.debug("testSubmitRequest: url=" + url +
570                 " status=" + statusCode);
571         }
572         Assert.assertEquals(statusCode, EXPECTED_STATUS);
573
574     }
575
576     // ---------------------------------------------------------------
577     // Utility methods used by tests above
578     // ---------------------------------------------------------------
579     @Override
580     public String getServicePathComponent() {
581         return SERVICE_PATH_COMPONENT;
582     }
583
584     private MultipartOutput createRelationInstance(String identifier) {
585         RelationsCommon relation = new RelationsCommon();
586         fillRelation(relation, identifier);
587
588         MultipartOutput multipart = new MultipartOutput();
589         OutputPart commonPart =
590                 multipart.addPart(relation, MediaType.APPLICATION_XML_TYPE);
591         commonPart.getHeaders().add("label", client.getCommonPartName());
592         if(logger.isDebugEnabled()){
593           verbose("to be created, relation common ", relation,
594               RelationsCommon.class);
595         }
596         return multipart;
597     }
598
599     /**
600      * Fills the relation.
601      * 
602      * @param identifier the identifier
603      * 
604      * @return the relation
605      */
606     private void fillRelation(RelationsCommon relation, String identifier) {
607         fillRelation(relation, "Subject-" + identifier,
608                 "SubjectType-" + identifier + "-type",
609                 "Object-" + identifier,
610                 "ObjectType-" + identifier + "-type",
611                 RelationshipType.COLLECTIONOBJECT_INTAKE);
612     }
613
614     /**
615      * Fills the relation.
616      * 
617      * @param documentId1 the document id1
618      * @param documentType1 the document type1
619      * @param documentId2 the document id2
620      * @param documentType2 the document type2
621      * @param rt the rt
622      * 
623      * @return the relation
624      */
625     private void fillRelation(RelationsCommon relation,
626             String documentId1, String documentType1,
627             String documentId2, String documentType2,
628             RelationshipType rt) {
629         relation.setDocumentId1(documentId1);
630         relation.setDocumentType1(documentType1);
631         relation.setDocumentId2(documentId2);
632         relation.setDocumentType2(documentType2);
633
634         relation.setRelationshipType(rt);
635     }
636 }