[jboss-svn-commits] JBL Code SVN: r9714 - in labs/jbossrules/trunk: drools-compiler/src/test/java/org/drools/integrationtests and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 22 16:23:51 EST 2007
Author: tirelli
Date: 2007-02-22 16:23:51 -0500 (Thu, 22 Feb 2007)
New Revision: 9714
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectType.java
Log:
JBRULES-700: fixing serialization problem
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2007-02-22 21:18:56 UTC (rev 9713)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2007-02-22 21:23:51 UTC (rev 9714)
@@ -71,8 +71,8 @@
* This can be done by merging into existing binary packages, or totally from source.
*/
public class PackageBuilder {
- private static final JavaCompiler cachedJavaCompiler = null;
-
+ private static final JavaCompiler cachedJavaCompiler = null;
+
private JavaCompiler compiler;
private Package pkg;
private List results;
@@ -86,7 +86,9 @@
private FunctionResolver functionResolver;
private ClassFieldExtractorCache classFieldExtractorCache;
private Map lineMappings;
-
+
+ private RuleBuilder builder;
+
/**
* Use this when package is starting from scratch.
*/
@@ -203,6 +205,10 @@
this.pkg = newPackage( packageDescr );
}
+ builder = new RuleBuilder( getTypeResolver(),
+ getFunctionFixer(),
+ this.classFieldExtractorCache );
+
//only try to compile if there are no parse errors
if ( !hasErrors() ) {
for ( final Iterator it = packageDescr.getFactTemplates().iterator(); it.hasNext(); ) {
@@ -306,7 +312,7 @@
final String fileName = className.replace( '.',
'/' ) + ".java";
-
+
src.add( fileName,
text.getBytes() );
@@ -316,17 +322,17 @@
}
private void addFunction(final FunctionDescr functionDescr) {
-
- String functionClassName = this.pkg.getName() + "." + ucFirst( functionDescr.getName() );
- functionDescr.setClassName(functionClassName);
-
+
+ String functionClassName = this.pkg.getName() + "." + ucFirst( functionDescr.getName() );
+ functionDescr.setClassName( functionClassName );
+
final FunctionBuilder builder = new FunctionBuilder();
this.pkg.addFunction( functionDescr.getName() );
addClassCompileTask( functionClassName,
functionDescr,
builder.build( this.pkg,
- functionDescr,
+ functionDescr,
getFunctionFixer(),
getTypeResolver(),
lineMappings ),
@@ -373,11 +379,6 @@
this.src );
ruleDescr.setClassName( ucFirst( ruleClassName ) );
- // TODO: cache the builder!!!
- final RuleBuilder builder = new RuleBuilder( getTypeResolver(),
- getFunctionFixer(),
- this.classFieldExtractorCache );
-
builder.build( this.pkg,
ruleDescr );
@@ -607,8 +608,8 @@
final EclipseJavaCompilerSettings eclipseSettings = new EclipseJavaCompilerSettings();
Map map = eclipseSettings.getMap();
map.put( CompilerOptions.OPTION_TargetPlatform,
- this.configuration.getJavaLanguageLevel() );
-
+ this.configuration.getJavaLanguageLevel() );
+
// We now default this to 1.5, so we can use static imports.
map.put( CompilerOptions.OPTION_Source,
"1.5" );
@@ -685,7 +686,7 @@
public static class RuleErrorHandler extends ErrorHandler {
private BaseDescr descr;
- private Rule rule;
+ private Rule rule;
public RuleErrorHandler(final BaseDescr ruleDescr,
final Rule rule,
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2007-02-22 21:18:56 UTC (rev 9713)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2007-02-22 21:23:51 UTC (rev 9714)
@@ -101,7 +101,7 @@
/** Implementation specific subclasses must provide this. */
protected abstract RuleBase getRuleBase(RuleBaseConfiguration config) throws Exception;
- public void xxxtestGlobals() throws Exception {
+ public void testGlobals() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "globals_rule_test.drl" ) ) );
@@ -128,12 +128,12 @@
list.get( 0 ) );
}
- public void xxxtestFieldBiningsAndEvalSharing() throws Exception {
+ public void testFieldBiningsAndEvalSharing() throws Exception {
String drl = "test_FieldBindingsAndEvalSharing.drl";
evalSharingTest( drl );
}
- public void xxxtestFieldBiningsAndPredicateSharing() throws Exception {
+ public void testFieldBiningsAndPredicateSharing() throws Exception {
String drl = "test_FieldBindingsAndPredicateSharing.drl";
evalSharingTest( drl );
}
@@ -163,7 +163,7 @@
list.size() );
}
- public void xxxtestEmptyColumn() throws Exception {
+ public void testEmptyColumn() throws Exception {
// pre build the package
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EmptyColumn.drl" ) ) );
@@ -209,7 +209,7 @@
return ruleBase;
}
- public void xxxtestExplicitAnd() throws Exception {
+ public void testExplicitAnd() throws Exception {
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_ExplicitAnd.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -231,7 +231,7 @@
list.size() );
}
- public void xxxtestHelloWorld() throws Exception {
+ public void testHelloWorld() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "HelloWorld.drl" ) );
@@ -257,7 +257,7 @@
}
- public void xxxtestDateEffective() throws Exception {
+ public void testDateEffective() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_EffectiveDate.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -276,7 +276,7 @@
}
- public void xxxtestLiteral() throws Exception {
+ public void testLiteral() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -299,7 +299,7 @@
list.get( 0 ) );
}
- public void xxxtestLiteralWithBoolean() throws Exception {
+ public void testLiteralWithBoolean() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_with_boolean.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -323,7 +323,7 @@
list.get( 0 ) );
}
- public void xxxtestFactTemplate() throws Exception {
+ public void testFactTemplate() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FactTemplate.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -357,7 +357,7 @@
}
- public void xxxtestPropertyChangeSupport() throws Exception {
+ public void testPropertyChangeSupport() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_PropertyChange.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -393,7 +393,7 @@
}
- public void xxxtestBigDecimal() throws Exception {
+ public void testBigDecimal() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "big_decimal_and_comparable.drl" ) ) );
@@ -425,7 +425,7 @@
list.size() );
}
- public void xxxtestCell() throws Exception {
+ public void testCell() throws Exception {
final Cell cell1 = new Cell( 9 );
final Cell cell = new Cell( 0 );
@@ -443,7 +443,7 @@
cell.getValue() );
}
- public void xxxtestOr() throws Exception {
+ public void testOr() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "or_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -484,7 +484,7 @@
}
- public void xxxtestQuery() throws Exception {
+ public void testQuery() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "simple_query_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -501,7 +501,7 @@
results.size() );
}
- public void xxxtestEval() throws Exception {
+ public void testEval() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "eval_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -526,7 +526,7 @@
list.get( 0 ) );
}
- public void xxxtestJaninoEval() throws Exception {
+ public void testJaninoEval() throws Exception {
PackageBuilderConfiguration config = new PackageBuilderConfiguration();
config.setCompiler( PackageBuilderConfiguration.JANINO );
final PackageBuilder builder = new PackageBuilder( config );
@@ -553,7 +553,7 @@
list.get( 0 ) );
}
- public void xxxtestEvalMore() throws Exception {
+ public void testEvalMore() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "eval_rule_test_more.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -574,7 +574,7 @@
list.get( 0 ) );
}
- public void xxxtestReturnValue() throws Exception {
+ public void testReturnValue() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "returnvalue_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -607,7 +607,7 @@
list.get( 1 ) );
}
- public void xxxtestPredicate() throws Exception {
+ public void testPredicate() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "predicate_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -640,7 +640,7 @@
list.get( 1 ) );
}
- public void xxxtestNot() throws Exception {
+ public void testNot() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "not_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -676,7 +676,7 @@
Assert.assertTrue( list.contains( new Integer( 8 ) ) );
}
- public void xxxtestNotWithBindings() throws Exception {
+ public void testNotWithBindings() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "not_with_bindings_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -717,7 +717,7 @@
list.size() );
}
- public void xxxtestNullBehaviour() throws Exception {
+ public void testNullBehaviour() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "null_behaviour.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -739,7 +739,7 @@
}
- public void xxxtestNullConstraint() throws Exception {
+ public void testNullConstraint() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "null_constraint.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -766,7 +766,7 @@
}
- public void xxxtestExists() throws Exception {
+ public void testExists() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "exists_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -804,7 +804,7 @@
list.size() );
}
- public void xxxtestExists2() throws Exception {
+ public void testExists2() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_exists.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -847,7 +847,7 @@
list.size() );
}
- public void xxxtestImportFunctions() throws Exception {
+ public void testImportFunctions() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ImportFunctions.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -876,7 +876,7 @@
list.get( 3 ) );
}
- public void xxxtestBasicFrom() throws Exception {
+ public void testBasicFrom() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_From.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -931,7 +931,7 @@
list3.get( 0 ) );
}
- public void xxxtestFromWithParams() throws Exception {
+ public void testFromWithParams() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FromWithParams.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -999,7 +999,7 @@
list.get( 5 ) );
}
- public void xxxtestWithInvalidRule() throws Exception {
+ public void testWithInvalidRule() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "invalid_rule.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1026,7 +1026,7 @@
}
- public void xxxtestErrorLineNumbers() throws Exception {
+ public void testErrorLineNumbers() throws Exception {
// this test aims to test semantic errors
// parser errors are another test case
final PackageBuilder builder = new PackageBuilder();
@@ -1072,7 +1072,7 @@
assertFalse( first.getMessage().equals( "" ) );
}
- public void xxxtestFunction() throws Exception {
+ public void testFunction() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionInConsequence.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1095,7 +1095,7 @@
list.get( 0 ) );
}
- public void xxxtestDynamicFunction() throws Exception {
+ public void testDynamicFunction() throws Exception {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DynamicFunction1.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1162,7 +1162,7 @@
}
- public void xxxtestAssertRetract() throws Exception {
+ public void testAssertRetract() throws Exception {
// postponed while I sort out KnowledgeHelperFixer
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "assert_retract.drl" ) ) );
@@ -1192,7 +1192,7 @@
}
- public void xxxtestWithExpanderDSL() throws Exception {
+ public void testWithExpanderDSL() throws Exception {
final PackageBuilder builder = new PackageBuilder();
final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_dsl.drl" ) );
final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_expander.dsl" ) );
@@ -1232,7 +1232,7 @@
}
- public void xxxtestWithExpanderMore() throws Exception {
+ public void testWithExpanderMore() throws Exception {
final PackageBuilder builder = new PackageBuilder();
final Reader source = new InputStreamReader( getClass().getResourceAsStream( "rule_with_expander_dsl_more.drl" ) );
final Reader dsl = new InputStreamReader( getClass().getResourceAsStream( "test_expander.dsl" ) );
@@ -1286,7 +1286,7 @@
}
- public void xxxtestPredicateAsFirstColumn() throws Exception {
+ public void testPredicateAsFirstColumn() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "predicate_as_first_column.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1312,7 +1312,7 @@
provolone.getPrice() );
}
- public void xxxtestSalience() throws Exception {
+ public void testSalience() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "salience_rule_test.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1343,7 +1343,7 @@
}
- public void xxxtestNoLoop() throws Exception {
+ public void testNoLoop() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "no-loop.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1368,7 +1368,7 @@
}
- public void xxxtestConsequenceException() throws Exception {
+ public void testConsequenceException() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ConsequenceException.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1390,7 +1390,7 @@
}
}
- public void xxxtestFunctionException() throws Exception {
+ public void testFunctionException() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionException.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1412,7 +1412,7 @@
}
}
- public void xxxtestEvalException() throws Exception {
+ public void testEvalException() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EvalException.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1434,7 +1434,7 @@
}
}
- public void xxxtestPredicateException() throws Exception {
+ public void testPredicateException() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_PredicateException.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1456,7 +1456,7 @@
}
}
- public void xxxtestReturnValueException() throws Exception {
+ public void testReturnValueException() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ReturnValueException.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1477,7 +1477,7 @@
}
}
- public void xxxtestMultiRestrictionFieldConstraint() throws Exception {
+ public void testMultiRestrictionFieldConstraint() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_MultiRestrictionFieldConstraint.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1551,7 +1551,7 @@
assertTrue( list4.contains( chili1 ) );
}
- public void xxxtestAgendaGroups() throws Exception {
+ public void testAgendaGroups() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_AgendaGroups.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1597,7 +1597,7 @@
list.get( 7 ) );
}
- public void xxxtestDumpers() throws Exception {
+ public void testDumpers() throws Exception {
final DrlParser parser = new DrlParser();
final PackageDescr pkg = parser.parse( new InputStreamReader( getClass().getResourceAsStream( "test_Dumpers.drl" ) ) );
@@ -1656,7 +1656,7 @@
final XmlDumper xmlDumper = new XmlDumper();
final String xmlResult = xmlDumper.dump( pkg );
- System.out.println( xmlResult );
+ //System.out.println( xmlResult );
builder = new PackageBuilder();
builder.addPackageFromXml( new StringReader( xmlResult ) );
@@ -1683,7 +1683,7 @@
list.get( 2 ) );
}
- public void xxxtestActivationGroups() throws Exception {
+ public void testActivationGroups() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ActivationGroups.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1736,7 +1736,7 @@
}
- public void xxxtestDuration() throws Exception {
+ public void testDuration() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Duration.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1768,7 +1768,7 @@
}
- public void xxxtestDurationWithNoLoop() throws Exception {
+ public void testDurationWithNoLoop() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Duration_with_NoLoop.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1799,7 +1799,7 @@
list.size() );
}
- public void xxxtestFireRuleAfterDuration() throws Exception {
+ public void testFireRuleAfterDuration() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FireRuleAfterDuration.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1833,7 +1833,7 @@
}
- public void xxxtestContainsCheese() throws Exception {
+ public void testContainsCheese() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ContainsCheese.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1863,7 +1863,7 @@
list.get( 0 ) );
}
- public void xxxtestStaticFieldReference() throws Exception {
+ public void testStaticFieldReference() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_StaticField.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -1889,7 +1889,7 @@
list.get( 0 ) );
}
- public void xxxtestDynamicRuleAdditions() throws Exception {
+ public void testDynamicRuleAdditions() throws Exception {
Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) );
PackageBuilder builder = new PackageBuilder();
@@ -1985,7 +1985,7 @@
}
- public void xxxtestDynamicRuleRemovals() throws Exception {
+ public void testDynamicRuleRemovals() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
@@ -2087,7 +2087,7 @@
}
}
- public void xxxtestDynamicRuleRemovalsUnusedWorkingMemory() throws Exception {
+ public void testDynamicRuleRemovalsUnusedWorkingMemory() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic1.drl" ) ) );
@@ -2152,7 +2152,7 @@
}
}
- public void xxxtestDuplicateRuleNames() throws Exception {
+ public void testDuplicateRuleNames() throws Exception {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DuplicateRuleName1.drl" ) ) );
@@ -2168,7 +2168,7 @@
}
- public void xxxtestNullValuesIndexing() throws Exception {
+ public void testNullValuesIndexing() throws Exception {
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_NullValuesIndexing.drl" ) );
final PackageBuilder builder = new PackageBuilder();
@@ -2200,7 +2200,7 @@
}
- public void xxxtestSerializable() throws Exception {
+ public void testSerializable() throws Exception {
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable.drl" ) );
@@ -2268,7 +2268,7 @@
workingMemory.getObjects().get( 1 ) );
}
- public void xxxtestLogicalAssertions() throws Exception {
+ public void testLogicalAssertions() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertions.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2308,7 +2308,7 @@
workingMemory.getObjects().size() );
}
- public void xxxtestLogicalAssertionsBacking() throws Exception {
+ public void testLogicalAssertionsBacking() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsBacking.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2359,7 +2359,7 @@
list.size() );
}
- public void xxxtestLogicalAssertionsSelfreferencing() throws Exception {
+ public void testLogicalAssertionsSelfreferencing() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsSelfreferencing.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2402,7 +2402,7 @@
list.size() );
}
- public void xxxtestLogicalAssertionsLoop() throws Exception {
+ public void testLogicalAssertionsLoop() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsLoop.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2430,7 +2430,7 @@
l.size() );
}
- public void xxxtestLogicalAssertionsNoLoop() throws Exception {
+ public void testLogicalAssertionsNoLoop() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsNoLoop.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2531,7 +2531,7 @@
events.size() );
}
- public void xxxtestLogicalAssertionsNot() throws Exception {
+ public void testLogicalAssertionsNot() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsNot.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2588,7 +2588,7 @@
list.get( 0 ) );
}
- public void xxxtestLogicalAssertionsNotPingPong() throws Exception {
+ public void testLogicalAssertionsNotPingPong() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsNotPingPong.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2621,7 +2621,7 @@
list.size() );
}
- public void xxxtestLogicalAssertionsDynamicRule() throws Exception {
+ public void testLogicalAssertionsDynamicRule() throws Exception {
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsDynamicRule.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2749,7 +2749,7 @@
list.size() );
}
- public void xxxtestLogicalAssertionsModifyEqual() throws Exception {
+ public void testLogicalAssertionsModifyEqual() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionsModifyEqual.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2791,7 +2791,7 @@
}
}
- public void xxxtestLogicalAssertionsWithExists() throws Exception {
+ public void testLogicalAssertionsWithExists() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_LogicalAssertionWithExists.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2877,7 +2877,7 @@
cheeseList.size() );
}
- public void xxxtestEmptyRule() throws Exception {
+ public void testEmptyRule() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_EmptyRule.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2896,7 +2896,7 @@
assertTrue( list.contains( "fired2" ) );
}
- public void xxxtestjustEval() throws Exception {
+ public void testjustEval() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NoColumns.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -2915,7 +2915,7 @@
assertTrue( list.contains( "fired3" ) );
}
- public void xxxtestOrWithBinding() throws Exception {
+ public void testOrWithBinding() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_OrWithBindings.drl" ) ) );
@@ -2966,7 +2966,7 @@
return bytes;
}
- public void xxxtestJoinNodeModifyObject() throws Exception {
+ public void testJoinNodeModifyObject() throws Exception {
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_JoinNodeModifyObject.drl" ) );
final PackageBuilder builder = new PackageBuilder();
@@ -3004,7 +3004,7 @@
}
}
- public void xxxtestRemovePackage() {
+ public void testRemovePackage() {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_RemovePackage.drl" ) ) );
@@ -3037,7 +3037,7 @@
}
}
- public void xxxtestQuery2() {
+ public void testQuery2() {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Query.drl" ) ) );
@@ -3071,7 +3071,7 @@
}
}
- public void xxxtestTwoQuerries() throws Exception {
+ public void testTwoQuerries() throws Exception {
// @see JBRULES-410 More than one Query definition causes an incorrect
// Rete network to be built.
@@ -3105,7 +3105,7 @@
results.size() );
}
- public void xxxtestExistsWithBinding() throws Exception {
+ public void testExistsWithBinding() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ExistsWithBindings.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3131,7 +3131,7 @@
list.size() );
}
- public void xxxtestInsurancePricingExample() throws Exception {
+ public void testInsurancePricingExample() throws Exception {
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "insurance_pricing_example.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
final WorkingMemory wm = ruleBase.newWorkingMemory();
@@ -3149,7 +3149,7 @@
policy.getBasePrice() );
}
- public void xxxtestLLR() throws Exception {
+ public void testLLR() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_JoinNodeModifyTuple.drl" ) );
@@ -3247,7 +3247,7 @@
}
- public void xxxtestAccumulate() throws Exception {
+ public void testAccumulate() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Accumulate.drl" ) );
@@ -3282,7 +3282,7 @@
results.get( 3 ) );
}
- public void xxxtestAccumulateModify() throws Exception {
+ public void testAccumulateModify() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_AccumulateModify.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -3350,7 +3350,7 @@
}
- public void xxxtestCollect() throws Exception {
+ public void testCollect() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Collect.drl" ) );
@@ -3389,7 +3389,7 @@
results.get( 0 ).getClass().getName() );
}
- public void xxxtestCollectModify() throws Exception {
+ public void testCollectModify() throws Exception {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Collect.drl" ) );
final RuleBase ruleBase = loadRuleBase( reader );
@@ -3459,7 +3459,7 @@
}
- public void xxxtestAssertRetractNoloop() {
+ public void testAssertRetractNoloop() {
try {
// read in the source
final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Assert_Retract_Noloop.drl" ) );
@@ -3476,7 +3476,7 @@
}
}
- public void xxxtestDoubleQueryWithExists() throws Exception {
+ public void testDoubleQueryWithExists() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_DoubleQueryWithExists.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3561,7 +3561,7 @@
queryResults.size() );
}
- public void xxxtestFunctionWithPrimitives() throws Exception {
+ public void testFunctionWithPrimitives() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_FunctionWithPrimitives.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3584,7 +3584,7 @@
list.get( 0 ) );
}
- public void xxxtestReturnValueAndGlobal() throws Exception {
+ public void testReturnValueAndGlobal() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_ReturnValueAndGlobal.drl" ) ) );
@@ -3623,7 +3623,7 @@
nonmatchlist.size() );
}
- public void xxxtestDeclaringAndUsingBindsInSamePattern() throws Exception {
+ public void testDeclaringAndUsingBindsInSamePattern() throws Exception {
final RuleBaseConfiguration config = new RuleBaseConfiguration();
config.setRemoveIdentities( true );
@@ -3662,7 +3662,7 @@
}
- public void xxxtestMissingImports() {
+ public void testMissingImports() {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_missing_import.drl" ) ) );
@@ -3680,7 +3680,7 @@
}
}
- public void xxxtestNestedConditionalElements() throws Exception {
+ public void testNestedConditionalElements() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_NestedConditionalElements.drl" ) ) );
@@ -3715,7 +3715,7 @@
list.size() );
}
- public void xxxtestForall() throws Exception {
+ public void testForall() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Forall.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3749,7 +3749,7 @@
list.size() );
}
- public void xxxtestDeclarationUsage() throws Exception {
+ public void testDeclarationUsage() throws Exception {
try {
final PackageBuilder builder = new PackageBuilder();
@@ -3768,7 +3768,7 @@
}
}
- public void xxxtestUnbalancedTrees() throws Exception {
+ public void testUnbalancedTrees() throws Exception {
try {
final PackageBuilder builder = new PackageBuilder();
@@ -3805,7 +3805,7 @@
}
}
- public void xxxtestDynamicRules() throws Exception {
+ public void testDynamicRules() throws Exception {
final RuleBase ruleBase = getRuleBase();
final WorkingMemory workingMemory = ruleBase.newWorkingMemory();
Cheese a = new Cheese( "stilton", 10);
@@ -3823,7 +3823,7 @@
workingMemory.fireAllRules();
}
- public void xxxtestDynamicRules2() throws Exception {
+ public void testDynamicRules2() throws Exception {
final RuleBase ruleBase = getRuleBase();
final WorkingMemory workingMemory = ruleBase.newWorkingMemory();
@@ -3841,7 +3841,7 @@
workingMemory.fireAllRules();
}
- public void xxxtestImportConflict() throws Exception {
+ public void testImportConflict() throws Exception {
try {
final RuleBase ruleBase = getRuleBase();
final PackageBuilder builder = new PackageBuilder();
@@ -3855,7 +3855,7 @@
}
- public void xxxtestPrimitiveArray() throws Exception {
+ public void testPrimitiveArray() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_primitiveArray.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3885,7 +3885,7 @@
}
- public void xxxtestEmptyIdentifier() throws Exception {
+ public void testEmptyIdentifier() throws Exception {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_emptyIdentifier.drl" ) ) );
@@ -3914,7 +3914,7 @@
}
}
- public void xxxtestLogicalAssertions3() throws Exception {
+ public void testLogicalAssertions3() throws Exception {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_logicalAssertions3.drl" ) ) );
final Package pkg = builder.getPackage();
@@ -3965,7 +3965,7 @@
}
- public void xxxtestDuplicateVariableBinding() throws Exception {
+ public void testDuplicateVariableBinding() throws Exception {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_duplicateVariableBinding.drl" ) ) );
@@ -4008,7 +4008,7 @@
}
}
- public void xxxtestDuplicateVariableBindingError() throws Exception {
+ public void testDuplicateVariableBindingError() throws Exception {
try {
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_duplicateVariableBindingError.drl" ) ) );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectType.java 2007-02-22 21:18:56 UTC (rev 9713)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ClassObjectType.java 2007-02-22 21:23:51 UTC (rev 9714)
@@ -36,26 +36,26 @@
ObjectType {
// Objenesis instance without cache (false)
- private static final Objenesis OBJENESIS = new ObjenesisStd(false);
-
+ private static final Objenesis OBJENESIS = new ObjenesisStd( false );
+
/**
*
*/
- private static final long serialVersionUID = 320;
+ private static final long serialVersionUID = 320;
/** Java object class. */
- protected Class objectTypeClass;
+ protected Class objectTypeClass;
- protected ValueType valueType;
+ protected ValueType valueType;
- protected boolean shadowEnabled;
+ protected boolean shadowEnabled;
- protected Class shadowClass;
-
- protected ObjectInstantiator instantiator;
+ protected Class shadowClass;
- private Field delegate;
+ protected transient ObjectInstantiator instantiator;
+ protected transient Field delegate;
+
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
@@ -86,17 +86,32 @@
this.valueType = ValueType.determineValueType( objectTypeClass );
if ( shadowClass != null ) {
this.shadowClass = shadowClass;
- this.instantiator = OBJENESIS.getInstantiatorOf( this.shadowClass );
this.shadowEnabled = true;
- try {
- delegate = this.shadowClass.getDeclaredField( ShadowProxyFactory.DELEGATE_FIELD_NAME );
- delegate.setAccessible( true );
- } catch ( Exception e ) {
- throw new RuntimeDroolsException("Error retriving delegate field for shadow proxy class: "+this.shadowClass.getName(), e );
- }
+ setInstantiator();
+ setDelegateFieldObject();
}
}
+ /**
+ *
+ */
+ private void setInstantiator() {
+ this.instantiator = OBJENESIS.getInstantiatorOf( this.shadowClass );
+ }
+
+ /**
+ *
+ */
+ private void setDelegateFieldObject() {
+ try {
+ delegate = this.shadowClass.getDeclaredField( ShadowProxyFactory.DELEGATE_FIELD_NAME );
+ delegate.setAccessible( true );
+ } catch ( Exception e ) {
+ throw new RuntimeDroolsException( "Error retriving delegate field for shadow proxy class: " + this.shadowClass.getName(),
+ e );
+ }
+ }
+
// ------------------------------------------------------------
// Instance methods
// ------------------------------------------------------------
@@ -136,8 +151,15 @@
ShadowProxy proxy = null;
if ( isShadowEnabled() ) {
try {
+ if ( delegate == null ) {
+ this.setDelegateFieldObject();
+ }
+ if ( instantiator == null ) {
+ this.setInstantiator();
+ }
proxy = (ShadowProxy) this.instantiator.newInstance();
- delegate.set( proxy, fact );
+ delegate.set( proxy,
+ fact );
} catch ( final Exception e ) {
throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
e );
More information about the jboss-svn-commits
mailing list