KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > encoding > TestCircularRefs


1 package test.encoding;
2
3 import org.apache.axis.AxisFault;
4 import org.apache.axis.client.Call;
5 import test.GenericLocalTest;
6
7 import java.util.Vector JavaDoc;
8
9 public class TestCircularRefs extends GenericLocalTest {
10     public TestCircularRefs() {
11         super("foo");
12     }
13
14     public TestCircularRefs(String JavaDoc s) {
15         super(s);
16     }
17
18     public void testCircularVectors() throws Exception JavaDoc {
19         try {
20             Call call = getCall();
21             Object JavaDoc result = call.invoke("getCircle", null);
22         } catch (AxisFault af){
23             return;
24         }
25         fail("Expected a fault");
26         // This just tests that we don't get exceptions during deserialization
27
// for now. We're still getting nulls for some reason, and once that's
28
// fixed we should uncomment this next line
29

30         // assertTrue("Result wasn't an array", result.getClass().isArray());
31
}
32     
33     /**
34      * Service method. Return a Vector containing an object graph with a loop.
35      *
36      * @return a Vector with circular references
37      */

38     public Vector JavaDoc getCircle() {
39         Vector JavaDoc vector1 = new Vector JavaDoc();
40         vector1.addElement("AString");
41         Vector JavaDoc vector2 = new Vector JavaDoc();
42         vector2.addElement(vector1);
43         vector1.addElement(vector2);
44         return vector2;
45     }
46 }
47
Popular Tags