openamf/src/java/org/openamf/io AMFSerializerTest.java,1.3,1.4

[email protected] Sat, 06 Dec 2003 00:27:56 -0800
Newsgroups gmane.comp.java.openamf.cvs
Message-ID <[email protected]>
Update of /cvsroot/openamf/openamf/src/java/org/openamf/io
In directory sc8-pr-cvs1:/tmp/cvs-serv30870/src/java/org/openamf/io

Modified Files:
	AMFSerializerTest.java 
Log Message:
added date, boolean, and XML Document to the AMFMessage


Index: AMFSerializerTest.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/io/AMFSerializerTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AMFSerializerTest.java	30 Nov 2003 06:11:04 -0000	1.3
--- AMFSerializerTest.java	6 Dec 2003 08:27:54 -0000	1.4
***************
*** 2,5 ****
--- 2,8 ----
  
  import java.io.*;
+ import javax.xml.parsers.*;
+ import org.w3c.dom.*;
+ import org.xml.sax.InputSource;
  import org.openamf.*;
  import junit.framework.*;
***************
*** 57,66 ****
    }
  
!   private AMFMessage getTestMessage()
    {
      AMFMessage message = new AMFMessage();
      message.addHeader("testKey", true, "testValue");
!     message.addBody("someService.someMethod", "someResponse", "body value", AMFBody.DATA_TYPE_STRING);
      return message;
    }
  }
--- 60,108 ----
    }
  
!   private AMFMessage getTestMessage() throws Exception 
    {
      AMFMessage message = new AMFMessage();
+     
      message.addHeader("testKey", true, "testValue");
!     
!     message.addBody("someService.someMethod", "someResponse", 
!     				"body value", AMFBody.DATA_TYPE_STRING);
!     
!     AMFBody bodyWithDate = new AMFBody("someService.someMethod",
!     				"someResponse",
!     				new java.util.Date(),
! 					AMFBody.DATA_TYPE_DATE);
!     
!     message.addBody(bodyWithDate);
!     
!     AMFBody bodyWithBoolean = new AMFBody("someService.someMethod",
!     		"someResponse",
!     		java.lang.Boolean.TRUE,
! 			AMFBody.DATA_TYPE_BOOLEAN);
!     
!     message.addBody(bodyWithBoolean);
!     
!     AMFBody bodyWithXML = new AMFBody("someService.someMethod",
!     		"someResponse",
!     		getXMLDocument(),
! 			AMFBody.DATA_TYPE_XML);
!     
!     message.addBody(bodyWithXML);
!     
      return message;
+ 
    }
+   
+   private org.w3c.dom.Document getXMLDocument() throws Exception
+   {
+   	String strXML = "<?xml version=\"1.0\"?><foo><bar>Hello</bar></foo>";
+   	
+   	Document document = null;
+ 	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ 	DocumentBuilder builder = factory.newDocumentBuilder();
+ 	document = builder.parse(new InputSource(new StringReader(strXML)));
+ 	
+ 	return document;
+   }
+   
  }




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/