| 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; |
| 8 |
|
| 9 |
public class TestCircularRefs extends GenericLocalTest { |
| 10 |
public TestCircularRefs() { |
| 11 |
super("foo"); |
| 12 |
} |
| 13 |
|
| 14 |
public TestCircularRefs(String s) { |
| 15 |
super(s); |
| 16 |
} |
| 17 |
|
| 18 |
public void testCircularVectors() throws Exception { |
| 19 |
try { |
| 20 |
Call call = getCall(); |
| 21 |
Object 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 getCircle() { |
| 39 |
Vector vector1 = new Vector(); |
| 40 |
vector1.addElement("AString"); |
| 41 |
Vector vector2 = new Vector(); |
| 42 |
vector2.addElement(vector1); |
| 43 |
vector1.addElement(vector2); |
| 44 |
return vector2; |
| 45 |
} |
| 46 |
} |