[jboss-cvs] jboss-seam/src/test/jsUnit ...

Shane Bryzak sbryzak at redhat.com
Sun Jun 17 17:54:04 EDT 2007


  User: sbryzak2
  Date: 07/06/17 17:54:04

  Modified:    src/test/jsUnit  jsUnitSeamRemoting.html
  Log:
  JBSEAM-1249
  
  Revision  Changes    Path
  1.4       +47 -1     jboss-seam/src/test/jsUnit/jsUnitSeamRemoting.html
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: jsUnitSeamRemoting.html
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/test/jsUnit/jsUnitSeamRemoting.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- jsUnitSeamRemoting.html	12 Nov 2006 22:45:14 -0000	1.3
  +++ jsUnitSeamRemoting.html	17 Jun 2007 21:54:04 -0000	1.4
  @@ -7,7 +7,7 @@
   <title>Seam Remoting JsUnit Tests</title>
   <link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
   <script language="JavaScript" type="text/javascript" src="../../../extras/jsUnit/app/jsUnitCore.js"></script>
  -<script language="JavaScript" type="text/javascript" src="../../main/org/jboss/seam/remoting/remote.js"></script>
  +<script language="JavaScript" type="text/javascript" src="../../remoting/org/jboss/seam/remoting/remote.js"></script>
   <script language="JavaScript" type="text/javascript">
   
   /** Confirm that the URL encoding/decoding function we are using works **/
  @@ -167,6 +167,52 @@
     assertEquals(t, Seam.Remoting.getType(instance));
   }
   
  +function testExtractEncodedSessionId() {
  +  assertEquals('abcdefg', Seam.Remoting.extractEncodedSessionId('http://localhost:8080/contextPath/page.seam;jsessionid=abcdefg?foo=bar'));
  +  assertEquals('abcdefg', Seam.Remoting.extractEncodedSessionId('http://localhost:8080/contextPath/page.seam;jsessionid=abcdefg'));
  +  assertEquals(null, Seam.Remoting.extractEncodedSessionId('http://localhost:8080/contextPath/page.seam'));
  +}
  +
  +function testEncodeAjaxRequest() {
  +  var restoreXMLHttpRequest = window.XMLHttpRequest;
  +  window.XMLHttpRequest = dummyXMLHttpRequest;
  +  Seam.Remoting.resourcePath = "/resourcePath";
  +  Seam.Remoting.encodedSessionId = 'abcdefg';
  +  var req = Seam.Remoting.sendAjaxRequest(null, "/execute", null, true); 
  +  assertEquals("POST", req.method);
  +  assertEquals("/resourcePath/execute;jsessionid=abcdefg", req.path);
  +  assertEquals(true, req.async);
  +  window.XMLHttpRequest = restoreXMLHttpRequest;
  +}
  +
  +function testNoEncodeAjaxRequest() {
  +  var restoreXMLHttpRequest = window.XMLHttpRequest;
  +  window.XMLHttpRequest = dummyXMLHttpRequest;
  +  Seam.Remoting.resourcePath = "/resourcePath";
  +  Seam.Remoting.encodedSessionId = null;
  +  var req = Seam.Remoting.sendAjaxRequest(null, "/execute", null, true); 
  +  assertEquals("POST", req.method);
  +  assertEquals("/resourcePath/execute", req.path);
  +  assertEquals(true, req.async);
  +  window.XMLHttpRequest = restoreXMLHttpRequest;
  +}
  +
  +function dummyXMLHttpRequest() {
  +  this.method = null;
  +  this.path = null;
  +  this.async = null;
  +}
  +
  +dummyXMLHttpRequest.prototype = {
  +  open: function(method, path, async) {
  +    this.method = method;
  +    this.path = path;
  +    this.async = async;
  +  },
  +
  +  send: function(envelope) {}
  +}
  +
   </script>
   </head>
   
  
  
  



More information about the jboss-cvs-commits mailing list