[OFBiz] SVN: r7551 - in trunk: . base/config base/dtd base/src/base/org/ofbiz/base/component base/src/base/org/ofbiz/base/container framework framework/entity framework/entity/testdef framework/service framework/service/src/org/ofbiz/service/test framework/service/testdef framework/testtools framework/testtools/dtd framework/testtools/servicedef framework/testtools/src framework/testtools/src/org framework/testtools/src/org/ofbiz framework/testtools/src/org/ofbiz/testtools
jonesde@svn.ofbiz.org
jonesde at svn.ofbiz.org
Tue May 9 19:14:15 CDT 2006
Author: jonesde
Date: 2006-05-09 19:08:10 -0500 (Tue, 09 May 2006)
New Revision: 7551
Added:
trunk/base/dtd/base-catalog.xml
trunk/framework/entity/testdef/
trunk/framework/entity/testdef/entitytests.xml
trunk/framework/service/testdef/
trunk/framework/service/testdef/servicetests.xml
trunk/framework/testtools/
trunk/framework/testtools/build.xml
trunk/framework/testtools/dtd/
trunk/framework/testtools/dtd/test-suite.xsd
trunk/framework/testtools/dtd/testtools-catalog.xml
trunk/framework/testtools/ofbiz-component.xml
trunk/framework/testtools/servicedef/
trunk/framework/testtools/servicedef/services.xml
trunk/framework/testtools/src/
trunk/framework/testtools/src/org/
trunk/framework/testtools/src/org/ofbiz/
trunk/framework/testtools/src/org/ofbiz/testtools/
trunk/framework/testtools/src/org/ofbiz/testtools/JunitSuiteWrapper.java
trunk/framework/testtools/src/org/ofbiz/testtools/JythonTest.java
trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
trunk/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
trunk/framework/testtools/src/org/ofbiz/testtools/TestCaseBase.java
trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
Modified:
trunk/.classpath
trunk/base/config/test-containers.xml
trunk/base/dtd/ofbiz-component.xsd
trunk/base/src/base/org/ofbiz/base/component/ComponentConfig.java
trunk/base/src/base/org/ofbiz/base/container/JunitContainer.java
trunk/build.xml
trunk/framework/component-load.xml
trunk/framework/entity/ofbiz-component.xml
trunk/framework/service/ofbiz-component.xml
trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTests.java
Log:
Initial implementation of test runner in a new testtools component; supports specifying tests in the ofbiz-component.xml file instead of in the test-containers.xml file; entity and service tests are now moved over; already support JUnit tests, still some coding to do for service tests and Jython tests, which are intended to be from recorded web sessions using one of the various tools for this, still need to decide on one of those to centralize on as well as generic Jython scripts may not be sufficient for this, may be specific to tool generating them
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/.classpath 2006-05-10 00:08:10 UTC (rev 7551)
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry excluding="org/ofbiz/base/util/OfbizJsBsfEngine.java" kind="src" path="base/src/base"/>
+ <classpathentry kind="src" path="framework/testtools/src"/>
<classpathentry kind="src" path="framework/geronimo/src"/>
<classpathentry excluding="org/ofbiz/accounting/thirdparty/clearcommerce/**|org/ofbiz/accounting/thirdparty/verisign/**" kind="src" path="applications/accounting/src"/>
<classpathentry excluding="org/ofbiz/content/openoffice/|org/ofbiz/content/report/" kind="src" path="applications/content/src"/>
Modified: trunk/base/config/test-containers.xml
===================================================================
--- trunk/base/config/test-containers.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/base/config/test-containers.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -64,9 +64,11 @@
<!-- load JUnit test container -->
<container name="junit-container" class="org.ofbiz.base.container.JunitContainer">
<property name="base-test" value="org.ofbiz.base.test.BaseUnitTests"/>
- <property name="entity-test" value="org.ofbiz.entity.test.EntityTestSuite"/>
- <property name="service-test" value="org.ofbiz.service.test.ServiceEngineTests"/>
+ <!-- this is now run through the new testtools stuff <property name="entity-test" value="org.ofbiz.entity.test.EntityTestSuite"/> -->
+ <!-- this is now run through the new testtools stuff <property name="service-test" value="org.ofbiz.service.test.ServiceEngineTests"/> -->
<!-- <property name="usps-test" value="org.ofbiz.shipment.thirdparty.usps.UspsServicesTests"/> -->
<!-- For the jxtests component: <property name="jxunit-test" value="net.sourceforge.jxunit.JXTestCase"/> -->
</container>
+
+ <container name="testtools-container" class="org.ofbiz.testtools.TestRunContainer"/>
</ofbiz-containers>
Added: trunk/base/dtd/base-catalog.xml
===================================================================
--- trunk/base/dtd/base-catalog.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/base/dtd/base-catalog.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+ "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<!--
+ Comment the DTD declaration to avoid looking for it on the web.
+ Alternatively we can place a copy of the DTD locally and refer to it.
+-->
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <!-- <public publicId="-//W3C//DTD SVG 1.0//EN" uri="svg10.dtd"/> -->
+ <system systemId="http://www.ofbiz.org/dtds/component-loader.xsd" uri="component-loader.xsd"/>
+ <system systemId="http://www.ofbiz.org/dtds/jndi-config.xsd" uri="jndi-config.xsd"/>
+ <system systemId="http://www.ofbiz.org/dtds/ofbiz-component.xsd" uri="ofbiz-component.xsd"/>
+ <system systemId="http://www.ofbiz.org/dtds/ofbiz-containers.xsd" uri="ofbiz-containers.xsd"/>
+</catalog>
Property changes on: trunk/base/dtd/base-catalog.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Modified: trunk/base/dtd/ofbiz-component.xsd
===================================================================
--- trunk/base/dtd/ofbiz-component.xsd 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/base/dtd/ofbiz-component.xsd 2006-05-10 00:08:10 UTC (rev 7551)
@@ -30,6 +30,7 @@
<xs:element minOccurs="0" maxOccurs="unbounded" ref="classpath"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="entity-resource"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="service-resource"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="test-suite"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="webapp"/>
</xs:sequence>
<xs:attributeGroup ref="attlist.ofbiz-component"/>
@@ -122,6 +123,15 @@
<xs:attribute type="xs:string" name="loader" use="required"/>
<xs:attribute type="xs:string" name="location" use="required"/>
</xs:attributeGroup>
+ <xs:element name="test-suite">
+ <xs:complexType>
+ <xs:attributeGroup ref="attlist.test-suite"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.test-suite">
+ <xs:attribute type="xs:string" name="loader" use="required"/>
+ <xs:attribute type="xs:string" name="location" use="required"/>
+ </xs:attributeGroup>
<xs:element name="webapp">
<xs:complexType>
<xs:sequence>
Modified: trunk/base/src/base/org/ofbiz/base/component/ComponentConfig.java
===================================================================
--- trunk/base/src/base/org/ofbiz/base/component/ComponentConfig.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/base/src/base/org/ofbiz/base/component/ComponentConfig.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -158,6 +158,17 @@
return serviceInfos;
}
+ public static List getAllTestSuiteInfos() {
+ List testSuiteInfos = FastList.newInstance();
+ Iterator i = getAllComponents().iterator();
+ while (i.hasNext()) {
+ ComponentConfig cc = (ComponentConfig) i.next();
+ testSuiteInfos.addAll(cc.getTestSuiteInfos());
+ }
+ return testSuiteInfos;
+
+ }
+
public static List getAllWebappResourceInfos() {
List webappInfos = FastList.newInstance();
Iterator i = getAllComponents().iterator();
@@ -278,6 +289,7 @@
protected List classpathInfos = FastList.newInstance();
protected List entityResourceInfos = FastList.newInstance();
protected List serviceResourceInfos = FastList.newInstance();
+ protected List testSuiteInfos = FastList.newInstance();
protected List webappInfos = FastList.newInstance();
protected ComponentConfig() {}
@@ -354,6 +366,14 @@
this.serviceResourceInfos.add(serviceResourceInfo);
}
+ // test-suite - serviceResourceInfos
+ elementIter = UtilXml.childElementList(ofbizComponentElement, "test-suite").iterator();
+ while (elementIter.hasNext()) {
+ Element curElement = (Element) elementIter.next();
+ TestSuiteInfo testSuiteInfo = new TestSuiteInfo(this, curElement);
+ this.testSuiteInfos.add(testSuiteInfo);
+ }
+
// webapp - webappInfos
elementIter = UtilXml.childElementList(ofbizComponentElement, "webapp").iterator();
while (elementIter.hasNext()) {
@@ -452,39 +472,43 @@
}
public List getClasspathInfos() {
- return classpathInfos;
+ return this.classpathInfos;
}
public String getComponentName() {
- return componentName;
+ return this.componentName;
}
public List getEntityResourceInfos() {
- return entityResourceInfos;
+ return this.entityResourceInfos;
}
public String getGlobalName() {
- return globalName;
+ return this.globalName;
}
public Map getResourceLoaderInfos() {
- return resourceLoaderInfos;
+ return this.resourceLoaderInfos;
}
public String getRootLocation() {
- return rootLocation;
+ return this.rootLocation;
}
public List getServiceResourceInfos() {
- return serviceResourceInfos;
+ return this.serviceResourceInfos;
}
+ public List getTestSuiteInfos() {
+ return this.testSuiteInfos;
+ }
+
public List getWebappInfos() {
- return webappInfos;
+ return this.webappInfos;
}
public boolean enabled() {
- return enabled;
+ return this.enabled;
}
public static class ResourceLoaderInfo {
@@ -549,6 +573,12 @@
}
}
+ public static class TestSuiteInfo extends ResourceInfo {
+ public TestSuiteInfo(ComponentConfig componentConfig, Element element) {
+ super(componentConfig, element);
+ }
+ }
+
public static class WebappInfo {
public ComponentConfig componentConfig;
public List virtualHosts;
Modified: trunk/base/src/base/org/ofbiz/base/container/JunitContainer.java
===================================================================
--- trunk/base/src/base/org/ofbiz/base/container/JunitContainer.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/base/src/base/org/ofbiz/base/container/JunitContainer.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -112,7 +112,7 @@
public void stop() throws ContainerException {
try {
- Thread.sleep(5000);
+ Thread.sleep(2000);
} catch (Exception e) {
throw new ContainerException(e);
}
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/build.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -34,6 +34,7 @@
datafile/build.xml,minilang/build.xml,
common/build.xml,workflow/build.xml,
webapp/build.xml,guiapp/build.xml,widget/build.xml,
+ testtools/build.xml,
appserver/build.xml,webtools/build.xml"/>
<!-- For Shark add "shark/build.xml" to the list above, in the framework-builds list (after workflow, before webapp works fine) -->
@@ -277,4 +278,3 @@
</java>
</target>
</project>
-
Modified: trunk/framework/component-load.xml
===================================================================
--- trunk/framework/component-load.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/component-load.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -44,6 +44,7 @@
<load-component component-location="${ofbiz.home}/framework/appserver"/>
<load-component component-location="${ofbiz.home}/framework/workflow"/>
<load-component component-location="${ofbiz.home}/framework/shark"/>
+ <load-component component-location="${ofbiz.home}/framework/testtools"/>
<load-component component-location="${ofbiz.home}/framework/webtools"/>
<load-component component-location="${ofbiz.home}/framework/images"/>
<load-component component-location="${ofbiz.home}/framework/example"/>
Modified: trunk/framework/entity/ofbiz-component.xml
===================================================================
--- trunk/framework/entity/ofbiz-component.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/entity/ofbiz-component.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org
+ * Copyright (c) 2003-2006 The Open For Business Project - www.ofbiz.org
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -37,4 +37,6 @@
<!-- these are for unit testing -->
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel_test.xml"/>
<entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup_test.xml"/>
+
+ <test-suite loader="main" location="testdef/entitytests.xml"/>
</ofbiz-component>
Added: trunk/framework/entity/testdef/entitytests.xml
===================================================================
--- trunk/framework/entity/testdef/entitytests.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/entity/testdef/entitytests.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+Copyright 2006-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.
+-->
+
+<test-suite suite-name="entitytests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/test-suite.xsd">
+ <test-case case-name="entity-tests"><junit-test-suite class-name="org.ofbiz.entity.test.EntityTestSuite"/></test-case>
+</test-suite>
Property changes on: trunk/framework/entity/testdef/entitytests.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Modified: trunk/framework/service/ofbiz-component.xml
===================================================================
--- trunk/framework/service/ofbiz-component.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/service/ofbiz-component.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -30,10 +30,14 @@
<classpath type="dir" location="dtd"/>
<classpath type="jar" location="lib/*"/>
<classpath type="jar" location="build/lib/*"/>
+
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
<entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/ScheduledServiceData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/ScheduledServices.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/ServiceSecurityData.xml"/>
+
<service-resource type="model" loader="main" location="servicedef/services.xml"/>
+
+ <test-suite loader="main" location="testdef/servicetests.xml"/>
</ofbiz-component>
Modified: trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTests.java
===================================================================
--- trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTests.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTests.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -1,6 +1,19 @@
/*
* $Id$
*
+ * Copyright 2004-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.
*/
package org.ofbiz.service.test;
Added: trunk/framework/service/testdef/servicetests.xml
===================================================================
--- trunk/framework/service/testdef/servicetests.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/service/testdef/servicetests.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+Copyright 2006-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.
+-->
+
+<test-suite suite-name="servicetests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/test-suite.xsd">
+ <test-case case-name="service-tests"><junit-test-suite class-name="org.ofbiz.service.test.ServiceEngineTests"/></test-case>
+</test-suite>
Property changes on: trunk/framework/service/testdef/servicetests.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Property changes on: trunk/framework/testtools
___________________________________________________________________
Name: svn:ignore
+ build
Added: trunk/framework/testtools/build.xml
===================================================================
--- trunk/framework/testtools/build.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/build.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: build.xml 7423 2006-04-26 22:36:00Z jonesde $
+
+Copyright 2006-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.
+-->
+
+<project name="OFBiz - Test Tools Component" default="jar" basedir=".">
+
+ <!-- ================================================================== -->
+ <!-- Initialization of all property settings -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+ <property environment="env"/>
+ <property name="desc" value="Test Tools Component"/>
+ <property name="name" value="ofbiz-testtools"/>
+ <property name="src.dir" value="src"/>
+ <property name="dtd.dir" value="dtd"/>
+ <property name="lib.dir" value="lib"/>
+ <property name="build.dir" value="build"/>
+ </target>
+
+ <target name="classpath">
+ <path id="local.class.path">
+ <!-- <fileset dir="${lib.dir}" includes="*.jar"/> -->
+ <fileset dir="../../base/lib" includes="*.jar"/>
+ <fileset dir="../../base/build/lib" includes="*.jar"/>
+ <fileset dir="../../framework/entity/lib" includes="*.jar"/>
+ <fileset dir="../../framework/entity/build/lib" includes="*.jar"/>
+ <fileset dir="../../framework/security/build/lib" includes="*.jar"/>
+ <fileset dir="../../framework/service/lib" includes="*.jar"/>
+ <fileset dir="../../framework/service/build/lib" includes="*.jar"/>
+ <fileset dir="../../framework/minilang/build/lib" includes="*.jar"/>
+ </path>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Removes all created files and directories -->
+ <!-- ================================================================== -->
+
+ <target name="clean" depends="clean-lib">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="clean-lib" depends="init">
+ <delete dir="${build.dir}/lib"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Makes sure the needed directory structure is in place -->
+ <!-- ================================================================== -->
+
+ <target name="prepare" depends="clean-lib">
+ <mkdir dir="${build.dir}/classes"/>
+ <mkdir dir="${build.dir}/lib"/>
+ </target>
+
+ <target name="prepare-docs" depends="init">
+ <mkdir dir="${build.dir}/javadocs"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Compilation of the source files -->
+ <!-- ================================================================== -->
+
+ <target name="classes" depends="prepare,classpath">
+ <javac debug="on" source="1.4" deprecation="on" destdir="${build.dir}/classes">
+ <classpath>
+ <path refid="local.class.path"/>
+ </classpath>
+ <src path="${src.dir}"/>
+ </javac>
+ <copy todir="${build.dir}/classes">
+ <!-- don't put the DTDs in the jar file... -->
+ <fileset dir="${src.dir}" includes="**/*.properties,**/*.xml,**/*.bsh,**/*.logic,**/*.js,**/*.jacl,**/*.py"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="classes">
+ <jar jarfile="${build.dir}/lib/${name}.jar" basedir="${build.dir}/classes"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Build JavaDoc -->
+ <!-- ================================================================== -->
+
+ <target name="docs" depends="prepare-docs,classpath">
+ <javadoc packagenames="org.ofbiz.service.*"
+ classpathref="local.class.path"
+ destdir="${build.dir}/javadocs"
+ Windowtitle="Open for Business - ${desc}">
+ <sourcepath path="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="all" depends="jar,docs"/>
+</project>
Property changes on: trunk/framework/testtools/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/dtd/test-suite.xsd
===================================================================
--- trunk/framework/testtools/dtd/test-suite.xsd 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/dtd/test-suite.xsd 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+Copyright 2006-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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+<!--
+ ==================================================
+ ========== The Simple Methods Section ==========
+ ==================================================
+ (see further down for the Simple Map Processor Section)
+-->
+
+ <!-- Reusable artifacts (abstract elements, groups, attributeGroups -->
+ <xs:element name="TestCaseTypes" abstract="true"/>
+ <xs:group name="AllTestCaseTypes">
+ <xs:choice>
+ <xs:element ref="TestCaseTypes"/>
+ </xs:choice>
+ </xs:group>
+
+ <!-- ELEMENTS start here -->
+ <xs:element name="test-suite">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" ref="test-case"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="attlist.test-suite"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.test-suite">
+ <xs:attribute type="xs:string" name="suite-name" use="required"/>
+ <xs:attribute type="xs:string" name="delegator-name" default="test"/>
+ <xs:attribute type="xs:string" name="dispatcher-name" default="test-dispatcher"/>
+ </xs:attributeGroup>
+ <xs:element name="test-case">
+ <xs:annotation><xs:documentation></xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:group minOccurs="1" maxOccurs="1" ref="AllTestCaseTypes"/>
+ <xs:attributeGroup ref="attlist.test-case"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.test-case">
+ <xs:attribute type="xs:string" name="case-name" use="required"/>
+ </xs:attributeGroup>
+
+ <xs:element name="junit-test-suite" substitutionGroup="TestCaseTypes">
+ <xs:annotation><xs:documentation>Used for JUnit test suites written as a Java class.</xs:documentation></xs:annotation>
+ <xs:complexType>
+ <xs:attributeGroup ref="attlist.junit-test-suite"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.junit-test-suite">
+ <xs:attribute type="xs:string" name="class-name" use="required">
+ <xs:annotation><xs:documentation>Should extend the junit.framework.TestCase class.</xs:documentation></xs:annotation>
+ </xs:attribute>
+ </xs:attributeGroup>
+
+ <xs:element name="service-test" substitutionGroup="TestCaseTypes">
+ <xs:complexType>
+ <xs:attributeGroup ref="attlist.service-test"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.service-test">
+ <xs:attribute type="xs:string" name="service-name" use="required"/>
+ </xs:attributeGroup>
+
+ <xs:element name="jython-test" substitutionGroup="TestCaseTypes">
+ <xs:complexType>
+ <xs:attributeGroup ref="attlist.jython-test"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.jython-test">
+ <xs:attribute type="xs:string" name="script-location" use="required"/>
+ </xs:attributeGroup>
+</xs:schema>
Property changes on: trunk/framework/testtools/dtd/test-suite.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/xsd
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/dtd/testtools-catalog.xml
===================================================================
--- trunk/framework/testtools/dtd/testtools-catalog.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/dtd/testtools-catalog.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+ "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<!--
+ Comment the DTD declaration to avoid looking for it on the web.
+ Alternatively we can place a copy of the DTD locally and refer to it.
+-->
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <!-- <public publicId="-//W3C//DTD SVG 1.0//EN" uri="svg10.dtd"/> -->
+ <system systemId="http://www.ofbiz.org/dtds/test-suite.xsd" uri="test-suite.xsd"/>
+</catalog>
Property changes on: trunk/framework/testtools/dtd/testtools-catalog.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/ofbiz-component.xml
===================================================================
--- trunk/framework/testtools/ofbiz-component.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/ofbiz-component.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: ofbiz-component.xml 7423 2006-04-26 22:36:00Z jonesde $
+
+Copyright 2001-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.
+-->
+
+<ofbiz-component name="example"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-component.xsd">
+ <!-- define resource loaders; most common is to use the component resource loader -->
+ <resource-loader name="main" type="component"/>
+
+ <!-- place the config directory on the classpath to access configuration files -->
+ <classpath type="dir" location="dtd"/>
+
+ <!-- load single or multiple external libraries -->
+ <classpath type="jar" location="build/lib/*"/>
+
+ <!-- service resources: model(s), eca(s) and group definitions -->
+ <service-resource type="model" loader="main" location="servicedef/services.xml"/>
+</ofbiz-component>
Property changes on: trunk/framework/testtools/ofbiz-component.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/servicedef/services.xml
===================================================================
--- trunk/framework/testtools/servicedef/services.xml 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/servicedef/services.xml 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+$Id: $
+
+Copyright 2006-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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">
+ <description>Test Tool Services</description>
+ <vendor>OFBiz</vendor>
+ <version>1.0</version>
+
+ <service name="testServiceInterface" engine="interface" location="" invoke="">
+ <description>
+ This has test service specific attributes; most of the important information comes from standard service attributes, including:
+ - responseMessage: success, error, or fail
+ - errorMessage, errorMessageList, errorMessageMap: where messages will comes from for error or fail responses
+ - successMessage, successMessagesList: where messages will comes from for success responses
+ </description>
+ <attribute name="testCase" type="junit.framework.TestCase" mode="IN" optional="false"/>
+ </service>
+</services>
Property changes on: trunk/framework/testtools/servicedef/services.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/JunitSuiteWrapper.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/JunitSuiteWrapper.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/JunitSuiteWrapper.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,95 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javolution.util.FastList;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.ofbiz.base.component.ComponentConfig;
+import org.ofbiz.base.config.GenericConfigException;
+import org.ofbiz.base.config.ResourceHandler;
+import org.ofbiz.base.util.Debug;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Use this class in a JUnit test runner to prepare the TestSuite.
+ *
+ * @author <a href="mailto:jonesde at ofbiz.org">David E. Jones</a>
+ */
+public class JunitSuiteWrapper {
+
+ public static final String module = JunitSuiteWrapper.class.getName();
+
+ protected List modelTestSuiteList = FastList.newInstance();
+
+ public JunitSuiteWrapper() {
+ List testSuiteInfoList = ComponentConfig.getAllTestSuiteInfos();
+ Iterator testSuiteInfoIter = testSuiteInfoList.iterator();
+ while (testSuiteInfoIter.hasNext()) {
+ ComponentConfig.TestSuiteInfo testSuiteInfo = (ComponentConfig.TestSuiteInfo) testSuiteInfoIter.next();
+
+ ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler();
+ try {
+ Document testSuiteDocument = testSuiteResource.getDocument();
+ // TODO create TestSuite object based on this that will contain its TestCase objects
+ Element documentElement = testSuiteDocument.getDocumentElement();
+ ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement);
+ this.modelTestSuiteList.add(modelTestSuite);
+ } catch (GenericConfigException e) {
+ String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]";
+ Debug.logError(e, errMsg, module);
+ throw new IllegalArgumentException(errMsg);
+ }
+ }
+ }
+
+ public void populateTestSuite(TestSuite suite) {
+ Iterator modelTestSuiteIter = this.modelTestSuiteList.iterator();
+ while (modelTestSuiteIter.hasNext()) {
+ ModelTestSuite modelTestSuite = (ModelTestSuite) modelTestSuiteIter.next();
+ List testList = modelTestSuite.getTestList();
+ Iterator testIter = testList.iterator();
+ while (testIter.hasNext()) {
+ Test tst = (Test) testIter.next();
+ suite.addTest(tst);
+ }
+ }
+ }
+
+ public List getAllTestList() {
+ List allTestList = FastList.newInstance();
+
+ Iterator modelTestSuiteIter = this.modelTestSuiteList.iterator();
+ while (modelTestSuiteIter.hasNext()) {
+ ModelTestSuite modelTestSuite = (ModelTestSuite) modelTestSuiteIter.next();
+ List testList = modelTestSuite.getTestList();
+ Iterator testIter = testList.iterator();
+ while (testIter.hasNext()) {
+ Test tst = (Test) testIter.next();
+ allTestList.add(tst);
+ }
+ }
+
+ return allTestList;
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/JunitSuiteWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/JythonTest.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/JythonTest.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/JythonTest.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,51 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import org.w3c.dom.Element;
+
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+/**
+ * @author jonesde
+ *
+ */
+public class JythonTest extends TestCaseBase {
+
+ public static final String module = JythonTest.class.getName();
+
+ protected String scriptLocation;
+
+ /**
+ * @param modelTestSuite
+ */
+ public JythonTest(String caseName, ModelTestSuite modelTestSuite, Element mainElement) {
+ super(caseName, modelTestSuite);
+ this.scriptLocation = mainElement.getAttribute("script-location");
+ }
+
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/JythonTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,117 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javolution.util.FastList;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.ObjectType;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.service.LocalDispatcher;
+import org.w3c.dom.Element;
+
+/**
+ * Use this class in a JUnit test runner to bootstrap the Test Suite runner.
+ *
+ * @author <a href="mailto:jonesde at ofbiz.org">David E. Jones</a>
+ */
+public class ModelTestSuite {
+
+ public static final String module = ModelTestSuite.class.getName();
+
+ protected String suiteName;
+ protected String delegatorName;
+ protected String dispatcherName;
+
+ protected GenericDelegator delegator;
+ protected LocalDispatcher dispatcher;
+
+ protected List testList = FastList.newInstance();
+
+ public ModelTestSuite(Element mainElement) {
+ this.suiteName = mainElement.getAttribute("suite-name");
+
+ this.delegatorName = mainElement.getAttribute("delegator-name");
+ if (UtilValidate.isEmpty(this.delegatorName)) this.delegatorName = "test";
+
+ this.dispatcherName = mainElement.getAttribute("dispatcher-name");
+ if (UtilValidate.isEmpty(this.dispatcherName)) this.dispatcherName = "test-dispatcher";
+
+ this.delegator = GenericDelegator.getGenericDelegator(this.delegatorName);
+ this.dispatcher = new GenericDispatcher(this.dispatcherName, delegator);
+
+ List testCaseElementList = UtilXml.childElementList(mainElement, "test-case");
+ Iterator testCaseElementIter = testCaseElementList.iterator();
+ while (testCaseElementIter.hasNext()) {
+ Element testCaseElement = (Element) testCaseElementIter.next();
+ String caseName = testCaseElement.getAttribute("case-name");
+
+ Element childElement = UtilXml.firstChildElement(testCaseElement);
+ String nodeName = childElement.getNodeName();
+ if ("junit-test-suite".equals(nodeName)) {
+ String className = childElement.getAttribute("class-name");
+
+ try {
+ Class clz = ObjectType.loadClass(className);
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(clz);
+ Enumeration testEnum = suite.tests();
+ int testsAdded = 0;
+ while (testEnum.hasMoreElements()) {
+ Test tst = (Test) testEnum.nextElement();
+ this.testList.add(tst);
+ testsAdded++;
+ }
+ Debug.logInfo("Added " + testsAdded + " tests from the class: " + className, module);
+ } catch (Exception e) {
+ String errMsg = "Unable to load test suite class : " + className;
+ Debug.logError(e, errMsg, module);
+ }
+ } else if ("service-test".equals(nodeName)) {
+ this.testList.add(new ServiceTest(caseName, this, childElement));
+ } else if ("jython-test".equals(nodeName)) {
+ this.testList.add(new JythonTest(caseName, this, childElement));
+ }
+ }
+ }
+
+ String getSuiteName() {
+ return this.suiteName;
+ }
+
+ GenericDelegator getDelegator() {
+ return this.delegator;
+ }
+
+ LocalDispatcher getDispatcher() {
+ return this.dispatcher;
+ }
+
+ List getTestList() {
+ return testList;
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,50 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import junit.framework.TestResult;
+
+import org.w3c.dom.Element;
+
+/**
+ * @author jonesde
+ *
+ */
+public class ServiceTest extends TestCaseBase {
+
+ public static final String module = ServiceTest.class.getName();
+
+ protected String serviceName;
+
+ /**
+ * @param modelTestSuite
+ */
+ public ServiceTest(String caseName, ModelTestSuite modelTestSuite, Element mainElement) {
+ super(caseName, modelTestSuite);
+ this.serviceName = mainElement.getAttribute("service-name");
+ }
+
+ public int countTestCases() {
+ return 1;
+ }
+
+ public void run(TestResult result) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/ServiceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/TestCaseBase.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/TestCaseBase.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/TestCaseBase.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,38 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import junit.framework.Test;
+
+/**
+ * Base class for OFBiz Test Tools test case implementations.
+ *
+ * @author <a href="mailto:jonesde at ofbiz.org">David E. Jones</a>
+ */
+public abstract class TestCaseBase implements Test {
+
+ public static final String module = TestCaseBase.class.getName();
+
+ protected ModelTestSuite modelTestSuite;
+ protected String caseName;
+
+ public TestCaseBase(String caseName, ModelTestSuite modelTestSuite) {
+ this.modelTestSuite = modelTestSuite;
+ this.caseName = caseName;
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/TestCaseBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Added: trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
===================================================================
--- trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java 2006-05-09 18:50:53 UTC (rev 7550)
+++ trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java 2006-05-10 00:08:10 UTC (rev 7551)
@@ -0,0 +1,99 @@
+/*
+ * $Id: $
+ *
+ * Copyright 2006-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.
+ */
+package org.ofbiz.testtools;
+
+import java.util.Enumeration;
+
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.ofbiz.base.container.Container;
+import org.ofbiz.base.container.ContainerException;
+import org.ofbiz.base.util.Debug;
+
+/**
+ * A Container implementation to run the tests configured through this testtools stuff.
+ *
+ * @author <a href="mailto:jonesde at ofbiz.org">David E. Jones</a>
+ */
+public class TestRunContainer implements Container {
+
+ public static final String module = TestRunContainer.class.getName();
+ protected TestResult results = null;
+ protected String configFile = null;
+
+ /**
+ * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
+ */
+ public void init(String[] args, String configFile) {
+ this.configFile = configFile;
+ }
+
+ public boolean start() throws ContainerException {
+ //ContainerConfig.Container jc = ContainerConfig.getContainer("junit-container", configFile);
+
+ // get the tests to run
+ JunitSuiteWrapper jsWrapper = new JunitSuiteWrapper();
+
+ // load the tests into the suite
+ TestSuite suite = new TestSuite();
+ jsWrapper.populateTestSuite(suite);
+
+ // holder for the results
+ results = new TestResult();
+
+ // run the tests
+ suite.run(results);
+
+ // dispay the results
+ Debug.log("[JUNIT] Pass: " + results.wasSuccessful() + " | # Tests: " + results.runCount() + " | # Failed: " +
+ results.failureCount() + " # Errors: " + results.errorCount(), module);
+ if (Debug.infoOn()) {
+ Debug.log("[JUNIT] ----------------------------- ERRORS ----------------------------- [JUNIT]", module);
+ Enumeration err = results.errors();
+ if (!err.hasMoreElements()) {
+ Debug.log("None");
+ } else {
+ while (err.hasMoreElements()) {
+ Debug.log("--> " + err.nextElement(), module);
+ }
+ }
+ Debug.log("[JUNIT] ------------------------------------------------------------------ [JUNIT]", module);
+ Debug.log("[JUNIT] ---------------------------- FAILURES ---------------------------- [JUNIT]", module);
+ Enumeration fail = results.failures();
+ if (!fail.hasMoreElements()) {
+ Debug.log("None");
+ } else {
+ while (fail.hasMoreElements()) {
+ Debug.log("--> " + fail.nextElement(), module);
+ }
+ }
+ Debug.log("[JUNIT] ------------------------------------------------------------------ [JUNIT]", module);
+ }
+
+ return true;
+ }
+
+ public void stop() throws ContainerException {
+ try {
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ throw new ContainerException(e);
+ }
+ }
+}
Property changes on: trunk/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
More information about the Svn
mailing list