You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/06/22 22:01:22 UTC
svn commit: r416480 [1/2] - in /incubator/xap/trunk/testsrc: ./ xap/
xap/requestservice/ xap/session/ xap/util/ xap/util/Vector/ xap/xml/ zimbra/
Author: jmargaris
Date: Thu Jun 22 15:01:21 2006
New Revision: 416480
URL: http://svn.apache.org/viewvc?rev=416480&view=rev
Log:
test source commit
Added:
incubator/xap/trunk/testsrc/
incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html (with props)
incubator/xap/trunk/testsrc/XapUnitTestSuite.html (with props)
incubator/xap/trunk/testsrc/_TestJavaScript.html (with props)
incubator/xap/trunk/testsrc/xap/
incubator/xap/trunk/testsrc/xap/requestservice/
incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html (with props)
incubator/xap/trunk/testsrc/xap/session/
incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html (with props)
incubator/xap/trunk/testsrc/xap/session/_TestContainer.html (with props)
incubator/xap/trunk/testsrc/xap/session/_TestContainer.js (with props)
incubator/xap/trunk/testsrc/xap/util/
incubator/xap/trunk/testsrc/xap/util/Vector/
incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html (with props)
incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html (with props)
incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html (with props)
incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html (with props)
incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html (with props)
incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html (with props)
incubator/xap/trunk/testsrc/xap/util/_TestVector.html (with props)
incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html (with props)
incubator/xap/trunk/testsrc/xap/xml/
incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html (with props)
incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js (with props)
incubator/xap/trunk/testsrc/xap/xml/_TestElement.html (with props)
incubator/xap/trunk/testsrc/xap/xml/_TestElement.js (with props)
incubator/xap/trunk/testsrc/xap/xml/_TestParser.html (with props)
incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html (with props)
incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js (with props)
incubator/xap/trunk/testsrc/xap/xml/parserTester.js (with props)
incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html (with props)
incubator/xap/trunk/testsrc/xap/xml/xmodifyTestCommands.xal
incubator/xap/trunk/testsrc/zimbra/
incubator/xap/trunk/testsrc/zimbra/_TestZimbra.html (with props)
Added: incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html (added)
+++ incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Suite</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript">
+
+ function vectorSuite ( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/xap/util/Vector/_TestJava1_1MethodExistance.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/Vector/_TestVectorInstantiation.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html" );
+ return result;
+ }
+
+ function suite() {
+ var suite = new top.jsUnitTestSuite();
+ var webappContext = "/jsunit";
+
+ suite.addTestSuite( vectorSuite ( webappContext ) );
+ return suite;
+ }
+ </script>
+</head>
+
+<body>
+<h1>XAP JsUnit Test Suite</h1>
+</body>
+</html>
Propchange: incubator/xap/trunk/testsrc/QA_XmlUnitTestSuite.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/XapUnitTestSuite.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/XapUnitTestSuite.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/XapUnitTestSuite.html (added)
+++ incubator/xap/trunk/testsrc/XapUnitTestSuite.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>JsUnit Test Suite</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript">
+
+ function utilSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/xap/util/_TestVector.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/_TestHashtable.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/_TestLogFactory.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/_TestCharacter.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/util/_TestXmlUtils.html" );
+ return result;
+ }
+
+ function xmlSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/xap/xml/_TestParser.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/xml/_TestDocument.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/xml/_TestElement.html" );
+ return result;
+ }
+
+ function mcoSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ return result;
+ }
+
+ function zimbraSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/zimbra/_TestZimbra.html" );
+ return result;
+ }
+
+ function sessionSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/xap/session/_TestClientSession.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/session/_TestContainer.html" );
+ return result;
+ }
+
+ function tagsSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/xap/tags/_TestPluginRegistryImpl.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/tags/_TestAbstractTagImpl.html" );
+ result.addTestPage( webappContext + "/testsrc/xap/tags/_TestPluginDocumentHandler.html" );
+ // result.addTestPage( webappContext + "/testsrc/xap/tags/_TestUiDocumentHandler.html" );
+ return result;
+ }
+
+ function testSuite( webappContext ) {
+ var result = new top.jsUnitTestSuite();
+ result.addTestPage( webappContext + "/testsrc/_TestJavaScript.html" );
+ return result;
+ }
+
+
+ function suite() {
+ var suite = new top.jsUnitTestSuite();
+ var webappContext = "/jsunit";
+
+ //suite.addTestSuite( testSuite( webappContext ));
+ suite.addTestSuite( tagsSuite( webappContext ) );
+ suite.addTestSuite( utilSuite( webappContext ) );
+ suite.addTestSuite( xmlSuite( webappContext ) );
+ suite.addTestSuite( mcoSuite( webappContext ) );
+ suite.addTestSuite( zimbraSuite( webappContext ) );
+ suite.addTestSuite( sessionSuite( webappContext ) );
+
+ return suite;
+ }
+ </script>
+</head>
+
+<body>
+<h1>XAP JsUnit Test Suite</h1>
+</body>
+</html>
Propchange: incubator/xap/trunk/testsrc/XapUnitTestSuite.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/_TestJavaScript.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/_TestJavaScript.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/_TestJavaScript.html (added)
+++ incubator/xap/trunk/testsrc/_TestJavaScript.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Document Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+</head>
+
+<body>
+
+ <script language="JavaScript" type="text/javascript">
+
+ function testJavaScript() {
+ var source = "//bla bla \nfunction Base(){} \nBase.prototype.toString = function(){ return \"Base object\";}";
+ eval( source );
+ var b = new Base();
+ alert("Base:" + b);
+ }
+
+ function Base(){}
+
+ function Extended(){
+ Base.call( this );
+ }
+ Extended.prototype = new Base;
+
+ function testInstanceOf() {
+ var b = new Extended();
+ alert("b instanceof Base:" + (b instanceof Base) );
+ }
+ </script>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/_TestJavaScript.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html (added)
+++ incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Document Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+ function testRequestServiceMethods() {
+ //TODO
+ }
+
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/requestservice/_TestRequestService.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html (added)
+++ incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>ClientSession Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+ function testClientSessionMethods() {
+ DBG = new AjxDebug( AjxDebug.NONE, null, false );
+ var session = new ClientSession( "/xap" );
+ assertTrue( session != null );
+ }
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/session/_TestClientSession.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/session/_TestContainer.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/session/_TestContainer.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/session/_TestContainer.html (added)
+++ incubator/xap/trunk/testsrc/xap/session/_TestContainer.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Element Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+
+ <script language="JavaScript" type="text/javascript" src="_TestContainer.js"></script>
+
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/session/_TestContainer.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/session/_TestContainer.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/session/_TestContainer.js?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/session/_TestContainer.js (added)
+++ incubator/xap/trunk/testsrc/xap/session/_TestContainer.js Thu Jun 22 15:01:21 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+function ContainerListener(){
+ this._lastListenerMethod = null;
+ this._lastName = null;
+}
+
+
+
+ContainerListener.prototype.removedFromContainer = function( container, name){
+ this._lastListenerMethod = this.removedFromContainer;
+ this._lastName = name;
+}
+
+
+ContainerListener.prototype.addedToContainer = function( container, name){
+ this._lastListenerMethod = this.addedToContainer;
+ this._lastName = name;
+}
+
+
+function exposeTestFunctionNames(){
+ return ["testAddAndRemove"];
+}
+
+function testAddAndRemove() {
+
+ var containerObject1 = new ContainerListener();
+ var containerObject2 = new ContainerListener();
+ var containerObject3 = new ContainerListener();
+
+ var container = new Container();
+
+ container.put(null, containerObject1);
+ assertTrue("Called addedToContainer when adding un-named object",
+ containerObject1._lastListenerMethod==containerObject1.addedToContainer);
+
+ assertTrue("Called with name null", containerObject1._lastName==null);
+
+ assertTrue("Container getName() null",
+ container.getName(containerObject1)==null);
+
+ assertTrue("Container getNames() length 0",
+ container.getNames().length==0);
+
+ assertTrue("Container getObjects() length 1",
+ container.getObjects().length==1);
+
+ container.removeValue(containerObject1);
+
+ assertTrue("Called removedFromContainer when adding un-named object",
+ containerObject1._lastListenerMethod==containerObject1.removedFromContainer);
+
+ assertTrue("Called with name null but name was " + containerObject1._lastName, containerObject1._lastName==null);
+
+ assertTrue("Container getName() null",
+ container.getName(containerObject1)==null);
+
+ assertTrue("Container getNames() length 0",
+ container.getNames().length==0);
+
+ assertTrue("Container getObjects() length 0",
+ container.getObjects().length==0);
+
+
+ container.put("containerObject1", containerObject1);
+ assertTrue("Called addedToContainer when adding containerObject1",
+ containerObject1._lastListenerMethod==containerObject1.addedToContainer);
+
+ assertTrue("Called with name containerObject1 when adding", containerObject1._lastName=="containerObject1");
+
+ assertTrue("Container getName() containerObject1",
+ container.getName(containerObject1)=="containerObject1");
+
+ assertTrue("Container getNames() length 1",
+ container.getNames().length==1);
+
+ assertTrue("Container getObjects() length 1",
+ container.getObjects().length==1);
+
+ container.removeValue(containerObject1);
+
+ assertTrue("Called removedFromContainer when removing containerObject1",
+ containerObject1._lastListenerMethod==containerObject1.removedFromContainer);
+
+ assertTrue("Called with name containerObject1 when removing", containerObject1._lastName=="containerObject1");
+
+ assertTrue("Container getName() null",
+ container.getName(containerObject1)==null);
+
+ assertTrue("Container getNames() length 0",
+ container.getNames().length==0);
+
+ assertTrue("Container getObjects() length 0",
+ container.getObjects().length==0);
+
+ container.put("containerObject1", containerObject1);
+ container.put("containerObject2", containerObject2);
+
+ //replace the old thing with the new one
+ container.put("containerObject2", containerObject3)
+
+ assertTrue("repalced the old containerObject2",
+ containerObject2._lastListenerMethod==containerObject2.removedFromContainer);
+
+ assertTrue("replaced called remove with name", containerObject2._lastName=="containerObject2");
+
+ assertTrue("Container getName() null for replaced object",
+ container.getName(containerObject2)==null);
+
+
+ assertTrue("repalced the old containerObject2 with new one",
+ containerObject3._lastListenerMethod==containerObject3.addedToContainer);
+
+ assertTrue("replaced called add with name", containerObject3._lastName=="containerObject2");
+
+ assertTrue("Container getName() containerObject2 for replaced object",
+ container.getName(containerObject3)=="containerObject2");
+
+
+ assertTrue("Container getNames() length 2",
+ container.getNames().length==2);
+
+ assertTrue("Container getObjects() length 2",
+ container.getObjects().length==2);
+
+}
+
+
+
+
+
+
+
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/session/_TestContainer.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,122 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Vector Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testIfMethodDefined_addElement(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 addElement() method exists", v.addElement==null);
+ }
+
+ function testIfMethodDefined_capacity(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 capacity() method exists", v.capacity==null);
+ }
+
+ function testIfMethodDefined_contains(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 contains() method exists", v.contains==null);
+ }
+
+ function testIfMethodDefined_copyInto(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 copyInto() method exists", v.copyInto==null);
+ }
+
+ function testIfMethodDefined_elementAt(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 elementAt() method exists", v.elementAt==null);
+ }
+
+ function testIfMethodDefined_elements(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 elements() method exists", v.elements==null);
+ }
+
+ function testIfMethodDefined_ensureCapacity(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 ensureCapacity() method exists", v.ensureCapacity==null);
+ }
+
+ function testIfMethodDefined_firstElement(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 firstElement() method exists", v.firstElement==null);
+ }
+
+ function testIfMethodDefined_indexOf(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 indexOf() method exists", v.indexOf==null);
+ }
+
+ function testIfMethodDefined_isEmpty(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 isEmpty() method exists", v.isEmpty==null);
+ }
+
+ function testIfMethodDefined_lastElement(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 lastElement() method exists", v.lastElement==null);
+ }
+
+ function testIfMethodDefined_lastIndexOf(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 lastIndexOf() method exists", v.lastIndexOf==null);
+ }
+
+ function testIfMethodDefined_removeAllElements(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 removeAllElements() method exists", v.removeAllElements==null);
+ }
+
+ function testIfMethodDefined_removeElement(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 removeElement() method exists", v.removeElement==null);
+ }
+
+ function testIfMethodDefined_removeElementAt(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 removeElementAt() method exists", v.removeElementAt==null);
+ }
+
+ function testIfMethodDefined_setElementAt(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 setElementAt() method exists", v.setElementAt==null);
+ }
+
+ function testIfMethodDefined_setSize(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 setSize() method exists", v.setSize==null);
+ }
+
+ function testIfMethodDefined_size(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 size() method exists", v.size==null);
+ }
+
+ function testIfMethodDefined_toString(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 toString() method exists", v.toString==null);
+ }
+
+ function testIfMethodDefined_trimToSize(){
+ var v = new Vector(100);
+ assertFalse("test that java 1.1 trimToSize() method exists", v.trimToSize==null);
+ }
+
+ </script>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/Vector/_TestJava1_1VectorMethodExistance.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Vector Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testNegativeInitialSize() {
+ try {
+ var v = new Vector(-1);
+ } catch ( error ) {
+ //the Vector class should probably have its own exceptions for usability
+ //this test checks for the array's error message and fails
+
+ if (error.toString().indexOf("invalid array length") > -1){
+ fail("an invalid array length error was returned, but a vector error should be returned instead")
+ }
+ return;
+ }
+ //if no error is thrown, this test should also fail
+ fail("Error was expected but none was recieved")
+ }
+
+ //trim to negative size
+ //isEmpty on negative size
+
+
+
+
+ </script>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorInstantiation.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,83 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Vector Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testSize100SetAndTrimTo99(){
+
+ var v = new Vector(100);
+ assertTrue("assert initial vector is empty",v.isEmpty());
+
+ for (i=0; i<100; i++){
+ v.addElement("element"+i);
+ }
+ assertEquals("assert vector size = initial size of 100",v.size(),100);
+ v.resize(99);
+ v.trimToSize();
+ assertEquals("assert vector size = trimmed size of 99",v.size(),99);
+ }
+
+ function testSize100SetAndTrimTo1(){
+ var v = new Vector(100);
+ assertTrue("assert initial vector is empty",v.isEmpty());
+
+ for (i=0; i<100; i++){
+ v.addElement("element"+i);
+ }
+
+ assertEquals("assert vector size = initial size of 100",v.size(),100);
+ v.resize(1) ;
+ v.trimToSize();
+ assertEquals("assert vector size = trimmed size of 1",v.size(),1);
+ }
+
+ function testSize100SetAndTrimTo0(){
+ var v = new Vector(100);
+ assertTrue("assert initial vector is empty",v.isEmpty());
+
+ for (i=0; i<100; i++){
+ v.addElement("element"+i);
+ }
+
+ assertEquals("assert vector size = initial size of 100",100,v.size());
+ v.resize(0);
+ v.trimToSize();
+ assertEquals("assert vector size = trimmed size of 0",0,v.size());
+ }
+
+ function testSetAndTrimToNegativeOne(){
+ var v = new Vector(100);
+ assertTrue("assert initial vector is empty",v.isEmpty());
+
+ for (i=0; i<100; i++){
+ v.addElement("element"+i);
+ }
+
+ assertEquals("assert vector size = initial size of 100",v.size(),100);
+
+ try {
+ v.resize(-1);
+ v.trimToSize();
+ } catch ( error ) {
+ return;
+ }
+ fail("Error expected at v.setSize(-1);")
+ }
+
+ </script>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/Vector/_TestVectorSetAndTrimSize.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Character Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testCharacter() {
+ assertTrue( xap.util.Character.isLetter != null );
+ assertTrue( xap.util.Character.isDigit != null );
+ assertTrue( xap.util.Character.isLetterOrDigit != null );
+ }
+
+ function testIsLetter(){
+ assertTrue( xap.util.Character.isLetter('b') );
+ }
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/_TestCharacter.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Hashtable Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+
+ <script language="JavaScript" type="text/javascript">
+ function testHashtableMethods() {
+ var h = new Hashtable();
+
+ assertTrue( h.size != null );
+ assertTrue( h.clear != null );
+ assertTrue( h.containsKey != null );
+ assertTrue( h.containsValue != null );
+ assertTrue( h.get != null );
+ assertTrue( h.put != null );
+ assertTrue( h.remove != null );
+ assertTrue( h.keys != null );
+ assertTrue( h.values != null );
+ assertTrue( h.toString != null );
+ }
+
+ function testPut(){
+ var h = new Hashtable();
+ h.put( "a", "foo" );
+ assertTrue( "foo" == h.get( "a" ) );
+
+ //NOTE these tests used to fail when hashkey
+ //was just based on toString
+ var object1 = new Object();
+ var object2 = new Object();
+
+ h.put(object1,"object1");
+ h.put(object2,"object2");
+
+ assertTrue(h.size()==3);
+ assertTrue(h.get(object1)=="object1");
+ assertTrue(h.get(object2)=="object2");
+ assertTrue(h.keys().length==3);
+ assertTrue(h.values().length==3);
+
+ h.put(object1,"newobject1");
+ assertTrue(h.size()==3);
+ assertTrue(h.get(object1)=="newobject1");
+ assertTrue(h.get(object2)=="object2");
+ }
+
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/_TestHashtable.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Vector Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testLogFactoryMethods() {
+ assertTrue( LogFactory.getLog != null );
+ var log = LogFactory.getLog( "foo" );
+ assertTrue( log != null );
+ assertTrue( log.debug != null );
+ assertTrue( log.info != null );
+ assertTrue( log.exception != null );
+ assertTrue( log.error != null );
+ }
+
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/_TestLogFactory.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/_TestVector.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/_TestVector.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/_TestVector.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/_TestVector.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,120 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Vector Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+ function testIfVectorMethodsDefined() {
+ var v = new Vector(100);
+ //check to see that the functions are defined at all
+ assertFalse(v.size==null);
+ assertFalse(v.addElement==null);
+ assertFalse(v.elementAt==null);
+ assertFalse(v.isEmpty==null);
+ assertFalse(v.getLastElement==null);
+ assertFalse(v.getFirstElement==null);
+ assertFalse(v.insertElementAt==null);
+ assertFalse(v.resize==null);
+ assertFalse(v.removeAllElements==null);
+ assertFalse(v.indexOf==null);
+ }
+
+ function testVectorOperations() {
+ var v = new Vector(100);
+
+ //vector is empty
+ assertTrue(v.size()==0);
+ assertTrue(v.isEmpty());
+
+ //add "James"
+ v.addElement( "James" );
+ assertTrue(v.size()==1);
+ assertFalse(v.isEmpty());
+ assertTrue(v.elementAt(0)=="James");
+ assertTrue(v.getFirstElement()=="James");
+ assertTrue(v.getLastElement()=="James");
+
+ //now add "Dave"
+ v.addElement( "Dave" );
+ assertTrue(v.size()==2);
+ assertTrue(v.elementAt(0)=="James");
+ assertTrue(v.elementAt(1)=="Dave");
+ assertTrue(v.getFirstElement()=="James");
+ assertTrue(v.getLastElement()=="Dave");
+
+ //now insert Igor in between
+ v.insertElementAt( "Igor" , 1);
+ assertTrue(v.size()==3);
+ assertTrue(v.elementAt(0)=="James");
+ assertTrue(v.elementAt(1)=="Igor");
+ assertTrue(v.elementAt(2)=="Dave");
+ assertTrue(v.getFirstElement()=="James");
+ assertTrue(v.getLastElement()=="Dave");
+ assertTrue(v.indexOf("James")==0);
+ assertTrue(v.indexOf("Igor")==1);
+ assertTrue(v.indexOf("Dave")==2);
+ assertTrue(v.indexOf("BLEARGH")==-1);
+ assertTrue(v.contains("James"));
+ assertTrue(v.contains("Igor"));
+ assertTrue(v.contains("Dave"));
+ assertTrue(!v.contains("BLEARGH"));
+
+ }
+
+ function testOutOfBoundsExceptions() {
+ //check for out of bounds exception
+ var v = new Vector(10);
+ var exception = null;
+ try {
+ v.elementAt( 3 );
+ }
+ catch( error ) {
+ return;
+ }
+ fail( "testOutOfBoundsExceptions failed" );
+ }
+
+ function testRemove() {
+ var v = new Vector(100);
+ v.addElement( "James" );
+ v.addElement( "Igor" );
+ v.addElement( "Dave" );
+
+ //now remove james
+ assertTrue(v.removeElementAt(0)=="James");
+ assertTrue(v.size()==2);
+ assertTrue(v.getFirstElement()=="Igor");
+ assertTrue(v.getLastElement()=="Dave");
+
+ //remove all elements
+ v.removeAllElements();
+ assertTrue(v.size()==0);
+ assertTrue(v.getFirstElement()==null);
+ }
+
+ function testOutOfBounds() {
+ var v = new Vector();
+ try {
+ var foo = v.elementAt( -1 );
+ } catch ( e ) {
+ return;
+ }
+ fail("OutOfBoundsException was expected in textOutOfBounds" );
+ }
+
+ </script>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/_TestVector.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html (added)
+++ incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>XmlUtils Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+ <script language="JavaScript" type="text/javascript">
+
+ function testXmlUtilsMethods() {
+ assertTrue( XmlUtils.getIndentation != null );
+ assertTrue( XmlUtils.encode != null );
+ assertTrue( XmlUtils.decode != null );
+ assertTrue( XmlUtils.getIndentation != null );
+ assertTrue( XmlUtils.encodeDoubleQuotes != null );
+ assertTrue( XmlUtils.isValidXmlTagName != null );
+ }
+
+ function testEncode() {
+ var encoded = XmlUtils.encode( "<foo>" );
+ assertEquals( encoded, "<foo>" );
+ }
+
+ function testDecode() {
+ var decoded = XmlUtils.decode( "<foo>" );
+ assertEquals( decoded, "<foo>" );
+ }
+
+ function testIsValidXmlTagName() {
+ var result = XmlUtils.isValidXmlTagName("foo");
+ assertTrue( result );
+ }
+
+ </script>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/util/_TestXmlUtils.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html (added)
+++ incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Element Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+
+ <script language="JavaScript" type="text/javascript" src="_TestDocument.js"></script>
+
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/xml/_TestDocument.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js (added)
+++ incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js Thu Jun 22 15:01:21 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+function exposeTestFunctionNames(){
+ return ["testDocumentMethods",
+ "testCreateDocument",
+ "testSetRootElement",
+ "testAddAttributeChangeListener",
+ "testAddStructureChangeListener",
+ "testRemoveAttributeChangeListener",
+ "testRemoveStructureChangeListener"];
+}
+
+ function testDocumentMethods() {
+ var doc = new Document( null );
+ assertTrue( "doc.addAttributeChangeListener", doc.addAttributeChangeListener != null );
+ assertTrue( "doc._addDocumentFragmentToIdMapAndCheckForPrefixCollisions", doc._addDocumentFragmentToIdMapAndCheckForPrefixCollisions != null );
+ assertTrue( "doc._addIdToElementMapping", doc._addIdToElementMapping != null );
+ assertTrue( "doc._addSystemAttributeChangeListener", doc._addSystemAttributeChangeListener != null );
+ assertTrue( "doc._addSystemStructureChangeListener", doc._addSystemStructureChangeListener != null );
+ assertTrue( "doc.addStructureChangeListener", doc.addStructureChangeListener != null );
+ assertTrue( "doc._checkPrefixForCollisionAndRegister", doc._checkPrefixForCollisionAndRegister != null );
+ assertTrue( "doc._clearSystemListeners", doc._clearSystemListeners != null );
+ assertTrue( "doc.createElement", doc.createElement != null );
+ assertTrue( "doc.getElementById", doc.getElementById != null );
+ assertTrue( "doc._getNamespaceForPrefix", doc._getNamespaceForPrefix != null );
+ assertTrue( "doc._getNotificationListener", doc._getNotificationListener != null );
+ assertTrue( "doc", doc._getPrefixForNamespace != null );
+ assertTrue( "doc.getRootElement", doc.getRootElement != null );
+ assertTrue( "doc._getUidProvider", doc._getUidProvider != null );
+ assertTrue( "doc._notifyListenersOfStructureChange", doc._notifyListenersOfStructureChange != null );
+ assertTrue( "doc._registerPrefix", doc._registerPrefix != null );
+ assertTrue( "doc.removeAttributeChangeListener", doc.removeAttributeChangeListener != null );
+ assertTrue( "doc._removeDocumentFragmentFromIdMap", doc._removeDocumentFragmentFromIdMap != null );
+ assertTrue( "doc._removeExistingRoot", doc._removeExistingRoot != null );
+ assertTrue( "doc._removeSystemAttributeChangeListener", doc._removeSystemAttributeChangeListener != null );
+ assertTrue( "doc._removeSystemStructureChangeListener", doc._removeSystemStructureChangeListener != null );
+ assertTrue( "doc.removeStructureChangeListener", doc.removeStructureChangeListener != null );
+ assertTrue( "doc._setNotificationListener", doc._setNotificationListener != null );
+ assertTrue( "doc.setRootElement", doc.setRootElement != null );
+ assertTrue( "doc.toString", doc.toString != null );
+ assertTrue( "doc._toStringHelper", doc._toStringHelper != null );
+ assertTrue( "doc.toXml", doc.toXml != null );
+ assertTrue( "doc.toXmlWithoutAutoAssignedIds", doc.toXmlWithoutAutoAssignedIds != null );
+}
+
+function testCreateDocument() {
+ var doc = new Document( null ); // no root
+ assertTrue( doc != null );
+}
+
+function testSetRootElement() {
+ var doc = new Document( null );
+ var el = doc.createElement( "myRoot" );
+ doc.setRootElement( el );
+ assertTrue( doc.getRootElement()=== el );
+}
+
+function testAddAttributeChangeListener() {
+ var doc = new Document( null );
+ doc.addAttributeChangeListener( new Object() );
+}
+
+function testAddStructureChangeListener() {
+ var doc = new Document( null );
+ doc.addStructureChangeListener( new Object() );
+}
+
+function testRemoveAttributeChangeListener() {
+ var doc = new Document( null );
+ doc.addAttributeChangeListener( new Object() );
+}
+
+function testRemoveStructureChangeListener() {
+ var doc = new Document( null );
+ var obj = new Object();
+ obj.prototype = new StructureChangeListener();
+ doc.addStructureChangeListener( obj );
+ assertTrue( doc._structureChangeListeners.size() == 1 );
+ doc.removeStructureChangeListener( obj );
+ assertTrue( doc._structureChangeListeners.size() == 0 );
+}
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/xml/_TestDocument.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/_TestElement.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/_TestElement.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/_TestElement.html (added)
+++ incubator/xap/trunk/testsrc/xap/xml/_TestElement.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Element Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+
+ <script language="JavaScript" type="text/javascript" src="_TestElement.js"></script>
+
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap( "/jsunit" );
+ </script>
+</head>
+
+<body>
+
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/xml/_TestElement.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/_TestElement.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/_TestElement.js?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/_TestElement.js (added)
+++ incubator/xap/trunk/testsrc/xap/xml/_TestElement.js Thu Jun 22 15:01:21 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+function exposeTestFunctionNames(){
+ return ["testElementMethods",
+ "testAppendChild",
+ "testRemoveChild",
+ "testSetAttribute",
+ "testClone"];
+}
+
+//TODO we really need to test some advanced things like
+//setting attributes/adding children and having the before/on
+//events change the value, reject them, etc.
+//we should really port our Java unit tests
+/**
+ * Test the existence of various methods, this will catch spelling
+ * errors, typos that lead to bad JS, etc etc
+ */
+function testElementMethods() {
+ var doc = new Document( null );
+ var el = doc.createElement( "bar" );
+ assertTrue( "XapElement._createUniqueElementId", XapElement._createUniqueElementId != null );
+ assertTrue( "XapElement.isGeneratedId", XapElement.isGeneratedId != null );
+ assertTrue( "el.addAttributeChangeListener", el.addAttributeChangeListener != null );
+ assertTrue( "el.addDocumentOwnershipListener", el.addDocumentOwnershipListener != null );
+ assertTrue( "el.addStructureChangeListener", el.addStructureChangeListener != null );
+ assertTrue( "el.appendChild", el.appendChild != null );
+ assertTrue( "el.clone", el.clone != null );
+ assertTrue( "el._cloneHelper", el._cloneHelper != null );
+ assertTrue( "el.deepClone", el.deepClone != null );
+ assertTrue( "el._doAnyAttributeChangeListenersExist", el._doAnyAttributeChangeListenersExist != null );
+ assertTrue( "el._doAnyStructureChangeListenersExist", el._doAnyStructureChangeListenersExist != null );
+ assertTrue( "el._ensureCapacityForPair", el._ensureCapacityForPair != null );
+ assertTrue( "el.getAttribute", el.getAttribute != null );
+ assertTrue( "el.getChildAt", el.getChildAt != null );
+ assertTrue( "el.getChildCount", el.getChildCount != null );
+ assertTrue( "el.getLocalName", el.getLocalName != null );
+ assertTrue( "el.getNamespaceUri", el.getNamespaceUri != null );
+ assertTrue( "el.getOwnerDocument", el.getOwnerDocument != null );
+ assertTrue( "el.getParent", el.getParent != null );
+ assertTrue( "el.getPrefix", el.getPrefix != null );
+ assertTrue( "el.getQName", el.getQName != null );
+ assertTrue( "el._indexOf", el._indexOf != null );
+ assertTrue( "el.indexOfChild", el.indexOfChild != null );
+ assertTrue( "el._indexOfKey", el._indexOfKey != null );
+ assertTrue( "el.removeAttributeChangeListener", el.removeAttributeChangeListener != null );
+ assertTrue( "el.removeChild", el.removeChild != null );
+ assertTrue( "el.removeDocumentOwnershipListener", el.removeDocumentOwnershipListener != null );
+ assertTrue( "el._removePairStartingAtIndexAndReturnLastKey", el._removePairStartingAtIndexAndReturnLastKey != null );
+ assertTrue( "el.removeStructureChangeListener", el.removeStructureChangeListener != null );
+ assertTrue( "el.setAttribute", el.setAttribute != null );
+ assertTrue( "el.toString", el.toString != null );
+ assertTrue( "el.toXml", el.toXml != null );
+ assertTrue( "el.toXmlWithoutAutoAssignedIds", el.toXmlWithoutAutoAssignedIds != null );
+ assertTrue( "el.toXmlWithSimpleAttributeEncoding", el.toXmlWithSimpleAttributeEncoding != null );
+ assertTrue( "el.toXmlWithSimpleAttributeEncodingWithoutAutoAssignedIds", el.toXmlWithSimpleAttributeEncodingWithoutAutoAssignedIds != null );
+}
+
+
+function testAppendChild() {
+ var doc = new Document( null );
+ var el = doc.createElement( "bar" );
+ var el1 = doc.createElement( "foo" );
+ el.appendChild( el1 );
+ assert(el.childNodes.length==1);
+}
+
+function testRemoveChild() {
+ var doc = new Document( null );
+ var el = doc.createElement( "bar" );
+ doc.setRootElement( el );
+ var el1 = doc.createElement( "foo" );
+ el.appendChild( el1 );
+ el.removeChild( el1 );
+ assert(el.childNodes.length==0);
+}
+
+function testSetAttribute() {
+ var doc = new Document( null );
+ var el = doc.createElement("bar");
+ el.setAttribute( "name", "value" );
+ assert(el.getAttribute("name")=="value");
+}
+
+function testClone() {
+ var doc = new Document( null );
+ var el = doc.createElement( "panel" );
+ el.setAttribute("id","myPanel");
+
+ //TODO this needs to be a lot better
+ var c = el.deepClone( false );
+
+ var d = el.deepClone( true );
+ assertTrue("clone with IDs", d.getAttribute("id") == "myPanel");
+}
\ No newline at end of file
Propchange: incubator/xap/trunk/testsrc/xap/xml/_TestElement.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/_TestParser.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/_TestParser.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/_TestParser.html (added)
+++ incubator/xap/trunk/testsrc/xap/xml/_TestParser.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,228 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Parser Unit Tests</title>
+ <link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+ <script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ Xap.bootstrap("/jsunit");
+ </script>
+</head>
+
+
+<body>
+
+
+ <script language="JavaScript" type="text/javascript" src="parserTestStrings.js"></script>
+ <script language="JavaScript" type="text/javascript">
+
+ //-----------------------------------------------------------------------
+ // Parser-specific Methods.
+ //-----------------------------------------------------------------------
+
+ function createDoc(xmlString){
+ var handler = new SaxContentHandler();
+ var parser = new SaxParser(handler);
+
+ parser.setDocumentHandler( handler );
+ parser.parse( xmlString ) ;
+ return handler._document ;
+ }
+
+
+ function assertExceptionThrownOnParse(xmlString){
+ exceptionThrown = false;
+ try{
+ doc = createDoc(xmlString);
+ } catch(ee){
+ exceptionThrown = true;
+ }
+
+ assertTrue("An exception should have been thrown for invalid xml.",
+ exceptionThrown);
+ }
+
+ function assertSpecificExceptionThrownOnParse(xmlString, exceptionID){
+ var exceptionThrown = false;
+
+ var classStr = "" ;
+ try{
+
+
+ doc = createDoc(xmlString);
+ } catch(e){
+ // Should work for XapException subclasses:
+ if( e.getClassName ){
+ classStr = e.getClassName() ;
+ }
+
+ if ( classStr == exceptionID ) {
+ exceptionThrown = true;
+ }
+ }
+ assertTrue("An " + exceptionID +
+ " should have been thrown for '" + xmlString + "', but was: " +
+ classStr, exceptionThrown);
+ }
+
+ function assertEntitiesResolved(xmlString, resolvedEntitiesString){
+ var doc = createDoc(xmlString);
+ var root = doc.getRootElement();
+ var child = root.getChildAt(0);
+
+ assertEquals("Entities in attributes were not resolved correctly.",
+ resolvedEntitiesString,
+ root.getAttribute("testname")
+ );
+ assertEquals("Entities in text node were not resolved correctly.",
+ resolvedEntitiesString,
+ child.getChildAt(0).nodeValue
+ );
+ }
+
+
+ //-----------------------------------------------------------------------
+ // Test Methods.
+ //-----------------------------------------------------------------------
+
+
+ function ztestTwoRootElements() {
+ assertExceptionThrownOnParse(TWO_ROOT_ELEMENTS);
+ }
+
+
+ function testMissingClosingTag() {
+ assertExceptionThrownOnParse(NO_CLOSING_TAG);
+ }
+
+ function testMissingClosingBrace() {
+ assertExceptionThrownOnParse(NO_CLOSING_BRACE);
+ }
+
+
+ function testNoClosingCommentTag() {
+ assertExceptionThrownOnParse(NO_CLOSING_COMMENT_TAG);
+ }
+
+
+ function testRandomMalformed() {
+ var exception = false;
+ try {
+ assertSpecificExceptionThrownOnParse(RANDOM_MALFORMED,EmptyDocumentException.CLASS) ;
+ } catch ( e ) {
+ exception = true;
+ }
+ assertTrue("Expected the previous assertion to fail.", exception);
+ }
+
+ function testNormalEntityResolution() {
+ assertEntitiesResolved(WITH_ENTITIES, ENTITY_RESOLVED_VALUE);
+ }
+
+ function testEmptyDocument() {
+ assertSpecificExceptionThrownOnParse(EMPTY_DOCUMENT,
+ "EmptyDocumentException");
+ }
+
+ function testDuplicateAttributeNames() {
+ var doc = createDoc(DUPLICATE_ATTRIBUTES_ON_ELEMENT);
+ assertEquals("If there are two attributes with the same name, " +
+ "the second one should take precedence.",
+ doc.getRootElement().getAttribute("name"), "value2");
+ }
+
+ function testTextAndCdata() {
+ var doc = createDoc(TEXT_AND_CDATA);
+ var outStr = "" ;
+
+ assertEquals("The root element should have three children.",
+ doc.getRootElement().getChildCount(), 3);
+
+ assertEquals("The first child should be a text node.",
+ doc.getRootElement().getChildAt(0).nodeValue, "'I am text'");
+ expected = "'I am CDATA'";
+ outStr += ("[" + doc.getRootElement().getChildAt(1) + "]");
+ outStr += ("[" + expected + "]");
+ assertEquals("The second child should be a CDATA node.",
+ doc.getRootElement().getChildAt(1).nodeValue, expected);
+ assertEquals("The third child should be a text node.",
+ doc.getRootElement().getChildAt(2).nodeValue, "'I am another text'");
+ }
+
+/**
+ * Will make this more elaborate later; for now, just make sure we don't
+ * err parsing more than one line..beyond that, it's also a test of the document
+ * handler....
+*/
+ function testLargerXML(){
+ var exceptionThrown = true ;
+ try {
+ var doc = createDoc(EMPLOYEE_XML);
+ // Made it here, so
+ exceptionThrown = false ;
+ } catch(ee) {}
+
+ assertFalse(exceptionThrown) ;
+/* Breaks unit test coherence....
+ assertEquals(doc.getRootElement().getChildAt(0).getChildAt(9).getAttribute("role"),
+ "Sales Guy"
+ )
+ assertEquals(doc.getRootElement().getChildAt(0).getChildAt(1).getAttribute("name"),
+ "Coach K. Wei"
+ )
+*/
+
+ }
+
+
+ function ztestUnicodeHexEntityResolution() {
+ assertEntitiesResolved(WITH_ENTITIES_UNICODE_HEX, ENTITY_RESOLVED_VALUE_UNICODE_HEX);
+ }
+
+ function ztestUnicodeDecEntityResolution() {
+ assertEntitiesResolved(WITH_ENTITIES_UNICODE_DEC, ENTITY_RESOLVED_VALUE_UNICODE_DEC);
+ }
+
+
+
+
+
+
+
+
+
+
+// In firefox:
+// passed: testMissingClosingTag() ;
+
+// passed: testMissingClosingBrace() ;
+
+// passed: testNormalEntityResolution() ;
+
+// passed: testDuplicateAttributeNames() ;
+
+// passed: testTextAndCdata() ;
+
+// passed: testEmptyDocument() ;
+
+// passed: testNoClosingCommentTag() ;
+
+// passed: testRandomMalformed() ;
+
+// passed testTwoRootElements() ;
+
+// testUnicodeHexEntityResolution() ;
+
+// testUnicodeDecEntityResolution() ;
+
+
+
+
+ </script>
+</body>
+</html>
Propchange: incubator/xap/trunk/testsrc/xap/xml/_TestParser.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html (added)
+++ incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Testing SaxParser.js ...</title>
+
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript">
+ //alert("About to bootstrap.") ;
+ Xap.bootstrap("file://C:/workspace/rave") ;
+ //alert("Bootstrapped.") ;
+ </script>
+
+
+<script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/testsrc/xap/xml/parserTestStrings.js"></script>
+<script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/testsrc/xap/xml/parserTester.js"></script>
+
+
+
+</head>
+
+<body>
+ <div id="resultPane">
+ <script language="JavaScript" type="text/javascript">
+ //resultPane=document.getElementById("resultPane");
+ testParserMethods() ;
+ </script>
+</body>
+</html>
+
+
Propchange: incubator/xap/trunk/testsrc/xap/xml/parserTestBed.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js (added)
+++ incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js Thu Jun 22 15:01:21 2006
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+ TWO_ROOT_ELEMENTS = "<root/><root2/>";
+NO_CLOSING_TAG = "<root><child></root>";
+NO_CLOSING_BRACE = "<root><child</root>";
+RANDOM_MALFORMED = "John is an evil-doer";
+EMPTY_DOCUMENT = " \r\n\t ";
+NO_CLOSING_COMMENT_TAG = "<!-- This is a comment..oops forgot the closing tag" +"<root/>";
+WITH_ENTITIES = "<root testname=\">A<BB"CCC'DDDD&EEEEE\">" +
+" <child>>A<BB"CCC'DDDD&EEEEE</child>" +
+"</root>";
+
+//?
+ENTITY_RESOLVED_VALUE= ">A<BB\"CCC'DDDD&EEEEE";
+WITH_ENTITIES_UNICODE_DEC = "<root testname=\"ߞߐ\">" +
+" <child>ߞߐ</child>" +
+"</root>";
+
+// 2014(dec) == 7DE(hex), 2000(dec) == 7D0(hex)
+ENTITY_RESOLVED_VALUE_UNICODE_DEC = "<root>\u07DE\u07D0</root>";
+WITH_ENTITIES_UNICODE_HEX = "<root testname=\"ƙĀ\">" +
+" <child>ƙĀ</child>" +
+"</root>";
+ENTITY_RESOLVED_VALUE_UNICODE_HEX = "<root>\u0199\u0100</root>";
+DUPLICATE_ATTRIBUTES_ON_ELEMENT = "<root name=\"value1\" name=\"value2\" />";
+TEXT_AND_CDATA = "<root>'I am text'<![CDATA['I am CDATA']]>'I am another text'</root>";
+EMPLOYEE_XML =
+ "<Nexaweb id=\"root\">\n" +
+" <employees id=\"employees\">\n" +
+" <employee id=\"0\"\n" +
+" department=\"Executive Management\"\n" +
+" role=\"Chief Exectutive Officer\" \n" +
+" name=\"Larry Geisel\" />\n" +
+" <employee id=\"1\"\n" +
+" department=\"Engineering\"\n" +
+" role=\"Chief Technology Officer\" \n" +
+" name=\"Coach K. Wei\" />\n" +
+" <employee id=\"2\"\n" +
+" department=\"Engineering\"\n" +
+" role=\"Chief Cook & Bottle Washer\" \n" +
+" name=\"John Constantine\" />\n" +
+" <employee id=\"3\"\n" +
+" department=\"Engineering\"\n" +
+" role=\"Director Client Development\" \n" +
+" name=\"James Margaris\" />\n" +
+" <employee id=\"4\"\n" +
+" department=\"Engineering\"\n" +
+" role=\"Liaison To The National Security Agency\" \n" +
+" name=\"Peter Eacmen\" />\n" +
+" <employee id=\"5\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Sales Guy\" \n" +
+" name=\"Faceless / Nameless Sales Guy #1\" />\n" +
+" <employee id=\"6\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Sales Guy\" \n" +
+" name=\"Faceless / Nameless Sales Guy #2\" />\n" +
+" <employee id=\"7\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Sales Guy\" \n" +
+" name=\"Faceless / Nameless Sales Guy #3\" />\n" +
+" <employee id=\"8\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Sales Guy\" \n" +
+" name=\"Faceless / Nameless Sales Guy #4\" />\n" +
+" <employee id=\"9\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Sales Guy\" \n" +
+" name=\"Faceless / Nameless Sales Guy #5\" />\n" +
+" <employee id=\"10\"\n" +
+" department=\"Sales\"\n" +
+" role=\"Vice President Sales\" \n" +
+" name=\"Barry 'Knuckles' Gilbane\" />\n" +
+" </employees>\n" +
+"</Nexaweb>\n";
+
+XUPDATE_UNIT_TESTS_XML =
+ "<Nexaweb id=\"root\">\n" +
+ " <employees id=\"employees\">\n" +
+ " <employee id=\"0\"\n" +
+ " department=\"Executive Management\"\n" +
+ " role=\"Chief Exectutive Officer\" \n" +
+ " name=\"Larry Geisel\" />\n" +
+ " <employee id=\"1\"\n" +
+ " department=\"Engineering\"\n" +
+ " role=\"Chief Technology Officer\" \n" +
+ " name=\"Coach K. Wei\" />\n" +
+ " <employee id=\"2\"\n" +
+ " department=\"Engineering\"\n" +
+ " role=\"Chief Cook & Bottle Washer\" \n" +
+ " name=\"John Constantine\" />\n" +
+ " <employee id=\"3\"\n" +
+ " department=\"Engineering\"\n" +
+ " role=\"Director Client Development\" \n" +
+ " name=\"James Margaris\" />\n" +
+ " <employee id=\"4\"\n" +
+ " department=\"Engineering\"\n" +
+ " role=\"Liaison To The National Security Agency\" \n" +
+ " name=\"Peter Eacmen\" />\n" +
+ " <employee id=\"5\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Sales Guy\" \n" +
+ " name=\"Faceless / Nameless Sales Guy #1\" />\n" +
+ " <employee id=\"6\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Sales Guy\" \n" +
+ " name=\"Faceless / Nameless Sales Guy #2\" />\n" +
+ " <employee id=\"7\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Sales Guy\" \n" +
+ " name=\"Faceless / Nameless Sales Guy #3\" />\n" +
+ " <employee id=\"8\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Sales Guy\" \n" +
+ " name=\"Faceless / Nameless Sales Guy #4\" />\n" +
+ " <employee id=\"9\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Sales Guy\" \n" +
+ " name=\"Faceless / Nameless Sales Guy #5\" />\n" +
+ " <employee id=\"10\"\n" +
+ " department=\"Sales\"\n" +
+ " role=\"Vice President Sales\" \n" +
+ " name=\"Barry 'Knuckles' Gilbane\" />\n" +
+ " <employee \n" +
+ " department=\"IDless department\"\n" +
+ " role=\"IDless Role\" \n" +
+ " name=\"ID-LESS\" />\n" +
+ " </employees>\n" +
+ "</Nexaweb>\n";
+
+XML =
+ "<pre:Root xmlns:pre=\"http://nexaweb.com/testing\" level=\"0\">\n" +
+" <RootOne level=\"1\" hasChildren=\"false\" />\n" +
+" <RootTwo level=\"1\" hasChildren=\"true\">\n" +
+" <RootTwoOne level=\"2\" hasChildren=\"false\" />\n" +
+" <RootTwoTwo level=\"2\" hasChildren=\"false\" />\n" +
+" <RootTwoThree xmlns=\"http://nexaweb.com/testing2\" " +
+" level=\"2\" hasChildren=\"true\">\n" +
+" <pre:RootTwoThreeOne level=\"3\" hasChildren=\"false\" />\n" +
+" <pre:RootTwoThreeTwo level=\"3\" hasChildren=\"true\" >\n" +
+" <RootTwoThreeTwoOne level=\"4\" hasChildren=\"false\" />\n" +
+" <RootTwoThreeTwoTwo level=\"4\" hasChildren=\"false\" />\n" +
+" <RootTwoThreeTwoThree level=\"4\" hasChildren=\"true\" >" +
+"I am an evil-doer.</RootTwoThreeTwoThree>" +
+" <RootTwoThreeTwoFour level=\"4\" hasChildren=\"false\" />\n"+
+" <RootTwoThreeTwoFive level=\"4\" hasChildren=\"false\" />\n"+
+" <RootTwoThreeTwoSix level=\"4\" hasChildren=\"false\" />\n" +
+" </pre:RootTwoThreeTwo>\n" +
+" <RootTwoThreeThree level=\"3\" hasChildren=\"false\" />\n" +
+" <RootTwoThreeFour level=\"3\" hasChildren=\"false\" />\n" +
+" <RootTwoThreeFive level=\"3\" hasChildren=\"false\" />\n" +
+" </RootTwoThree>\n" +
+" </RootTwo>\n" +
+" <RootThree level=\"1\" hasChildren=\"false\" />\n" +
+" <RootFour level=\"1\" hasChildren=\"false\" />\n" +
+"</pre:Root>\n";
+
+
+
+
+allParserTestStringNames = new Array(0) ;
+allParserTestStringNames[0] = "TWO_ROOT_ELEMENTS" ;
+allParserTestStringNames[1] = "NO_CLOSING_TAG" ;
+allParserTestStringNames[2] = "NO_CLOSING_BRACE" ;
+allParserTestStringNames[3] = "RANDOM_MALFORMED" ;
+allParserTestStringNames[4] = "EMPTY_DOCUMENT" ;
+allParserTestStringNames[5] = "NO_CLOSING_COMMENT_TAG" ;
+allParserTestStringNames[6] = "WITH_ENTITIES" ;
+allParserTestStringNames[7] = "ENTITY_RESOLVED_VALUE" ;
+allParserTestStringNames[8] = "WITH_ENTITIES_UNICODE_DEC" ;
+allParserTestStringNames[9] = "ENTITY_RESOLVED_VALUE_UNICODE_DEC" ;
+allParserTestStringNames[10] = "WITH_ENTITIES_UNICODE_HEX" ;
+allParserTestStringNames[11] = "ENTITY_RESOLVED_VALUE_UNICODE_HEX" ;
+allParserTestStringNames[12] = "DUPLICATE_ATTRIBUTES_ON_ELEMENT" ;
+allParserTestStringNames[13] = "TEXT_AND_CDATA" ;
+allParserTestStringNames[14] = "EMPLOYEE_XML" ;
+allParserTestStringNames[15] = "XUPDATE_UNIT_TESTS_XML" ;
+allParserTestStringNames[16] = "XML" ;
+
+
+allParserTestStrings = new Array(0) ;
+allParserTestStrings[0] = ( TWO_ROOT_ELEMENTS );
+allParserTestStrings[1] = ( NO_CLOSING_TAG );
+allParserTestStrings[2] = ( NO_CLOSING_BRACE );
+allParserTestStrings[3] = ( RANDOM_MALFORMED );
+allParserTestStrings[4] = ( EMPTY_DOCUMENT );
+allParserTestStrings[5] = ( NO_CLOSING_COMMENT_TAG );
+allParserTestStrings[6] = ( WITH_ENTITIES );
+allParserTestStrings[7] = ( ENTITY_RESOLVED_VALUE );
+allParserTestStrings[8] = ( WITH_ENTITIES_UNICODE_DEC );
+allParserTestStrings[9] = ( ENTITY_RESOLVED_VALUE_UNICODE_DEC );
+allParserTestStrings[10] = ( WITH_ENTITIES_UNICODE_HEX );
+allParserTestStrings[11] = ( ENTITY_RESOLVED_VALUE_UNICODE_HEX );
+allParserTestStrings[12] = ( DUPLICATE_ATTRIBUTES_ON_ELEMENT );
+allParserTestStrings[13] = ( TEXT_AND_CDATA );
+allParserTestStrings[14] = ( EMPLOYEE_XML );
+allParserTestStrings[15] = ( XUPDATE_UNIT_TESTS_XML );
+allParserTestStrings[16] = ( XML );
Propchange: incubator/xap/trunk/testsrc/xap/xml/parserTestStrings.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/parserTester.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/parserTester.js?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/parserTester.js (added)
+++ incubator/xap/trunk/testsrc/xap/xml/parserTester.js Thu Jun 22 15:01:21 2006
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+
+if(!allParserTestStrings){
+ alert("Haven't loaded in test strings in 'allParserTestStrings'.");
+ //return ;
+}
+
+
+//alert(allParserTestStrings) ;
+
+index=-1;
+theStr = "" ;
+
+outstring="" ;
+
+function testParserMethods(){
+
+ // The for() loop below operates in [minIndex,maxIndex):
+ var maxIndexPlusOne= allParserTestStrings.length ; // Can change this as we debug:
+ var minIndex = 0 ;
+
+ var firstArg = prompt("Test string range: 0 =< min <="+ (maxIndexPlusOne),"0","Min test string index") ;
+ if ( firstArg !=null){
+ if ( (""+parseInt(firstArg)) != "NaN" ){
+ minIndex = parseInt(firstArg) ;
+ var maxIndexNew = prompt(
+"Test string range: "+minIndex+"=< max <="+ maxIndexPlusOne,(maxIndexPlusOne -1),"Max test string index"
+ );
+ if (maxIndexNew !=null){
+ if ( (""+parseInt(maxIndexNew)) != "NaN" ){
+ maxIndexPlusOne = parseInt(maxIndexNew)+1 ;
+ }
+ }
+ } else {
+ // If this isn't a number, treat it as a string to
+ // be parsed:
+ allParserTestStrings = new Array(firstArg) ;
+ maxIndexPlusOne = 1;
+ allParserTestStringNames = new Array("TESTING:"+firstArg) ;
+ }
+ }
+
+
+ for(index=minIndex; index<maxIndexPlusOne;++index){
+ theStr = ""+allParserTestStrings[index];
+ var str = ""+theStr ; // Locally-scoped variables easier to see in Venkman
+ var result = "";
+
+ //document.writeln("<br>"+allTestStringNames[index]+"<br>") ;
+ var resultString="\n";
+ resultString += "\n"+index+": "+allParserTestStringNames[index] ;
+ resultString += "\n"+index+": "+ theStr;
+
+ try {
+ var parser = new SaxParser();
+ var handler = new SaxContentHandler();
+ parser.setDocumentHandler( handler );
+ parser.parse(theStr) ;
+ //result = Xparse(theStr) ;
+ //toXml = retag(result).replace(/<[\/]*ROOT>/g,"") ;
+
+ toXml = handler._document.toXmlWithoutAutoAssignedIds(true) ;
+
+ /** Compare in and out strings....
+ var inStr = str.replace(/\s+/g," ").replace(/[\n\r]/g," ").replace(/&/g,"&").replace(/&apos ;/g,"'") ;
+ var outStr = toXml.replace(/\s+/g," ").replace(/[\n\r]/g," ").replace(/&/g,"&").replace(/&apos ;/g,"'") ;
+ // Original may have whitesapce that doesn't matter to
+ // final result, and so is lost in parsing:
+ inStr=inStr.replace(/ >/g,">") ;
+ outStr=outStr.replace(/ >/g,">") ;
+ inStr=inStr.replace(/ \/>/g,"/>") ;
+ outStr=outStr.replace(/ \/>/g,"/>") ;
+ // Also, it's entirely legal to represent what was originally <inStr></inStr> as <inStr/>
+ //
+ //inStr=inStr.replace(/<\(.*\)? \(.*?\)><\/\1>/g,"/>") ;
+ //outStr=outStr.replace(/><\/[A-z:]+>/g,"/>") ;
+
+ matchesP = ( inStr == outStr ) ;
+
+
+
+ if (matchesP){
+ resultString += "<----MATCHES WITHIN WHITESPACE" ;
+ }
+ **/
+
+ resultString += "\n"+index+": "+ toXml ;
+ } catch (e) {
+ result = e.toString() ;
+ resultString += "\n"+index+": EXCEPTION: "+result ;
+ } finally {
+ outstring += "\n"+resultString ;
+ resultString = (resultString + "\n");
+ if(document){
+ // format for html:---keep this order, otherwise you <br>'s become <br> 's
+ resultHtmlString = resultString.replace(/[ ]+/g," ").replace(/&/g,"&").replace(/&apos ;/g,"'")
+ resultHtmlString = resultHtmlString.replace(/</g,"<").replace(/>/g,">");
+ resultHtmlString = resultHtmlString.replace(/\n/g,"<br>") ;
+ // Highlight the cursor:
+ resultHtmlString = resultHtmlString.replace(/\[STOP\]/g,"<font color='#FF0000'><strong>|</strong></font>") ;
+ document.writeln(resultHtmlString) ;
+ }
+ }
+
+ }//end looping through test strings to parse
+}
+
+
+if(!document){
+ testParserMethods() ;
+}
Propchange: incubator/xap/trunk/testsrc/xap/xml/parserTester.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html (added)
+++ incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html Thu Jun 22 15:01:21 2006
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Testing Xmodify and associated classes</title>
+
+ <style type="text/css">
+ <!--
+ @import url(./Example1.css);
+ -->
+ </style>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave//src/xap/util/Utils.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/Xap.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/xml/xmodify/DirectiveSet.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/xml/xmodify/UpdateDirective.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/xml/xmodify/CommandDirective.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/xml/xmodify/XmodifyException.js"></script>
+ <script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/xml/xmodify/Xmodify.js"></script>
+ <!-- script language="JavaScript" type="text/javascript" src="file://C:/workspace/rave/src/xap/requestservice/RequestService.js"></script -->
+
+ <script language="JavaScript" type="text/javascript">
+ var sourceRoot = "file://C:/workspace/rave/";
+ Xap.bootstrap( sourceRoot );
+ </script>
+</head>
+
+<body onload="test();">
+
+
+<script language="JavaScript" type="text/javascript">
+
+function test() {
+ Xmodify.DEBUG=true;
+ try {
+ var requestService = new RequestService( null );
+
+ // index.xal contains Xmodify instructions that need to get executed
+ var content = requestService.retrieve( "./xmodifyTestCommands.xal" );
+ var parser = new SaxParser();
+ var handler = new SaxContentHandler();
+ parser.setDocumentHandler( handler );
+ parser.parse( content );
+
+ // At this point, 'doc' represents our Document containing Xmodify
+ // instructions
+ var commandsDoc = handler._document;
+
+ // Get the container containing the UI doc (also our DOM) representing
+ // the application UI. All Xmodify ops will be executed against this
+ // DOM.
+ var documentContainer = new DocumentContainer();
+ var uiDoc = documentContainer.getUiDocument();
+ //alert("UI Document:\n" + uiDoc.toXml( true ));
+
+ /////////////////////////////////////////////////
+ // Here is what I need from Xmodify:
+ /////////////////////////////////////////////////
+ alert("xmodify:\n"+ commandsDoc.firstChild.firstChild) ;
+ var xmodify = new Xmodify( commandsDoc.firstChild.firstChild);
+ alert("documentContainer",documentContainer) ;
+ xmodify.execute( documentContainer );
+ } catch (ee) {
+ // Need a catch here, even though we mean to do
+ // nothing interesting:
+ throw ee ;
+ } finally {
+ // The reason for the try{} above
+ Xmodify.DEBUG=false;
+ }
+ }
+
+</script>
+</body>
+</html>
Propchange: incubator/xap/trunk/testsrc/xap/xml/xmodifyTestBed.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/testsrc/xap/xml/xmodifyTestCommands.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/xml/xmodifyTestCommands.xal?rev=416480&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/xml/xmodifyTestCommands.xal (added)
+++ incubator/xap/trunk/testsrc/xap/xml/xmodifyTestCommands.xal Thu Jun 22 15:01:21 2006
@@ -0,0 +1,58 @@
+<xal xmlns="http://www.openxal.org/xal">
+ <xm:modifications xmlns:xm="http://www.openxal.org/xmodify">
+
+ <xm:append select="/xal">
+ <button id="x0" text="x" bgColor="#FF0000" x="100px" y="100px"
+ width="100px" height="100px"/>
+ <button2 id="x2" text="x1" bgColor="#FF0000" x="100px" y="100px"
+ width="100px" height="100px"/>
+ </xm:append>
+
+ <xm:insert-after select="/xal/button">
+ <button1 id="x1" text="x1" bgColor="#FF0000" x="100px" y="100px"
+ width="100px" height="100px"/>
+ </xm:insert-after>
+
+ <xm:insert-before select="/xal/button2">
+ <button1a id="x3" text="y" bgColor="#FF0000" x="100px" y="100px"
+ width="100px" height="100px"
+ />
+ </xm:insert-before>
+
+ <xm:append select="/xal/button1">
+ <buttonnested id="y1" text="new child" bgColor="#FF0000" x="100px" y="100px" width="100px" height="100px"/>
+ <buttonnested id="y2" text="new child" bgColor="#FF0000" x="100px" y="100px" width="100px" height="100px"/>
+ <buttonnested2 id="y3" text="new child" bgColor="#FF0000" x="100px" y="100px" width="100px" height="100px"/>
+ </xm:append>
+
+
+ <xm:remove-element select="/xal/button1/buttonnested">
+ </xm:remove-element>
+
+ <xm:set-attribute select="/xal/button1">
+ <attribute name="AA" value="A1" />
+ <attribute name="BB" value="B1" />
+ </xm:set-attribute>
+
+
+
+ <xm:append select="/xal">
+ <IamRoot id="newroot">Root</IamRoot>
+ </xm:append>
+
+ <xm:remove-attribute select="/xal/button1">
+ <attribute name="AA"/>
+ </xm:set-attribute>
+
+
+ <xm:set-attribute select="/xal/button2">
+ <attribute name="firstName" value=""Bob"" />
+ <attribute name="lastName" value="Dobbs" />
+ </xm:set-attribute>
+
+
+ <xm:remove-children select="/xal/button1">
+ </xm:remove-element>
+
+ </xm:modifications>
+</xal>