Source Code Cross Referenced for ParticalMaxOccursTest.java in  » Web-Services-AXIS2 » adb » org » apache » axis2 » schema » particalmaxoccurs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services AXIS2 » adb » org.apache.axis2.schema.particalmaxoccurs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.axis2.schema.particalmaxoccurs;
020:
021:        import junit.framework.TestCase;
022:
023:        import org.apache.axiom.om.OMElement;
024:        import org.apache.axiom.om.OMAbstractFactory;
025:        import org.apache.axiom.om.util.StAXUtils;
026:
027:        import javax.xml.stream.XMLStreamException;
028:        import javax.xml.stream.XMLStreamReader;
029:        import java.io.ByteArrayInputStream;
030:
031:        import com.mynamespace.testparticlemaxoccurs.*;
032:
033:        public class ParticalMaxOccursTest extends TestCase {
034:
035:            private int i = 0;
036:
037:            public void testParticalSequenceMaxOccursTest1() {
038:                TestParticalSequenceMaxOccurs1 testParticalMaxOccures1 = new TestParticalSequenceMaxOccurs1();
039:                TestParticalSequenceMaxOccursType1 testParticalMaxOccursType1 = new TestParticalSequenceMaxOccursType1();
040:                testParticalMaxOccures1
041:                        .setTestParticalSequenceMaxOccurs1(testParticalMaxOccursType1);
042:
043:                TestParticalSequenceMaxOccursType1Sequence[] testSequences = new TestParticalSequenceMaxOccursType1Sequence[2];
044:
045:                testSequences[0] = new TestParticalSequenceMaxOccursType1Sequence();
046:                testSequences[0].setParm1("Param11");
047:                testSequences[0].setParm2("Param12");
048:
049:                testSequences[1] = new TestParticalSequenceMaxOccursType1Sequence();
050:                testSequences[1].setParm1("Param21");
051:                testSequences[1].setParm2("Param22");
052:
053:                testParticalMaxOccursType1
054:                        .setTestParticalSequenceMaxOccursType1Sequence(testSequences);
055:
056:                try {
057:                    OMElement omElement = testParticalMaxOccures1.getOMElement(
058:                            TestParticalSequenceMaxOccurs1.MY_QNAME,
059:                            OMAbstractFactory.getOMFactory());
060:                    String omElementString = omElement.toStringWithConsume();
061:                    System.out.println("OM String ==> " + omElementString);
062:                    XMLStreamReader xmlReader = StAXUtils
063:                            .createXMLStreamReader(new ByteArrayInputStream(
064:                                    omElementString.getBytes()));
065:                    TestParticalSequenceMaxOccurs1 result = TestParticalSequenceMaxOccurs1.Factory
066:                            .parse(xmlReader);
067:                    TestParticalSequenceMaxOccursType1Sequence[] resultSequences = result
068:                            .getTestParticalSequenceMaxOccurs1()
069:                            .getTestParticalSequenceMaxOccursType1Sequence();
070:                    assertEquals(resultSequences[0].getParm1(), "Param11");
071:                    assertEquals(resultSequences[0].getParm2(), "Param12");
072:                    assertEquals(resultSequences[1].getParm1(), "Param21");
073:                    assertEquals(resultSequences[1].getParm2(), "Param22");
074:                } catch (XMLStreamException e) {
075:                    fail();
076:                } catch (Exception e) {
077:                    fail();
078:                }
079:            }
080:
081:            public void testParticleSequenceMaxOccurs2() {
082:                TestParticalSequenceMaxOccurs2 testParticalMaxOccures2 = new TestParticalSequenceMaxOccurs2();
083:                TestParticalSequenceMaxOccursType2 testParticalMaxOccursType2 = new TestParticalSequenceMaxOccursType2();
084:                testParticalMaxOccures2
085:                        .setTestParticalSequenceMaxOccurs2(testParticalMaxOccursType2);
086:
087:                TestParticalSequenceMaxOccursType2Sequence[] testSequences = new TestParticalSequenceMaxOccursType2Sequence[2];
088:
089:                testSequences[0] = new TestParticalSequenceMaxOccursType2Sequence();
090:                testSequences[0].setParm1(new String[] { "Param111",
091:                        "Param112", "Param113" });
092:                testSequences[0].setParm2(new String[] { "Param111",
093:                        "Param112", "Param113" });
094:
095:                testSequences[1] = new TestParticalSequenceMaxOccursType2Sequence();
096:                testSequences[1].setParm1(new String[] { "Param121",
097:                        "Param122", "Param123" });
098:                testSequences[1].setParm2(new String[] { "Param121",
099:                        "Param122", "Param123" });
100:
101:                testParticalMaxOccursType2
102:                        .setTestParticalSequenceMaxOccursType2Sequence(testSequences);
103:
104:                try {
105:                    OMElement omElement = testParticalMaxOccures2.getOMElement(
106:                            TestParticalSequenceMaxOccurs2.MY_QNAME,
107:                            OMAbstractFactory.getOMFactory());
108:                    String omElementString = omElement.toStringWithConsume();
109:                    System.out.println("OM String ==> " + omElementString);
110:                    XMLStreamReader xmlReader = StAXUtils
111:                            .createXMLStreamReader(new ByteArrayInputStream(
112:                                    omElementString.getBytes()));
113:                    TestParticalSequenceMaxOccurs2 result = TestParticalSequenceMaxOccurs2.Factory
114:                            .parse(xmlReader);
115:                    TestParticalSequenceMaxOccursType2Sequence[] resultSequences = result
116:                            .getTestParticalSequenceMaxOccurs2()
117:                            .getTestParticalSequenceMaxOccursType2Sequence();
118:                    assertEquals(resultSequences[0].getParm1()[0], "Param111");
119:                    assertEquals(resultSequences[0].getParm1()[1], "Param112");
120:                    assertEquals(resultSequences[0].getParm1()[2], "Param113");
121:                    assertEquals(resultSequences[1].getParm2()[0], "Param121");
122:                    assertEquals(resultSequences[1].getParm2()[1], "Param122");
123:                    assertEquals(resultSequences[1].getParm2()[2], "Param123");
124:                } catch (XMLStreamException e) {
125:                    e.printStackTrace();
126:                    fail();
127:                } catch (Exception e) {
128:                    e.printStackTrace();
129:                    fail();
130:                }
131:            }
132:
133:            public void testParticleSequenceMaxOccurs3() {
134:                TestParticalSequenceMaxOccurs3 testParticalMaxOccures3 = new TestParticalSequenceMaxOccurs3();
135:                TestParticalSequenceMaxOccursType3 testParticalMaxOccursType3 = new TestParticalSequenceMaxOccursType3();
136:                testParticalMaxOccures3
137:                        .setTestParticalSequenceMaxOccurs3(testParticalMaxOccursType3);
138:
139:                TestParticalSequenceMaxOccursType3Sequence[] testSequences = new TestParticalSequenceMaxOccursType3Sequence[2];
140:
141:                testSequences[0] = new TestParticalSequenceMaxOccursType3Sequence();
142:                testSequences[0].setParm2(new String[] { "Param111", null,
143:                        "Param113" });
144:
145:                testSequences[1] = new TestParticalSequenceMaxOccursType3Sequence();
146:                testSequences[1].setParm1(new String[] { "Param121",
147:                        "Param122", null });
148:
149:                testParticalMaxOccursType3
150:                        .setTestParticalSequenceMaxOccursType3Sequence(testSequences);
151:
152:                try {
153:                    OMElement omElement = testParticalMaxOccures3.getOMElement(
154:                            TestParticalSequenceMaxOccurs3.MY_QNAME,
155:                            OMAbstractFactory.getOMFactory());
156:                    String omElementString = omElement.toStringWithConsume();
157:                    System.out.println("OM String ==> " + omElementString);
158:                    XMLStreamReader xmlReader = StAXUtils
159:                            .createXMLStreamReader(new ByteArrayInputStream(
160:                                    omElementString.getBytes()));
161:                    TestParticalSequenceMaxOccurs3 result = TestParticalSequenceMaxOccurs3.Factory
162:                            .parse(xmlReader);
163:                    TestParticalSequenceMaxOccursType3Sequence[] resultSequences = result
164:                            .getTestParticalSequenceMaxOccurs3()
165:                            .getTestParticalSequenceMaxOccursType3Sequence();
166:                    assertEquals(resultSequences[0].getParm2()[0], "Param111");
167:                    assertEquals(resultSequences[0].getParm2()[1], null);
168:                    assertEquals(resultSequences[0].getParm2()[2], "Param113");
169:                    assertEquals(resultSequences[1].getParm1()[0], "Param121");
170:                    assertEquals(resultSequences[1].getParm1()[1], "Param122");
171:                    assertEquals(resultSequences[1].getParm1()[2], null);
172:                } catch (XMLStreamException e) {
173:                    fail();
174:                } catch (Exception e) {
175:                    fail();
176:                }
177:            }
178:
179:            public void testParticleSequenceMaxOccurs4() {
180:
181:                TestParticalSequenceMaxOccurs4 testParticalSequenceMaxOccurs4 = new TestParticalSequenceMaxOccurs4();
182:                TestParticalSequenceMaxOccursType4 testParticalSequenceMaxOccursType4 = new TestParticalSequenceMaxOccursType4();
183:                testParticalSequenceMaxOccurs4
184:                        .setTestParticalSequenceMaxOccurs4(testParticalSequenceMaxOccursType4);
185:
186:                TestParticalSequenceMaxOccursType4Sequence[] testParticalSequenceMaxOccursType4Sequence = new TestParticalSequenceMaxOccursType4Sequence[3];
187:
188:                testParticalSequenceMaxOccursType4
189:                        .setTestParticalSequenceMaxOccursType4Sequence(testParticalSequenceMaxOccursType4Sequence);
190:                testParticalSequenceMaxOccursType4Sequence[0] = new TestParticalSequenceMaxOccursType4Sequence();
191:                testParticalSequenceMaxOccursType4Sequence[0]
192:                        .setParm1(getNewCustomType());
193:
194:                testParticalSequenceMaxOccursType4Sequence[1] = new TestParticalSequenceMaxOccursType4Sequence();
195:                testParticalSequenceMaxOccursType4Sequence[1]
196:                        .setParm2("Param2");
197:
198:                testParticalSequenceMaxOccursType4Sequence[2] = new TestParticalSequenceMaxOccursType4Sequence();
199:                testParticalSequenceMaxOccursType4Sequence[2]
200:                        .setParm3(getNewCustomType());
201:
202:                try {
203:                    OMElement omElement = testParticalSequenceMaxOccurs4
204:                            .getOMElement(
205:                                    TestParticalSequenceMaxOccurs4.MY_QNAME,
206:                                    OMAbstractFactory.getOMFactory());
207:                    String omElementString = omElement.toStringWithConsume();
208:                    System.out.println("OM String ==> " + omElementString);
209:                    XMLStreamReader xmlReader = StAXUtils
210:                            .createXMLStreamReader(new ByteArrayInputStream(
211:                                    omElementString.getBytes()));
212:                    TestParticalSequenceMaxOccurs4 result = TestParticalSequenceMaxOccurs4.Factory
213:                            .parse(xmlReader);
214:                    TestParticalSequenceMaxOccursType4Sequence[] resultSequences = result
215:                            .getTestParticalSequenceMaxOccurs4()
216:                            .getTestParticalSequenceMaxOccursType4Sequence();
217:                    assertTrue(isEqual(resultSequences[0].getParm1(),
218:                            testParticalSequenceMaxOccursType4Sequence[0]
219:                                    .getParm1()));
220:                    assertTrue(isEqual(resultSequences[0].getParm2(),
221:                            testParticalSequenceMaxOccursType4Sequence[0]
222:                                    .getParm2()));
223:                    assertTrue(isEqual(resultSequences[0].getParm3(),
224:                            testParticalSequenceMaxOccursType4Sequence[0]
225:                                    .getParm3()));
226:
227:                    assertTrue(isEqual(resultSequences[1].getParm1(),
228:                            testParticalSequenceMaxOccursType4Sequence[1]
229:                                    .getParm1()));
230:                    assertTrue(isEqual(resultSequences[1].getParm2(),
231:                            testParticalSequenceMaxOccursType4Sequence[1]
232:                                    .getParm2()));
233:                    assertTrue(isEqual(resultSequences[1].getParm3(),
234:                            testParticalSequenceMaxOccursType4Sequence[1]
235:                                    .getParm3()));
236:
237:                    assertTrue(isEqual(resultSequences[2].getParm1(),
238:                            testParticalSequenceMaxOccursType4Sequence[2]
239:                                    .getParm1()));
240:                    assertTrue(isEqual(resultSequences[2].getParm2(),
241:                            testParticalSequenceMaxOccursType4Sequence[2]
242:                                    .getParm2()));
243:                    assertTrue(isEqual(resultSequences[2].getParm3(),
244:                            testParticalSequenceMaxOccursType4Sequence[2]
245:                                    .getParm3()));
246:
247:                } catch (XMLStreamException e) {
248:                    fail();
249:                } catch (Exception e) {
250:                    fail();
251:                }
252:
253:            }
254:
255:            public void testParticleSequenceMaxOccurs5() {
256:
257:                TestParticalSequenceMaxOccurs5 testParticalSequenceMaxOccurs5 = new TestParticalSequenceMaxOccurs5();
258:                TestParticalSequenceMaxOccursType5 testParticalSequenceMaxOccursType5 = new TestParticalSequenceMaxOccursType5();
259:                testParticalSequenceMaxOccurs5
260:                        .setTestParticalSequenceMaxOccurs5(testParticalSequenceMaxOccursType5);
261:
262:                TestParticalSequenceMaxOccursType5Sequence[] testParticalSequenceMaxOccursType5Sequence = new TestParticalSequenceMaxOccursType5Sequence[3];
263:
264:                testParticalSequenceMaxOccursType5
265:                        .setTestParticalSequenceMaxOccursType5Sequence(testParticalSequenceMaxOccursType5Sequence);
266:
267:                testParticalSequenceMaxOccursType5Sequence[0] = new TestParticalSequenceMaxOccursType5Sequence();
268:                testParticalSequenceMaxOccursType5Sequence[0]
269:                        .setParm1(new TestCustomType[] { getNewCustomType() });
270:                testParticalSequenceMaxOccursType5Sequence[0]
271:                        .setParm3(new TestCustomType[] { getNewCustomType() });
272:
273:                testParticalSequenceMaxOccursType5Sequence[1] = new TestParticalSequenceMaxOccursType5Sequence();
274:                testParticalSequenceMaxOccursType5Sequence[1]
275:                        .setParm1(new TestCustomType[] { getNewCustomType() });
276:                testParticalSequenceMaxOccursType5Sequence[1]
277:                        .setParm2("Param2");
278:                testParticalSequenceMaxOccursType5Sequence[1]
279:                        .setParm3(new TestCustomType[] { getNewCustomType() });
280:
281:                testParticalSequenceMaxOccursType5Sequence[2] = new TestParticalSequenceMaxOccursType5Sequence();
282:                testParticalSequenceMaxOccursType5Sequence[2]
283:                        .setParm1(new TestCustomType[] { getNewCustomType() });
284:                testParticalSequenceMaxOccursType5Sequence[2]
285:                        .setParm3(new TestCustomType[] { getNewCustomType() });
286:
287:                try {
288:                    OMElement omElement = testParticalSequenceMaxOccurs5
289:                            .getOMElement(
290:                                    TestParticalSequenceMaxOccurs5.MY_QNAME,
291:                                    OMAbstractFactory.getOMFactory());
292:                    String omElementString = omElement.toStringWithConsume();
293:                    System.out.println("OM String ==> " + omElementString);
294:                    XMLStreamReader xmlReader = StAXUtils
295:                            .createXMLStreamReader(new ByteArrayInputStream(
296:                                    omElementString.getBytes()));
297:                    TestParticalSequenceMaxOccurs5 result = TestParticalSequenceMaxOccurs5.Factory
298:                            .parse(xmlReader);
299:                    TestParticalSequenceMaxOccursType5Sequence[] resultSequences = result
300:                            .getTestParticalSequenceMaxOccurs5()
301:                            .getTestParticalSequenceMaxOccursType5Sequence();
302:                    assertTrue(isEqual(resultSequences[0].getParm1(),
303:                            testParticalSequenceMaxOccursType5Sequence[0]
304:                                    .getParm1()));
305:                    assertTrue(isEqual(resultSequences[0].getParm2(),
306:                            testParticalSequenceMaxOccursType5Sequence[0]
307:                                    .getParm2()));
308:                    assertTrue(isEqual(resultSequences[0].getParm3(),
309:                            testParticalSequenceMaxOccursType5Sequence[0]
310:                                    .getParm3()));
311:
312:                    assertTrue(isEqual(resultSequences[1].getParm1(),
313:                            testParticalSequenceMaxOccursType5Sequence[1]
314:                                    .getParm1()));
315:                    assertTrue(isEqual(resultSequences[1].getParm2(),
316:                            testParticalSequenceMaxOccursType5Sequence[1]
317:                                    .getParm2()));
318:                    assertTrue(isEqual(resultSequences[1].getParm3(),
319:                            testParticalSequenceMaxOccursType5Sequence[1]
320:                                    .getParm3()));
321:
322:                    assertTrue(isEqual(resultSequences[2].getParm1(),
323:                            testParticalSequenceMaxOccursType5Sequence[2]
324:                                    .getParm1()));
325:                    assertTrue(isEqual(resultSequences[2].getParm2(),
326:                            testParticalSequenceMaxOccursType5Sequence[2]
327:                                    .getParm2()));
328:                    assertTrue(isEqual(resultSequences[2].getParm3(),
329:                            testParticalSequenceMaxOccursType5Sequence[2]
330:                                    .getParm3()));
331:
332:                } catch (XMLStreamException e) {
333:                    e.printStackTrace();
334:                    fail();
335:                } catch (Exception e) {
336:                    e.printStackTrace();
337:                    fail();
338:                }
339:
340:            }
341:
342:            public void testParticalSequenceMaxOccursTest6() {
343:                TestParticalSequenceMaxOccurs6 testParticalMaxOccures6 = new TestParticalSequenceMaxOccurs6();
344:                TestParticalSequenceMaxOccursType6 testParticalMaxOccursType6 = new TestParticalSequenceMaxOccursType6();
345:                testParticalMaxOccures6
346:                        .setTestParticalSequenceMaxOccurs6(testParticalMaxOccursType6);
347:
348:                TestParticalSequenceMaxOccursType6Sequence[] testSequences = new TestParticalSequenceMaxOccursType6Sequence[2];
349:
350:                testSequences[0] = new TestParticalSequenceMaxOccursType6Sequence();
351:                testSequences[0].setParm1("Param11");
352:                testSequences[0].setParm2("Param12");
353:
354:                testSequences[1] = new TestParticalSequenceMaxOccursType6Sequence();
355:                testSequences[1].setParm1("Param21");
356:                testSequences[1].setParm2("Param22");
357:
358:                testParticalMaxOccursType6
359:                        .setTestParticalSequenceMaxOccursType6Sequence(testSequences);
360:                testParticalMaxOccursType6.setAttribute1("Attribute1");
361:                testParticalMaxOccursType6.setAttribute2("Attribute2");
362:
363:                try {
364:                    OMElement omElement = testParticalMaxOccures6.getOMElement(
365:                            TestParticalSequenceMaxOccurs6.MY_QNAME,
366:                            OMAbstractFactory.getOMFactory());
367:                    String omElementString = omElement.toStringWithConsume();
368:                    System.out.println("OM String ==> " + omElementString);
369:                    XMLStreamReader xmlReader = StAXUtils
370:                            .createXMLStreamReader(new ByteArrayInputStream(
371:                                    omElementString.getBytes()));
372:                    TestParticalSequenceMaxOccurs6 result = TestParticalSequenceMaxOccurs6.Factory
373:                            .parse(xmlReader);
374:                    TestParticalSequenceMaxOccursType6Sequence[] resultSequences = result
375:                            .getTestParticalSequenceMaxOccurs6()
376:                            .getTestParticalSequenceMaxOccursType6Sequence();
377:                    assertEquals(resultSequences[0].getParm1(), "Param11");
378:                    assertEquals(resultSequences[0].getParm2(), "Param12");
379:                    assertEquals(resultSequences[1].getParm1(), "Param21");
380:                    assertEquals(resultSequences[1].getParm2(), "Param22");
381:                    assertEquals(result.getTestParticalSequenceMaxOccurs6()
382:                            .getAttribute1(), "Attribute1");
383:                    assertEquals(result.getTestParticalSequenceMaxOccurs6()
384:                            .getAttribute2(), "Attribute2");
385:                } catch (XMLStreamException e) {
386:                    fail();
387:                } catch (Exception e) {
388:                    fail();
389:                }
390:            }
391:
392:            public void testParticalMaxOccursTest() {
393:                TestParticalChoiceMaxOccurs testParticalChoiceMaxOccurs = new TestParticalChoiceMaxOccurs();
394:                TestParticalChoiceMaxOccursType testParticalChoiceMaxOccursType = new TestParticalChoiceMaxOccursType();
395:                testParticalChoiceMaxOccurs
396:                        .setTestParticalChoiceMaxOccurs(testParticalChoiceMaxOccursType);
397:
398:                testParticalChoiceMaxOccursType.setParm1("Param1");
399:
400:                try {
401:                    OMElement omElement = testParticalChoiceMaxOccurs
402:                            .getOMElement(TestParticalChoiceMaxOccurs.MY_QNAME,
403:                                    OMAbstractFactory.getOMFactory());
404:                    String omElementString = omElement.toStringWithConsume();
405:                    System.out.println("OM string ==> " + omElementString);
406:                    XMLStreamReader xmlReader = StAXUtils
407:                            .createXMLStreamReader(new ByteArrayInputStream(
408:                                    omElementString.getBytes()));
409:                    TestParticalChoiceMaxOccurs result = TestParticalChoiceMaxOccurs.Factory
410:                            .parse(xmlReader);
411:                    assertEquals(result.getTestParticalChoiceMaxOccurs()
412:                            .getParm1(), "Param1");
413:                } catch (XMLStreamException e) {
414:                    fail();
415:                } catch (Exception e) {
416:                    fail();
417:                }
418:            }
419:
420:            public void testParticalChoiceMaxOccursTest1() {
421:                TestParticalChoiceMaxOccurs1 testParticalMaxOccures1 = new TestParticalChoiceMaxOccurs1();
422:                TestParticalChoiceMaxOccursType1 testParticalMaxOccursType1 = new TestParticalChoiceMaxOccursType1();
423:                testParticalMaxOccures1
424:                        .setTestParticalChoiceMaxOccurs1(testParticalMaxOccursType1);
425:
426:                TestParticalChoiceMaxOccursType1Choice[] testChoices = new TestParticalChoiceMaxOccursType1Choice[2];
427:
428:                testChoices[0] = new TestParticalChoiceMaxOccursType1Choice();
429:                testChoices[0].setParm1("Param11");
430:
431:                testChoices[1] = new TestParticalChoiceMaxOccursType1Choice();
432:                testChoices[1].setParm2("Param12");
433:
434:                testParticalMaxOccursType1
435:                        .setTestParticalChoiceMaxOccursType1Choice(testChoices);
436:
437:                try {
438:                    OMElement omElement = testParticalMaxOccures1.getOMElement(
439:                            TestParticalChoiceMaxOccurs1.MY_QNAME,
440:                            OMAbstractFactory.getOMFactory());
441:                    String omElementString = omElement.toStringWithConsume();
442:                    System.out.println("OM String ==> " + omElementString);
443:                    XMLStreamReader xmlReader = StAXUtils
444:                            .createXMLStreamReader(new ByteArrayInputStream(
445:                                    omElementString.getBytes()));
446:                    TestParticalChoiceMaxOccurs1 result = TestParticalChoiceMaxOccurs1.Factory
447:                            .parse(xmlReader);
448:                    TestParticalChoiceMaxOccursType1Choice[] resultChoices = result
449:                            .getTestParticalChoiceMaxOccurs1()
450:                            .getTestParticalChoiceMaxOccursType1Choice();
451:                    assertEquals(resultChoices[0].getParm1(), "Param11");
452:                    assertEquals(resultChoices[1].getParm2(), "Param12");
453:                } catch (XMLStreamException e) {
454:                    fail();
455:                } catch (Exception e) {
456:                    fail();
457:                }
458:            }
459:
460:            public void testParticleChoiceMaxOccurs2() {
461:                TestParticalChoiceMaxOccurs2 testParticalMaxOccures2 = new TestParticalChoiceMaxOccurs2();
462:                TestParticalChoiceMaxOccursType2 testParticalMaxOccursType2 = new TestParticalChoiceMaxOccursType2();
463:                testParticalMaxOccures2
464:                        .setTestParticalChoiceMaxOccurs2(testParticalMaxOccursType2);
465:
466:                TestParticalChoiceMaxOccursType2Choice[] testChoices = new TestParticalChoiceMaxOccursType2Choice[2];
467:
468:                testChoices[0] = new TestParticalChoiceMaxOccursType2Choice();
469:                testChoices[0].setParm1(new String[] { "Param111", "Param112",
470:                        "Param113" });
471:
472:                testChoices[1] = new TestParticalChoiceMaxOccursType2Choice();
473:                testChoices[1].setParm2(new String[] { "Param121", "Param122",
474:                        "Param123" });
475:
476:                testParticalMaxOccursType2
477:                        .setTestParticalChoiceMaxOccursType2Choice(testChoices);
478:
479:                try {
480:                    OMElement omElement = testParticalMaxOccures2.getOMElement(
481:                            TestParticalChoiceMaxOccurs2.MY_QNAME,
482:                            OMAbstractFactory.getOMFactory());
483:                    String omElementString = omElement.toStringWithConsume();
484:                    System.out.println("OM String ==> " + omElementString);
485:                    XMLStreamReader xmlReader = StAXUtils
486:                            .createXMLStreamReader(new ByteArrayInputStream(
487:                                    omElementString.getBytes()));
488:                    TestParticalChoiceMaxOccurs2 result = TestParticalChoiceMaxOccurs2.Factory
489:                            .parse(xmlReader);
490:                    TestParticalChoiceMaxOccursType2Choice[] resultChoices = result
491:                            .getTestParticalChoiceMaxOccurs2()
492:                            .getTestParticalChoiceMaxOccursType2Choice();
493:                    assertEquals(resultChoices[0].getParm1()[0], "Param111");
494:                    assertEquals(resultChoices[0].getParm1()[1], "Param112");
495:                    assertEquals(resultChoices[0].getParm1()[2], "Param113");
496:                    assertEquals(resultChoices[1].getParm2()[0], "Param121");
497:                    assertEquals(resultChoices[1].getParm2()[1], "Param122");
498:                    assertEquals(resultChoices[1].getParm2()[2], "Param123");
499:                } catch (XMLStreamException e) {
500:                    fail();
501:                } catch (Exception e) {
502:                    fail();
503:                }
504:            }
505:
506:            public void testParticleChoiceMaxOccurs3() {
507:                TestParticalChoiceMaxOccurs3 testParticalMaxOccures3 = new TestParticalChoiceMaxOccurs3();
508:                TestParticalChoiceMaxOccursType3 testParticalMaxOccursType3 = new TestParticalChoiceMaxOccursType3();
509:                testParticalMaxOccures3
510:                        .setTestParticalChoiceMaxOccurs3(testParticalMaxOccursType3);
511:
512:                TestParticalChoiceMaxOccursType3Choice[] testChoices = new TestParticalChoiceMaxOccursType3Choice[2];
513:
514:                testChoices[0] = new TestParticalChoiceMaxOccursType3Choice();
515:                testChoices[0].setParm1(new String[] { "Param111", null,
516:                        "Param113" });
517:
518:                testChoices[1] = new TestParticalChoiceMaxOccursType3Choice();
519:                testChoices[1].setParm2(new String[] { "Param121", "Param122",
520:                        null });
521:
522:                testParticalMaxOccursType3
523:                        .setTestParticalChoiceMaxOccursType3Choice(testChoices);
524:
525:                try {
526:                    OMElement omElement = testParticalMaxOccures3.getOMElement(
527:                            TestParticalChoiceMaxOccurs3.MY_QNAME,
528:                            OMAbstractFactory.getOMFactory());
529:                    String omElementString = omElement.toStringWithConsume();
530:                    System.out.println("OM String ==> " + omElementString);
531:                    XMLStreamReader xmlReader = StAXUtils
532:                            .createXMLStreamReader(new ByteArrayInputStream(
533:                                    omElementString.getBytes()));
534:                    TestParticalChoiceMaxOccurs3 result = TestParticalChoiceMaxOccurs3.Factory
535:                            .parse(xmlReader);
536:                    TestParticalChoiceMaxOccursType3Choice[] resultChoices = result
537:                            .getTestParticalChoiceMaxOccurs3()
538:                            .getTestParticalChoiceMaxOccursType3Choice();
539:                    assertEquals(resultChoices[0].getParm1()[0], "Param111");
540:                    assertEquals(resultChoices[0].getParm1()[1], null);
541:                    assertEquals(resultChoices[0].getParm1()[2], "Param113");
542:                    assertEquals(resultChoices[1].getParm2()[0], "Param121");
543:                    assertEquals(resultChoices[1].getParm2()[1], "Param122");
544:                    assertEquals(resultChoices[1].getParm2()[2], null);
545:                } catch (XMLStreamException e) {
546:                    fail();
547:                } catch (Exception e) {
548:                    fail();
549:                }
550:            }
551:
552:            public void testParticleChoiceMaxOccurs4() {
553:
554:                TestParticalChoiceMaxOccurs4 testParticalChoiceMaxOccurs4 = new TestParticalChoiceMaxOccurs4();
555:                TestParticalChoiceMaxOccursType4 testParticalChoiceMaxOccursType4 = new TestParticalChoiceMaxOccursType4();
556:                testParticalChoiceMaxOccurs4
557:                        .setTestParticalChoiceMaxOccurs4(testParticalChoiceMaxOccursType4);
558:
559:                TestParticalChoiceMaxOccursType4Choice[] testParticalChoiceMaxOccursType4Choice = new TestParticalChoiceMaxOccursType4Choice[3];
560:
561:                testParticalChoiceMaxOccursType4
562:                        .setTestParticalChoiceMaxOccursType4Choice(testParticalChoiceMaxOccursType4Choice);
563:                testParticalChoiceMaxOccursType4Choice[0] = new TestParticalChoiceMaxOccursType4Choice();
564:                testParticalChoiceMaxOccursType4Choice[0]
565:                        .setParm1(getNewCustomType());
566:
567:                testParticalChoiceMaxOccursType4Choice[1] = new TestParticalChoiceMaxOccursType4Choice();
568:                testParticalChoiceMaxOccursType4Choice[1].setParm2("Param2");
569:
570:                testParticalChoiceMaxOccursType4Choice[2] = new TestParticalChoiceMaxOccursType4Choice();
571:                testParticalChoiceMaxOccursType4Choice[2]
572:                        .setParm3(getNewCustomType());
573:
574:                try {
575:                    OMElement omElement = testParticalChoiceMaxOccurs4
576:                            .getOMElement(
577:                                    TestParticalChoiceMaxOccurs4.MY_QNAME,
578:                                    OMAbstractFactory.getOMFactory());
579:                    String omElementString = omElement.toStringWithConsume();
580:                    System.out.println("OM String ==> " + omElementString);
581:                    XMLStreamReader xmlReader = StAXUtils
582:                            .createXMLStreamReader(new ByteArrayInputStream(
583:                                    omElementString.getBytes()));
584:                    TestParticalChoiceMaxOccurs4 result = TestParticalChoiceMaxOccurs4.Factory
585:                            .parse(xmlReader);
586:                    TestParticalChoiceMaxOccursType4Choice[] resultChoices = result
587:                            .getTestParticalChoiceMaxOccurs4()
588:                            .getTestParticalChoiceMaxOccursType4Choice();
589:                    assertTrue(isEqual(resultChoices[0].getParm1(),
590:                            testParticalChoiceMaxOccursType4Choice[0]
591:                                    .getParm1()));
592:                    assertTrue(isEqual(resultChoices[0].getParm2(),
593:                            testParticalChoiceMaxOccursType4Choice[0]
594:                                    .getParm2()));
595:                    assertTrue(isEqual(resultChoices[0].getParm3(),
596:                            testParticalChoiceMaxOccursType4Choice[0]
597:                                    .getParm3()));
598:
599:                    assertTrue(isEqual(resultChoices[1].getParm1(),
600:                            testParticalChoiceMaxOccursType4Choice[1]
601:                                    .getParm1()));
602:                    assertTrue(isEqual(resultChoices[1].getParm2(),
603:                            testParticalChoiceMaxOccursType4Choice[1]
604:                                    .getParm2()));
605:                    assertTrue(isEqual(resultChoices[1].getParm3(),
606:                            testParticalChoiceMaxOccursType4Choice[1]
607:                                    .getParm3()));
608:
609:                    assertTrue(isEqual(resultChoices[2].getParm1(),
610:                            testParticalChoiceMaxOccursType4Choice[2]
611:                                    .getParm1()));
612:                    assertTrue(isEqual(resultChoices[2].getParm2(),
613:                            testParticalChoiceMaxOccursType4Choice[2]
614:                                    .getParm2()));
615:                    assertTrue(isEqual(resultChoices[2].getParm3(),
616:                            testParticalChoiceMaxOccursType4Choice[2]
617:                                    .getParm3()));
618:
619:                } catch (XMLStreamException e) {
620:                    fail();
621:                } catch (Exception e) {
622:                    fail();
623:                }
624:
625:            }
626:
627:            public void testParticleChoiceMaxOccurs5() {
628:
629:                TestParticalChoiceMaxOccurs5 testParticalChoiceMaxOccurs5 = new TestParticalChoiceMaxOccurs5();
630:                TestParticalChoiceMaxOccursType5 testParticalChoiceMaxOccursType5 = new TestParticalChoiceMaxOccursType5();
631:                testParticalChoiceMaxOccurs5
632:                        .setTestParticalChoiceMaxOccurs5(testParticalChoiceMaxOccursType5);
633:
634:                TestParticalChoiceMaxOccursType5Choice[] testParticalChoiceMaxOccursType5Choice = new TestParticalChoiceMaxOccursType5Choice[3];
635:
636:                testParticalChoiceMaxOccursType5
637:                        .setTestParticalChoiceMaxOccursType5Choice(testParticalChoiceMaxOccursType5Choice);
638:
639:                testParticalChoiceMaxOccursType5Choice[0] = new TestParticalChoiceMaxOccursType5Choice();
640:                testParticalChoiceMaxOccursType5Choice[0]
641:                        .setParm1(new TestCustomType[] { getNewCustomType() });
642:
643:                testParticalChoiceMaxOccursType5Choice[1] = new TestParticalChoiceMaxOccursType5Choice();
644:                testParticalChoiceMaxOccursType5Choice[1].setParm2("Param2");
645:
646:                testParticalChoiceMaxOccursType5Choice[2] = new TestParticalChoiceMaxOccursType5Choice();
647:                testParticalChoiceMaxOccursType5Choice[2]
648:                        .setParm3(new TestCustomType[] { getNewCustomType() });
649:
650:                try {
651:                    OMElement omElement = testParticalChoiceMaxOccurs5
652:                            .getOMElement(
653:                                    TestParticalChoiceMaxOccurs5.MY_QNAME,
654:                                    OMAbstractFactory.getOMFactory());
655:                    String omElementString = omElement.toStringWithConsume();
656:                    System.out.println("OM String ==> " + omElementString);
657:                    XMLStreamReader xmlReader = StAXUtils
658:                            .createXMLStreamReader(new ByteArrayInputStream(
659:                                    omElementString.getBytes()));
660:                    TestParticalChoiceMaxOccurs5 result = TestParticalChoiceMaxOccurs5.Factory
661:                            .parse(xmlReader);
662:                    TestParticalChoiceMaxOccursType5Choice[] resultChoices = result
663:                            .getTestParticalChoiceMaxOccurs5()
664:                            .getTestParticalChoiceMaxOccursType5Choice();
665:                    assertTrue(isEqual(resultChoices[0].getParm1(),
666:                            testParticalChoiceMaxOccursType5Choice[0]
667:                                    .getParm1()));
668:                    assertTrue(isEqual(resultChoices[0].getParm2(),
669:                            testParticalChoiceMaxOccursType5Choice[0]
670:                                    .getParm2()));
671:                    assertTrue(isEqual(resultChoices[0].getParm3(),
672:                            testParticalChoiceMaxOccursType5Choice[0]
673:                                    .getParm3()));
674:
675:                    assertTrue(isEqual(resultChoices[1].getParm1(),
676:                            testParticalChoiceMaxOccursType5Choice[1]
677:                                    .getParm1()));
678:                    assertTrue(isEqual(resultChoices[1].getParm2(),
679:                            testParticalChoiceMaxOccursType5Choice[1]
680:                                    .getParm2()));
681:                    assertTrue(isEqual(resultChoices[1].getParm3(),
682:                            testParticalChoiceMaxOccursType5Choice[1]
683:                                    .getParm3()));
684:
685:                    assertTrue(isEqual(resultChoices[2].getParm1(),
686:                            testParticalChoiceMaxOccursType5Choice[2]
687:                                    .getParm1()));
688:                    assertTrue(isEqual(resultChoices[2].getParm2(),
689:                            testParticalChoiceMaxOccursType5Choice[2]
690:                                    .getParm2()));
691:                    assertTrue(isEqual(resultChoices[2].getParm3(),
692:                            testParticalChoiceMaxOccursType5Choice[2]
693:                                    .getParm3()));
694:
695:                } catch (XMLStreamException e) {
696:                    e.printStackTrace();
697:                    fail();
698:                } catch (Exception e) {
699:                    e.printStackTrace();
700:                    fail();
701:                }
702:
703:            }
704:
705:            public void testParticalChoiceMaxOccursTest6() {
706:                TestParticalChoiceMaxOccurs6 testParticalMaxOccures6 = new TestParticalChoiceMaxOccurs6();
707:                TestParticalChoiceMaxOccursType6 testParticalMaxOccursType6 = new TestParticalChoiceMaxOccursType6();
708:                testParticalMaxOccures6
709:                        .setTestParticalChoiceMaxOccurs6(testParticalMaxOccursType6);
710:
711:                TestParticalChoiceMaxOccursType6Choice[] testChoices = new TestParticalChoiceMaxOccursType6Choice[2];
712:
713:                testChoices[0] = new TestParticalChoiceMaxOccursType6Choice();
714:                testChoices[0].setParm1("Param11");
715:
716:                testChoices[1] = new TestParticalChoiceMaxOccursType6Choice();
717:                testChoices[1].setParm2("Param12");
718:
719:                testParticalMaxOccursType6
720:                        .setTestParticalChoiceMaxOccursType6Choice(testChoices);
721:                testParticalMaxOccursType6.setAttribute1("Attribute1");
722:                testParticalMaxOccursType6.setAttribute2("Attribute2");
723:
724:                try {
725:                    OMElement omElement = testParticalMaxOccures6.getOMElement(
726:                            TestParticalChoiceMaxOccurs6.MY_QNAME,
727:                            OMAbstractFactory.getOMFactory());
728:                    String omElementString = omElement.toStringWithConsume();
729:                    System.out.println("OM String ==> " + omElementString);
730:                    XMLStreamReader xmlReader = StAXUtils
731:                            .createXMLStreamReader(new ByteArrayInputStream(
732:                                    omElementString.getBytes()));
733:                    TestParticalChoiceMaxOccurs6 result = TestParticalChoiceMaxOccurs6.Factory
734:                            .parse(xmlReader);
735:                    TestParticalChoiceMaxOccursType6Choice[] resultChoices = result
736:                            .getTestParticalChoiceMaxOccurs6()
737:                            .getTestParticalChoiceMaxOccursType6Choice();
738:                    assertEquals(resultChoices[0].getParm1(), "Param11");
739:                    assertEquals(resultChoices[1].getParm2(), "Param12");
740:                    assertEquals(result.getTestParticalChoiceMaxOccurs6()
741:                            .getAttribute1(), "Attribute1");
742:                    assertEquals(result.getTestParticalChoiceMaxOccurs6()
743:                            .getAttribute2(), "Attribute2");
744:                } catch (XMLStreamException e) {
745:                    fail();
746:                } catch (Exception e) {
747:                    fail();
748:                }
749:            }
750:
751:            private TestCustomType getNewCustomType() {
752:                i++;
753:                TestCustomType testCustomType = new TestCustomType();
754:                testCustomType.setParam1("Param" + i + "2");
755:                testCustomType.setParam2(new String[] { "Param" + i + "21",
756:                        "Param" + i + "22", "Param" + i + "23" });
757:                testCustomType.setParam3("Param" + i + "3");
758:                return testCustomType;
759:            }
760:
761:            private boolean isEqual(TestCustomType object1,
762:                    TestCustomType object2) {
763:                boolean isEqual = false;
764:                if ((object1 != null) && (object2 != null)) {
765:                    isEqual = isEqual(object1.getParam1(), object2.getParam1())
766:                            && isEqual(object1.getParam2(), object2.getParam2())
767:                            && isEqual(object1.getParam3(), object2.getParam3());
768:                } else if ((object1 == null) && (object2 == null)) {
769:                    isEqual = true;
770:                }
771:                return isEqual;
772:            }
773:
774:            private boolean isEqual(TestCustomType[] object1,
775:                    TestCustomType[] object2) {
776:                boolean isEqual = false;
777:                if ((object1 != null) && (object2 != null)) {
778:                    if (object1.length == object2.length) {
779:                        isEqual = true;
780:                        for (int i = 0; i < object1.length; i++) {
781:                            if (!isEqual(object1[i], object2[i])) {
782:                                isEqual = false;
783:                                break;
784:                            }
785:                        }
786:                    }
787:                } else if ((object1 == null) && (object2 == null)) {
788:                    isEqual = true;
789:                }
790:                return isEqual;
791:            }
792:
793:            private boolean isEqual(String[] object1, String[] object2) {
794:                boolean isEqual = false;
795:                if ((object1 != null) && (object2 != null)) {
796:                    if (object1.length == object2.length) {
797:                        isEqual = true;
798:                        for (int i = 0; i < object1.length; i++) {
799:                            if (!isEqual(object1[i], object2[i])) {
800:                                isEqual = false;
801:                                break;
802:                            }
803:                        }
804:                    }
805:                } else if ((object1 == null) && (object2 == null)) {
806:                    isEqual = true;
807:                }
808:                return isEqual;
809:            }
810:
811:            private boolean isEqual(String object1, String object2) {
812:                boolean isEqual = false;
813:                if ((object1 != null) && (object2 != null)) {
814:                    isEqual = object1.equals(object2);
815:                } else if ((object1 == null) && (object2 == null)) {
816:                    isEqual = true;
817:                }
818:                return isEqual;
819:            }
820:
821:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.