KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > encoding > TestArray


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 JavaDoc name) {
20         super(name);
21     }
22     
23     public void testArray1() {
24         String JavaDoc tab_items [] = new String JavaDoc[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 JavaDoc[]{in_table});
33         SOAPEnvelope env = new SOAPEnvelope();
34         env.addBodyElement(input);
35         String JavaDoc 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 }
42
Popular Tags