Added License information

Added rule files for  DOM HTML test generation
Updated READMES
Updated automated scripts.
Added Hacked DOMAccessorImpl/DocumentImpl files


git-svn-id: svn://10.0.0.236/trunk@58136 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
leila.garin%eng.sun.com
2000-01-18 22:38:10 +00:00
parent a434fb89e3
commit 553f9bfab7
28 changed files with 1292 additions and 257 deletions

View File

@@ -1,10 +1,23 @@
/**
* @author Raju Pallath
* @version 1.0
*
* This class is the Base Class for all test cases.
*
*/
/*
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.test;

View File

@@ -1,7 +1,24 @@
/**
* @version 1.00 06 Jul 1999
* @author Raju Pallath
*/
/*
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.test;
import java.lang.*;
@@ -19,16 +36,23 @@ class BWJavaTemplate
String packageName=null;
String outputDir=null;
Vector outputFiles=null;
private Method[] methods = null;
private String currMethod=new String();
private String currParamList=new String();
private Hashtable rules = null;
public BWJavaTemplate(String ajclass, String aoutDir)
public BWJavaTemplate(String ajclass, String aoutDir, String rulesFile)
{
outputDir = aoutDir+System.getProperty("file.separator");
fullclass = ajclass;
if (fullclass == null) {
System.out.println("Class Name cannot be NULL... ");
return;
}
if (rulesFile != null) {
loadRules(rulesFile);
}
int idx = fullclass.lastIndexOf(".");
if ( idx != -1)
@@ -48,13 +72,16 @@ System.out.println("class Name is " + jclass);
}
outputFiles = new Vector();
if (!(parseClassConstructor())) return;
if (!(parseClassMethod())) return;
System.out.println("Parsing constructors and methods ...");
if (!(parseClassConstructor()) && !(parseClassMethod())) {
System.out.println("Can't parse neither COnstructors nor Methods !!!\n");
return;
}
DataOutputStream dos = null;
String txtFile = jclass + ".txt";
try {
dos = new DataOutputStream( new FileOutputStream(txtFile));
dos = new DataOutputStream( new FileOutputStream(outputDir+txtFile));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + txtFile);
return;
@@ -81,6 +108,32 @@ System.out.println("class Name is " + jclass);
}
private void loadRules(String rulesFile) {
try {
/* Input stream routines*/
FileInputStream in = new FileInputStream(rulesFile);
LineNumberReader ln = new LineNumberReader((Reader)(new InputStreamReader((InputStream)in)));
/*Parsing rules file*/
rules = new Hashtable();
String str = null;
int pos = -1;
while((str = ln.readLine()) != null) {
if ((pos = str.indexOf(' ')) <= 0 || pos == str.length()) {
System.out.println("WARNIG: rules file format error at line "+ln.getLineNumber());
} else {
//System.out.println("Rules: "+str.substring(0, pos)+" <-> "+str.substring(pos+1));
rules.put((Object)str.substring(0, pos), (Object)str.substring(pos+1));
}
}
} catch (Exception e) {
System.out.println("WARNING: Can't read rules file "+rulesFile+": "+e.fillInStackTrace()+"\n");
rules = null;
}
}
/**
* Parses the class constructors and create class files
*
@@ -95,7 +148,7 @@ System.out.println("class Name is " + jclass);
System.out.println("Could not find class file " + fullclass);
return false;
}
if (Modifier.isAbstract(cl.getModifiers()))
if (Modifier.isAbstract(cl.getModifiers()))
return false;
if (Modifier.isInterface(cl.getModifiers()))
@@ -216,11 +269,12 @@ System.out.println("class Name is " + jclass);
System.out.println("Could not find class file " + fullclass);
return false;
}
Method methods[] = rt.getMethods(cl);
methods = rt.getMethods(cl);
String paramString = null;
int staticFlag=0;
for (int i = 0; i < methods.length; i++)
{
System.out.println("Parsing method: "+jclass+" -> "+methods[i].getName());
staticFlag=0;
Method m = methods[i];
Class[] paramTypes = m.getParameterTypes();
@@ -236,6 +290,7 @@ System.out.println("class Name is " + jclass);
paramString = new String();
ParamCombination pcomb = null;
System.out.println("Number of parms: "+paramTypes.length);
pcomb = new ParamCombination(paramTypes.length);
if (pcomb == null)
{
@@ -335,7 +390,7 @@ System.out.println("class Name is " + jclass);
if (param.compareTo("String") == 0)
{
result.addElement("\"null\"");
result.addElement("null");
result.addElement("\"DUMMY_STRING\"");
} else
if (param.compareTo("int") == 0)
@@ -425,7 +480,11 @@ System.out.println("class Name is " + jclass);
{
result.addElement("null");
result.addElement("new Byte(Byte.MIN_VALUE)");
result.addElement("new Byte(Byte.MAX_VALUE)");
result.addElement("new Byte(Byte.MAX_VALUE)");
} else
if (rules != null && rules.get(param) != null) {
result.addElement((String)rules.get(param));
result.addElement("null");
} else {
result.addElement("null");
result.addElement("NOTNULL");
@@ -477,7 +536,7 @@ System.out.println("class Name is " + jclass);
DataOutputStream raf = null;
try {
raf = new DataOutputStream( new FileOutputStream(filename));
raf = new DataOutputStream( new FileOutputStream(outputDir+filename));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + filename);
return;
@@ -516,6 +575,8 @@ System.out.println("class Name is " + jclass);
fstr = fstr + "\n";
fstr = fstr + "import org.w3c.dom.*;";
fstr = fstr + "\n";
fstr = fstr + "import org.w3c.dom.html.*;";
fstr = fstr + "\n";
fstr = fstr + "\n";
fstr = fstr + "public class " + cName;
fstr = fstr + " extends BWBaseTest implements Execution";
@@ -608,10 +669,13 @@ System.out.println("class Name is " + jclass);
fstr = fstr + " osRoutine(os);";
fstr = fstr + "\n";
String pString=valueList;
/* String pString=valueList;
if (valueList == null)
pString= new String("");
*/
if (rules != null && rules.get(className) != null)
fstr =fstr + makeTestRoutine(className, returnType, methodName, valueList);
fstr = fstr + " return BWBaseTest.PASSED;";
fstr = fstr + "\n";
@@ -678,7 +742,7 @@ System.out.println("class Name is " + jclass);
DataOutputStream dos = null;
String txtFile = className + ".txt";
try {
dos = new DataOutputStream( new FileOutputStream(txtFile));
dos = new DataOutputStream( new FileOutputStream(outputDir+txtFile));
} catch (Exception e) {
System.out.println("ERROR: Could not create File " + txtFile);
return;
@@ -701,9 +765,64 @@ System.out.println("class Name is " + jclass);
}
}
private Method findMethod(String mn) {
if (methods == null)
return null;
for (int i=0; i < methods.length; i++) {
//System.out.println("Comparing: "+mn+" <-> "+methods[i].getName());
if (methods[i].getName().compareTo(mn) == 0)
return methods[i];
}
return null;
}
private String makeTestRoutine(String className, String returnType, String methodName, String valueList) {
String result = new String("");
String tab = " ", tab1=tab+tab, tab2=tab1+tab, tab3=tab2+tab1;
String robj = "", check = "";
String valList = valueList;
if (valueList == null)
valList = "";
/*Weather method returns object ?*/
if (returnType.compareTo("void") != 0) {
robj = returnType + " rc = ";
if (returnType.indexOf('.') > 0)
check = tab3 + "if (rc == null) return BWBaseTest.FAILED;\n";
}
/*Let's try to find set<->get pair for methods with one argument ...*/
if (methodName.startsWith("set") && valueList.indexOf(',') < 0 && valueList.compareTo("null") != 0) {
String getMethod = "get" + methodName.substring(3);
//System.out.println("GET_METHOD "+getMethod);
Method m;
if ((m = findMethod(getMethod)) != null && m.getParameterTypes().length == 0) {
String equals = ".equals";
/* Weather return type is standard ?*/
if (m.getReturnType().getName().indexOf('.') < 0)
equals = "==";
check = tab3+"if (!(obj."+getMethod+"()"+equals+"("+valueList+"))) return BWBaseTest.FAILED;\n";
}
}
result += tab1 + "Document d = (Document)tobj;\n";
result += tab1 + "if (d != null) {\n";
result += tab2 + "try {\n";
result += tab3 + className+" obj = " + rules.get(className)+";\n";
result += tab3 + robj + "obj." + methodName + "("+valList+");\n" + check;
result += tab2 + "} catch (Exception e) {\n";
result += tab3 + "return BWBaseTest.FAILED;\n";
result += tab2 + "}\n";
result += tab1 + "} else {\n";
result += tab2 + "return BWBaseTest.FAILED;\n";
result += tab1 + "}\n";
return result;
}
public static void usage()
{
System.out.println("Usage: java JavaTestTemplate [-d <output dir>] <className>");
System.out.println("Usage: java JavaTestTemplate [-d <output dir>] [-r <rules_file>] <className>");
}
public static void main(String args[])
@@ -716,7 +835,47 @@ System.out.println("class Name is " + jclass);
String className = null;
String outDirectory = null;
String rulesFile = null;
switch(args.length) {
case(0):
BWJavaTemplate.usage();
return;
case(1):
if(args[0].charAt(0) == '-') {
BWJavaTemplate.usage();
return;
}
className = args[0];
break;
default:
for(int i=0; i<args.length;) {
if(args[i].charAt(0) != '-') {
if (className != null) {
BWJavaTemplate.usage();
return;
}
className = args[i];
i++;
} else {
switch(args[i].charAt(1)) {
case('d'):
outDirectory = args[i+1];
i+=2;
break;
case('r'):
rulesFile = args[i+1];
i+=2;
break;
default:
BWJavaTemplate.usage();
return;
} //end of switch
}
}
} //end of switch
/*
if (args.length == 3) {
if (args[0].compareTo("-d") != 0) {
BWJavaTemplate.usage();
@@ -729,8 +888,8 @@ System.out.println("class Name is " + jclass);
outDirectory = new String(".");
className = args[0];
}
BWJavaTemplate jt = new BWJavaTemplate(className, outDirectory);
*/
BWJavaTemplate jt = new BWJavaTemplate(className, outDirectory, rulesFile);
}
}

View File

@@ -1,5 +1,7 @@
BW_TESTDIR=/home/user/Blackwood/src/JavaDOM/CoreLevel1/src
BW_TESTDIR=
BW_TESTFILE=BWTestClass.lst
BW_LOGDIR=/home/user/Blackwood/src/JavaDOM/CoreLevel1/src/log
BW_LOGDIR=
BW_LOGFILE=BWTest.log
BW_THREADMODE=S
BW_HTMLTEST=file:
BW_XMLTEST=file:

View File

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

View File

@@ -1 +1 @@
org.mozilla.dom.test.DocumentImpl_createComment_String_1
org.mozilla.dom.test.DocumentTypeImpl_getEntities

View File

@@ -1,11 +1,24 @@
/**
* @author Raju Pallath
* @version 1.0
*
* This class is the Base Thread Class for all test cases.
* Using this, we can run test cases ina multi threaded fashion.
*
*/
/*
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.test;

View File

@@ -25,17 +25,31 @@ import java.util.Vector;
import java.util.Enumeration;
import org.w3c.dom.Document;
import org.mozilla.dom.test.TestLoader;
import org.mozilla.dom.test.*;
public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
private DOMAccessor instance = null;
private static DOMAccessor instance = null;
private Vector documentLoadListeners = new Vector();
public static native void register();
public static native void unregister();
public synchronized DOMAccessor getInstance() {
static {
System.err.println("\n\nDOMAccessor: autoregestring ...\n\n");
try {
//at this moment library is not loaded yet - tet's do it
System.loadLibrary("javadomjni");
DocumentImpl.initialize();
} catch (Exception e) {
System.out.println("Can't load javadomjni.dll: "+e);
System.exit(-1);
}
getInstance().addDocumentLoadListener(new TestListener());
}
public static synchronized DOMAccessor getInstance() {
if (instance == null) {
instance = new DOMAccessorImpl();
}
@@ -63,6 +77,8 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
public synchronized void
startURLLoad(String url, String contentType, Document doc) {
System.err.println("############## DOMAccessor: startURLLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
@@ -74,45 +90,24 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
public synchronized void
endURLLoad(String url, int status, Document doc) {
System.err.println("############ DOMAccessor: endURLLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
(DocumentLoadListener) e.nextElement();
listener.endURLLoad(url, status, doc);
}
if ((!(url.endsWith(".html"))) && (!(url.endsWith(".xml"))))
return;
if (url.endsWith(".html"))
{
if (url.indexOf("test.html") == -1) {
System.out.println("TestCases Tuned to run with test.html...");
return;
}
}
if (url.endsWith(".xml"))
{
if (url.indexOf("test.xml") == -1) {
System.out.println("TestCases Tuned to run with test.xml...");
return;
}
}
Object obj = (Object) doc;
TestLoader tl = new TestLoader(obj, 0);
if (tl != null) {
Object retobj = tl.loadTest();
}
}
public synchronized void
progressURLLoad(String url, int progress, int progressMax,
Document doc) {
System.err.println("############ DOMAccessor: progressURLLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
@@ -124,6 +119,9 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
public synchronized void
statusURLLoad(String url, String message, Document doc) {
System.err.println("############ DOMAccessor: statusURLLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
@@ -136,6 +134,9 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
public synchronized void
startDocumentLoad(String url) {
System.err.println("############ DOMAccessor: startDocLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
@@ -147,6 +148,9 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
public synchronized void
endDocumentLoad(String url, int status, Document doc) {
System.err.println("############ DOMAccessor: endDocLoad "+url);
for (Enumeration e = documentLoadListeners.elements();
e.hasMoreElements();) {
DocumentLoadListener listener =
@@ -154,4 +158,58 @@ public class DOMAccessorImpl implements DOMAccessor, DocumentLoadListener {
listener.endDocumentLoad(url, status, doc);
}
}
}
} //end of class
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;
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

View File

@@ -1,22 +1,17 @@
/*
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/
The contents of this file are subject to the Mozilla Public License
Version 1.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.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.
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):
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.
*/
package org.mozilla.dom;

View File

@@ -0,0 +1,92 @@
/*
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 org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
import org.w3c.dom.EntityReference;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.events.DocumentEvent;
import org.w3c.dom.events.Event;
import org.w3c.dom.DOMException;
public class DocumentImpl extends NodeImpl implements Document, DocumentEvent {
// instantiated from JNI only
private DocumentImpl() {}
public native Attr createAttribute(String name);
public native CDATASection createCDATASection(String data);
public native Comment createComment(String data);
public native DocumentFragment createDocumentFragment();
public native Element createElement(String tagName);
public native EntityReference createEntityReference(String name);
public native ProcessingInstruction
createProcessingInstruction(String target,
String data);
public native Text createTextNode(String data);
public native DocumentType getDoctype();
public native Element getDocumentElement();
public native NodeList getElementsByTagName(String tagName);
public native DOMImplementation getImplementation();
/* The only change in this file - private -> public*/
public static native void initialize();
public Event createEvent(String type) throws DOMException {
throw new UnsupportedOperationException();
}
static {
System.loadLibrary("javadomjni");
initialize();
}
public Node importNode(Node importedNode, boolean deep) throws DOMException {
throw new UnsupportedOperationException();
}
public Element createElementNS(String namespaceURI, String qualifiedName)
throws DOMException {
throw new UnsupportedOperationException();
}
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
throws DOMException {
throw new UnsupportedOperationException();
}
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
throw new UnsupportedOperationException();
}
}

View File

@@ -1,11 +1,24 @@
/**
* @author Raju Pallath
* @version 1.0
*
* A interface which define the execute method. This interface is
* implemented by all Test Classes.
*
*/
/*
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.test;

View File

@@ -1,3 +1,23 @@
# 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):
HOMEDIR=../
SRCDIR=$(HOMEDIR)/src
CLASSDIR=$(HOMEDIR)/classes
@@ -15,16 +35,17 @@ all:
$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
$(JAVAC) -d $(CLASSDIR) $(DOMFILE)
cd api; make
cd $(CLASSDIR); jar cvf testdom.jar org
JAVAFILES= Execution.java \
BWBaseTest.java \
BWTestThread.java \
TestLoader.java \
ParamCombination.java \
ReflectionTest.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE= DOMFactory.java \
DOMFILE= DocumentImpl.java \
DOMAccessorImpl.java
clean:

View File

@@ -1,3 +1,24 @@
# 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):
HOMEDIR=../
SRCDIR=$(HOMEDIR)/src
CLASSDIR=$(HOMEDIR)/classes
@@ -15,16 +36,17 @@ all:
$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
$(JAVAC) -d $(CLASSDIR) $(DOMFILE)
cd api; make
cd $(CLASSDIR); jar cvf testdom.jar org
JAVAFILES= Execution.java \
BWBaseTest.java \
BWTestThread.java \
TestLoader.java \
ParamCombination.java \
ReflectionTest.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE= DOMFactory.java \
DOMFILE= DocumentImpl.java \
DOMAccessorImpl.java
clean:

View File

@@ -1,3 +1,25 @@
#!nmake
#
# 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):
HOMEDIR=..
SRCDIR=$(HOMEDIR)\src
CLASSDIR=$(HOMEDIR)\classes
@@ -6,6 +28,10 @@ JAVAC=javac
TESTPACKAGE=org\mozilla\dom\test
DOMPACKAGE=org\mozilla\dom
GENERATOR_FILES=BWJavaTemplate.java \
ReflectionTest.java \
ParamCombination.java
JAVAFILES= Execution.java \
BWBaseTest.java \
TestLoader.java \
@@ -14,21 +40,34 @@ JAVAFILES= Execution.java \
BWTestThread.java \
BWJavaTemplate.java
DOMFILE= DOMFactory.java \
DOMAccessorImpl.java
all:
DOMFILE=DOMAccessorImpl.java \
DocumentImpl.java
all: testloader accessor
@echo done
@cd api
@nmake -f Makefile.win
testloader:
@echo "******************************************************"
@echo "Make changes to $(SRCDIR)\mozilla.bat"
@echo "and execute it else it may not compile..."
@echo "******************************************************"
@echo ""
@echo Building test accessory classes ...
@echo Building test accessory classes ...
@$(JAVAC) -d $(CLASSDIR) $(JAVAFILES)
accessor:
!if !defined(USE_APPLET_FOR_REGISTRATION)
@echo Building DOMAccessor ...
@$(JAVAC) -d $(CLASSDIR) $(DOMFILE)
@echo done
@cd api
@nmake -f Makefile.win
!endif
generator:
javac $(GENERATOR_FILES) -d $(CLASSDIR)
clean:
del /f/q $(CLASSDIR)\$(TESTPACKAGE)\*.class

View File

@@ -1,7 +1,23 @@
/**
* @version 1.00 06 Jul 1999
* @author Raju Pallath
*/
/*
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.test;

View File

@@ -5,10 +5,14 @@ For Solaris
1) open mozilla.csh
2) make changes to variables
BLACKWOOD_HOME
MOZILLA_FIVE_HOME
JAVA_HOME
TEST_PATH
MOZILLA_FIVE_HOME - Absolute path where mozilla-bin
executable is located.
JAVA_HOME - Absolute Path to JDK dir.
TEST_PATH - Absolute Directory Path where file
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.
3) source mozilla.csh
this will set up the environment
@@ -20,6 +24,10 @@ 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
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
(By default it is assumed that they can be accessed as
@@ -57,37 +65,59 @@ Assumption:
For WIN32
===========
Assumes you have installed PERL
Assumes you have installed PERL and the following variables are set in your environment:
MOZILLA_HOME - top directory in mozilla's tree
JAVA_HOME - path to JDK
1) open mozilla.bat
2) make changes to variables
BLACKWOOD_HOME - the path to the parent directory of this one
MOZILLA_FIVE_HOME
JAVA_HOME
TEST_PATH
TEST_URL- as explained below
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
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
3) execute mozilla.bat from command prompt
this will set up the environment for this command prompt
this will create new console and set up the environment for this
command prompt
4) Edit BWProperties file and change the locations for variables
BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is
located)
BW_LOGDIR (Absolute Directory Path where log files need to be
created)
BW_THREADMODE (Execute tests in single thread [S] or
multi-thread [M] mode. Takes values S/M.)
BW_TESTDIR (Absolute Directory Path where file BWTestClass.lst is
located)
BW_LOGDIR (Absolute Directory Path where log files need to be
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
run tests through TestLoader applet)
BW_XMLTEST (URL where test.xml file are located. Used if you
run tests through TestLoader applet)
NOTE: Since on Windows file separator is a `\`, it should be escaped
by another '\'. So if a file is in c:\mozilla\tests then it
would be written as c:\\mozilla\\tests.
5) Copy files test.html and test.xml into
some document directory of HTTP server. TEST_URL environment
variable should contain the URL of this directory.
For example, if you placed the files in the root directory of
HTTP server "myserver", then value of TEST_URL should be
"http://myserver".
5) Invoke autorun.pl from command prompt.
perl autorun.pl
For quick testing say
if you use applet for registration
mozilla.exe file:/TestLoaderHTML.html
(mozilla.exe file:/TestLoaderXML.html)
6) Invoke autorun.pl from command prompt.
perl autorun.pl
if you use hacked DOMAcceessorImpl.
mozilla.exe file:/test.html
(mozilla.exe file:/test.xml)
7) The results are recorded in HTML file BWTest.html
and in log file BWTest.log

View File

@@ -6,43 +6,67 @@
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<center>
<h3>
<b>README for DOM API Test Execution</b></h3></center>
<b>README for DOM API Test Execution</b></h3>
<a href="#solaris">Solaris</a>
&nbsp;
&nbsp;
<a href="#winnt">WinNT</a>
&nbsp;
&nbsp;
<a href="#linux">Linux</a>
&nbsp;
&nbsp;
<a href="#mac">Macintosh</a>
</center>
<a name=solaris>
<center>
<hr NOSHADE WIDTH="100%"></center>
<i><u><font color="#990000"><font size=+3>Solaris</font></font></u></i>
<ul>
<li>
<b><font size=+1>open <font color="#FF6666">mozilla.csh</font></font></b></li>
</ul>
<ul>
<li>
<b><font size=+1>make changes to variables</font></b></li>
<ul>
<li>
<b><font color="#FF6666"><font size=+1>BLACKWOOD_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>MOZILLA_FIVE_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>JAVA_HOME</font></font></b></li>
<li>
<b><font color="#FF6666"><font size=+1>TEST_PATH</font></font></b></li>
</ul>
</ul>
<ul>
<ul>&nbsp;
<center><table BORDER COLS=2 WIDTH="80%" BGCOLOR="#99FFCC" NOSAVE >
<tr NOSAVE>
<td WIDTH="30%" NOSAVE><b><font color="#FF6666"><font size=+1>TEST_PATH</font></font></b></td>
<td><b>Absolute Directory Path where file BWTestClass.lst is located.</b></td>
</tr>
<tr NOSAVE>
<td NOSAVE><b><font color="#FF6666"><font size=+1>MOZILLA_FIVE_HOME</font></font></b></td>
<td><b>Absolute Path where mozilla-bin is located.</b></td>
</tr>
<tr>
<td><b><font color="#FF6666"><font size=+1>JAVA_HOME</font></font></b></td>
<td><b>Absolute Path to JDK dir.</b></td>
</tr>
<tr>
<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
used.</b></td>
</tr>
</table></center>
<li>
<b><font size=+1>source mozilla.csh this will set up the environment</font></b></li>
</ul>
<ul>
<li>
<b><font size=+1>Edit BWProperties file and change the locations for variables</font></b></li>
</ul>
@@ -66,6 +90,20 @@
<td><b>Indicates whether to execute tests in single-thread mode[S]&nbsp;&nbsp;&nbsp;&nbsp;
or multi-thread mode[M].&nbsp; Takes values S/M .</b></td>
</tr>
<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
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>
<br><b>run tests through TestLoader applet</b></td>
</tr>
</table></center>
<ul>&nbsp;</ul>
@@ -95,8 +133,7 @@ and in log file <font color="#FF6666">BWTest.log</font> Individual test
Log files are also found in 'log' directory.</font></b></li>
</ul>
<hr NOSHADE WIDTH="100%">&nbsp;<b><font size=+1>To Invoke a specific test
case</font></b>
<p><br><b><font size=+1>To Invoke a specific test case</font></b>
<blockquote><b><font size=+1>sh autorun.sh -t org.mozilla.dom.test.AttrImpl_getName</font></b></blockquote>
<b><font size=+1><u><font color="#3366FF">NOTE:</font></u>All Test Cases
are recorded in file BWTestClass.lst.ORIG</font></b>
@@ -107,8 +144,111 @@ of your WebServer.</b></font>
<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>
</a>
<hr SIZE=4 NOSHADE WIDTH="100%">
<a name="winnt">
<br><i><u><font color="#990000"><font size=+3>Windows NT</font></font></u></i>
<ol>
<li>
<b>Assumes you have installed PERL and the following variables are set
in your environment:</b></li>
<ul>
<li>
<font color="#FF6666">MOZILLA_HOME</font> - top directory in mozilla's
tree</li>
<li>
<font color="#FF6666">JAVA_HOME</font> - path to JDK</li>
</ul>
<li>
open mozilla.bat</li>
<li>
make changes to variables</li>
<ul>
<li>
<font color="#FF6666">MOZILLA_BIN</font> - Mozilla's executable file name
(e.g. mozilla.exe or viewer.exe)</li>
<li>
<font color="#FF6666">TEST_PATH</font> - path to the current directory
(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
if you run tests through hacked DOMAccessor only.</li>
</ul>
<li>
execute <b>mozilla.bat</b> from command prompt this will create new console
and set up the environment for this command prompt</li>
<li>
Edit BWProperties file and change the locations for variables</li>
<ul>
<li>
<font color="#FF6666">BW_TESTDIR</font> (Absolute Directory Path where
file BWTestClass.lst is located)</li>
<li>
<font color="#FF6666">BW_LOGDIR</font> (Absolute Directory Path where log
files need to be created)</li>
<li>
<font color="#FF6666">BW_THREADMODE</font> (Execute tests in single thread
[S] or multi-thread [M] mode. Takes values S/M.)</li>
<li>
<font color="#FF6666">BW_HTMLTEST</font> (URL where test.html file are
located. Used if you run tests through TestLoader applet)</li>
<li>
<font color="#FF6666">BW_XMLTEST</font> (URL where test.xml file are located.
Used if you run tests through TestLoader applet)</li>
</ul>
<br>
<b>NOTE:</b> Since on Windows file separator is a `\`, it should be escaped by
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another '\'. So if a file is in c:\mozilla\tests then it would be written as c:\\mozilla\\tests.
<br>
<br>
<li>
There are several ways to run tests:</li>
<ul>
<li>
Invoke autorun.pl from command prompt.</li>
<br><b>perl autorun.pl</b>
<br>For each test new Mozilla is executed.
<li>
For quick testing say</li>
<br><b>mozilla.exe file:/TestLoaderHTML.html</b>
<br>(mozilla.exe file:/TestLoaderXML.html)
<br>if you use applet for registration
<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>
<li>
The results are recorded in HTML file BWTest.html and in log file BWTest.log
Individual test Log files are also found in 'log' directory.</li>
</ol>
<!--
<ul>
<li>
<b><font size=+1>open <font color="#FF6666">mozilla.bat</font></font></b></li>
@@ -194,8 +334,9 @@ then value of TEST_URL should be&nbsp; "<font color="#3333FF">http://myserver</f
<ul><b><font size=+1>The results are recorded in HTML file <font color="#FF6666">BWTest.html</font>
and in log file <font color="#FF6666">BWTest.log</font> Individual test
Log files are also found in 'log' directory.</font></b></ul>
-->
</a>
<hr SIZE=4 NOSHADE WIDTH="100%">
<br><b><font size=+1>&nbsp;</font></b>
<br>&nbsp;
</body>
</html>

View File

@@ -1,7 +1,24 @@
/**
* @version 1.00 11 Mar 1997
* @author Cay Horstmann
*/
/*
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.test;
import java.lang.reflect.*;

View File

@@ -1,30 +1,66 @@
/**
****************************************************************************
*
* @author Raju Pallath
* @version 1.0
*
* this class loads all the Test cases and executes them and returns the
* pass/fail status.
* The Factory class loads this class and executes all Test Cases
* listed in a file whose path is set by env. variable BW_TESTDIR
* and filename by itself is set in BW_TESTFILE
* This class loops thru' each file entry and tries to execute each test
* case.
*
****************************************************************************
*/
/*
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.test;
import java.lang.*;
import java.util.*;
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.DocumentLoadListener;
import org.mozilla.dom.test.*;
public class TestLoader
public class TestLoader extends Applet implements DocumentLoadListener
{
private Object targetObj;
private int returnType = 0;
private static String TESTFILE = "BWTestClass.lst";
private static String PROPERTYFILE = "BWProperties";
private static String LOGFILE = "BWTest.log";
private static String LOGHTML = "BWTest.html";
private static String LOGTXT = "BWTest.txt";
public static Properties propTable = new Properties();
private final boolean debug = true;
private static String FILE_SEP = "/";
/**
************************************************************************
* Default constructor
*
************************************************************************
*/
public TestLoader()
{
System.out.println("########################## Createing default TestLoader ...\n");
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
FILE_SEP = System.getProperty("file.separator");
}
/**
************************************************************************
@@ -38,10 +74,31 @@ public class TestLoader
*/
public TestLoader(Object obj, int areturnType)
{
System.out.println("########################## Createing TestLoader ...");
targetObj = obj;
returnType = areturnType;
FILE_SEP = System.getProperty("file.separator");
}
/**
*
************************************************************************
*
* Sets the Testing Target
*
* @param target Target to be tested
*
* @return void
*
************************************************************************
*
*/
void setTarget(Object target)
{
targetObj = target;
}
/**
*
************************************************************************
@@ -62,6 +119,32 @@ public class TestLoader
// Read Property File
TestLoader.readPropertyFile();
// Check Property Names, to see if provided with correct file
// separators.
// For Windows platform FILE_SEP is \ but it has to be escaped with
// another \ , so a property value would look like c:\\mozilla\\java
// instead of c:\mozilla\java
//
String CHECK_SEP = "/";
if ( FILE_SEP.compareTo("/") == 0) CHECK_SEP = "\\";
Enumeration em = propTable.propertyNames();
if (em == null) return null;
while (em.hasMoreElements())
{
String name = (String)(em.nextElement());
String val = propTable.getProperty(name);
if (val == null) continue;
int idx = val.indexOf(CHECK_SEP);
if (idx != -1) {
System.out.println("********** ERROR: File Separator for Property " + name + " is incorrect in file " + PROPERTYFILE);
return null;
}
}
String testDir = ".";
String testFile = TESTFILE;
@@ -73,16 +156,18 @@ public class TestLoader
testFile = propTable.getProperty("BW_TESTFILE");
if (testFile == null) testFile = TESTFILE;
String fname = testDir + "/" + testFile;
String fname = testDir + FILE_SEP + testFile;
FileInputStream in = null;
try {
in = new FileInputStream(fname);
} catch (SecurityException e) {
System.out.println ("Security Exception:Could not create stream for file " + fname);
System.exit(-1);
return null;
} catch (FileNotFoundException e) {
System.out.println ("Could not create stream for file " + fname);
System.exit(-1);
return null;
}
@@ -133,6 +218,7 @@ public class TestLoader
Class c=null;
try {
System.out.println("############### Class name: "+s);
c = Class.forName(s);
} catch (ClassNotFoundException e) {
System.out.println ("Could not find class " + s);
@@ -150,11 +236,19 @@ public class TestLoader
// If single thread execution
if (threadMode.compareTo("S") == 0)
{
try {
System.out.println("################ Starting test ...");
if (((BWBaseTest)classObj).execute(targetObj)) {
txtPrint(s, "PASSED");
System.out.println("################ passed");
} else {
txtPrint(s, "FAILED");
System.out.println("################ failed");
}
} catch (Exception e) {
System.out.println("################ failed with exception: "+e);
txtPrint(s, "FAILED: "+e);
}
// if any return type expected, then it is returned.
// This is just a provision kept for latter use
@@ -165,14 +259,20 @@ public class TestLoader
//}
} else {
BWTestThread t = new BWTestThread(s);
try {
System.out.println("############## Starting test ...");
if (t != null)
{
t.setTestObject(classObj, targetObj);
t.start();
}
} catch (Exception e) {
txtPrint(s, "FAILED: "+e);
}
}
}
//txtPrint("Parent Thread Done", "PASSED");
return null;
}
@@ -217,6 +317,7 @@ public class TestLoader
return;
}
}
/**
@@ -251,7 +352,6 @@ public class TestLoader
*/
public static void logPrint(String msg)
{
if (msg == null) return;
String logDir = propTable.getProperty("BW_LOGDIR");
@@ -260,8 +360,7 @@ public class TestLoader
String logFile = propTable.getProperty("BW_LOGFILE");
if (logFile == null) logFile = LOGFILE;
String fname = logDir + "/" + logFile;
String fname = logDir + FILE_SEP + logFile;
// Get Output Stream from Log file
RandomAccessFile raf=null;
@@ -306,7 +405,7 @@ public class TestLoader
String fname = logDir + "/" + logFile;
String fname = logDir + FILE_SEP + logFile;
File f=null;
try {
@@ -392,7 +491,7 @@ public class TestLoader
String logFile = LOGHTML;
String fname = logDir + "/" + logFile;
String fname = logDir + FILE_SEP + logFile;
// Get Output Stream from Log file
RandomAccessFile raf=null;
@@ -449,7 +548,7 @@ public class TestLoader
String logFile = LOGHTML;
String fname = logDir + "/" + logFile;
String fname = logDir + FILE_SEP + logFile;
// Get Output Stream from Log file
RandomAccessFile raf=null;
@@ -506,7 +605,7 @@ public class TestLoader
String logFile = TestLoader.LOGTXT;
String fname = logDir + "/" + logFile;
String fname = logDir + FILE_SEP + logFile;
// Get Output Stream from Log file
RandomAccessFile raf=null;
@@ -536,12 +635,81 @@ public class TestLoader
}
}
private Object targetObj;
private int returnType;
private static String TESTFILE = "BWTestClass.lst";
private static String PROPERTYFILE = "BWProperties";
private static String LOGFILE = "BWTest.log";
private static String LOGHTML = "BWTest.html";
private static String LOGTXT = "BWTest.txt";
public static Properties propTable = new Properties();
}
/*Implementing DocumentLoadListener interface*/
public void endDocumentLoad(String url, int status, Document doc)
{
System.out.println("################### Got Document: "+url);
if ((!(url.endsWith(".html"))) && (!(url.endsWith(".xml")))) {
System.out.println("################### Document is not HTML/XML ... "+url);
return;
}
if (url.endsWith(".html"))
{
if (url.indexOf("test.html") == -1) {
System.out.println("TestCases Tuned to run with test.html...");
return;
}
}
if (url.endsWith(".xml"))
{
if (url.indexOf("test.xml") == -1) {
System.out.println("TestCases Tuned to run with test.xml...");
return;
}
}
Object obj = (Object) doc;
setTarget(obj);
System.out.println("################## Loading test ... ");
try {
Object retobj = loadTest();
System.out.println("################## test exited normally ... ");
} catch (Exception e) {
System.out.println("################## test exited abnormally: \n" + e);
}
doc = null;
};
public void startURLLoad(String url, String contentType, Document doc) {};
public void endURLLoad(String url, int status, 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) {};
/*Overiding some Applet's methods */
public void init()
{
System.err.println("################## Regestring DocumentLoadListener !");
DOMAccessorImpl.getInstance().addDocumentLoadListener((DocumentLoadListener)this);
String testURL = propTable.getProperty("BW_HTMLTEST");
if (testURL == null) {
System.err.println("################# WARNING: BW_HTMLTEST property is not set ! Using file: protocol by default !");
testURL="file:";
}
if (getParameter("test_type").equals("XML")) {
testURL = propTable.getProperty("BW_XMLTEST");
if (testURL == null)
testURL="file:";
testURL+="/test.xml";
} else if (getParameter("test_type").equals("HTML")) {
testURL+="/test.html";
} else {
System.err.println("################ WARNING: Unrecognized test type (valid are HTML/XML):"+getParameter("test_type")+"\nLoading test.html by default.");
testURL+="/test.html";
}
System.err.println("################## Loading "+testURL);
try {
getAppletContext().showDocument(new URL(testURL));
} catch (Exception e) {
System.err.println("############ Can't show test document: \nException: " + e.fillInStackTrace());
}
}
}//end of class

View File

@@ -0,0 +1,7 @@
<html>
<body>
<applet code="org.mozilla.dom.test.TestLoader" width=1 height=1>
<param name="test_type" value="HTML">
</applet>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<html>
<body>
<applet code="org.mozilla.dom.test.TestLoader" width=1 height=1></applet>
<param name="test_type" value="XML">
</script>
</body>
</html>

View File

@@ -1,18 +1,31 @@
# !/bin/perl
#!/usr/bin/perl
#
# Created By: Raju Pallath
# Creation Date: Aug 2nd 1999
# 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/
#
# Ported by: Konstantin S. Ermakov
# Ported date: Aug 24th 1999
# 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):
###################################################################
# This script is used to invoke all test case for DOM API
# through apprunner and to recored their results
# through mozilla_bin and to recored their results
#
#
# Attach Perl Libraries
###################################################################
use Cwd;
use File::Copy;
use Win32::Process;
@@ -20,14 +33,15 @@ use Win32::Process;
###################################################################
# time in seconds after which the apprunner has to be killed.
# by default the apprunner will be up for so much time regardless of
# time in seconds after which the mozilla has to be killed.
# by default the mozilla will be up for so much time regardless of
# whether over or not. User can either decrease it or increase it.
#
$DELAY_FACTOR = 25;
# time period in seconds of periodically checking: is the apprunner still alive
$DELAY_FACTOR = 15;
# time period in seconds of periodically checking: is the mozilla still alive
$DELAY_OF_CYCLE = 5;
$TESTROOT = $ENV{"TEST_PATH"};
$DOCROOT = $ENV{"TEST_URL"};
# delimiter for logfile
@@ -280,14 +294,22 @@ if ( $mozhome eq "" ) {
die;
}
if ( ! -f "$mozhome/apprunner.exe" ) {
print "Could not find 'apprunner.exe' in MOZILLA_FIVE_HOME.\n";
$mozilla_bin=@ENV{"MOZILLA_BIN"};
if ( ! -f "$mozhome/$mozilla_bin" ) {
print "Could not find $mozilla_bin in MOZILLA_FIVE_HOME ($mozhome).\n";
print "Please check your setting...\n";
die;
}
if ( ! -d $TESTROOT) {
print "TEST_PATH directory doesn't exist ($TESTROOT)\n";
print "Please check your setting...\n";
die;
}
# Here must come a piece of code, that determinates
# apprunner instance, removes core, but there's no
# mozilla instance, removes core, but there's no
# core under win32
# Backup existing .lst file
@@ -330,30 +352,46 @@ if ( -f "$LOGHTML" ) {
}
# construct DOCFILE
$DOCFILE = "$DOCROOT/test.html";
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.html";
}
$runcnt = 1;
$filename = "$curdir/BWTestClass.lst.ORIG";
if ($runtype == 1) {
$DOCFILE = "$DOCROOT/test.html";
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.html";
}
$filename = "$curdir/BWTestClass.lst.html.ORIG";
$runcnt = 1;
}
if ($runtype == 2) {
$DOCFILE = "$DOCROOT/test.xml";
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderXML.html";
} else {
$DOCFILE = "$DOCROOT/test.xml";
}
$filename = "$curdir/BWTestClass.lst.xml.ORIG";
$runcnt = 1;
}
if ($runtype == 3) {
$DOCFILE = "$DOCROOT/test.html";
if (@ENV{"USE_APPLET_FOR_REGISTRATION"}) {
$DOCFILE = "$DOCROOT/TestLoaderHTML.html";
} else {
$DOCFILE = "$DOCROOT/test.xml";
}
$filename = "$curdir/BWTestClass.lst.html.ORIG";
$runcnt = 2;
}
# Prepare log streams
open( LOGFILE, ">>$LOGFILE" ) or die("Can't open LOG file...\n");
open( LOGFILE, ">>$LOGFILE" ) or die("Can't open LOG file ($LOGFILE)...\n");
select LOGFILE; $| = 1; select STDOUT;
open( LOGHTML, ">$LOGHTML" ) or die("Can't open HTML file...\n");
@@ -393,16 +431,17 @@ while (true) {
($nom) = ($testcase =~ /([^\.]*)$/);
$testlog = "$curdir/log/$nom.$id.log";
print("Loading $DOCFILE ...\n");
open( SAVEOUT, ">&STDOUT" );
open( SAVEERR, ">&STDERR" );
open( STDOUT, ">$testlog" ) or die "Can't redirect stdout";
open( STDERR, ">&STDOUT" );
Win32::Process::Create($ProcessObj,
"$mozhome/apprunner.exe",
"$mozhome/apprunner.exe $DOCFILE ",
"$mozhome/$mozilla_bin",
"$mozhome/$mozilla_bin $DOCFILE",
1,
NORMAL_PRIORITY_CLASS,
"$mozhome" ) || die "cann't start apprunner";
"$TESTROOT" ) || die "cann't start $moilla_bin";
close( STDOUT );
close( STDERR );
open( STDOUT, ">&SAVEOUT" );

View File

@@ -1,16 +1,32 @@
#!/bin/sh -x
#
# Created By: Raju Pallath
# Creation Date: Aug 2nd 1999
# 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):
##################################################################
# This script is used to invoke all test case for DOM API
# thru' apprunner and to recored their results
# thru' mozilla-bin and to record their results
#
##################################################################
#
# time in seconds after which the apprunner has to be killed.
# by default the apprunner will be up for so much time regardless of
# time in seconds after which the mozilla-bin has to be killed.
# by default the mozilla-bin will be up for so much time regardless of
# whether over or not. User can either decrease it or increase it.
#
DELAY_FACTOR=50
@@ -216,13 +232,13 @@ constructHTMLBody()
sort -u $LOGTXT > $LOGTXT.tmp
/bin/mv $LOGTXT.tmp $LOGTXT
for i in `cat $LOGTXT`
while read i
do
class=`echo $i | cut -d"=" -f1`
status=`echo $i | cut -d"=" -f2`
echo "<tr><td>$class</td><td>$status</td></tr>\n" >> $LOGHTML
done
done < $LOGTXT
}
@@ -355,20 +371,20 @@ then
exit 1;
fi
if [ ! -x "$mozhome/apprunner" ]
if [ ! -x "$mozhome/mozilla-bin" ]
then
echo "Could not find executable 'apprunner' in MOZILLA_FIVE_HOME."
echo "Could not find executable 'mozilla-bin' in MOZILLA_FIVE_HOME."
echo "Please check your setting..."
echo
exit 1;
fi
chkpid=`ps -aef | grep apprunner | grep -v grep | awk '{ print $2 }'`
chkpid=`ps -aef | grep mozilla-bin | grep -v grep | awk '{ print $2 }'`
if [ ! -z "$chkpid" ]
then
echo "Detected an instance of apprunner...";
echo "Exit out from apprunner and restart this script..."
echo "Detected an instance of mozilla-bin...";
echo "Exit out from mozilla-bin and restart this script..."
exit 1
fi
@@ -444,15 +460,26 @@ then
fi
/bin/touch $LOGHTML
# construct DOCFILE
DOCFILE="$DOCROOT/test.html"
appreg=${USE_APPLET_FOR_REGISTRATION}
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
runcnt=1
filename="$curdir/BWTestClass.lst.ORIG"
if [ "$runtype" = "1" ]
then
DOCFILE="$DOCROOT/test.html"
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
runcnt=1
filename="$curdir/BWTestClass.lst.html.ORIG"
fi
@@ -460,29 +487,34 @@ fi
if [ "$runtype" = "2" ]
then
DOCFILE="$DOCROOT/test.xml"
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.xml";
else
DOCFILE="$DOCROOT/TestLoaderXML.html";
fi
filename="$curdir/BWTestClass.lst.xml.ORIG"
runcnt=1
fi
if [ "$runtype" = "3" ]
then
DOCFILE="$DOCROOT/test.html"
if [ -z "$appreg" ]
then
DOCFILE="$DOCROOT/test.html";
else
DOCFILE="$DOCROOT/TestLoaderHTML.html";
fi
filename="$curdir/BWTestClass.lst.html.ORIG"
runcnt=2
fi
echo "Runtype is $runtype"
constructLogHeader
CLASSPATH="$curdir/../classes:${CLASSPATH}"
if [ "$executionMode" = "M" ]
then
DELAY_FACTOR=`expr $DELAY_FACTOR \* 10`
fi
currcnt=0
while true
do
@@ -527,11 +559,11 @@ do
format=`echo $testcase | sed 's/\./\//g'`
nom=`basename $format`
testlog="$curdir/log/$nom.$id.log"
./apprunner $DOCFILE 2>$testlog 1>&2 &
./mozilla-bin $DOCFILE 2>$testlog 1>&2 &
# dummy sleep to allow apprunner to show up on process table
# dummy sleep to allow mozilla-bin to show up on process table
sleep 3
curpid=`ps -aef | grep apprunner | grep -v grep | awk '{ print $2 }'`
curpid=`ps -aef | grep mozilla-bin | grep -v grep | awk '{ print $2 }'`
flag=0
cnt=0
@@ -556,7 +588,7 @@ do
break
fi
chkpid=`ps -aef | grep apprunner | grep -v grep | awk '{ print $2 }'`
chkpid=`ps -aef | grep mozilla-bin | grep -v grep | awk '{ print $2 }'`
if [ -z "$chkpid" ]
then
flag=1
@@ -570,7 +602,6 @@ do
fi
cnt=`expr $cnt + 10`
if [ $cnt -eq $DELAY_FACTOR ]
then
flag=0
@@ -597,7 +628,6 @@ do
currcnt=`expr $currcnt + 1`
if [ $currcnt -eq $runcnt ]
then
break

View File

@@ -0,0 +1 @@
java org.mozilla.dom.test.BWJavaTemplate %1 %2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -0,0 +1,36 @@
#!/usr/bin/perl
#
# 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):
($#ARGV > 0) || die "Usage: gen_rules.pl <file_list> <output_rules>\n";
open (IN, "<$ARGV[0]") || die "Can't open in file $ARGV[0]: $!\n";
open (OUT, ">$ARGV[1]") || die "Can't open out file $ARGV[1]: $!\n";
while(<IN>) {
if (/.*\d (.*?)\.java/) {
$elem = $1;
$name = "UNKNOWN_ELEMENT";
if ($elem =~ /HTML(.*)Element/) {
$name = uc $1;
}
print OUT "$elem (($elem)(d.createElement(\"$name\")))\n";
}
}

View File

@@ -0,0 +1,36 @@
#!/usr/bin/perl
#
# 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):
($#ARGV > 0) || die "Usage: gen_rules.pl <file_list> <output_dir> <rules_file>\n";
open (IN, "<$ARGV[0]") || die "Can't open in file $ARGV[0]: $!\n";
while(<IN>) {
if (/.*\d (.*?)\.java/) {
$elem = $1;
$name = "UNKNOWN_ELEMENT";
if ($elem =~ /HTML(.*)Element/) {
$name = $1;
}
system "build_test.bat -d $ARGV[1] -r $ARGV[2] org.w3c.dom.html.$elem";
}
}

View File

@@ -0,0 +1,58 @@
HTMLDOMImplementation ((HTMLDOMImplementation)(d.createElement("UNKNOWN_ELEMENT")))
HTMLElement ((HTMLElement)(d.createElement("")))
HTMLHeadingElement ((HTMLHeadingElement)(d.createElement("HEADING")))
HTMLFieldSetElement ((HTMLFieldSetElement)(d.createElement("FIELDSET")))
HTMLTableCaptionElement ((HTMLTableCaptionElement)(d.createElement("TABLECAPTION")))
HTMLTableSectionElement ((HTMLTableSectionElement)(d.createElement("TABLESECTION")))
HTMLTableColElement ((HTMLTableColElement)(d.createElement("TABLECOL")))
HTMLCollection ((HTMLCollection)(((HTMLDocument)d).getAnchors()))
HTMLDocument ((HTMLDocument)(d.getDocumentElement()))
HTMLAnchorElement ((HTMLAnchorElement)(d.createElement("A")))
HTMLAppletElement ((HTMLAppletElement)(d.createElement("APPLET")))
HTMLAreaElement ((HTMLAreaElement)(d.createElement("AREA")))
HTMLBaseElement ((HTMLBaseElement)(d.createElement("BASE")))
HTMLBaseFontElement ((HTMLBaseFontElement)(d.createElement("BASEFONT")))
HTMLBodyElement ((HTMLBodyElement)(d.createElement("BODY")))
HTMLBRElement ((HTMLBRElement)(d.createElement("BR")))
HTMLButtonElement ((HTMLButtonElement)(d.createElement("BUTTON")))
HTMLDirectoryElement ((HTMLDirectoryElement)(d.createElement("DIRECTORY")))
HTMLDivElement ((HTMLDivElement)(d.createElement("DIV")))
HTMLDListElement ((HTMLDListElement)(d.createElement("DL")))
HTMLFontElement ((HTMLFontElement)(d.createElement("FONT")))
HTMLFormElement ((HTMLFormElement)(d.createElement("FORM")))
HTMLFrameElement ((HTMLFrameElement)(d.createElement("FRAME")))
HTMLFrameSetElement ((HTMLFrameSetElement)(d.createElement("FRAMESET")))
HTMLHeadElement ((HTMLHeadElement)(d.createElement("HEAD")))
HTMLHRElement ((HTMLHRElement)(d.createElement("HR")))
HTMLHtmlElement ((HTMLHtmlElement)(d.createElement("HTML")))
HTMLIFrameElement ((HTMLIFrameElement)(d.createElement("IFRAME")))
HTMLImageElement ((HTMLImageElement)(d.createElement("IMAGE")))
HTMLInputElement ((HTMLInputElement)(d.createElement("INPUT")))
HTMLIsIndexElement ((HTMLIsIndexElement)(d.createElement("ISINDEX")))
HTMLLabelElement ((HTMLLabelElement)(d.createElement("LABEL")))
HTMLLegendElement ((HTMLLegendElement)(d.createElement("LEGEND")))
HTMLLIElement ((HTMLLIElement)(d.createElement("LI")))
HTMLLinkElement ((HTMLLinkElement)(d.createElement("LINK")))
HTMLMapElement ((HTMLMapElement)(d.createElement("MAP")))
HTMLMenuElement ((HTMLMenuElement)(d.createElement("MENU")))
HTMLMetaElement ((HTMLMetaElement)(d.createElement("META")))
HTMLModElement ((HTMLModElement)(d.createElement("MOD")))
HTMLObjectElement ((HTMLObjectElement)(d.createElement("OBJECT")))
HTMLOListElement ((HTMLOListElement)(d.createElement("OL")))
HTMLOptGroupElement ((HTMLOptGroupElement)(d.createElement("OPTGROUP")))
HTMLOptionElement ((HTMLOptionElement)(d.createElement("OPTION")))
HTMLParagraphElement ((HTMLParagraphElement)(d.createElement("PARAGRAPH")))
HTMLParamElement ((HTMLParamElement)(d.createElement("PARAM")))
HTMLPreElement ((HTMLPreElement)(d.createElement("PRE")))
HTMLQuoteElement ((HTMLQuoteElement)(d.createElement("QUOTE")))
HTMLScriptElement ((HTMLScriptElement)(d.createElement("SCRIPT")))
HTMLSelectElement ((HTMLSelectElement)(d.createElement("SELECT")))
HTMLStyleElement ((HTMLStyleElement)(d.createElement("STYLE")))
HTMLTableCellElement ((HTMLTableCellElement)(d.createElement("TD")))
HTMLTableElement ((HTMLTableElement)(d.createElement("TABLE")))
HTMLTableRowElement ((HTMLTableRowElement)(d.createElement("TR")))
HTMLTextAreaElement ((HTMLTextAreaElement)(d.createElement("TEXTAREA")))
HTMLTitleElement ((HTMLTitleElement)(d.createElement("TITLE")))
HTMLUListElement ((HTMLUListElement)(d.createElement("UL")))

View File

@@ -1,12 +1,35 @@
set BLACKWOOD_HOME=
set MOZILLA_FIVE_HOME=
set JAVA_HOME=
set TEST_PATH=%BLACKWOOD_HOME%
# url of the directory where you placed test.html and test.xml
set TEST_URL=
rem @ECHO off
set BLACKWOOD_HOME=%MOZILLA_HOME%
set MOZILLA_FIVE_HOME=%MOZILLA_HOME%\dist\WIN32_D.OBJ\bin
rem Mozilla binary file name
set MOZILLA_BIN=mozilla.exe
set JAVA_HOME=%JAVAHOME%
rem path to the SRC directory of the JavaDOM tests
set TEST_PATH=E:\Mozilla\BW_SQE\Tests_accessor\src\JavaDOM\CoreLevel1\src
rem if this variable is set then we register DOMDocumentListener through TestLoader applet
rem (currently avilable on Win32 only)
rem otherwise hacked DOMAccessorImpl class is used for running tests
set USE_APPLET_FOR_REGISTRATION=1
if %USE_APPLET_FOR_REGISTRATION%x==1x del %TEST_PATH%\..\classes\org\mozilla\dom\DOMAccessorImpl.class 2> nul;
if %USE_APPLET_FOR_REGISTRATION%x==1x del %TEST_PATH%\..\classes\org\mozilla\dom\DocumentImpl.class 2> nul;
rem url of the directory where you placed test.html and test.xml
rem complete URL looks like that: $TEST_PATH/test.html(xml)
rem if you register DOMDocumentListener through TestLoader applet (by default under Win32) then
rem url below is unused - it should be set in the BWProperties file
rem (BW_HTMLTEST and BW_XMLTEST properties)
rem (file:/test.html and file:/test.xml URLs are used by default)
set TEST_URL=file:
set PATH=%JAVA_HOME%\bin;%PATH%
set PATH=%MOZILLA_FIVE_HOME%;%PATH%
set CLASSPATH=%MOZILLA_FIVE_HOME%\classes
set CLASSPATH=%TEST_PATH%\classes;%CLASSPATH%
set CLASSPATH=%TEST_PATH%\..\classes;%MOZILLA_HOME%\dist\classes;%CLASSPATH%
rem creating new console window with these variables being set
start

View File

@@ -1,7 +1,6 @@
setenv BLACKWOOD_HOME `pwd`/..
setenv TEST_PATH `pwd`/..
setenv MOZILLA_FIVE_HOME `pwd`/../../../../dist/bin
setenv JAVA_HOME /usr/local/java/jdk1.2/solaris
setenv TEST_PATH ${BLACKWOOD_HOME}
setenv PREFIX /workspace
setenv LD_LIBRARY_PATH ${JAVA_HOME}/jre/lib/sparc