1 package net.wotonomy.web.xml;
2
3
4 import java.io.Serializable;
5 import java.net.URL;
6 import java.util.Date;
7
8 import junit.framework.TestCase;
9
10 public class XMLRPCSelectorTest extends TestCase {
11
12 public XMLRPCSelectorTest(String name) {
13 super(name);
14 }
15
16 protected void setUp() throws Exception {
17 super.setUp();
18 }
19
20 protected void tearDown() throws Exception {
21 super.tearDown();
22 }
23
24 public static void testFoo( ) {
25 try
26 {
27
28 URL url = new URL( "http://localhost:8080/xmlrpctest" );
29
30
31 XMLRPCSelector getFullName =
32 new XMLRPCSelector( "getFullName" );
33 XMLRPCSelector getCreateDate =
34 new XMLRPCSelector( "getCreateDate" );
35 XMLRPCSelector setCreateDate =
36 new XMLRPCSelector( "setCreateDate" );
37 XMLRPCSelector getChildList =
38 new XMLRPCSelector( "getChildList" );
39 XMLRPCSelector setChildList =
40 new XMLRPCSelector( "setChildList" );
41
42
43 System.out.println( getFullName.invoke( url ) );
44
45
46 System.out.println( getCreateDate.invoke( url ) );
47
48 setCreateDate.invoke( url, new java.util.Date() );
49
50 System.out.println( getCreateDate.invoke( url ) );
51
52
53 java.util.List childList = (java.util.List) getChildList.invoke( url );
54 System.out.println( childList );
55
56 childList.add( new MockSerializableObject(new Long(5),"John","Doe", new Date()) );
57 setChildList.invoke( url, childList );
58
59 System.out.println( getChildList.invoke( url ) );
60 }
61 catch (Exception exc)
62 {
63
64 }
65 }
66
67 public static class MockSerializableObject implements Serializable {
68 public String firstname;
69 public String lastname;
70 public Long id;
71 public Date aDate;
72
73 public MockSerializableObject(Long id, String firstname, String lastname, Date date) {
74 super();
75 aDate = date;
76 this.firstname = firstname;
77 this.id = id;
78 this.lastname = lastname;
79 }
80
81 }
82
83 }