summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web/src/test/java/net/wotonomy/web
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-19 17:56:33 -0400
commitaedc34d55462a75e329bbf342251ff6504cd117e (patch)
treebcc8f1f2352582717b484df302aeea6696b8f000 /projects/net.wotonomy.web/src/test/java/net/wotonomy/web
Initial import from SVN
Diffstat (limited to 'projects/net.wotonomy.web/src/test/java/net/wotonomy/web')
-rw-r--r--projects/net.wotonomy.web/src/test/java/net/wotonomy/web/xml/XMLRPCSelectorTest.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/projects/net.wotonomy.web/src/test/java/net/wotonomy/web/xml/XMLRPCSelectorTest.java b/projects/net.wotonomy.web/src/test/java/net/wotonomy/web/xml/XMLRPCSelectorTest.java
new file mode 100644
index 0000000..989a7ff
--- /dev/null
+++ b/projects/net.wotonomy.web/src/test/java/net/wotonomy/web/xml/XMLRPCSelectorTest.java
@@ -0,0 +1,83 @@
+package net.wotonomy.web.xml;
+
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+public class XMLRPCSelectorTest extends TestCase {
+
+ public XMLRPCSelectorTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public static void testFoo( ) {
+ try
+ {
+ // create url for server
+ URL url = new URL( "http://localhost:8080/xmlrpctest" );
+
+ // set up selectors
+ XMLRPCSelector getFullName =
+ new XMLRPCSelector( "getFullName" );
+ XMLRPCSelector getCreateDate =
+ new XMLRPCSelector( "getCreateDate" );
+ XMLRPCSelector setCreateDate =
+ new XMLRPCSelector( "setCreateDate" );
+ XMLRPCSelector getChildList =
+ new XMLRPCSelector( "getChildList" );
+ XMLRPCSelector setChildList =
+ new XMLRPCSelector( "setChildList" );
+
+ // fetch the full name
+ System.out.println( getFullName.invoke( url ) );
+
+ // fetch the create date
+ System.out.println( getCreateDate.invoke( url ) );
+ // set date to current time
+ setCreateDate.invoke( url, new java.util.Date() );
+ // re-fetch the create date
+ System.out.println( getCreateDate.invoke( url ) );
+
+ // fetch the child list
+ java.util.List childList = (java.util.List) getChildList.invoke( url );
+ System.out.println( childList );
+ // add a new child
+ childList.add( new MockSerializableObject(new Long(5),"John","Doe", new Date()) );
+ setChildList.invoke( url, childList );
+ // re-fetch the child list
+ System.out.println( getChildList.invoke( url ) );
+ }
+ catch (Exception exc)
+ {
+ //exc.printStackTrace();
+ }
+ }
+
+ public static class MockSerializableObject implements Serializable {
+ public String firstname;
+ public String lastname;
+ public Long id;
+ public Date aDate;
+
+ public MockSerializableObject(Long id, String firstname, String lastname, Date date) {
+ super();
+ aDate = date;
+ this.firstname = firstname;
+ this.id = id;
+ this.lastname = lastname;
+ }
+
+ }
+
+}