1 package org.apache.ws.jaxme.junit; 2 3 import org.apache.ws.jaxme.test.recursion.Attribute; 4 import org.apache.ws.jaxme.test.recursion.DirectEmployee; 5 import org.apache.ws.jaxme.test.recursion.IndirectEmployee; 6 import org.apache.ws.jaxme.test.recursion.PotEmployee; 7 8 9 22 public class RecursionTest extends BaseTestCase { 23 25 public RecursionTest(String pName) { super(pName); } 26 27 30 public void testIndirectRecursion() throws Exception { 31 final String xml = 32 "<rec:IndirectEmployee name=\"Bill\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" + 33 " <rec:Manager>\n" + 34 " <rec:Employees name=\"Bud\" id=\"2\">\n" + 35 " <rec:Manager>\n" + 36 " <rec:Employees name=\"Buck\" id=\"3\">\n" + 37 " <rec:Manager/>\n" + 38 " </rec:Employees>\n" + 39 " </rec:Manager>\n" + 40 " </rec:Employees>\n" + 41 " </rec:Manager>\n" + 42 "</rec:IndirectEmployee>"; 43 44 unmarshalMarshalUnmarshal(IndirectEmployee.class, xml); 45 } 46 47 50 public void testDirectRecursion() throws Exception { 51 final String xml = 52 "<rec:DirectEmployee name=\"John\" id=\"4\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" + 53 " <rec:Employees name=\"Jack\" id=\"5\">\n" + 54 " <rec:Employees name=\"Jim\" id=\"6\">\n" + 55 " <rec:Employees name=\"James\" id=\"7\"/>\n" + 56 " </rec:Employees>\n" + 57 " </rec:Employees>\n" + 58 "</rec:DirectEmployee>"; 59 unmarshalMarshalUnmarshal(DirectEmployee.class, xml); 60 } 61 62 65 public void testPotentialRecursion() throws Exception { 66 final String xml1 = 67 "<rec:PotEmployee name=\"John\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" + 68 " <rec:Employees name=\"Francis\" id=\"3\"/>\n" + 69 "</rec:PotEmployee>"; 70 unmarshalMarshalUnmarshal(PotEmployee.class, xml1); 71 final String xml2 = 72 "<rec:PotEmployee name=\"John\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" + 73 " <rec:Manager>\n" + 74 " <rec:Employees name=\"Francis\" id=\"3\"/>\n" + 75 " </rec:Manager>\n" + 76 "</rec:PotEmployee>"; 77 unmarshalMarshalUnmarshal(PotEmployee.class, xml2); 78 } 79 80 82 public void testElementRecursion() throws Exception { 83 final String xml = 84 "<rec:Attribute name=\"Sam\" id=\"1\" xmlns:rec=\"http://ws.apache.org/jaxme/test/recursion\">\n" + 85 " <rec:AttributeList>\n" + 86 " <rec:Attribute name=\"Sonny\" id=\"2\">\n" + 87 " <rec:AttributeList/>\n" + 88 " </rec:Attribute>\n" + 89 " <rec:Attribute name=\"Severine\" id=\"3\">\n" + 90 " <rec:AttributeList/>\n" + 91 " </rec:Attribute>\n" + 92 " </rec:AttributeList>\n" + 93 "</rec:Attribute>"; 94 unmarshalMarshalUnmarshal(Attribute.class, xml); 95 } 96 } 97 | Popular Tags |