KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > interop > InteropDocWrappedTest


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "WSIF" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 2001, 2002, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package interop;
59
60 import interop.wsifserviceWrapped.ArrayOfSimpleDocument;
61 import interop.wsifserviceWrapped.ChildDocument;
62 import interop.wsifserviceWrapped.ComplexDocumentResponse;
63 import interop.wsifserviceWrapped.ComplexDocument_ElemType;
64 import interop.wsifserviceWrapped.ComplexDocument_Type;
65 import interop.wsifserviceWrapped.Doc_TestPortType;
66 import interop.wsifserviceWrapped.SimpleDocument_ElemType;
67 import interop.wsifserviceWrapped.SimpleDocument_Type;
68 import interop.wsifserviceWrapped.SingleTagResponse;
69 import interop.wsifserviceWrapped.SingleTag_ElemType;
70 import interop.wsifserviceWrapped.SingleTag_Type;
71 import interop.wsifserviceWrapped.SimpleDocumentResponse;
72 import java.io.StringWriter JavaDoc;
73
74 import junit.framework.Test;
75 import junit.framework.TestCase;
76 import junit.framework.TestSuite;
77
78 import org.apache.wsif.WSIFException;
79 import org.apache.wsif.WSIFMessage;
80 import org.apache.wsif.WSIFOperation;
81 import org.apache.wsif.WSIFPort;
82 import org.apache.wsif.WSIFService;
83 import org.apache.wsif.WSIFServiceFactory;
84 import org.apache.xml.serialize.OutputFormat;
85 import org.apache.xml.serialize.XMLSerializer;
86 import org.w3c.dom.Element JavaDoc;
87 import util.TestUtilities;
88
89 /**
90  * Junit test to test out the AXIS provider docstyle support using wrapped parts
91  *
92  * This test is part of the SOAP Builders interoperability testing
93  * effort described at http://www.whitemesa.net/. The WSDL is
94  * available online at http://www.whitemesa.net/wsdl/interopdoc.wsdl
95  *
96  * @author Ant Elder <ant.elder@uk.ibm.com>
97  */

98 public class InteropDocWrappedTest extends TestCase {
99     
100     String JavaDoc wsdlLocation =
101         TestUtilities.getWsdlPath("java\\test\\interop\\wsifservice")
102             + "interopdoc.wsdl";
103 // + "interopdocLocal.wsdl";
104
// "http://www.whitemesa.net/wsdl/interopdoc.wsdl";
105

106     public InteropDocWrappedTest(String JavaDoc name) {
107         super(name);
108     }
109
110     public static void main(String JavaDoc[] args) {
111 // TestUtilities.startListeners(
112
// TestUtilities.ADDRESSBOOK_LISTENER
113
// | TestUtilities.ASYNC_LISTENER
114
// | TestUtilities.NATIVEJMS_LISTENER);
115
junit.textui.TestRunner.run(suite());
116 // TestUtilities.stopListeners();
117
}
118
119     public static Test suite() {
120         return new TestSuite(InteropDocWrappedTest.class);
121     }
122
123     public void setUp() {
124         TestUtilities.setUpExtensionsAndProviders();
125     }
126
127     public void testSingleTagDII() {
128         doitSingleTagDII("interopDocPort", "axis");
129     }
130     public void testSimpleDocumentDII() {
131         doitSimpleDocumentDII("interopDocPort", "axis");
132     }
133     public void testComplexDocumentDII() {
134         doitComplexDocumentDII("interopDocPort", "axis");
135     }
136     public void testSingleTagStub() {
137         doitSingleTagStub("interopDocPort", "axis");
138     }
139     public void testSimpleDocumentStub() {
140         doitSimpleDocumentStub("interopDocPort", "axis");
141     }
142     public void testComplexDocumentStub() {
143         doitComplexDocumentStub("interopDocPort", "axis");
144     }
145
146     private void doitSingleTagDII(String JavaDoc portName, String JavaDoc protocol) {
147         if (portName.toUpperCase().indexOf("JMS") != -1
148             && !TestUtilities.areWeTesting("jms"))
149             return;
150
151         TestUtilities.setProviderForProtocol(protocol);
152
153         try {
154             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
155             WSIFService service =
156                 factory.getService(
157                     wsdlLocation,
158                     null,
159                     null,
160                     "http://soapinterop.org/",
161                     "Doc_TestPortType");
162
163             service.mapType(
164                new javax.xml.namespace.QName JavaDoc(
165                    "http://soapinterop.org/",
166                    ">SingleTag"),
167                SingleTag_ElemType.class );
168             service.mapType(
169                new javax.xml.namespace.QName JavaDoc(
170                    "http://soapinterop.org/",
171                    "SingleTag"),
172                SingleTag_Type.class );
173             service.mapType(
174                new javax.xml.namespace.QName JavaDoc(
175                    "http://soapinterop.org/",
176                    "SingleTagResponse"),
177                SingleTagResponse.class );
178
179             WSIFPort port = service.getPort(portName);
180
181             WSIFOperation operation = port.createOperation("SingleTag");
182
183             WSIFMessage inMsg = operation.createInputMessage();
184             WSIFMessage outMsg = operation.createOutputMessage();
185             WSIFMessage faultMsg = operation.createFaultMessage();
186
187             SingleTag_ElemType stet = new SingleTag_ElemType();
188             stet.setSingleTag(new SingleTag_Type());
189             
190             inMsg.setObjectPart("parameters", stet);
191
192             boolean ok =
193                 operation.executeRequestResponseOperation(
194                     inMsg,
195                     outMsg,
196                     faultMsg);
197
198             assertTrue("operation returned false!!", ok);
199  
200             Object JavaDoc o = null;
201             try {
202                 o = outMsg.getObjectPart("outputDoc");
203                 assertTrue("response is null!!!", o != null);
204             } catch (WSIFException e) {
205                 assertTrue("response part 'outputDoc' not found in output message!!!", false);
206             }
207             assertTrue(
208                 "response part has wrong type: " + o.getClass(),
209                 SingleTagResponse.class.isAssignableFrom(o.getClass()));
210
211             SingleTagResponse response = (SingleTagResponse) o;
212             assertNotNull("response singleTag is null!!!", response.getSingleTag());
213
214         } catch (Exception JavaDoc ex) {
215             ex.printStackTrace();
216             assertTrue(
217                 "InteropDocTest.doitSingleTagDII("
218                     + portName
219                     + ") caught exception "
220                     + ex.getLocalizedMessage(),
221                 false);
222         }
223     }
224
225     private void doitSimpleDocumentDII(String JavaDoc portName, String JavaDoc protocol) {
226         if (portName.toUpperCase().indexOf("JMS") != -1
227             && !TestUtilities.areWeTesting("jms"))
228             return;
229
230         TestUtilities.setProviderForProtocol(protocol);
231
232         try {
233             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
234             WSIFService service =
235                 factory.getService(
236                     wsdlLocation,
237                     null,
238                     null,
239                     "http://soapinterop.org/",
240                     "Doc_TestPortType");
241
242             service.mapPackage("http://soapinterop.org/", "interop.wsifserviceWrapped");
243             service.mapType(
244                new javax.xml.namespace.QName JavaDoc(
245                    "http://soapinterop.org/",
246                    ">SimpleDocument"),
247                SimpleDocument_ElemType.class );
248             service.mapType(
249                new javax.xml.namespace.QName JavaDoc(
250                    "http://soapinterop.org/",
251                    "SimpleDocument"),
252                SimpleDocument_Type.class );
253             service.mapType(
254                new javax.xml.namespace.QName JavaDoc(
255                    "http://soapinterop.org/",
256                    "SimpleDocumentResponse"),
257                SimpleDocumentResponse.class );
258
259             WSIFPort port = service.getPort(portName);
260
261             WSIFOperation operation = port.createOperation("SimpleDocument");
262
263             WSIFMessage inMsg = operation.createInputMessage();
264             WSIFMessage outMsg = operation.createOutputMessage();
265             WSIFMessage faultMsg = operation.createFaultMessage();
266
267             SimpleDocument_ElemType sdtet = new SimpleDocument_ElemType();
268             SimpleDocument_Type sdt = new SimpleDocument_Type();
269             sdt.setValue("petra");
270             sdtet.setSimpleDocument(sdt);
271
272             inMsg.setObjectPart("parameters", sdtet);
273
274             boolean ok =
275                 operation.executeRequestResponseOperation(
276                     inMsg,
277                     outMsg,
278                     faultMsg);
279
280             assertTrue("operation returned false!!", ok);
281  
282             Object JavaDoc o = null;
283             try {
284                 o = outMsg.getObjectPart("outputDoc");
285                 assertTrue("response is null!!!", o != null);
286             } catch (WSIFException e) {
287                 assertTrue("response part 'outputDoc' not found in output message!!!", false);
288             }
289             assertTrue(
290                 "response part has wrong type: " + o.getClass(),
291                 SimpleDocumentResponse.class.isAssignableFrom(o.getClass()));
292
293             SimpleDocumentResponse response = (SimpleDocumentResponse) o;
294             SimpleDocument_Type sdtResponse = response.getSimpleDocument();
295             assertNotNull("response SimpleDocument is null!!!", sdtResponse);
296
297             assertTrue(
298                 "document value wrong: " + sdtResponse.getValue(),
299                 sdt.getValue().equals(sdtResponse.getValue()));
300
301         } catch (Exception JavaDoc ex) {
302             ex.printStackTrace();
303             assertTrue(
304                 "InteropDocTest.doitSimpleDocumentDII("
305                     + portName
306                     + ") caught exception "
307                     + ex.getLocalizedMessage(),
308                 false);
309         }
310     }
311
312     private void doitComplexDocumentDII(String JavaDoc portName, String JavaDoc protocol) {
313         if (portName.toUpperCase().indexOf("JMS") != -1
314             && !TestUtilities.areWeTesting("jms"))
315             return;
316
317         TestUtilities.setProviderForProtocol(protocol);
318
319         try {
320             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
321             WSIFService service =
322                 factory.getService(
323                     wsdlLocation,
324                     null,
325                     null,
326                     "http://soapinterop.org/",
327                     "Doc_TestPortType");
328
329             service.mapPackage("http://soapinterop.org/", "interop.wsifserviceWrapped");
330
331             service.mapType(
332                new javax.xml.namespace.QName JavaDoc(
333                    "http://soapinterop.org/",
334                    ">ComplexDocument"),
335                ComplexDocument_ElemType.class );
336             service.mapType(
337                new javax.xml.namespace.QName JavaDoc(
338                    "http://soapinterop.org/",
339                    "ComplexDocument"),
340                ComplexDocument_Type.class );
341             service.mapType(
342                new javax.xml.namespace.QName JavaDoc(
343                    "http://soapinterop.org/",
344                    "ArrayOfSimpleDocument"),
345                ArrayOfSimpleDocument.class );
346             service.mapType(
347                new javax.xml.namespace.QName JavaDoc(
348                    "http://soapinterop.org/",
349                    "SimpleDocument"),
350                SimpleDocument_Type.class );
351             service.mapType(
352                new javax.xml.namespace.QName JavaDoc(
353                    "http://soapinterop.org/",
354                    "ChildDocument"),
355                ChildDocument.class );
356             service.mapType(
357                new javax.xml.namespace.QName JavaDoc(
358                    "http://soapinterop.org/",
359                    "ComplexDocumentResponse"),
360                ComplexDocumentResponse.class );
361
362             WSIFPort port = service.getPort(portName);
363
364             WSIFOperation operation = port.createOperation("ComplexDocument");
365
366             WSIFMessage inMsg = operation.createInputMessage();
367             WSIFMessage outMsg = operation.createOutputMessage();
368             WSIFMessage faultMsg = operation.createFaultMessage();
369
370             ComplexDocument_ElemType cdtet = new ComplexDocument_ElemType();
371             ComplexDocument_Type cdt = makeComplexDocument();
372             checkComplexDocument(cdt);
373             cdtet.setComplexDocument(cdt);
374
375             inMsg.setObjectPart("parameters", cdtet);
376
377             boolean ok =
378                 operation.executeRequestResponseOperation(
379                     inMsg,
380                     outMsg,
381                     faultMsg);
382
383             assertTrue("operation returned false!!", ok);
384  
385             Object JavaDoc o = null;
386             try {
387                 o = outMsg.getObjectPart("outputDoc");
388                 assertTrue("response is null!!!", o != null);
389             } catch (WSIFException e) {
390                 assertTrue("response part 'outputDoc' not found in output message!!!", false);
391             }
392             assertTrue(
393                 "response part has wrong type: " + o.getClass(),
394                 ComplexDocumentResponse.class.isAssignableFrom(o.getClass()));
395
396             ComplexDocumentResponse response = (ComplexDocumentResponse) o;
397             ComplexDocument_Type cdtResponse = response.getComplexDocument();
398             assertNotNull("response ComplexDocument is null!!!", cdtResponse);
399           
400             checkComplexDocument(cdtResponse);
401
402         } catch (Exception JavaDoc ex) {
403             ex.printStackTrace();
404             assertTrue(
405                 "InteropDocTest.doitComplexDocumentDII("
406                     + portName
407                     + ") caught exception "
408                     + ex.getLocalizedMessage(),
409                 false);
410         }
411     }
412     private void doitSingleTagStub(String JavaDoc portName, String JavaDoc protocol) {
413         if (portName.toUpperCase().indexOf("JMS") != -1
414             && !TestUtilities.areWeTesting("jms"))
415             return;
416
417         TestUtilities.setProviderForProtocol(protocol);
418
419         try {
420             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
421             WSIFService service =
422                 factory.getService(
423                     wsdlLocation,
424                     null,
425                     null,
426                     "http://soapinterop.org/",
427                     "Doc_TestPortType");
428
429             service.mapPackage("http://soapinterop.org/", "interop.wsifserviceWrapped");
430
431             service.mapType(
432                new javax.xml.namespace.QName JavaDoc(
433                    "http://soapinterop.org/",
434                    ">SingleTag"),
435                SingleTag_ElemType.class );
436             service.mapType(
437                new javax.xml.namespace.QName JavaDoc(
438                    "http://soapinterop.org/",
439                    "SingleTag"),
440                SingleTag_Type.class );
441             service.mapType(
442                new javax.xml.namespace.QName JavaDoc(
443                    "http://soapinterop.org/",
444                    "SingleTagResponse"),
445                SingleTagResponse.class );
446
447             Doc_TestPortType stub = (Doc_TestPortType) service.getStub(portName, Doc_TestPortType.class);
448
449             SingleTag_ElemType stet = new SingleTag_ElemType();
450             stet.setSingleTag(new SingleTag_Type());
451
452             SingleTagResponse response = stub.singleTag(stet);
453
454             assertNotNull("response is null!!!", response);
455             assertNotNull("response singleTag is null!!!", response.getSingleTag());
456
457         } catch (Exception JavaDoc ex) {
458             ex.printStackTrace();
459             assertTrue(
460                 "InteropDocTest.doitSingleTagDII("
461                     + portName
462                     + ") caught exception "
463                     + ex.getLocalizedMessage(),
464                 false);
465         }
466     }
467
468     private void doitSimpleDocumentStub(String JavaDoc portName, String JavaDoc protocol) {
469         if (portName.toUpperCase().indexOf("JMS") != -1
470             && !TestUtilities.areWeTesting("jms"))
471             return;
472
473         TestUtilities.setProviderForProtocol(protocol);
474
475         try {
476             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
477             WSIFService service =
478                 factory.getService(
479                     wsdlLocation,
480                     null,
481                     null,
482                     "http://soapinterop.org/",
483                     "Doc_TestPortType");
484
485             service.mapPackage("http://soapinterop.org/", "interop.wsifserviceWrapped");
486
487             service.mapType(
488                new javax.xml.namespace.QName JavaDoc(
489                    "http://soapinterop.org/",
490                    ">SimpleDocument"),
491                SimpleDocument_ElemType.class );
492             service.mapType(
493                new javax.xml.namespace.QName JavaDoc(
494                    "http://soapinterop.org/",
495                    "SimpleDocument"),
496                SimpleDocument_Type.class );
497             service.mapType(
498                new javax.xml.namespace.QName JavaDoc(
499                    "http://soapinterop.org/",
500                    "SimpleDocumentResponse"),
501                SimpleDocumentResponse.class );
502
503             Doc_TestPortType stub = (Doc_TestPortType) service.getStub(portName, Doc_TestPortType.class);
504
505             SimpleDocument_ElemType sdtet = new SimpleDocument_ElemType();
506             SimpleDocument_Type sdt = new SimpleDocument_Type();
507             sdt.setValue("petra");
508             sdtet.setSimpleDocument(sdt);
509
510             SimpleDocumentResponse response = stub.simpleDocument(sdtet);
511
512             assertNotNull("response is null!!!", response);
513
514             SimpleDocument_Type sdtResponse = response.getSimpleDocument();
515             assertNotNull("response simpleDocument is null!!!", sdtResponse);
516
517             assertTrue(
518                 "simpleDocument value wrong: " + sdtResponse.getValue(),
519                 sdt.getValue().equals(sdtResponse.getValue()));
520
521         } catch (Exception JavaDoc ex) {
522             ex.printStackTrace();
523             assertTrue(
524                 "InteropDocTest.doitSimpleDocumentDII("
525                     + portName
526                     + ") caught exception "
527                     + ex.getLocalizedMessage(),
528                 false);
529         }
530     }
531
532     private void doitComplexDocumentStub(String JavaDoc portName, String JavaDoc protocol) {
533         if (portName.toUpperCase().indexOf("JMS") != -1
534             && !TestUtilities.areWeTesting("jms"))
535             return;
536
537         TestUtilities.setProviderForProtocol(protocol);
538
539         try {
540             WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
541             WSIFService service =
542                 factory.getService(
543                     wsdlLocation,
544                     null,
545                     null,
546                     "http://soapinterop.org/",
547                     "Doc_TestPortType");
548
549             service.mapPackage("http://soapinterop.org/", "interop.wsifserviceWrapped");
550
551             service.mapType(
552                new javax.xml.namespace.QName JavaDoc(
553                    "http://soapinterop.org/",
554                    ">ComplexDocument"),
555                ComplexDocument_ElemType.class );
556             service.mapType(
557                new javax.xml.namespace.QName JavaDoc(
558                    "http://soapinterop.org/",
559                    "ComplexDocument"),
560                ComplexDocument_Type.class );
561             service.mapType(
562                new javax.xml.namespace.QName JavaDoc(
563                    "http://soapinterop.org/",
564                    "ArrayOfSimpleDocument"),
565                ArrayOfSimpleDocument.class );
566             service.mapType(
567                new javax.xml.namespace.QName JavaDoc(
568                    "http://soapinterop.org/",
569                    "SimpleDocument"),
570                SimpleDocument_Type.class );
571             service.mapType(
572                new javax.xml.namespace.QName JavaDoc(
573                    "http://soapinterop.org/",
574                    "ChildDocument"),
575                ChildDocument.class );
576             service.mapType(
577                new javax.xml.namespace.QName JavaDoc(
578                    "http://soapinterop.org/",
579                    "ComplexDocumentResponse"),
580                ComplexDocumentResponse.class );
581
582             Doc_TestPortType stub = (Doc_TestPortType) service.getStub(portName, Doc_TestPortType.class);
583
584             ComplexDocument_ElemType cdtet = new ComplexDocument_ElemType();
585             ComplexDocument_Type cdt = makeComplexDocument();
586             checkComplexDocument(cdt);
587             cdtet.setComplexDocument(cdt);
588                         
589             ComplexDocumentResponse response = stub.complexDocument(cdtet);
590             assertNotNull("response is null!!!", response);
591
592             ComplexDocument_Type cdtResponse = response.getComplexDocument();
593             assertNotNull("response complexDocument is null!!!", cdtResponse);
594
595             checkComplexDocument(cdtResponse);
596
597         } catch (Exception JavaDoc ex) {
598             ex.printStackTrace();
599             assertTrue(
600                 "InteropDocTest.doitComplexDocumentDII("
601                     + portName
602                     + ") caught exception "
603                     + ex.getLocalizedMessage(),
604                 false);
605         }
606     }
607
608     private ComplexDocument_Type makeComplexDocument() {
609         
610         ComplexDocument_Type cdt = new ComplexDocument_Type();
611
612         ArrayOfSimpleDocument asd = new ArrayOfSimpleDocument();
613         SimpleDocument_Type[] adt = new SimpleDocument_Type[2];
614         adt[0] = new SimpleDocument_Type("petra");
615         adt[1] = new SimpleDocument_Type("ant");
616         asd.setSimpleDocument(adt);
617         cdt.setSimpleDoc(asd);
618         
619         ChildDocument cd = new ChildDocument();
620         asd = new ArrayOfSimpleDocument();
621         adt = new SimpleDocument_Type[1];
622         adt[0] = new SimpleDocument_Type("sue");
623         asd.setSimpleDocument(adt);
624         cd.setChildSimpleDoc(asd);
625         cdt.setChild(cd);
626         
627         cdt.setAnAttribute("together");
628
629         return cdt;
630     }
631
632     private void checkComplexDocument(ComplexDocument_Type cdt) {
633         
634         ArrayOfSimpleDocument asd = cdt.getSimpleDoc();
635         assertTrue("asd is null!!!", asd != null);
636         SimpleDocument_Type[] adt = asd.getSimpleDocument();
637
638         boolean b = "petra".equals(adt[0]);
639
640         assertTrue("adt is null!!!", adt != null);
641         assertTrue("adt length not 2, is: " + adt.length, adt.length == 2);
642         assertTrue("child adt[0] not 'petra', is: " + adt[0], "petra".equals(adt[0].getValue()));
643         assertTrue("child adt[1] not 'ant', is: " + adt[0], "ant".equals(adt[1].getValue()));
644         
645         ChildDocument cd = cdt.getChild();
646         asd = cd.getChildSimpleDoc();
647         assertTrue("child asd is null!!!", asd != null);
648         adt = asd.getSimpleDocument();
649         assertTrue("child adt is null!!!", adt != null);
650         assertTrue("child adt length not 1, is: " + adt.length, adt.length == 1);
651         assertTrue("child adt[0] not 'sue', is: " + adt[0], "sue".equals(adt[0].getValue()));
652         
653         String JavaDoc s = cdt.getAnAttribute();
654         assertTrue("attribute not 'together' is: " + s, "together".equals(s));
655
656     }
657
658 }
659
Popular Tags