Added DOMAccessor.java (insted of DOMAccessorImpl)

Added redirect.html
This commit is contained in:
rpallath%eng.sun.com 2000-04-01 00:04:15 +00:00
Родитель 41f4a8b425
Коммит a9b57a5ba1
14 изменённых файлов: 277 добавлений и 59 удалений

Просмотреть файл

@ -1,6 +1,6 @@
BW_TESTDIR=/opt/mozilla/java/dom/tests/src
BW_TESTDIR=/workspace/mozilla/java/dom/tests/src
BW_TESTFILE=BWTestClass.lst
BW_LOGDIR=/opt/mozilla/java/dom/tests/src/log
BW_LOGDIR=/workspace/mozilla/java/dom/tests/src/log
BW_LOGFILE=BWTest.log
BW_THREADMODE=S
BW_HTMLTEST=file:

Просмотреть файл

@ -1 +1 @@
org.mozilla.dom.test.TextImpl_splitText_int_2
org.mozilla.dom.test.AttrImpl_getName

Просмотреть файл

@ -0,0 +1,200 @@
/*
The contents of this file are subject to the Mozilla Public
License Version 1.1 (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.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org code.
The Initial Developer of the Original Code is Sun Microsystems,
Inc. Portions created by Sun are
Copyright (C) 1999 Sun Microsystems, Inc. All
Rights Reserved.
Contributor(s):
*/
package org.mozilla.dom;
import java.util.Vector;
import java.util.Enumeration;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.mozilla.dom.test.*;
import java.security.AccessController;
public final class DOMAccessor {
private static Vector documentLoadListeners = new Vector();
private static JavaDOMPermission permission = new JavaDOMPermission("JavaDOM");
static {
System.loadLibrary("javadomjni");
addDocumentLoadListener(new TestListener());
}
private void DOMAccessorImpl() {}
private static native void register();
private static native void unregister();
private static native Node getNodeByHandle(long p);
private static native void doGC();
public static synchronized void
addDocumentLoadListener(DocumentLoadListener listener) {
if (documentLoadListeners.size() == 0) {
register();
}
documentLoadListeners.addElement(listener);
}
public static synchronized void
removeDocumentLoadListener(DocumentLoadListener listener) {
documentLoadListeners.removeElement(listener);
if (documentLoadListeners.size() == 0) {
unregister();
}
}
public static synchronized void
startURLLoad(String url, String contentType, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startURLLoad(url, contentType, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
endURLLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endURLLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
progressURLLoad(String url, int progress, int progressMax,
long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.progressURLLoad(url, progress, progressMax, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
statusURLLoad(String url, String message, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.statusURLLoad(url, message, (Document)getNodeByHandle(p_doc));
}
doGC();
}
public static synchronized void
startDocumentLoad(String url) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.startDocumentLoad(url);
}
doGC();
}
public static synchronized void
endDocumentLoad(String url, int status, long p_doc) {
AccessController.checkPermission(permission);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endDocumentLoad(url, status, (Document)getNodeByHandle(p_doc));
}
doGC();
}
}
class TestListener implements DocumentLoadListener {
public void endDocumentLoad(String url, int status, Document doc) {
if (url.endsWith(".xul")
|| url.endsWith(".js")
|| url.endsWith(".css")
//|| url.startsWith("file:")
)
return;
if ((!(url.endsWith(".html"))) && (!(url.endsWith(".xml"))))
return;
if (url.endsWith(".html"))
{
if (url.indexOf("test.html") == -1) {
System.err.println("TestCases Tuned to run with test.html...");
return;
}
}
if (url.endsWith(".xml"))
{
if (url.indexOf("test.xml") == -1) {
System.err.println("TestCases Tuned to run with test.xml...");
return;
}
}
Object obj = (Object) doc;
System.out.println("Loading new TestLoader...\n");
TestLoader tl = new TestLoader(obj, 0);
if (tl != null) {
Object retobj = tl.loadTest();
}
//doc = null;
}
public void startURLLoad(String url, String contentType, Document doc) {}
public void progressURLLoad(String url, int progress, int progressMax,
Document doc) {}
public void statusURLLoad(String url, String message, Document doc) {}
public void startDocumentLoad(String url) {}
public void endURLLoad(String url, int status, Document doc) {}
} //end of class

Просмотреть файл

@ -46,7 +46,7 @@ JAVAFILES= Execution.java \
BWJavaTemplate.java
DOMFILE= DocumentImpl.java \
DOMAccessorImpl.java
DOMAccessor.java
clean:
for i in ${JAVAFILES} ; do \

Просмотреть файл

@ -47,7 +47,7 @@ JAVAFILES= Execution.java \
BWJavaTemplate.java
DOMFILE= DocumentImpl.java \
DOMAccessorImpl.java
DOMAccessor.java
clean:
for i in ${JAVAFILES} ; do \

Просмотреть файл

@ -41,7 +41,7 @@ JAVAFILES= Execution.java \
BWJavaTemplate.java
DOMFILE=DOMAccessorImpl.java \
DOMFILE=DOMAccessor.java \
DocumentImpl.java
all: testloader accessor

Просмотреть файл

@ -12,7 +12,7 @@ For Solaris
BWTestClass.lst is located.
USE_APPLET_FOR_REGISTRATION - set this variable if you wish to use
applet for running tests Otherwise
hacked DOMAccessorImpl class is used.
hacked DOMAccessor class is used.
3) source mozilla.csh
this will set up the environment
@ -24,16 +24,16 @@ For Solaris
created)
BW_THREADMODE (Execute tests in single thread [S] or
multi-thread [M] mode. Takes values S/M.)
BW_HTMLTEST (URL where test.html file are located. Used if you
BW_HTMLTEST (URL where redirect.html file are located. Used if you
run tests through TestLoader applet)
BW_XMLTEST (URL where test.xml file are located. Used if you run
tests through TestLoader applet)
5) Copy test.html and test.xml files to your Web-Servers DOCUMENT_ROOT
5) Copy redirect.html, test.html and test.xml files to your Web-Servers DOCUMENT_ROOT
(By default it is assumed that they can be accessed as
http://<server name>/text.html).
http://<server name>/redirect.html).
or
http://<server name>/~<username>/text.html).
http://<server name>/~<username>/redirect.html).
6) Invoke autorun.sh from command prompt.
sh autorun.sh
@ -52,9 +52,9 @@ NOTE: All Test Cases are reocorded in file BWTestClass.lst.ORIG
Assumption:
I assume that u have copied the files test.xml and test.html to your
DOCUMENT_ROOT of your WebServer.
The URL it tries to load is http://<servername>/test.html.
I assume that u have copied the files test.xml
and redirect.html test.html to your DOCUMENT_ROOT of your WebServer.
The URL it tries to load is http://<servername>/redirect.html.
If it is set in users public_html then open file autorun.sh
and change DOCROOT accordingly.
@ -75,16 +75,16 @@ Assumes you have installed PERL and the following variables are set in your envi
USE_APPLET_FOR_REGISTRATION - set this variable if you wish to use
applet for running tests
(now available under Win32 only).
Otherwise hacked DOMAccessorImpl class
Otherwise hacked DOMAccessor class
is used.
MOZILLA_BIN - Mozilla's executable file name
(e.g. mozilla.exe or viewer.exe)
TEST_PATH - path to the current directory
(where mozilla.bat is)
TEST_URL - URL where test.html and test.xml are
located (complete URL looks like:
$TEST_URL/test.html).Used if you run
tests through hacked DOMAccessor only
TEST_URL - URL where redirect.html and test.html
are located (complete URL looks like:
$TEST_URL/redirect.html).Used if you
run tests through hacked DOMAccessor only
3) execute mozilla.bat from command prompt
this will create new console and set up the environment for this
@ -98,9 +98,9 @@ Assumes you have installed PERL and the following variables are set in your envi
BW_THREADMODE (Execute tests in single thread [S] or
multi-thread [M] mode. Takes values S/M.)
BW_HTMLTEST (URL where test.html file are located. Used if you
BW_HTMLTEST (URL where redirect.html file is located. Used if you
run tests through TestLoader applet)
BW_XMLTEST (URL where test.xml file are located. Used if you
BW_XMLTEST (URL where test.xml file is located. Used if you
run tests through TestLoader applet)
NOTE: Since on Windows file separator is a `\`, it should be escaped
@ -115,9 +115,8 @@ Assumes you have installed PERL and the following variables are set in your envi
mozilla.exe file:/TestLoaderHTML.html
(mozilla.exe file:/TestLoaderXML.html)
if you use hacked DOMAcceessorImpl.
mozilla.exe file:/test.html
(mozilla.exe file:/test.xml)
if you use hacked DOMAcceessor.
mozilla.exe file:/redirect.html
7) The results are recorded in HTML file BWTest.html
and in log file BWTest.log

Просмотреть файл

@ -59,7 +59,7 @@
<td><b><font color="#FF6666"><font size=+1>USE_APPLET_FOR_REGISTRATION</font></font></b></td>
<td><b>Set this variable if you wish to use applet for running tests (now
available under Win32 only). Otherwise hacked DOMAccessorImpl class is
available under Win32 only). Otherwise hacked DOMAccessor class is
used.</b></td>
</tr>
</table></center>
@ -81,7 +81,7 @@ used.</b></td>
<tr NOSAVE>
<td NOSAVE><b><font color="#FF6666"><font size=+1>BW_LOGDIR</font></font></b></td>
<td><b>Absolute D.irectory&nbsp; Path where log files need to be created.</b></td>
<td><b>Absolute Directory&nbsp; Path where log files need to be created.</b></td>
</tr>
<tr>
@ -94,14 +94,14 @@ or multi-thread mode[M].&nbsp; Takes values S/M .</b></td>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_HTMLTEST</font></font></b></td>
<td><b>URL where test.html file are located. Used if you run tests through
<td><b>URL where redirect.html, test.html files are located. Used if you run tests through
TestLoader applet.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>BW_XMTEST</font></font></b></td>
<td><b>URL where test.xml file are located. Used if you</b>
<td><b>URL where redirect.html, test.xml files are located. Used if you</b>
<br><b>run tests through TestLoader applet</b></td>
</tr>
</table></center>
@ -110,7 +110,7 @@ TestLoader applet.</b></td>
<ul>
<li>
<b><font size=+1>Copy <font color="#FF6666">test.html</font> and <font color="#FF6666">test.xml</font>
<b><font size=+1>Copy <font color="#FF6666">redirect.html, test.html</font> and <font color="#FF6666">test.xml</font>
files to your web-servers DOCUMENT_ROOT ( By default it is assumed that
they can be&nbsp; accessed as <font color="#3366FF">http://[server name]/text.html</font>&nbsp;
or <font color="#3366FF">http://[servername]/~[username]/text.html</font>).</font></b></li>
@ -138,9 +138,9 @@ Log files are also found in 'log' directory.</font></b></li>
<b><font size=+1><u><font color="#3366FF">NOTE:</font></u>All Test Cases
are recorded in file BWTestClass.lst.ORIG</font></b>
<p><font size=+1><u><font color="#3366FF">ASSUMPTION</font></u><b>: I assume
that u have copied the files test.xml and test.html to your DOCUMENT_ROOT
that u have copied the files test.xml and redirect.html, test.html to your DOCUMENT_ROOT
of your WebServer.</b></font>
<br><b><font size=+1>The URL it tries to load is http://[servername]/test.html.</font></b>
<br><b><font size=+1>The URL it tries to load is http://[servername]/redirect.html.</font></b>
<br><b><font size=+1>If it is set in users public_html then open file autorun.sh
and change DOCROOT accordingly.</font></b>
<p>
@ -180,8 +180,8 @@ make changes to variables</li>
(where mozilla.bat is)</li>
<li>
<font color="#FF6666">TEST_URL</font> - URL where test.html and test.xml
are located (complte URL looks like that: $TEST_URL/test.html). Is used
<font color="#FF6666">TEST_URL</font> - URL where redirect.html and test.html
are located (complte URL looks like that: $TEST_URL/redirect.html). Is used
if you run tests through hacked DOMAccessor only.</li>
</ul>
@ -206,7 +206,7 @@ files need to be created)</li>
[S] or multi-thread [M] mode. Takes values S/M.)</li>
<li>
<font color="#FF6666">BW_HTMLTEST</font> (URL where test.html file are
<font color="#FF6666">BW_HTMLTEST</font> (URL where redirect.html file are
located. Used if you run tests through TestLoader applet)</li>
<li>
@ -240,9 +240,8 @@ For quick testing say</li>
<li>
or say</li>
<br><b>mozilla.exe file:/test.html</b>
<br>(mozilla.exe file:/test.xml)
<br>if you use hacked DOMAcceessorImpl.</ul>
<br><b>mozilla.exe file:/redirect.html</b>
<br>if you use hacked DOMAcceessor.</ul>
<li>
The results are recorded in HTML file BWTest.html and in log file BWTest.log
@ -313,7 +312,7 @@ or multi-thread mode[M].&nbsp; Takes values S/M .</b></td>
<ul>
<li>
<b><font size=+1>Copy files <font color="#CC6600">test.html</font>and <font color="#CC6600">test.xml</font>
<b><font size=+1>Copy files <font color="#CC6600">redirect.html, test.html</font>and <font color="#CC6600">test.xml</font>
into some document directory of HTTP server. TEST_URL environment variable
should contain the URL of this directory.</font></b></li>

Просмотреть файл

@ -27,7 +27,7 @@ import java.io.*;
import java.net.URL;
import java.applet.Applet;
import org.w3c.dom.Document;
import org.mozilla.dom.DOMAccessorImpl;
import org.mozilla.dom.DOMAccessor;
import org.mozilla.dom.DocumentLoadListener;
import org.mozilla.dom.test.*;
@ -136,6 +136,8 @@ public class TestLoader extends Applet implements DocumentLoadListener
String name = (String)(em.nextElement());
String val = propTable.getProperty(name);
if (val == null) continue;
if (val.indexOf("BW_HTMLTEST") != -1) continue;
if (val.indexOf("BW_XMLTEST") != -1) continue;
int idx = val.indexOf(CHECK_SEP);
if (idx != -1) {
@ -688,7 +690,7 @@ System.out.println("Inside LoadTest");
public void init()
{
System.err.println("################## Regestring DocumentLoadListener !");
DOMAccessorImpl.getInstance().addDocumentLoadListener((DocumentLoadListener)this);
DOMAccessor.addDocumentLoadListener((DocumentLoadListener)this);
String testURL = propTable.getProperty("BW_HTMLTEST");
if (testURL == null) {

Просмотреть файл

@ -32,6 +32,8 @@ use Win32::Process;
###################################################################
#sometimes we need to specify additional parameters for mozilla
$ADDITIONAL_PARAMETERS="-P mozProfile";
# time in seconds after which the mozilla has to be killed.
# by default the mozilla will be up for so much time regardless of
@ -83,9 +85,10 @@ sub title() {
print " Automated Execution of DOM API TestSuite\n";
print "################################################\n";
print "\n";
print "NOTE: You need to copy files test.html and test.xml into \n";
print " some document directory of HTTP server. TEST_URL environment \n";
print " variable should contain the URL of this directory.\n";
print "NOTE: You need to copy files redirect.html, test.html and test.xml\n";
print " into some document directory of HTTP server\n";
print " TEST_URL environment variable should contain the URL of \n";
print " this directory.\n";
print "\n";
print "\n";
@ -355,7 +358,7 @@ if ( -f "$LOGHTML" ) {
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.html";
$DOCFILE = "$DOCROOT/redirect.html";
}
$runcnt = 1;
$filename = "$curdir/BWTestClass.lst.ORIG";
@ -364,7 +367,7 @@ if ($runtype == 1) {
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.html";
$DOCFILE = "$DOCROOT/redirect.html";
}
$filename = "$curdir/BWTestClass.lst.html.ORIG";
$runcnt = 1;
@ -374,7 +377,7 @@ if ($runtype == 2) {
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderXML.html";
} else {
$DOCFILE = "$DOCROOT/test.xml";
$DOCFILE = "$DOCROOT/redirect.html";
}
$filename = "$curdir/BWTestClass.lst.xml.ORIG";
$runcnt = 1;
@ -384,7 +387,7 @@ if ($runtype == 3) {
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.xml";
$DOCFILE = "$DOCROOT/redirect.html";
}
$filename = "$curdir/BWTestClass.lst.html.ORIG";
$runcnt = 2;
@ -438,7 +441,7 @@ while (true) {
open( STDERR, ">&STDOUT" );
Win32::Process::Create($ProcessObj,
"$mozhome/$mozilla_bin",
"$mozhome/$mozilla_bin $DOCFILE",
"$mozhome/$mozilla_bin $ADDITIONAL_PARAMETERS $DOCFILE",
1,
NORMAL_PRIORITY_CLASS,
"$TESTROOT" ) || die "cann't start $moilla_bin";
@ -486,7 +489,7 @@ while (true) {
( ++$currcnt < $runcnt ) || last;
if ( $runtype == 3 ) {
$DOCFILE="$DOCROOT/test.xml";
$DOCFILE="$DOCROOT/redirect.html";
$filename="$curdir/BWTestClass.lst.xml.ORIG";
constructHTML;
appendEntries;

Просмотреть файл

@ -64,8 +64,9 @@ title()
echo " Automated Execution of DOM API TestSuite"
echo "################################################"
echo
echo "NOTE: You need to copy files test.html and test.xml to "
echo " DOCUMENT_ROOT dir. of your Web-Server on this machine."
echo "NOTE: You need to copy files redirect.html, test.html and"
echo " test.xml to DOCUMENT_ROOT dir. of your"
echo " Web-Server on this machine."
echo
echo
}
@ -464,7 +465,7 @@ fi
appreg=${USE_APPLET_FOR_REGISTRATION}
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
DOCFILE="$DOCROOT/redirect.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
@ -476,7 +477,7 @@ if [ "$runtype" = "1" ]
then
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
DOCFILE="$DOCROOT/redirect.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
@ -486,10 +487,10 @@ fi
if [ "$runtype" = "2" ]
then
DOCFILE="$DOCROOT/test.xml"
DOCFILE="$DOCROOT/redirect.html"
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.xml";
DOCFILE="$DOCROOT/redirect.html";
else
DOCFILE="$DOCROOT/TestLoaderXML.html";
fi
@ -501,7 +502,7 @@ if [ "$runtype" = "3" ]
then
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
DOCFILE="$DOCROOT/redirect.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
@ -635,7 +636,7 @@ do
if [ "$runtype" = "3" ]
then
DOCFILE="$DOCROOT/test.xml"
DOCFILE="$DOCROOT/redirect.html"
filename="$curdir/BWTestClass.lst.xml.ORIG"
constructHTML
appendEntries

Просмотреть файл

@ -1,6 +1,7 @@
rem @ECHO off
set BLACKWOOD_HOME=%MOZILLA_HOME%
set MOZILLA_FIVE_HOME=%MOZILLA_HOME%\dist\WIN32_D.OBJ\bin
set JAVADOM_HOME=%MOZILLA_HOME%\java\dom
rem Mozilla binary file name
set MOZILLA_BIN=mozilla.exe
set JAVA_HOME=%JAVAHOME%
@ -28,7 +29,7 @@ set TEST_URL=file:
set PATH=%JAVA_HOME%\bin;%PATH%
set PATH=%MOZILLA_FIVE_HOME%;%PATH%
set CLASSPATH=%TEST_PATH%\..\classes;%MOZILLA_HOME%\dist\classes;%CLASSPATH%
set CLASSPATH=%TEST_PATH%\..\classes;%JAVADOM_HOME%\classes;%MOZILLA_FIVE_HOME%\classes;%CLASSPATH%
rem creating new console window with these variables being set

Просмотреть файл

@ -1,5 +1,6 @@
setenv TEST_PATH `pwd`/..
setenv MOZILLA_FIVE_HOME `pwd`/../../../../dist/bin
setenv JAVADOM_HOME `pwd`/../../
setenv JAVA_HOME /usr/local/java/jdk1.2/solaris
setenv PREFIX /workspace
@ -12,5 +13,5 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${MOZILLA_FIVE_HOME}
setenv PATH ${JAVA_HOME}/bin:${PATH}
setenv PATH ${PATH}:${MOZILLA_FIVE_HOME}:${PREFIX}/bin
setenv CLASSPATH ${MOZILLA_FIVE_HOME}/classes:${PREFIX}/xml/xml.jar:.
setenv CLASSPATH ${JAVADOM_HOME}/classes:${MOZILLA_FIVE_HOME}/classes:${PREFIX}/xml/xml.jar:.
setenv CLASSPATH ${TEST_PATH}/classes:${CLASSPATH}

Просмотреть файл

@ -0,0 +1,12 @@
<html>
<body>
<script>
if (window.location.href.lastIndexOf(".xml") == -1)
{
window.location="test.xml";
} else {
window.location="test.html";
}
</script>
</body>
</html>