| 1 |
package test.encoding; |
| 2 |
|
| 3 |
import junit.framework.TestCase; |
| 4 |
import org.apache.axis.components.logger.LogFactory; |
| 5 |
import org.apache.axis.message.RPCElement; |
| 6 |
import org.apache.axis.message.RPCParam; |
| 7 |
import org.apache.axis.message.SOAPEnvelope; |
| 8 |
import org.apache.commons.logging.Log; |
| 9 |
|
| 10 |
|
| 11 |
/** |
| 12 |
* Test the serialization of an array. Test case for Bug 14666 |
| 13 |
* (NullPointerException taken in ArraySerializer when specifying array as input parameter.) |
| 14 |
*/ |
| 15 |
public class TestArray extends TestCase { |
| 16 |
static Log log = |
| 17 |
LogFactory.getLog(TestArray.class.getName()); |
| 18 |
|
| 19 |
public TestArray(String name) { |
| 20 |
super(name); |
| 21 |
} |
| 22 |
|
| 23 |
public void testArray1() { |
| 24 |
String tab_items [] = new String[4]; |
| 25 |
tab_items[0] = "table item 1"; |
| 26 |
tab_items[1] = "table item 2"; |
| 27 |
tab_items[2] = "table item 3"; |
| 28 |
tab_items[3] = "table item 4"; |
| 29 |
|
| 30 |
RPCParam in_table = new RPCParam("http://local_service.com/", "Input_Array", tab_items); |
| 31 |
RPCElement input = new RPCElement("http://localhost:8000/tester", "echoString", |
| 32 |
new Object[]{in_table}); |
| 33 |
SOAPEnvelope env = new SOAPEnvelope(); |
| 34 |
env.addBodyElement(input); |
| 35 |
String text = env.toString(); |
| 36 |
assertTrue(text != null); |
| 37 |
for(int i=0;i<tab_items.length;i++){ |
| 38 |
assertTrue(text.indexOf(tab_items[i])!=-1); |
| 39 |
} |
| 40 |
} |
| 41 |
} |