[jboss-svn-commits] JBL Code SVN: r11780 - in labs/jbossrules/trunk/experimental/drools-testing: generated-source and 30 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed May 9 04:14:53 EDT 2007
Author: mshaw
Date: 2007-05-09 04:14:53 -0400 (Wed, 09 May 2007)
New Revision: 11780
Added:
labs/jbossrules/trunk/experimental/drools-testing/.classpath
labs/jbossrules/trunk/experimental/drools-testing/.project
labs/jbossrules/trunk/experimental/drools-testing/build-castor-src.xml
labs/jbossrules/trunk/experimental/drools-testing/generated-source/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Fact.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FactType.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Field.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FieldType.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Result.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Rule.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/RuleType.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Scenario.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/ScenarioType.java
labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/TestSuite.java
labs/jbossrules/trunk/experimental/drools-testing/lib/
labs/jbossrules/trunk/experimental/drools-testing/lib/castor-xml-1.0.5.jar
labs/jbossrules/trunk/experimental/drools-testing/lib/xercesImpl-2.4.0.jar
labs/jbossrules/trunk/experimental/drools-testing/pom.xml
labs/jbossrules/trunk/experimental/drools-testing/rtl/
labs/jbossrules/trunk/experimental/drools-testing/rtl/test.rtl
labs/jbossrules/trunk/experimental/drools-testing/src/
labs/jbossrules/trunk/experimental/drools-testing/src/org/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/ApplicationProperties.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/PropertyNotFoundException.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/CouldNotParseDrlException.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/ObjectUtilsException.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/RuleTestLanguageException.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/TransformerServiceException.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/filters/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/filters/MultipleRuleAgendaFilter.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/SchemaBuilder.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TestSuiteRunner.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/Testing.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TransformerService.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Assertion.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Fact.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Field.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Outcome.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Rule.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Scenario.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/TestSuite.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/META-INF/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/META-INF/test-lang.xsd
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xml
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xsd
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/castor-mapping.xml
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/properties/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/properties/castorbuilder.properties
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/5_rules.drl
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/META-INF/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/META-INF/drools-3.0.xsd
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/test.drl
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/rtl/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/rtl/rtl.properties
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/RuleSetTest.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Account.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Person.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/TestingTest.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/ThingTester.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/rtl.properties
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/CollectionUtils.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/FieldUtils.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/ObjectUtils.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/OperatorUtils.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FactWrapper.java
labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FieldWrapper.java
Log:
Added: labs/jbossrules/trunk/experimental/drools-testing/.classpath
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/.classpath (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/.classpath 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="generated-source"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: labs/jbossrules/trunk/experimental/drools-testing/.project
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/.project (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/.project 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>drools-testing</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: labs/jbossrules/trunk/experimental/drools-testing/build-castor-src.xml
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/build-castor-src.xml (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/build-castor-src.xml 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,60 @@
+<project name="MyProject" default="castor:gen:src" basedir=".">
+ <description>
+ simple example build file
+ </description>
+ <!-- set global properties for this build -->
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+ <property name="dist" location="bin"/>
+ <property name="gen" location="generated-source"/>
+
+
+
+ <target name="init">
+ <!-- Create the time stamp -->
+ <tstamp/>
+ <!-- Create the build directory structure used by compile -->
+ <!--<mkdir dir="${build}"/>-->
+ </target>
+
+ <target name="compile" depends="init"
+ description="compile the source " >
+ <!-- Compile the java code from ${src} into ${build} -->
+ <javac srcdir="${src}" destdir="${build}"/>
+ </target>
+
+ <target name="dist" depends="compile"
+ description="generate the distribution" >
+ <!-- Create the distribution directory -->
+ <mkdir dir="${dist}/lib"/>
+
+ <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
+ <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
+ </target>
+
+ <target name="clean"
+ description="clean up" >
+ <!-- Delete the ${build} and ${dist} directory trees -->
+ <delete dir="${build}"/>
+ <delete dir="${gen}"/>
+ </target>
+
+
+<target name="castor:gen:src" depends="init"
+ description="Generate Java source files from XSD.">
+
+ <taskdef name="castor-srcgen"
+ classname="org.exolab.castor.tools.ant.taskdefs.CastorSourceGenTask"
+ />
+ <castor-srcgen dir="C:\eclipse\workspace\drools-testing\src\org\drools\testing\core\resources\castor\META-INF\"
+ todir="${gen}"
+ package="org.drools.testing.core.beans"
+ types="j2"
+ warnings="true"
+ bindingfile="C:\eclipse\workspace\drools-testing\src\org\drools\testing\core\resources\castor\binding\binding.xml"
+ nodesc="true">
+
+ </castor-srcgen>
+ </target>
+</project>
+
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Fact.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Fact.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Fact.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,124 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class Fact.
+ *
+ * @version $Revision$ $Date$
+ */
+public class Fact extends FactType
+implements java.io.Serializable
+{
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public Fact()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.Fact()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled org.drools.testing.core.beans.FactTyp
+ */
+ public static org.drools.testing.core.beans.FactType unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.FactType) Unmarshaller.unmarshal(org.drools.testing.core.beans.Fact.class, reader);
+ } //-- org.drools.testing.core.beans.FactType unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FactType.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FactType.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FactType.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,323 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+/**
+ * Class FactType.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class FactType implements java.io.Serializable {
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _id
+ */
+ private int _id;
+
+ /**
+ * keeps track of state for field: _id
+ */
+ private boolean _has_id;
+
+ /**
+ * Field _type
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _fieldList
+ */
+ private java.util.List _fieldList;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public FactType()
+ {
+ super();
+ this._fieldList = new java.util.ArrayList();
+ } //-- org.drools.testing.core.beans.FactType()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ *
+ *
+ * @param vField
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addField(org.drools.testing.core.beans.Field vField)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._fieldList.add(vField);
+ } //-- void addField(org.drools.testing.core.beans.Field)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vField
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addField(int index, org.drools.testing.core.beans.Field vField)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._fieldList.add(index, vField);
+ } //-- void addField(int, org.drools.testing.core.beans.Field)
+
+ /**
+ */
+ public void deleteId()
+ {
+ this._has_id= false;
+ } //-- void deleteId()
+
+ /**
+ * Method enumerateField
+ *
+ *
+ *
+ * @return an Enumeration over all possible elements of this
+ * collection
+ */
+ public java.util.Enumeration enumerateField()
+ {
+ return java.util.Collections.enumeration(this._fieldList);
+ } //-- java.util.Enumeration enumerateField()
+
+ /**
+ * Method getField
+ *
+ *
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ * @return the value of the org.drools.testing.core.beans.Field
+ * at the given index
+ */
+ public org.drools.testing.core.beans.Field getField(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._fieldList.size()) {
+ throw new IndexOutOfBoundsException("getField: Index value '" + index + "' not in range [0.." + (this._fieldList.size() - 1) + "]");
+ }
+
+ return (org.drools.testing.core.beans.Field) _fieldList.get(index);
+ } //-- org.drools.testing.core.beans.Field getField(int)
+
+ /**
+ * Method getField
+ *
+ *
+ *
+ * @return this collection as an Array
+ */
+ public org.drools.testing.core.beans.Field[] getField()
+ {
+ int size = this._fieldList.size();
+ org.drools.testing.core.beans.Field[] array = new org.drools.testing.core.beans.Field[size];
+ for (int index = 0; index < size; index++){
+ array[index] = (org.drools.testing.core.beans.Field) _fieldList.get(index);
+ }
+
+ return array;
+ } //-- org.drools.testing.core.beans.Field[] getField()
+
+ /**
+ * Method getFieldCount
+ *
+ *
+ *
+ * @return the size of this collection
+ */
+ public int getFieldCount()
+ {
+ return this._fieldList.size();
+ } //-- int getFieldCount()
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public int getId()
+ {
+ return this._id;
+ } //-- int getId()
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ } //-- java.lang.String getType()
+
+ /**
+ * Method hasId
+ *
+ *
+ *
+ * @return true if at least one Id has been added
+ */
+ public boolean hasId()
+ {
+ return this._has_id;
+ } //-- boolean hasId()
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ * Method iterateField
+ *
+ *
+ *
+ * @return an Iterator over all possible elements in this
+ * collection
+ */
+ public java.util.Iterator iterateField()
+ {
+ return this._fieldList.iterator();
+ } //-- java.util.Iterator iterateField()
+
+ /**
+ */
+ public void removeAllField()
+ {
+ this._fieldList.clear();
+ } //-- void removeAllField()
+
+ /**
+ * Method removeField
+ *
+ *
+ *
+ * @param vField
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeField(org.drools.testing.core.beans.Field vField)
+ {
+ boolean removed = _fieldList.remove(vField);
+ return removed;
+ } //-- boolean removeField(org.drools.testing.core.beans.Field)
+
+ /**
+ * Method removeFieldAt
+ *
+ *
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public org.drools.testing.core.beans.Field removeFieldAt(int index)
+ {
+ Object obj = this._fieldList.remove(index);
+ return (org.drools.testing.core.beans.Field) obj;
+ } //-- org.drools.testing.core.beans.Field removeFieldAt(int)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vField
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void setField(int index, org.drools.testing.core.beans.Field vField)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._fieldList.size()) {
+ throw new IndexOutOfBoundsException("setField: Index value '" + index + "' not in range [0.." + (this._fieldList.size() - 1) + "]");
+ }
+
+ this._fieldList.set(index, vField);
+ } //-- void setField(int, org.drools.testing.core.beans.Field)
+
+ /**
+ *
+ *
+ * @param vFieldArray
+ */
+ public void setField(org.drools.testing.core.beans.Field[] vFieldArray)
+ {
+ //-- copy array
+ _fieldList.clear();
+
+ for (int i = 0; i < vFieldArray.length; i++) {
+ this._fieldList.add(vFieldArray[i]);
+ }
+ } //-- void setField(org.drools.testing.core.beans.Field)
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id the value of field 'id'.
+ */
+ public void setId(int id)
+ {
+ this._id = id;
+ this._has_id = true;
+ } //-- void setId(int)
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type the value of field 'type'.
+ */
+ public void setType(java.lang.String type)
+ {
+ this._type = type;
+ } //-- void setType(java.lang.String)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Field.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Field.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Field.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,125 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class Field.
+ *
+ * @version $Revision$ $Date$
+ */
+public class Field extends FieldType
+implements java.io.Serializable
+{
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public Field()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.Field()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * org.drools.testing.core.beans.FieldType
+ */
+ public static org.drools.testing.core.beans.FieldType unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.FieldType) Unmarshaller.unmarshal(org.drools.testing.core.beans.Field.class, reader);
+ } //-- org.drools.testing.core.beans.FieldType unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FieldType.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FieldType.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/FieldType.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,143 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+/**
+ * Class FieldType.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class FieldType implements java.io.Serializable {
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _name
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _type
+ */
+ private java.lang.String _type;
+
+ /**
+ * Field _value
+ */
+ private java.lang.String _value;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public FieldType()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.FieldType()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ } //-- java.lang.String getName()
+
+ /**
+ * Returns the value of field 'type'.
+ *
+ * @return the value of field 'Type'.
+ */
+ public java.lang.String getType()
+ {
+ return this._type;
+ } //-- java.lang.String getType()
+
+ /**
+ * Returns the value of field 'value'.
+ *
+ * @return the value of field 'Value'.
+ */
+ public java.lang.String getValue()
+ {
+ return this._value;
+ } //-- java.lang.String getValue()
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name the value of field 'name'.
+ */
+ public void setName(java.lang.String name)
+ {
+ this._name = name;
+ } //-- void setName(java.lang.String)
+
+ /**
+ * Sets the value of field 'type'.
+ *
+ * @param type the value of field 'type'.
+ */
+ public void setType(java.lang.String type)
+ {
+ this._type = type;
+ } //-- void setType(java.lang.String)
+
+ /**
+ * Sets the value of field 'value'.
+ *
+ * @param value the value of field 'value'.
+ */
+ public void setValue(java.lang.String value)
+ {
+ this._value = value;
+ } //-- void setValue(java.lang.String)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Result.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Result.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Result.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,125 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class Result.
+ *
+ * @version $Revision$ $Date$
+ */
+public class Result extends FieldType
+implements java.io.Serializable
+{
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public Result()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.Result()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * org.drools.testing.core.beans.FieldType
+ */
+ public static org.drools.testing.core.beans.FieldType unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.FieldType) Unmarshaller.unmarshal(org.drools.testing.core.beans.Result.class, reader);
+ } //-- org.drools.testing.core.beans.FieldType unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Rule.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Rule.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Rule.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,124 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class Rule.
+ *
+ * @version $Revision$ $Date$
+ */
+public class Rule extends RuleType
+implements java.io.Serializable
+{
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public Rule()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.Rule()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled org.drools.testing.core.beans.RuleTyp
+ */
+ public static org.drools.testing.core.beans.RuleType unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.RuleType) Unmarshaller.unmarshal(org.drools.testing.core.beans.Rule.class, reader);
+ } //-- org.drools.testing.core.beans.RuleType unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/RuleType.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/RuleType.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/RuleType.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,333 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+/**
+ * Class RuleType.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class RuleType implements java.io.Serializable {
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _name
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _fire
+ */
+ private boolean _fire;
+
+ /**
+ * keeps track of state for field: _fire
+ */
+ private boolean _has_fire;
+
+ /**
+ * Field _resultList
+ */
+ private java.util.List _resultList;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public RuleType()
+ {
+ super();
+ this._resultList = new java.util.ArrayList();
+ } //-- org.drools.testing.core.beans.RuleType()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ *
+ *
+ * @param vResult
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addResult(org.drools.testing.core.beans.Result vResult)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._resultList.add(vResult);
+ } //-- void addResult(org.drools.testing.core.beans.Result)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vResult
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addResult(int index, org.drools.testing.core.beans.Result vResult)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._resultList.add(index, vResult);
+ } //-- void addResult(int, org.drools.testing.core.beans.Result)
+
+ /**
+ */
+ public void deleteFire()
+ {
+ this._has_fire= false;
+ } //-- void deleteFire()
+
+ /**
+ * Method enumerateResult
+ *
+ *
+ *
+ * @return an Enumeration over all possible elements of this
+ * collection
+ */
+ public java.util.Enumeration enumerateResult()
+ {
+ return java.util.Collections.enumeration(this._resultList);
+ } //-- java.util.Enumeration enumerateResult()
+
+ /**
+ * Returns the value of field 'fire'.
+ *
+ * @return the value of field 'Fire'.
+ */
+ public boolean getFire()
+ {
+ return this._fire;
+ } //-- boolean getFire()
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ } //-- java.lang.String getName()
+
+ /**
+ * Method getResult
+ *
+ *
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ * @return the value of the
+ * org.drools.testing.core.beans.Result at the given index
+ */
+ public org.drools.testing.core.beans.Result getResult(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._resultList.size()) {
+ throw new IndexOutOfBoundsException("getResult: Index value '" + index + "' not in range [0.." + (this._resultList.size() - 1) + "]");
+ }
+
+ return (org.drools.testing.core.beans.Result) _resultList.get(index);
+ } //-- org.drools.testing.core.beans.Result getResult(int)
+
+ /**
+ * Method getResult
+ *
+ *
+ *
+ * @return this collection as an Array
+ */
+ public org.drools.testing.core.beans.Result[] getResult()
+ {
+ int size = this._resultList.size();
+ org.drools.testing.core.beans.Result[] array = new org.drools.testing.core.beans.Result[size];
+ for (int index = 0; index < size; index++){
+ array[index] = (org.drools.testing.core.beans.Result) _resultList.get(index);
+ }
+
+ return array;
+ } //-- org.drools.testing.core.beans.Result[] getResult()
+
+ /**
+ * Method getResultCount
+ *
+ *
+ *
+ * @return the size of this collection
+ */
+ public int getResultCount()
+ {
+ return this._resultList.size();
+ } //-- int getResultCount()
+
+ /**
+ * Method hasFire
+ *
+ *
+ *
+ * @return true if at least one Fire has been added
+ */
+ public boolean hasFire()
+ {
+ return this._has_fire;
+ } //-- boolean hasFire()
+
+ /**
+ * Returns the value of field 'fire'.
+ *
+ * @return the value of field 'Fire'.
+ */
+ public boolean isFire()
+ {
+ return this._fire;
+ } //-- boolean isFire()
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ * Method iterateResult
+ *
+ *
+ *
+ * @return an Iterator over all possible elements in this
+ * collection
+ */
+ public java.util.Iterator iterateResult()
+ {
+ return this._resultList.iterator();
+ } //-- java.util.Iterator iterateResult()
+
+ /**
+ */
+ public void removeAllResult()
+ {
+ this._resultList.clear();
+ } //-- void removeAllResult()
+
+ /**
+ * Method removeResult
+ *
+ *
+ *
+ * @param vResult
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeResult(org.drools.testing.core.beans.Result vResult)
+ {
+ boolean removed = _resultList.remove(vResult);
+ return removed;
+ } //-- boolean removeResult(org.drools.testing.core.beans.Result)
+
+ /**
+ * Method removeResultAt
+ *
+ *
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public org.drools.testing.core.beans.Result removeResultAt(int index)
+ {
+ Object obj = this._resultList.remove(index);
+ return (org.drools.testing.core.beans.Result) obj;
+ } //-- org.drools.testing.core.beans.Result removeResultAt(int)
+
+ /**
+ * Sets the value of field 'fire'.
+ *
+ * @param fire the value of field 'fire'.
+ */
+ public void setFire(boolean fire)
+ {
+ this._fire = fire;
+ this._has_fire = true;
+ } //-- void setFire(boolean)
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name the value of field 'name'.
+ */
+ public void setName(java.lang.String name)
+ {
+ this._name = name;
+ } //-- void setName(java.lang.String)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vResult
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void setResult(int index, org.drools.testing.core.beans.Result vResult)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._resultList.size()) {
+ throw new IndexOutOfBoundsException("setResult: Index value '" + index + "' not in range [0.." + (this._resultList.size() - 1) + "]");
+ }
+
+ this._resultList.set(index, vResult);
+ } //-- void setResult(int, org.drools.testing.core.beans.Result)
+
+ /**
+ *
+ *
+ * @param vResultArray
+ */
+ public void setResult(org.drools.testing.core.beans.Result[] vResultArray)
+ {
+ //-- copy array
+ _resultList.clear();
+
+ for (int i = 0; i < vResultArray.length; i++) {
+ this._resultList.add(vResultArray[i]);
+ }
+ } //-- void setResult(org.drools.testing.core.beans.Result)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Scenario.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Scenario.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/Scenario.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,125 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class Scenario.
+ *
+ * @version $Revision$ $Date$
+ */
+public class Scenario extends ScenarioType
+implements java.io.Serializable
+{
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public Scenario()
+ {
+ super();
+ } //-- org.drools.testing.core.beans.Scenario()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * org.drools.testing.core.beans.ScenarioType
+ */
+ public static org.drools.testing.core.beans.ScenarioType unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.ScenarioType) Unmarshaller.unmarshal(org.drools.testing.core.beans.Scenario.class, reader);
+ } //-- org.drools.testing.core.beans.ScenarioType unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/ScenarioType.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/ScenarioType.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/ScenarioType.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,453 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+/**
+ * Class ScenarioType.
+ *
+ * @version $Revision$ $Date$
+ */
+public abstract class ScenarioType implements java.io.Serializable {
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _name
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _factList
+ */
+ private java.util.List _factList;
+
+ /**
+ * Field _ruleList
+ */
+ private java.util.List _ruleList;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public ScenarioType()
+ {
+ super();
+ this._factList = new java.util.ArrayList();
+ this._ruleList = new java.util.ArrayList();
+ } //-- org.drools.testing.core.beans.ScenarioType()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ *
+ *
+ * @param vFact
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addFact(org.drools.testing.core.beans.Fact vFact)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._factList.add(vFact);
+ } //-- void addFact(org.drools.testing.core.beans.Fact)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFact
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addFact(int index, org.drools.testing.core.beans.Fact vFact)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._factList.add(index, vFact);
+ } //-- void addFact(int, org.drools.testing.core.beans.Fact)
+
+ /**
+ *
+ *
+ * @param vRule
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addRule(org.drools.testing.core.beans.Rule vRule)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._ruleList.add(vRule);
+ } //-- void addRule(org.drools.testing.core.beans.Rule)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRule
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addRule(int index, org.drools.testing.core.beans.Rule vRule)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._ruleList.add(index, vRule);
+ } //-- void addRule(int, org.drools.testing.core.beans.Rule)
+
+ /**
+ * Method enumerateFact
+ *
+ *
+ *
+ * @return an Enumeration over all possible elements of this
+ * collection
+ */
+ public java.util.Enumeration enumerateFact()
+ {
+ return java.util.Collections.enumeration(this._factList);
+ } //-- java.util.Enumeration enumerateFact()
+
+ /**
+ * Method enumerateRule
+ *
+ *
+ *
+ * @return an Enumeration over all possible elements of this
+ * collection
+ */
+ public java.util.Enumeration enumerateRule()
+ {
+ return java.util.Collections.enumeration(this._ruleList);
+ } //-- java.util.Enumeration enumerateRule()
+
+ /**
+ * Method getFact
+ *
+ *
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ * @return the value of the org.drools.testing.core.beans.Fact
+ * at the given index
+ */
+ public org.drools.testing.core.beans.Fact getFact(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._factList.size()) {
+ throw new IndexOutOfBoundsException("getFact: Index value '" + index + "' not in range [0.." + (this._factList.size() - 1) + "]");
+ }
+
+ return (org.drools.testing.core.beans.Fact) _factList.get(index);
+ } //-- org.drools.testing.core.beans.Fact getFact(int)
+
+ /**
+ * Method getFact
+ *
+ *
+ *
+ * @return this collection as an Array
+ */
+ public org.drools.testing.core.beans.Fact[] getFact()
+ {
+ int size = this._factList.size();
+ org.drools.testing.core.beans.Fact[] array = new org.drools.testing.core.beans.Fact[size];
+ for (int index = 0; index < size; index++){
+ array[index] = (org.drools.testing.core.beans.Fact) _factList.get(index);
+ }
+
+ return array;
+ } //-- org.drools.testing.core.beans.Fact[] getFact()
+
+ /**
+ * Method getFactCount
+ *
+ *
+ *
+ * @return the size of this collection
+ */
+ public int getFactCount()
+ {
+ return this._factList.size();
+ } //-- int getFactCount()
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ } //-- java.lang.String getName()
+
+ /**
+ * Method getRule
+ *
+ *
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ * @return the value of the org.drools.testing.core.beans.Rule
+ * at the given index
+ */
+ public org.drools.testing.core.beans.Rule getRule(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._ruleList.size()) {
+ throw new IndexOutOfBoundsException("getRule: Index value '" + index + "' not in range [0.." + (this._ruleList.size() - 1) + "]");
+ }
+
+ return (org.drools.testing.core.beans.Rule) _ruleList.get(index);
+ } //-- org.drools.testing.core.beans.Rule getRule(int)
+
+ /**
+ * Method getRule
+ *
+ *
+ *
+ * @return this collection as an Array
+ */
+ public org.drools.testing.core.beans.Rule[] getRule()
+ {
+ int size = this._ruleList.size();
+ org.drools.testing.core.beans.Rule[] array = new org.drools.testing.core.beans.Rule[size];
+ for (int index = 0; index < size; index++){
+ array[index] = (org.drools.testing.core.beans.Rule) _ruleList.get(index);
+ }
+
+ return array;
+ } //-- org.drools.testing.core.beans.Rule[] getRule()
+
+ /**
+ * Method getRuleCount
+ *
+ *
+ *
+ * @return the size of this collection
+ */
+ public int getRuleCount()
+ {
+ return this._ruleList.size();
+ } //-- int getRuleCount()
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ * Method iterateFact
+ *
+ *
+ *
+ * @return an Iterator over all possible elements in this
+ * collection
+ */
+ public java.util.Iterator iterateFact()
+ {
+ return this._factList.iterator();
+ } //-- java.util.Iterator iterateFact()
+
+ /**
+ * Method iterateRule
+ *
+ *
+ *
+ * @return an Iterator over all possible elements in this
+ * collection
+ */
+ public java.util.Iterator iterateRule()
+ {
+ return this._ruleList.iterator();
+ } //-- java.util.Iterator iterateRule()
+
+ /**
+ */
+ public void removeAllFact()
+ {
+ this._factList.clear();
+ } //-- void removeAllFact()
+
+ /**
+ */
+ public void removeAllRule()
+ {
+ this._ruleList.clear();
+ } //-- void removeAllRule()
+
+ /**
+ * Method removeFact
+ *
+ *
+ *
+ * @param vFact
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeFact(org.drools.testing.core.beans.Fact vFact)
+ {
+ boolean removed = _factList.remove(vFact);
+ return removed;
+ } //-- boolean removeFact(org.drools.testing.core.beans.Fact)
+
+ /**
+ * Method removeFactAt
+ *
+ *
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public org.drools.testing.core.beans.Fact removeFactAt(int index)
+ {
+ Object obj = this._factList.remove(index);
+ return (org.drools.testing.core.beans.Fact) obj;
+ } //-- org.drools.testing.core.beans.Fact removeFactAt(int)
+
+ /**
+ * Method removeRule
+ *
+ *
+ *
+ * @param vRule
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeRule(org.drools.testing.core.beans.Rule vRule)
+ {
+ boolean removed = _ruleList.remove(vRule);
+ return removed;
+ } //-- boolean removeRule(org.drools.testing.core.beans.Rule)
+
+ /**
+ * Method removeRuleAt
+ *
+ *
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public org.drools.testing.core.beans.Rule removeRuleAt(int index)
+ {
+ Object obj = this._ruleList.remove(index);
+ return (org.drools.testing.core.beans.Rule) obj;
+ } //-- org.drools.testing.core.beans.Rule removeRuleAt(int)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFact
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void setFact(int index, org.drools.testing.core.beans.Fact vFact)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._factList.size()) {
+ throw new IndexOutOfBoundsException("setFact: Index value '" + index + "' not in range [0.." + (this._factList.size() - 1) + "]");
+ }
+
+ this._factList.set(index, vFact);
+ } //-- void setFact(int, org.drools.testing.core.beans.Fact)
+
+ /**
+ *
+ *
+ * @param vFactArray
+ */
+ public void setFact(org.drools.testing.core.beans.Fact[] vFactArray)
+ {
+ //-- copy array
+ _factList.clear();
+
+ for (int i = 0; i < vFactArray.length; i++) {
+ this._factList.add(vFactArray[i]);
+ }
+ } //-- void setFact(org.drools.testing.core.beans.Fact)
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name the value of field 'name'.
+ */
+ public void setName(java.lang.String name)
+ {
+ this._name = name;
+ } //-- void setName(java.lang.String)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRule
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void setRule(int index, org.drools.testing.core.beans.Rule vRule)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._ruleList.size()) {
+ throw new IndexOutOfBoundsException("setRule: Index value '" + index + "' not in range [0.." + (this._ruleList.size() - 1) + "]");
+ }
+
+ this._ruleList.set(index, vRule);
+ } //-- void setRule(int, org.drools.testing.core.beans.Rule)
+
+ /**
+ *
+ *
+ * @param vRuleArray
+ */
+ public void setRule(org.drools.testing.core.beans.Rule[] vRuleArray)
+ {
+ //-- copy array
+ _ruleList.clear();
+
+ for (int i = 0; i < vRuleArray.length; i++) {
+ this._ruleList.add(vRuleArray[i]);
+ }
+ } //-- void setRule(org.drools.testing.core.beans.Rule)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/TestSuite.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/TestSuite.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/generated-source/org/drools/testing/core/beans/TestSuite.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,385 @@
+/*
+ * This class was automatically generated with
+ * <a href="http://www.castor.org">Castor 1.0.5</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.drools.testing.core.beans;
+
+ //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+
+/**
+ * Class TestSuite.
+ *
+ * @version $Revision$ $Date$
+ */
+public class TestSuite extends org.drools.rule.Package
+implements java.io.Serializable
+{
+
+
+ //--------------------------/
+ //- Class/Member Variables -/
+ //--------------------------/
+
+ /**
+ * Field _name
+ */
+ private java.lang.String _name;
+
+ /**
+ * Field _description
+ */
+ private java.lang.String _description;
+
+ /**
+ * Field _fileName
+ */
+ private java.lang.String _fileName;
+
+ /**
+ * Field _scenarioList
+ */
+ private java.util.List _scenarioList;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public TestSuite()
+ {
+ super();
+ this._scenarioList = new java.util.ArrayList();
+ } //-- org.drools.testing.core.beans.TestSuite()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ *
+ *
+ * @param vScenario
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addScenario(org.drools.testing.core.beans.Scenario vScenario)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._scenarioList.add(vScenario);
+ } //-- void addScenario(org.drools.testing.core.beans.Scenario)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vScenario
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void addScenario(int index, org.drools.testing.core.beans.Scenario vScenario)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._scenarioList.add(index, vScenario);
+ } //-- void addScenario(int, org.drools.testing.core.beans.Scenario)
+
+ /**
+ * Method enumerateScenario
+ *
+ *
+ *
+ * @return an Enumeration over all possible elements of this
+ * collection
+ */
+ public java.util.Enumeration enumerateScenario()
+ {
+ return java.util.Collections.enumeration(this._scenarioList);
+ } //-- java.util.Enumeration enumerateScenario()
+
+ /**
+ * Returns the value of field 'description'.
+ *
+ * @return the value of field 'Description'.
+ */
+ public java.lang.String getDescription()
+ {
+ return this._description;
+ } //-- java.lang.String getDescription()
+
+ /**
+ * Returns the value of field 'fileName'.
+ *
+ * @return the value of field 'FileName'.
+ */
+ public java.lang.String getFileName()
+ {
+ return this._fileName;
+ } //-- java.lang.String getFileName()
+
+ /**
+ * Returns the value of field 'name'.
+ *
+ * @return the value of field 'Name'.
+ */
+ public java.lang.String getName()
+ {
+ return this._name;
+ } //-- java.lang.String getName()
+
+ /**
+ * Method getScenario
+ *
+ *
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ * @return the value of the
+ * org.drools.testing.core.beans.Scenario at the given index
+ */
+ public org.drools.testing.core.beans.Scenario getScenario(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._scenarioList.size()) {
+ throw new IndexOutOfBoundsException("getScenario: Index value '" + index + "' not in range [0.." + (this._scenarioList.size() - 1) + "]");
+ }
+
+ return (org.drools.testing.core.beans.Scenario) _scenarioList.get(index);
+ } //-- org.drools.testing.core.beans.Scenario getScenario(int)
+
+ /**
+ * Method getScenario
+ *
+ *
+ *
+ * @return this collection as an Array
+ */
+ public org.drools.testing.core.beans.Scenario[] getScenario()
+ {
+ int size = this._scenarioList.size();
+ org.drools.testing.core.beans.Scenario[] array = new org.drools.testing.core.beans.Scenario[size];
+ for (int index = 0; index < size; index++){
+ array[index] = (org.drools.testing.core.beans.Scenario) _scenarioList.get(index);
+ }
+
+ return array;
+ } //-- org.drools.testing.core.beans.Scenario[] getScenario()
+
+ /**
+ * Method getScenarioCount
+ *
+ *
+ *
+ * @return the size of this collection
+ */
+ public int getScenarioCount()
+ {
+ return this._scenarioList.size();
+ } //-- int getScenarioCount()
+
+ /**
+ * Method isValid
+ *
+ *
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try {
+ validate();
+ }
+ catch (org.exolab.castor.xml.ValidationException vex) {
+ return false;
+ }
+ return true;
+ } //-- boolean isValid()
+
+ /**
+ * Method iterateScenario
+ *
+ *
+ *
+ * @return an Iterator over all possible elements in this
+ * collection
+ */
+ public java.util.Iterator iterateScenario()
+ {
+ return this._scenarioList.iterator();
+ } //-- java.util.Iterator iterateScenario()
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void marshal(java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, out);
+ } //-- void marshal(java.io.Writer)
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException if an IOException occurs during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ */
+ public void marshal(org.xml.sax.ContentHandler handler)
+ throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+
+ Marshaller.marshal(this, handler);
+ } //-- void marshal(org.xml.sax.ContentHandler)
+
+ /**
+ */
+ public void removeAllScenario()
+ {
+ this._scenarioList.clear();
+ } //-- void removeAllScenario()
+
+ /**
+ * Method removeScenario
+ *
+ *
+ *
+ * @param vScenario
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeScenario(org.drools.testing.core.beans.Scenario vScenario)
+ {
+ boolean removed = _scenarioList.remove(vScenario);
+ return removed;
+ } //-- boolean removeScenario(org.drools.testing.core.beans.Scenario)
+
+ /**
+ * Method removeScenarioAt
+ *
+ *
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public org.drools.testing.core.beans.Scenario removeScenarioAt(int index)
+ {
+ Object obj = this._scenarioList.remove(index);
+ return (org.drools.testing.core.beans.Scenario) obj;
+ } //-- org.drools.testing.core.beans.Scenario removeScenarioAt(int)
+
+ /**
+ * Sets the value of field 'description'.
+ *
+ * @param description the value of field 'description'.
+ */
+ public void setDescription(java.lang.String description)
+ {
+ this._description = description;
+ } //-- void setDescription(java.lang.String)
+
+ /**
+ * Sets the value of field 'fileName'.
+ *
+ * @param fileName the value of field 'fileName'.
+ */
+ public void setFileName(java.lang.String fileName)
+ {
+ this._fileName = fileName;
+ } //-- void setFileName(java.lang.String)
+
+ /**
+ * Sets the value of field 'name'.
+ *
+ * @param name the value of field 'name'.
+ */
+ public void setName(java.lang.String name)
+ {
+ this._name = name;
+ } //-- void setName(java.lang.String)
+
+ /**
+ *
+ *
+ * @param index
+ * @param vScenario
+ * @throws java.lang.IndexOutOfBoundsException if the index
+ * given is outside the bounds of the collection
+ */
+ public void setScenario(int index, org.drools.testing.core.beans.Scenario vScenario)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._scenarioList.size()) {
+ throw new IndexOutOfBoundsException("setScenario: Index value '" + index + "' not in range [0.." + (this._scenarioList.size() - 1) + "]");
+ }
+
+ this._scenarioList.set(index, vScenario);
+ } //-- void setScenario(int, org.drools.testing.core.beans.Scenario)
+
+ /**
+ *
+ *
+ * @param vScenarioArray
+ */
+ public void setScenario(org.drools.testing.core.beans.Scenario[] vScenarioArray)
+ {
+ //-- copy array
+ _scenarioList.clear();
+
+ for (int i = 0; i < vScenarioArray.length; i++) {
+ this._scenarioList.add(vScenarioArray[i]);
+ }
+ } //-- void setScenario(org.drools.testing.core.beans.Scenario)
+
+ /**
+ * Method unmarshal
+ *
+ *
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException if object is
+ * null or if any SAXException is thrown during marshaling
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ * @return the unmarshaled
+ * org.drools.testing.core.beans.TestSuite
+ */
+ public static org.drools.testing.core.beans.TestSuite unmarshal(java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+ {
+ return (org.drools.testing.core.beans.TestSuite) Unmarshaller.unmarshal(org.drools.testing.core.beans.TestSuite.class, reader);
+ } //-- org.drools.testing.core.beans.TestSuite unmarshal(java.io.Reader)
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException if this
+ * object is an invalid instance according to the schema
+ */
+ public void validate()
+ throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ } //-- void validate()
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/lib/castor-xml-1.0.5.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/experimental/drools-testing/lib/castor-xml-1.0.5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/experimental/drools-testing/lib/xercesImpl-2.4.0.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/trunk/experimental/drools-testing/lib/xercesImpl-2.4.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/trunk/experimental/drools-testing/pom.xml
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/pom.xml (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/pom.xml 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>drools-testing</groupId>
+ <artifactId>drools-testing</artifactId>
+ <name>drools-testing</name>
+ <version>0.0.1</version>
+ <description></description>
+ <packaging>jar</packaging>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Maven Repository Switchboard</name>
+ <layout>default</layout>
+ <url>http://repo1.maven.org/maven2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ <updatePolicy>always</updatePolicy>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ <id>codehausSnapshots</id>
+ <name>Codehaus Snapshots</name>
+ <url>http://snapshots.maven.codehaus.org/maven2</url>
+ <layout>default</layout>
+ </repository>
+ </repositories>
+ <build>
+ <sourceDirectory>${basedir}/</sourceDirectory>
+ <outputDirectory>${basedir}/target/classes</outputDirectory>
+ <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
+ <resources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>${basedir}/src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>drools</groupId>
+ <artifactId>drools-core</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>drools</groupId>
+ <artifactId>drools-decisiontables</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>castor</groupId>
+ <artifactId>castor-xml</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>castor</groupId>
+ <artifactId>castor-srcgen-ant-task</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>2.7.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>3.0ea8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xerces</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.2.0.666</version>
+ </dependency>
+ <dependency>
+ <groupId>drools</groupId>
+ <artifactId>drools-jsr94</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-jci</groupId>
+ <artifactId>janino</artifactId>
+ <version>2.4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-jci</groupId>
+ <artifactId>eclipse</artifactId>
+ <version>3.2.0.666</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/rtl/test.rtl
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/rtl/test.rtl (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/rtl/test.rtl 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test-suite scenario-count="1" valid="true"><scenario fact-count="2" valid="true" rule-count="3"><fact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" field-count="1" valid="true" id="-279307516" xsi:type="java:org.drools.testing.core.wrapper.FactWrapper"><type>org.drools.testing.core.rules.model.Person</type><field valid="true" xsi:type="java:org.drools.testing.core.wrapper.FieldWrapper"><name>age</name><type>java.lang.Integer</type><value>0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59</value></field></fact><fact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" field-count="2" valid="true" id="678703840" xsi:type="java:org.drools.testing.core.wrapper.FactWrapper"><type>org.drools.testing.core.rules.model.Account</type><field valid="true" xsi:type="java:org.drools.testing.core.wrapper.FieldWrapper"><name>status</name><type>java.lang.String</t!
ype><value>active</value></field><field valid="true" xsi:type="java:org.drools.testing.core.wrapper.FieldWrapper"><name>balance</name><type>java.lang.Integer</type><value>0</value></field></fact><name>Scenario One</name><rule result-count="0" fire="true" valid="true"><name>rule1</name></rule><rule result-count="0" fire="true" valid="true"><name>rule2</name></rule><rule result-count="0" fire="true" valid="true"><name>rule3</name></rule></scenario><name>The Test Test Suite</name></test-suite>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/ApplicationProperties.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/ApplicationProperties.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/ApplicationProperties.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,297 @@
+/*
+ * Created on 26/05/2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.drools.testing.core.configuration;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author mshaw
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ApplicationProperties {
+
+ /**
+ * A reference to the AppProperties Singleton object.
+ */
+ private static ApplicationProperties s_AppProperties;
+ private Properties m_Properties;
+ private String m_FileName = "/org/drools/testing/core/resources/rtl/rtl.properties";
+ public final static String SYSTEM_PROPERTY = "rtl.properties.file";
+ public final static String ENVIRONMENT_PROPERTY = "environment";
+ public final static String DELIMETER = "_";
+
+ static Log log = LogFactory.getLog(ApplicationProperties.class);
+
+
+ /**
+ * Create a new properties instance.
+ *
+ * Retrieves the properties as a RESOURCE.
+ */
+ private ApplicationProperties() {
+
+ String methodName = "ApplicationProperties()";
+
+ BufferedInputStream bis = null;
+ m_Properties = new Properties();
+
+ log.info("AppProperties - using property file: " + m_FileName);
+
+ // Load the properties
+ try {
+ bis = new BufferedInputStream(ApplicationProperties.class.getResourceAsStream( m_FileName ));
+ m_Properties.load(bis);
+ }
+ catch (Exception ex) {
+ log.error(ex);
+ }
+ finally {
+ try {
+ if (bis != null) {
+ bis.close();
+ }
+ }
+ catch (IOException ex) { /* Cannot do anything here */}
+
+ }
+ }
+
+ /**
+ * load properties from the file system
+ *
+ */
+ private ApplicationProperties(String fileName) {
+
+ String methodName = "ApplicationProperties()";
+
+ FileInputStream fis = null;
+ BufferedInputStream bis = null;
+ m_Properties = new Properties();
+
+ log.info("AppProperties - using property file: " + fileName);
+
+ // Load the properties
+ try {
+ fis = new FileInputStream(fileName);
+ bis = new BufferedInputStream(ApplicationProperties.class.getResourceAsStream( m_FileName ));
+ m_Properties.load(bis);
+ }
+ catch (Exception ex) {
+ log.error(ex);
+ }
+ finally {
+ try {
+ if (bis != null) {
+ bis.close();
+ }
+ }
+ catch (IOException ex) { /* Cannot do anything here */}
+ try {
+ if (fis != null) {
+ fis.close();
+ }
+ }
+ catch (IOException ex) { /* Cannot do anything here */}
+ }
+ }
+
+ /**
+ * Returns a String associated with the property specified by
+ * propertyName.
+ *
+ * @param propertyName a string representing the property
+ * @return the associated value
+ */
+ public String getProperty(String propertyName) throws PropertyNotFoundException {
+
+ String result = m_Properties.getProperty(propertyName);
+
+ if (result == null) {
+ throw new PropertyNotFoundException("Could not find property " + propertyName + " in file " +
+ m_FileName);
+ }
+
+ return result;
+
+ }
+
+ /**
+ * Returns a String associated with the property specified by
+ * propertyName.
+ *
+ * @param propertyName a string representing the property
+ * @return the associated value
+ */
+ public String getEnvironmentSpecificProperty(String propertyName) throws PropertyNotFoundException {
+ String environment = System.getProperty(ENVIRONMENT_PROPERTY);
+ if (environment == null) {
+ throw new IllegalStateException("The System parameter: " + ENVIRONMENT_PROPERTY + " must be set");
+ }
+ String result = m_Properties.getProperty(environment + DELIMETER + propertyName);
+
+ if (result == null) {
+ throw new PropertyNotFoundException("Could not find environement specific property " + environment +
+ DELIMETER + propertyName + " in file " + m_FileName);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns an array of Strings associated with the property specified by
+ * propertyName. The method is used for entries that potentially have
+ * multiple values separated by a particular character or string.
+ *
+ * Typically this will be used for space separated words:
+ * String[] entries =
+ * AppProperties.getInstance().getPropertyEntries("PropertyName", " ");
+ *
+ * @param propertyName the name of the property
+ * @param separatorString the string that separates each entry
+ */
+ public String[] getPropertyEntries(String propertyName, String separatorString) throws PropertyNotFoundException {
+ String prop = m_Properties.getProperty(propertyName);
+
+ if (prop == null) {
+ throw new PropertyNotFoundException("Could not find property " + propertyName + " in file " + m_FileName);
+ }
+
+ StringTokenizer tokeniser = new StringTokenizer(prop, separatorString);
+ String[] result = new String[tokeniser.countTokens()];
+ int i = 0;
+
+ while (tokeniser.hasMoreElements()) {
+ result[i++] = tokeniser.nextToken();
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns an Iterator of property names
+ *
+ * @return all the property names
+ */
+ public Iterator getPropertyNames() {
+ return m_Properties.keySet().iterator();
+ }
+
+ /**
+ * method used to reload the property list at runtime
+ *
+ *
+ */
+ public void loadProprtyFile(String fileName) {
+ String methodName = "loadProprtyFile(String fileName)";
+ if (fileName == null) {
+ log.error("File name is null");
+ }
+ else {
+ s_AppProperties = new ApplicationProperties(fileName);
+ }
+ }
+
+ /**
+ * A string representaion of the properties in the Properties Table
+ */
+
+ public String propertiesToString() {
+ if (m_Properties == null) {
+ return ("Properties have not been initialised");
+ }
+ else {
+ String props = "";
+ Iterator propertyKeys = getPropertyNames();
+ while (propertyKeys.hasNext()) {
+ String currentKey = (String) propertyKeys.next();
+ props += currentKey + "=" + m_Properties.get(currentKey) + "\n";
+ }
+
+ return props;
+ }
+ }
+
+ /**
+ * Returns the instance of the AppProperties class
+ *
+ * @return the singleton instance
+ */
+ public static ApplicationProperties getInstance() {
+ if (s_AppProperties == null) {
+ s_AppProperties = new ApplicationProperties();
+ }
+
+ return s_AppProperties;
+ }
+
+ public String getFileName() {
+ return m_FileName;
+ }
+
+ public static void flushProperties() {
+ String methodName = "flushProperties()";
+ s_AppProperties = null;
+ }
+
+ /**
+ * Get a property but if it does not exist return the default value supplied in the
+ * method call.
+ * @param property
+ * @param defaultValue
+ * @return
+ */
+ public String getPropertyWithDefault(String property, String defaultValue)
+ {
+ try {
+ return getProperty(property);
+ } catch (PropertyNotFoundException e) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Get a property and return it as an int. Throws a property not found exception
+ * if the property exists but cannot be formatted.
+ * @param property
+ * @return
+ * @throws PropertyNotFoundException
+ */
+ public int getPropertyAsInt(String property) throws PropertyNotFoundException
+ {
+ try {
+ return new Integer(getProperty(property)).intValue();
+ } catch (NumberFormatException e) {
+ throw new PropertyNotFoundException("Property was found but could not converted to an int");
+ }
+ }
+
+ /**
+ * Get a property and return it as an int. Returns the default value if the
+ * property cannot be found or formatted as an int.
+ * @param property
+ * @param defaultValue
+ * @return
+ */
+ public int getPropertyAsIntWithDefault(String property, int defaultValue)
+ {
+ try {
+ return new Integer(getProperty(property)).intValue();
+ } catch (Exception e) {
+ return defaultValue;
+ }
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/PropertyNotFoundException.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/PropertyNotFoundException.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/configuration/PropertyNotFoundException.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,30 @@
+/*
+ * Created on 26/05/2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.drools.testing.core.configuration;
+
+import org.drools.testing.core.exception.RuleTestLanguageException;
+
+/**
+ * @author mshaw
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class PropertyNotFoundException extends RuleTestLanguageException {
+
+ public PropertyNotFoundException() {
+ super();
+ }
+
+ public PropertyNotFoundException(String message) {
+ super(message);
+ }
+
+ public PropertyNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/CouldNotParseDrlException.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/CouldNotParseDrlException.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/CouldNotParseDrlException.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,22 @@
+package org.drools.testing.core.exception;
+
+public class CouldNotParseDrlException extends RuleTestLanguageException {
+
+public CouldNotParseDrlException () {
+
+ super();
+
+ }
+
+ public CouldNotParseDrlException (String message) {
+
+ super(message);
+
+ }
+
+ public CouldNotParseDrlException (String message, Throwable cause) {
+
+ super(message,cause);
+
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/ObjectUtilsException.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/ObjectUtilsException.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/ObjectUtilsException.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,22 @@
+package org.drools.testing.core.exception;
+
+public class ObjectUtilsException extends RuleTestLanguageException {
+
+public ObjectUtilsException () {
+
+ super();
+
+ }
+
+ public ObjectUtilsException (String message) {
+
+ super(message);
+
+ }
+
+ public ObjectUtilsException (String message, Throwable cause) {
+
+ super(message,cause);
+
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/RuleTestLanguageException.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/RuleTestLanguageException.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/RuleTestLanguageException.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,69 @@
+/*
+ * Created on 30/11/2006
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.drools.testing.core.exception;
+
+/**
+ * @author mshaw
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public abstract class RuleTestLanguageException extends Exception {
+
+ private Throwable cause = null;
+
+ public RuleTestLanguageException () {
+ super();
+ }
+
+ public RuleTestLanguageException (String message) {
+ super(message);
+ }
+
+ public RuleTestLanguageException (String message, Throwable cause) {
+ super(message);
+ this.cause = cause;
+ }
+
+ public Throwable getCause() {
+ return cause;
+ }
+
+ public void printStackTrace() {
+ super.printStackTrace();
+ if (cause != null) {
+ System.err.println("Caused by:");
+ cause.printStackTrace();
+ }
+ }
+
+ public void printStackTrace(java.io.PrintStream ps) {
+ super.printStackTrace(ps);
+ if (cause != null) {
+ ps.println("Caused by:");
+ cause.printStackTrace(ps);
+ }
+ }
+
+ public void printStackTrace(java.io.PrintWriter pw) {
+ super.printStackTrace(pw);
+ if (cause != null) {
+ pw.println("Caused by:");
+ cause.printStackTrace(pw);
+ }
+ }
+
+ public String toString()
+ {
+ String exceptionString = super.toString();
+ if (cause != null) {
+ exceptionString += " Caused By: \n";
+ exceptionString += cause.toString();
+ }
+ return exceptionString;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/TransformerServiceException.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/TransformerServiceException.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/exception/TransformerServiceException.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,22 @@
+package org.drools.testing.core.exception;
+
+public class TransformerServiceException extends RuleTestLanguageException {
+
+public TransformerServiceException () {
+
+ super();
+
+ }
+
+ public TransformerServiceException (String message) {
+
+ super(message);
+
+ }
+
+ public TransformerServiceException (String message, Throwable cause) {
+
+ super(message,cause);
+
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/filters/MultipleRuleAgendaFilter.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/filters/MultipleRuleAgendaFilter.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/filters/MultipleRuleAgendaFilter.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,37 @@
+/*
+ * Created on 16/09/2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.drools.testing.core.filters;
+
+import java.util.Collection;
+
+import org.drools.spi.Activation;
+import org.drools.spi.AgendaFilter;
+
+/**
+ * @author mshaw
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class MultipleRuleAgendaFilter implements AgendaFilter {
+
+ private Collection rules;
+ private final boolean accept = false;
+
+ public MultipleRuleAgendaFilter (Collection rules) {
+ this.rules = rules;
+ }
+
+ public boolean accept(Activation activation) {
+
+ if (rules.contains(activation.getRule().getName()))
+ return true;
+ else
+ return false;
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/SchemaBuilder.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/SchemaBuilder.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/SchemaBuilder.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,38 @@
+package org.drools.testing.core.main;
+
+import java.io.FileWriter;
+
+import org.drools.lang.descr.PackageDescr;
+import org.drools.testing.core.beans.TestSuite;
+import org.drools.xml.XmlDumper;
+
+
+public class SchemaBuilder {
+
+ public static final void main(final String[] args) {
+ SchemaBuilder schemaBuilder = new SchemaBuilder();
+ //schemaBuilder.buildSchema();
+ schemaBuilder.buildTestSuite();
+ }
+
+ public void buildSchema () {
+ try {
+ PackageDescr packageDescr = TransformerService.parseDrl("/org/drools/testing/core/resources/drl/test.drl");
+ XmlDumper xmlDumper = new XmlDumper();
+ FileWriter writer = new FileWriter("drl.xml");
+ writer.write(xmlDumper.dump(packageDescr));
+ writer.close();
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void buildTestSuite () {
+ try {
+ TransformerService trService = new TransformerService();
+ TestSuite testSuite = trService.generateTestSuite("/org/drools/testing/core/resources/drl/test.drl");
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TestSuiteRunner.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TestSuiteRunner.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TestSuiteRunner.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,88 @@
+package org.drools.testing.core.main;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.PackageBuilder;
+import org.drools.event.AfterActivationFiredEvent;
+import org.drools.event.DefaultAgendaEventListener;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.testing.core.beans.Scenario;
+import org.drools.testing.core.exception.CouldNotParseDrlException;
+import org.drools.testing.core.exception.RuleTestLanguageException;
+import org.drools.testing.core.filters.MultipleRuleAgendaFilter;
+import org.drools.testing.core.rules.model.Account;
+import org.drools.testing.core.rules.model.Person;
+
+public class TestSuiteRunner {
+
+ private String file;
+ private RuleBase ruleBase;
+
+ public TestSuiteRunner (String file) throws RuleTestLanguageException {
+ this.file = file;
+ buildRuleBase();
+ }
+
+ /**
+ * Creates a new working memory from the rule base and fires
+ * the specified rules on the TestSuite Object
+ * @throws RuleTestLanguageException
+ */
+ public void runTests (Scenario scenario) throws RuleTestLanguageException {
+ WorkingMemory wm = ruleBase.newWorkingMemory();
+ Collection ruleNames = new ArrayList();
+ org.drools.testing.core.beans.Rule[] rules = scenario.getRule();
+ for (int i=0; i<rules.length; i++)
+ ruleNames.add(rules[i].getName());
+
+ wm.addEventListener( new DefaultAgendaEventListener() {
+ public void afterActivationFired(AfterActivationFiredEvent event) {
+ super.afterActivationFired( event );
+ System.out.println( event );
+ }
+
+ });
+
+ Account account = new Account();
+ account.setStatus("active");
+ account.setBalance(new Integer(0));
+ wm.assertObject(account);
+
+ Person person = new Person();
+ person.setAge(new Integer(25));
+ wm.assertObject(person);
+
+ wm.fireAllRules(new MultipleRuleAgendaFilter(ruleNames));
+ wm.dispose();
+ }
+
+ private void buildRuleBase () throws RuleTestLanguageException {
+
+ try {
+ // read in the source
+ Reader reader = new InputStreamReader( TestSuiteRunner.class.getResourceAsStream( file ) );
+ DrlParser parser = new DrlParser();
+ PackageDescr packageDescr = parser.parse( reader );
+
+
+ //pre build the package
+ PackageBuilder builder = new PackageBuilder();
+ builder.addPackage( packageDescr );
+ org.drools.rule.Package pkg = builder.getPackage();
+
+ //add the package to a rulebase
+ ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( pkg );
+ }catch (Exception e) {
+ throw new CouldNotParseDrlException("Could not parse drl file: "+file,e);
+ }
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/Testing.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/Testing.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/Testing.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,236 @@
+package org.drools.testing.core.main;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+import org.drools.lang.descr.ColumnDescr;
+import org.drools.lang.descr.LiteralDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.testing.core.beans.Rule;
+import org.drools.testing.core.beans.Scenario;
+import org.drools.testing.core.beans.TestSuite;
+import org.drools.testing.core.configuration.ApplicationProperties;
+import org.drools.testing.core.configuration.PropertyNotFoundException;
+import org.drools.testing.core.exception.RuleTestLanguageException;
+import org.drools.testing.core.utils.CollectionUtils;
+import org.drools.testing.core.utils.ObjectUtils;
+import org.drools.testing.core.utils.OperatorUtils;
+import org.drools.testing.core.wrapper.FactWrapper;
+import org.drools.testing.core.wrapper.FieldWrapper;
+
+/**
+ *
+ * @author mshaw
+ *
+ * This class is the main class for the drools core testing module. It provides
+ * functionalilty for generating test scenario's based on an input set of rules.
+ *
+ * facts - an internal list which contains a unique list of facts and fields
+ */
+public final class Testing {
+
+ private TestSuite testSuite;
+ private Scenario scenario;
+ private PackageDescr packageDescr;
+ private Random rng;
+ private List facts = new ArrayList();
+ private ApplicationProperties applicationProperties = ApplicationProperties.getInstance();
+ private ClassLoader classLoader;
+
+ public Testing () {
+
+ }
+
+ public Testing (String suiteName, PackageDescr packageDescr) {
+ this.testSuite = new TestSuite();
+ this.testSuite.setName(suiteName);
+ this.packageDescr = packageDescr;
+ }
+
+ /**
+ * Instantiate with a class loader
+ * @param suiteName
+ * @param packageDescr
+ */
+ public Testing (String suiteName, PackageDescr packageDescr, ClassLoader classLoader) {
+ this.testSuite = new TestSuite();
+ this.testSuite.setName(suiteName);
+ this.packageDescr = packageDescr;
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * return a testsuite serializable object with the name
+ *
+ * @param name
+ * @return
+ * @throws RuleTestLanguageException
+ */
+ public TestSuite getTestSuite () throws RuleTestLanguageException {
+
+ return this.testSuite;
+ }
+
+ /**
+ * Create a scenario object which will contain all the rules.
+ * We then make a call to processColumnDescriptors which will
+ * aid in generating our fact types.
+ *
+ * @throws RuleTestLanguageException
+ */
+ public Scenario generateScenario (String name, List rules) throws RuleTestLanguageException {
+
+ scenario = new Scenario();
+ scenario.setName(name);
+ rng = new Random();
+
+ Iterator i = rules.iterator();
+ while (i.hasNext()) {
+ RuleDescr rule = (RuleDescr) i.next();
+ scenario.addRule(getRule(rule));
+ processColumnDescriptors(rule.getLhs().getDescrs());
+ }
+
+ Iterator j = facts.iterator();
+ while (j.hasNext()) {
+ FactWrapper factWrapper = (FactWrapper) j.next();
+ factWrapper.setId(rng.nextInt());
+ scenario.addFact(factWrapper);
+ }
+
+ return scenario;
+ }
+
+ /**
+ *
+ * @param descrs
+ * @return List of facts
+ * @throws RuleTestLanguageException
+ */
+ public List processColumnDescriptors (List descrs) throws RuleTestLanguageException {
+
+ Iterator i = descrs.iterator();
+ while (i.hasNext()) {
+ // each columndescr is for a "when" statment in the drl
+ ColumnDescr columnDescr = (ColumnDescr) i.next();
+
+ Class classDefn = ObjectUtils.getClassDefn(columnDescr.getObjectType(), this.packageDescr.getImports(),this.classLoader);
+
+ FactWrapper fact = new FactWrapper();
+ fact.setType(classDefn.getName());
+ if (facts.contains(fact)) {
+ fact = (FactWrapper) facts.get(facts.indexOf(fact));
+ facts.remove(fact);
+ }
+
+ processLiteralDescriptors(classDefn, fact,columnDescr.getDescrs());
+ facts.add(fact);
+
+ }
+ return facts;
+ }
+
+ /**
+ *
+ * @param fact
+ * @param descrs
+ * @throws RuleTestLanguageException
+ */
+ public void processLiteralDescriptors (Class classDefn, FactWrapper fact, List descrs) throws RuleTestLanguageException {
+
+ List fields = (List) CollectionUtils.arrayToCollection(fact.getField());
+
+ Iterator i = descrs.iterator();
+ while (i.hasNext()) {
+ LiteralDescr literalDescr = (LiteralDescr) i.next();
+ FieldWrapper field = new FieldWrapper();
+ field.setName(literalDescr.getFieldName());
+ //field.setValue(literalDescr.getText());
+ field.setValue(getValue(literalDescr.getFieldName(), literalDescr.getText(), literalDescr.getEvaluator()));
+ field.setType(getType(classDefn, literalDescr.getFieldName()).getName());
+
+ if (!fields.contains(field))
+ fact.addField(field);
+ }
+ }
+
+ /**
+ *
+ * @param ruleDescr
+ * @return Rule
+ * @throws RuleTestLanguageException
+ */
+ public Rule getRule (RuleDescr ruleDescr) throws RuleTestLanguageException {
+
+ Rule rule = new Rule();
+ rule.setName(ruleDescr.getName());
+ rule.setFire(true);
+
+
+
+
+ return rule;
+ }
+
+ /**
+ *
+ * @param scenario
+ * @throws RuleTestLanguageException
+ */
+ public void addScenarioToSuite (Scenario scenario) throws RuleTestLanguageException {
+
+ this.testSuite.addScenario(scenario);
+ }
+
+ public Class getType (Class classDefn, String fieldName) {
+
+ Class type = null;
+ try {
+ type = classDefn.getDeclaredField(fieldName).getType();
+ }catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ }
+ return type;
+ }
+
+ public String getValue (String fieldName, String value, String operator) {
+
+ String result = null;
+
+ // is it a range?
+ if (OperatorUtils.rangeOperators.indexOf(operator) != -1)
+ result = getRangeValue(operator, value);
+ else
+ result = value;
+
+
+ return result;
+ }
+
+ public String getRangeValue (String operator, String value) {
+
+ String result = null;
+
+ try {
+ Integer min = new Integer(applicationProperties.getProperty("range.min"));
+ Integer max = new Integer(applicationProperties.getProperty("range.max"));
+
+ if (operator.indexOf("<") != -1)
+ max = new Integer(value);
+ else if (operator.indexOf(">") != -1)
+ min = new Integer(value);
+
+ result = min.toString();
+ for (int i=min.intValue()+1; i<max.intValue(); i++)
+ result = result + "," + i;
+
+ }catch (PropertyNotFoundException e) {
+
+ }
+
+ return result;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TransformerService.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TransformerService.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/main/TransformerService.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,75 @@
+package org.drools.testing.core.main;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.drools.compiler.DrlParser;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.testing.core.beans.TestSuite;
+import org.drools.testing.core.exception.RuleTestLanguageException;
+import org.drools.testing.core.exception.TransformerServiceException;
+import org.drools.testing.core.rules.RuleSetTest;
+import org.drools.xml.XmlDumper;
+import org.exolab.castor.mapping.Mapping;
+import org.exolab.castor.xml.Unmarshaller;
+import org.xml.sax.InputSource;
+
+public final class TransformerService {
+
+ public TransformerService () {
+ }
+
+ /**
+ * parseDrl uses the drools drl parser to read the drl and return object description
+ */
+ public final static PackageDescr parseDrl (String file) throws RuleTestLanguageException {
+
+ DrlParser drlParser = new DrlParser();
+ try {
+ Reader reader = new InputStreamReader( RuleSetTest.class.getResourceAsStream( file ) );
+ return drlParser.parse(reader);
+ }catch (Exception e) {
+ throw new TransformerServiceException("Exception ocurred ",e);
+ }
+ }
+
+ /**
+ * unMarshallDocument takes a drools PackageDescr and uses castor to
+ * unmarshall the document to a data transfer object indicative of an RTL file
+ */
+
+ public Object unMarshallDocument (PackageDescr packageDescr) throws RuleTestLanguageException {
+
+ Mapping mapping = new Mapping();
+ try {
+ InputSource inputSource = new InputSource(getClass().getResourceAsStream("/org/drools/testing/core/resources/castor/castor-mapping.xml"));
+ mapping.loadMapping(inputSource);
+ Unmarshaller unmarshaller = new Unmarshaller(mapping);
+ XmlDumper xmlDumper = new XmlDumper();
+ Object test = (Object) unmarshaller.unmarshal(new InputSource(new StringReader(xmlDumper.dump(packageDescr))));
+ return test;
+ }catch (Exception e) {
+ throw new TransformerServiceException("Exception ocurred ",e);
+ }
+ }
+
+ /**
+ * generateTestSuite
+ * takes a drl, unmarshalls it to a TestSuite object.
+ *
+ * This method can be overloaded so that the document being parsed and mapped
+ * can be any structure, for the moment I am just handling a mapping
+ * for drools drl files.
+ */
+ public TestSuite generateTestSuite (String file) throws RuleTestLanguageException {
+ TestSuite testSuite=null;
+ try {
+ testSuite = (TestSuite) unMarshallDocument(parseDrl(file));
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return testSuite;
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Assertion.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Assertion.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Assertion.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,20 @@
+package org.drools.testing.core.model;
+
+public class Assertion {
+
+ private String name;
+ private boolean success;
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public boolean isSuccess() {
+ return success;
+ }
+ public void setSuccess(boolean success) {
+ this.success = success;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Fact.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Fact.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Fact.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,34 @@
+package org.drools.testing.core.model;
+
+/**
+ *
+ * @author Matt
+ *
+ * A fact represents any object used in conidtional clauses within
+ * the set of rules being tested.
+ */
+public class Fact {
+
+ private Integer id;
+ private String type;
+ private Field[] fields;
+
+ public Field[] getFields() {
+ return fields;
+ }
+ public void setFields(Field[] fields) {
+ this.fields = fields;
+ }
+ public Integer getId() {
+ return id;
+ }
+ public void setId(Integer id) {
+ this.id = id;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Field.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Field.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Field.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,26 @@
+package org.drools.testing.core.model;
+
+public class Field {
+
+ private String name;
+ private String type;
+ private String value;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Outcome.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Outcome.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Outcome.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,20 @@
+package org.drools.testing.core.model;
+
+public class Outcome {
+
+ public Rule[] rules;
+ public Assertion[] assertions;
+
+ public Assertion[] getAssertions() {
+ return assertions;
+ }
+ public void setAssertions(Assertion[] assertions) {
+ this.assertions = assertions;
+ }
+ public Rule[] getRules() {
+ return rules;
+ }
+ public void setRules(Rule[] rules) {
+ this.rules = rules;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Rule.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Rule.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Rule.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,20 @@
+package org.drools.testing.core.model;
+
+public class Rule {
+
+ private String name;
+ private boolean fire;
+
+ public boolean isFire() {
+ return fire;
+ }
+ public void setFire(boolean fire) {
+ this.fire = fire;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Scenario.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Scenario.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/Scenario.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,20 @@
+package org.drools.testing.core.model;
+
+public class Scenario {
+
+ public Fact[] facts;
+ public Outcome[] outcomes;
+
+ public Fact[] getFacts() {
+ return facts;
+ }
+ public void setFacts(Fact[] facts) {
+ this.facts = facts;
+ }
+ public Outcome[] getOutcomes() {
+ return outcomes;
+ }
+ public void setOutcomes(Outcome[] outcomes) {
+ this.outcomes = outcomes;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/TestSuite.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/TestSuite.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/model/TestSuite.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,24 @@
+package org.drools.testing.core.model;
+
+/**
+ *
+ * @author Matt
+ *
+ * This is the test suite model for representation of rules
+ * in a testing environment.
+ *
+ * A test suite has many test scenarios.
+ */
+
+public class TestSuite {
+
+ private Scenario[] scenarios;
+
+ public Scenario[] getScenarios() {
+ return scenarios;
+ }
+
+ public void setScenarios(Scenario[] scenarios) {
+ this.scenarios = scenarios;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/META-INF/test-lang.xsd
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/META-INF/test-lang.xsd (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/META-INF/test-lang.xsd 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://drools.org/testing"
+ elementFormDefault="qualified"
+ xmlns:test="http://drools.org/testing">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">
+ Test schema for jbossrules.org/rtl
+ Copyright 2006 jbossrules.org. All rights reserved.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:element name="testSuite">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="scenario" type="test:scenarioType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ <xs:attribute name="description" type="xs:string"/>
+ <xs:attribute name="fileName" use="required" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="scenarioType">
+ <xs:sequence>
+ <xs:element name="fact" type="test:factType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="rule" type="test:ruleType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="factType">
+ <xs:sequence>
+ <xs:element name="type" type="xs:string"/>
+ <xs:element name="field" type="test:fieldType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="id" use="required" type="xs:integer"/>
+ </xs:complexType>
+
+ <xs:complexType name="fieldType">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="type" type="xs:string"/>
+ <xs:element name="value" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="ruleType">
+ <xs:sequence>
+ <xs:element name="result" type="test:fieldType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ <xs:attribute name="fire" use="required" type="xs:boolean"/>
+ </xs:complexType>
+
+</xs:schema>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xml
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xml (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xml 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,11 @@
+<binding xmlns="http://www.castor.org/SourceGenerator/Binding"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.castor.org/SourceGenerator/Binding"
+ defaultBindingType="element">
+
+ <elementBinding name="/testSuite">
+ <java-class>
+ <extends>org.drools.rule.Package</extends>
+ </java-class>
+ </elementBinding>
+</binding>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xsd
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xsd (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/binding/binding.xsd 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,248 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ Castor Source Generator Binding File XML Schema
+ Namespace: http://castor.exolab.org/SourceGenerator/Binding
+ System: http://castor.exolab.org/binding.xsd
+ Public: -//EXOLAB/Castor Binding Schema Version 1.0//EN
+
+ This schema is used to generate part of the
+ org.exolab.castor.builder.binding package
+ *Note*: This schema is under evolution and subject to change.
+ This schema is under the Exolab license
+
+ Author: Arnaud Blandin [blandin at intalio.com]
+ -->
+<!-- $Id: binding.xsd 5951 2006-05-30 22:18:48Z bsnyder $ -->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.castor.org/SourceGenerator/Binding"
+ xmlns="http://www.castor.org/SourceGenerator/Binding"
+ elementFormDefault="unqualified">
+
+ <!-- The root element -->
+ <xsd:element name="binding">
+ <xsd:annotation>
+ <xsd:documentation>
+ The root element that contains the different binding elements.
+ The binding file is written from a schema point of view and follows the
+ structure of an XML Schema.
+ The root element can also be used to configure the default binding type.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="include" type="includeType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="package" type="packageType" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="namingXML" type="namingXMLType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element ref="elementBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="attributeBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="complexTypeBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="groupBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <!-- Not yet implemented -->
+ <!--<xsd:element name="enumBinding" type="enumBindingType" minOccurs="0" maxOccurs="unbounded"/>-->
+ </xsd:sequence>
+ <!-- the binding type: 'element' approach or 'type' approach -->
+ <xsd:attribute name="defaultBindingType" type="bindingType"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!--global definition to allow reference-->
+ <xsd:element name="elementBinding" type="componentBindingType"/>
+ <xsd:element name="attributeBinding" type="componentBindingType"/>
+ <xsd:element name="complexTypeBinding" type="componentBindingType"/>
+ <xsd:element name="groupBinding" type="componentBindingType"/>
+
+ <!--ComplexTypes definitions-->
+ <xsd:complexType name="includeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A binding file can include other binding files by specifying the location
+ (URI) of the binding files to include.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="URI" type="xsd:anyURI" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="packageType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Mappings between a namespace and a java package can directly
+ be defined in the binding file. This element allows also the mapping
+ between a package and a schemaLocation.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <!--fully qualified name-->
+ <xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:choice>
+ <xsd:element name="namespace" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="schemaLocation" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ </xsd:choice>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="namingXMLType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This element allows to define naming convention when naming a complexType, element or
+ modelGroup. Indeed the user can decide of a prefix to add to each class name as well
+ as a suffix. This naming style won't affect the names entered in the binding file but only
+ the XML Names.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="elementName" type="namingType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="complexTypeName" type="namingType" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="modelGroupName" type="namingType" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="namingType">
+ <xsd:sequence>
+ <xsd:element name="prefix" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="suffix" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="componentBindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A binding element is defined to express the binding between an XML Schema Component
+ and Java class OR a java interface or a java member class. The XML Schema component can
+ be an element, an attribute, a complexType or a group. Attribute cannot be mapped to
+ class, the reader of a binding file will take care that class or interface are not
+ used for component whose xml-type is attribute.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="java-class" type="classType"/>
+ <xsd:element name="interface">
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="member" type="fieldType"/>
+ </xsd:choice>
+ <xsd:element ref="elementBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="attributeBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="complexTypeBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="groupBinding" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <!--the name of the schema component or an XPath expression that identify the component-->
+ <xsd:attribute name="name" type="pathType" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="classType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type gathers the needed information to generate a Java Class
+ from a binding file. Options such as generating the equals method,
+ using wrapper classes for primitives or using bound properties can
+ be defined via that element. When defined locally the options override
+ the values defined in the castor.properties file.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="implements" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="extends" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <!-- not yet implemented -->
+ <!--<xsd:element name="javadoc" type="xsd:string" minOccurs="0" maxOccurs="1"/>-->
+ </xsd:sequence>
+ <!--This attribute allows the local redefinition of a package name-->
+ <xsd:attribute name="package" type="xsd:string"/>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="final" type="xsd:boolean"/>
+ <xsd:attribute name="abstract" type="xsd:boolean"/>
+ <!--properties for generating specific methods-->
+ <xsd:attribute name="equals" type="xsd:boolean"/>
+ <xsd:attribute name="bound" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="fieldType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type represents the binding for class member. It allows the definition
+ of its name and java type as well as an implementation of FieldHandler
+ to help the Marshalling framework in handling that member. Defining a validator is also
+ possible. The names given for the validator and the fieldHandler must be fully qualified
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="java-type" type="xsd:string"/>
+ <xsd:attribute name="wrapper" type="xsd:boolean"/>
+ <xsd:attribute name="handler" type="xsd:string"/>
+ <!-- if the java-type is a primitive, the collection type must be an array -->
+ <!-- the validation of the above statement must be enforced in the generated sources -->
+ <xsd:attribute name="collection">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="array"/>
+ <xsd:enumeration value="vector"/>
+ <xsd:enumeration value="arraylist"/>
+ <xsd:enumeration value="hashtable"/>
+ <xsd:enumeration value="collection"/>
+ <xsd:enumeration value="odmg"/>
+ <xsd:enumeration value="set"/>
+ <xsd:enumeration value="map"/>
+ <xsd:enumeration value="sortedset"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="validator" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- <xsd:complexType name="enumBindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type allows the mapping between an XML schema enumeration
+ and a java class that follows the type-safe enumeration paradigm.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="enumClassName">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="package" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="enumMember">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"/>
+ <xsd:element name="javaName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+ <!--simpleType definitions-->
+ <xsd:simpleType name="pathType">
+ <xsd:annotation>
+ <xsd:documentation>
+ This type represents an easy path to access an element or an attribute
+ inside a schema. It is a direct restriction of the XPath specification.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <!-- <xsd:pattern value="//any Valid XML name(//|@)any Valid XML Name "/>-->
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="bindingType">
+ <xsd:annotation>
+ <xsd:documentation>
+ List of the allowed values for the binding type from an XML schema
+ to a java class. The type can either be 'element' or 'complexType'.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="element"/>
+ <xsd:enumeration value="type"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+</xsd:schema>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/castor-mapping.xml
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/castor-mapping.xml (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/castor-mapping.xml 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN"
+ "http://castor.org/mapping.dtd">
+<mapping>
+ <class name="org.drools.testing.core.beans.TestSuite" auto-complete="true">
+ <map-to element="package"/>
+ </class>
+</mapping>
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/properties/castorbuilder.properties
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/properties/castorbuilder.properties (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/castor/properties/castorbuilder.properties 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1 @@
+org.exolab.castor.builder.equalsmethod=true
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/5_rules.drl
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/5_rules.drl (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/5_rules.drl 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,38 @@
+package org.drools.samples
+import org.drools.benchmark.models.Account;
+
+rule rule0
+ when
+ $acc : Account(status == "standard", title == "mr", accountId == "acc0")
+ then
+ System.out.println("rule0 fired");
+end
+
+rule rule1
+ when
+ $acc : Account(status == "standard", title == "mr", accountId == "acc1")
+ then
+ System.out.println("rule1 fired");
+end
+
+rule rule2
+ when
+ $acc : Account(status == "standard", title == "mr", accountId == "acc2")
+ then
+ System.out.println("rule2 fired");
+end
+
+rule rule3
+ when
+ $acc : Account(status == "standard", title == "mr", accountId == "acc3")
+ then
+ System.out.println("rule3 fired");
+end
+
+rule rule4
+ when
+ $acc : Account(status == "standard", title == "mr", accountId == "acc4")
+ then
+ System.out.println("rule4 fired");
+end
+
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/META-INF/drools-3.0.xsd
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/META-INF/drools-3.0.xsd (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/META-INF/drools-3.0.xsd 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:drools="http://drools.org/drools-3.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://drools.org/drools-3.0">
+
+ <xs:element name="package">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="drools:import"/>
+
+ <xs:element ref="drools:global"/>
+
+ <xs:element ref="drools:function"/>
+
+ <xs:element ref="drools:rule"/>
+
+ <xs:element ref="drools:query"/>
+ </xs:choice>
+
+ <xs:attribute name="name" type="xs:string" use="required"/>
+
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="rule">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element maxOccurs="unbounded" minOccurs="0" ref="drools:rule-attribute"/>
+
+ <xs:element ref="drools:lhs"/>
+
+ <xs:element ref="drools:rhs"/>
+
+ </xs:sequence>
+
+ <xs:attribute name="name" type="xs:string" use="required"/>
+
+ </xs:complexType>
+
+ <!-- All rules must have unique names -->
+ <xs:key name="ruleName">
+ <xs:selector xpath="drools:rule"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ </xs:element>
+
+ <xs:element name="query">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element ref="drools:lhs"/>
+
+ </xs:sequence>
+
+ <xs:attribute name="name" type="xs:string" use="required"/>
+
+ </xs:complexType>
+
+ <!-- All rules must have unique names -->
+ <xs:key name="queryName">
+ <xs:selector xpath="drools:query"/>
+ <xs:field xpath="@name"/>
+ </xs:key>
+ </xs:element>
+
+ <xs:element name="rule-attribute">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+
+ <xs:element name="import">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="global">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="function">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" ref="drools:parameter"/>
+ <xs:element name="body" type="xs:string"/>
+ </xs:sequence>
+
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="return-type" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="parameter">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required"/>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+
+ <xs:element name="rhs" type="xs:string"/>
+
+ <xs:element name="lhs">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="drools:and"/>
+ <xs:element ref="drools:or"/>
+ <xs:element ref="drools:not"/>
+ <xs:element ref="drools:exists"/>
+ <xs:element ref="drools:eval"/>
+ <xs:element ref="drools:column"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="and">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="drools:and"/>
+ <xs:element ref="drools:or"/>
+ <xs:element ref="drools:not"/>
+ <xs:element ref="drools:exists"/>
+ <xs:element ref="drools:eval"/>
+ <xs:element ref="drools:column"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="or">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="drools:and"/>
+ <xs:element ref="drools:or"/>
+ <xs:element ref="drools:not"/>
+ <xs:element ref="drools:exists"/>
+ <xs:element ref="drools:eval"/>
+ <xs:element ref="drools:column"/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="not">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="drools:column"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="exists">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="drools:column"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="eval" type="xs:string" />
+
+ <xs:element name="column">
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="drools:field-binding"/>
+ <xs:element ref="drools:literal"/>
+ <xs:element ref="drools:predicate"/>
+ <xs:element ref="drools:return-value"/>
+ <xs:element ref="drools:bound-variable"/>
+ </xs:choice>
+ <xs:attribute name="identifier" type="xs:string" use="optional"/>
+ <xs:attribute name="object-type" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field-binding">
+ <xs:complexType>
+ <xs:attribute name="field-name" type="xs:string" use="required"/>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="literal">
+ <xs:complexType>
+ <xs:attribute name="field-name" type="xs:string" use="required"/>
+ <xs:attribute name="evaluator" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="predicate">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="field-name" type="xs:string" use="required"/>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="return-value">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="field-name" type="xs:string" use="required"/>
+ <xs:attribute name="evaluator" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="bound-variable">
+ <xs:complexType>
+ <xs:attribute name="field-name" type="xs:string" use="required"/>
+ <xs:attribute name="evaluator" type="xs:string" use="required"/>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/test.drl
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/test.drl (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/drl/test.drl 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,27 @@
+package org.drools.testing.core.rules
+import org.drools.testing.core.rules.model.Account;
+import org.drools.testing.core.rules.model.Person;
+
+rule rule1
+ when
+ $acc : Account (status == "active", balance == 0)
+ $person : Person ( age < 60 )
+ then
+ $acc.setBalance(new Integer(10));
+ modify($acc);
+end
+
+rule rule2
+ when
+ $acc : Account (status == "active", balance < 0)
+ then
+ $acc.setStatus("overdrawn");
+ modify($acc);
+end
+
+rule rule3
+ when
+ $acc : Account (balance > 0)
+ then
+ System.out.println("The banks likes you.. so we're increasing our fees!");
+end
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/rtl/rtl.properties
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/rtl/rtl.properties (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/resources/rtl/rtl.properties 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,3 @@
+# standard properties for rtl parsing
+range.min=0
+range.max=100
\ No newline at end of file
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/RuleSetTest.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/RuleSetTest.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/RuleSetTest.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,59 @@
+package org.drools.testing.core.rules;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.PackageBuilder;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.rule.Package;
+import org.drools.testing.core.rules.model.Account;
+
+public class RuleSetTest {
+
+ public static final void main(final String[] args) {
+ RuleSetTest test = new RuleSetTest();
+ test.testRules();
+ }
+
+ /**
+ * Loads a package and creates a rulebase
+ *
+ * @param file
+ * @return
+ * @throws Exception
+ */
+ private static RuleBase readRule(String file) throws Exception {
+ //read in the source
+ Reader reader = new InputStreamReader( RuleSetTest.class.getResourceAsStream( file ) );
+ DrlParser parser = new DrlParser();
+ PackageDescr packageDescr = parser.parse( reader );
+
+ //pre build the package
+ PackageBuilder builder = new PackageBuilder();
+ builder.addPackage( packageDescr );
+ Package pkg = builder.getPackage();
+
+ //add the package to a rulebase
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( pkg );
+ return ruleBase;
+ }
+
+ public void testRules() {
+ try {
+ String file = "test.drl";
+ RuleBase ruleBase = readRule( file );
+ WorkingMemory workingMemory = ruleBase.newWorkingMemory();
+ Account acc = new Account();
+ workingMemory.assertObject(acc);
+ workingMemory.fireAllRules();
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Account.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Account.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Account.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,27 @@
+package org.drools.testing.core.rules.model;
+
+
+public class Account {
+
+ private Integer balance = new Integer(0);
+ private String status = "active";
+
+ public Account () {}
+
+ public Integer getBalance() {
+ return balance;
+ }
+
+ public void setBalance(Integer balance) {
+ this.balance = balance;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Person.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Person.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/rules/model/Person.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,26 @@
+package org.drools.testing.core.rules.model;
+
+public class Person {
+
+ private String name;
+ private Integer age;
+
+ public Person () {
+
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/TestingTest.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/TestingTest.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/TestingTest.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,44 @@
+package org.drools.testing.core.test;
+
+import java.io.FileWriter;
+
+import junit.framework.TestCase;
+
+import org.drools.lang.descr.PackageDescr;
+import org.drools.testing.core.beans.Scenario;
+import org.drools.testing.core.beans.TestSuite;
+import org.drools.testing.core.main.TestSuiteRunner;
+import org.drools.testing.core.main.Testing;
+import org.drools.testing.core.main.TransformerService;
+
+public class TestingTest extends TestCase {
+
+ public void testGetScenario () throws Exception {
+
+ PackageDescr paDescr = TransformerService.parseDrl("/org/drools/testing/core/resources/drl/test.drl");
+ Testing testing = new Testing("The Test Test Suite", paDescr);
+ Scenario scenario = testing.generateScenario("Scenario One",paDescr.getRules());
+ assertTrue(scenario.getFactCount() > 0);
+ }
+
+ public void testGenerateRTL () throws Exception {
+ PackageDescr paDescr = TransformerService.parseDrl("/org/drools/testing/core/resources/drl/test.drl");
+ Testing testing = new Testing("The Test Test Suite", paDescr,TestingTest.class.getClassLoader());
+ Scenario scenario = testing.generateScenario("Scenario One",paDescr.getRules());
+ testing.addScenarioToSuite(scenario);
+ TestSuite testSuite = testing.getTestSuite();
+ FileWriter out = new FileWriter("rtl/test.rtl");
+ testSuite.marshal(out);
+ }
+
+ public void testRunScenario () throws Exception {
+ PackageDescr paDescr = TransformerService.parseDrl("/org/drools/testing/core/resources/drl/test.drl");
+ Testing testing = new Testing("The Test Test Suite", paDescr);
+ Scenario scenario = testing.generateScenario("Scenario One",paDescr.getRules());
+ testing.addScenarioToSuite(scenario);
+ TestSuite testSuite = testing.getTestSuite();
+
+ TestSuiteRunner testSuiteRunner = new TestSuiteRunner("/org/drools/testing/core/resources/drl/test.drl");
+ testSuiteRunner.runTests(scenario);
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/ThingTester.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/ThingTester.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/ThingTester.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,13 @@
+package org.drools.testing.core.test;
+
+import org.drools.testing.core.utils.OperatorUtils;
+
+import junit.framework.TestCase;
+
+public class ThingTester extends TestCase {
+
+ public void testFieldUtils () {
+
+ System.out.println(OperatorUtils.rangeOperators.indexOf("<"));
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/test/rtl.properties
===================================================================
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/CollectionUtils.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/CollectionUtils.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/CollectionUtils.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,68 @@
+package org.drools.testing.core.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * A Collection of utilities that can be used modify collections. Many
+ * utilities are provided within the java.util.Collections class and
+ * should not be duplicated here.
+ * @see java.util.Collections
+ */
+public class CollectionUtils {
+
+ /**
+ * A method used to return a sub collection given an original, a to
+ * and from index. The subCollection is backed by a java.util.ArrayList. This method
+ * should be used when a subCollection is required to be passed as a
+ * Serializable object. For example, the method List.subList(int fromIndex, int toIndex)
+ * is not appropriate as it not Serializable.
+ * @param original The original collection
+ * @param fromIndex The starting index to inclusive add from
+ * @param toIndex The endIndex to inclusive add too
+ * @return Collection with 0 or more elements fom the original.
+ */
+ public static Collection getSubCollection(Collection original, int fromIndex, int toIndex)
+ {
+ String methodName = "getSubCollection(Collection original, int fromIndex, int toIndex)";
+ ArrayList subCollection = new ArrayList();
+ Iterator originalIterator = original.iterator();
+ int count = 0;
+ while (originalIterator.hasNext())
+ {
+ Object nextObject = originalIterator.next();
+ if (count >= fromIndex && count <= toIndex)
+ {
+ subCollection.add(nextObject);
+ }
+ count++;
+ }
+ return subCollection;
+ }
+
+ /**
+ * Convert an Object array to a Collection
+ * @param objectArray
+ * @return
+ */
+ public static Collection arrayToCollection(Object[] objectArray)
+ {
+ ArrayList conversion = new ArrayList();
+ for (int i = 0; i < objectArray.length; i++)
+ {
+ conversion.add(objectArray[i]);
+ }
+ return conversion;
+ }
+
+ public static Object getLastItem (Collection items) {
+ Object nextObject = new Object();
+ Iterator i = items.iterator();
+ while (i.hasNext()) {
+ nextObject = i.next();
+ }
+ return nextObject;
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/FieldUtils.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/FieldUtils.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/FieldUtils.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,10 @@
+package org.drools.testing.core.utils;
+
+
+public final class FieldUtils {
+
+
+
+
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/ObjectUtils.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/ObjectUtils.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/ObjectUtils.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,47 @@
+package org.drools.testing.core.utils;
+
+import java.util.List;
+
+import org.drools.semantics.java.ClassTypeResolver;
+
+public final class ObjectUtils {
+
+ public static Object createObject(String className) {
+ Object object = null;
+ try {
+ //Class classDefinition = Class.forName(className, false, ClassLoader.getSystemClassLoader());
+ Class classDefinition = Class.forName(className);
+ object = classDefinition.newInstance();
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ return object;
+ }
+
+ public static Class getClassDefn (String className) {
+ Class classDefinition = null;
+ try {
+ //classDefinition = Class.forName(className, false, ClassLoader.getSystemClassLoader());
+ classDefinition = Class.forName(className);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ return classDefinition;
+ }
+
+ public static Class getClassDefn (String className, List imports, ClassLoader classLoader) {
+ Class classDefinition = null;
+ try {
+ ClassTypeResolver cResolver;
+ if (classLoader == null)
+ cResolver = new ClassTypeResolver(imports);
+ else
+ cResolver = new ClassTypeResolver(imports, classLoader);
+ classDefinition = cResolver.resolveType(className);
+ }catch (Exception e) {
+ System.out.println(e);
+ }
+ return classDefinition;
+ }
+
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/OperatorUtils.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/OperatorUtils.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/utils/OperatorUtils.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,6 @@
+package org.drools.testing.core.utils;
+
+public final class OperatorUtils {
+
+ public static final String rangeOperators = "<,>";
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FactWrapper.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FactWrapper.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FactWrapper.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,31 @@
+package org.drools.testing.core.wrapper;
+
+import org.drools.testing.core.beans.Fact;
+
+public class FactWrapper extends Fact {
+
+ public FactWrapper () {
+ super();
+ }
+
+ public boolean equals(java.lang.Object obj)
+ {
+ if ( this == obj )
+ return true;
+
+ if (obj instanceof Fact) {
+
+ Fact temp = (Fact)obj;
+ if (this.getType() != null) {
+ if (temp.getType() == null) return false;
+ else if (!(this.getType().equals(temp.getType())))
+ return false;
+ }
+ else if (temp.getType() != null)
+ return false;
+
+ return true;
+ }
+ return false;
+ }
+}
Added: labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FieldWrapper.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FieldWrapper.java (rev 0)
+++ labs/jbossrules/trunk/experimental/drools-testing/src/org/drools/testing/core/wrapper/FieldWrapper.java 2007-05-09 08:14:53 UTC (rev 11780)
@@ -0,0 +1,31 @@
+package org.drools.testing.core.wrapper;
+
+import org.drools.testing.core.beans.Field;
+
+public class FieldWrapper extends Field {
+
+ public FieldWrapper () {
+ super();
+ }
+
+ public boolean equals(java.lang.Object obj)
+ {
+ if ( this == obj )
+ return true;
+
+ if (obj instanceof Field) {
+
+ Field temp = (Field)obj;
+ if (this.getName() != null) {
+ if (temp.getName() == null) return false;
+ else if (!(this.getName().equals(temp.getName())))
+ return false;
+ }
+ else if (temp.getName() != null)
+ return false;
+
+ return true;
+ }
+ return false;
+ }
+}
More information about the jboss-svn-commits
mailing list