Author: mic...@jb... Date: 2006-04-21 23:06:44 -0400 (Fri, 21 Apr 2006) New Revision: 3896 Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/AndDescrTest.java labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/HelloWorld.drl labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/multiple_bindings.drl Removed: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldLeapsTest.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldTest.java Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/AndDescr.java labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/template/MappingError.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLExpressionCompilerTest.java labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLGrammarTest.java Log: refactored helloworld into integration tests Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/AndDescr.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/AndDescr.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/AndDescr.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -1,4 +1,5 @@ package org.drools.lang.descr; + /* * Copyright 2005 JBoss Inc * @@ -15,26 +16,69 @@ * limitations under the License. */ - - import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; -public class AndDescr extends PatternDescr - implements ConditionalElementDescr { - private List descrs = Collections.EMPTY_LIST; - +public class AndDescr extends PatternDescr + implements + ConditionalElementDescr { + private List descrs = Collections.EMPTY_LIST; + private Map boundColumns = new HashMap(); + public AndDescr() { } - + public void addDescr(PatternDescr patternDescr) { if ( this.descrs == Collections.EMPTY_LIST ) { - this.descrs = new ArrayList(1); + this.descrs = new ArrayList( 1 ); } - this.descrs.add( patternDescr ); +//MN: No pattern combining just yet +// if ( patternDescr instanceof ColumnDescr ) { +// addColumn( (ColumnDescr) patternDescr ); +// } else { + this.descrs.add( patternDescr ); +// } } - + + /** + * NOTE: to be used possibly in a future version... wire in above... + * This will check the column binding, and add the patterns + * to a previously bound column + * if one exists. + * If its not a bound column, or it is a unique bound variable column, + * it will just add it to the list of children descrs. + */ + private void addColumn(ColumnDescr col) { + String identifier = col.getIdentifier(); + if ( identifier == null || "".equals( identifier ) ) { + this.descrs.add( col ); + } else { + if (boundColumns.containsKey( identifier )) { + ColumnDescr existingCol = (ColumnDescr) boundColumns.get( identifier ); + if (existingCol.getObjectType().equals( col.getObjectType() )) { + combinePatterns(existingCol, col.getDescrs()); + } else { + this.descrs.add( col ); + } + } else { + boundColumns.put( identifier, col ); + this.descrs.add( col ); + } + } + } + + private void combinePatterns(ColumnDescr existingCol, + List newColPatterns) { + for ( Iterator iter = newColPatterns.iterator(); iter.hasNext(); ) { + existingCol.addDescr( (PatternDescr) iter.next() ); + } + + } + public List getDescrs() { return this.descrs; } Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/template/MappingError.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/template/MappingError.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/template/MappingError.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -92,9 +92,9 @@ public String getMessage() { switch(this.errorCode) { case ERROR_UNUSED_TOKEN: - return "Token "+this.token+" not used in the mapping."; + return "Warning, the token "+this.token+" not used in the mapping."; case ERROR_UNDECLARED_TOKEN: - return "Token "+this.token+" not found in the expression."; + return "Warning, the token "+this.token+" not found in the expression. (May not be a problem)."; case ERROR_INVALID_TOKEN: return "Invalid token declaration at offset "+this.offset+": "+this.token; case ERROR_UNMATCHED_BRACES: 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 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/IntegrationCases.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -52,6 +52,8 @@ import org.drools.event.AgendaEventListener; import org.drools.event.BeforeActivationFiredEvent; import org.drools.event.DefaultAgendaEventListener; +import org.drools.integrationtests.helloworld.Message; +import org.drools.lang.descr.PackageDescr; import org.drools.rule.Package; import org.drools.rule.Rule; @@ -87,6 +89,37 @@ list.get( 0 ) ); } + public void testHelloWorld() throws Exception { + + //read in the source + Reader reader = new InputStreamReader( getClass().getResourceAsStream( "HelloWorld.drl" ) ); + 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 = getRuleBase(); + ruleBase.addPackage( pkg ); + //load up the rulebase + + WorkingMemory workingMemory = ruleBase.newWorkingMemory(); + + //go ! + Message message = new Message( "hola" ); + message.addToList( "hello" ); + message.setNumber( 42 ); + + workingMemory.assertObject( message ); + workingMemory.assertObject( "boo" ); + workingMemory.fireAllRules(); + assertTrue( message.isFired() ); + + } + public void testLiteral() throws Exception { PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "literal_rule_test.drl" ) ) ); @@ -156,22 +189,23 @@ } public void testCell() throws Exception { - Cell cell1 = new Cell(9); - Cell cell = new Cell(0); - + Cell cell1 = new Cell( 9 ); + Cell cell = new Cell( 0 ); + PackageBuilder builder = new PackageBuilder(); - builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "evalmodify.drl" )) ); - + builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "evalmodify.drl" ) ) ); + RuleBase ruleBase = getRuleBase(); ruleBase.addPackage( builder.getPackage() ); - + WorkingMemory memory = ruleBase.newWorkingMemory(); - memory.assertObject(cell1); - memory.assertObject(cell); + memory.assertObject( cell1 ); + memory.assertObject( cell ); memory.fireAllRules(); - assertEquals(9, cell.getValue()); + assertEquals( 9, + cell.getValue() ); } - + public void testOr() throws Exception { PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "or_test.drl" ) ) ); @@ -439,7 +473,7 @@ workingMemory.fireAllRules(); } - + public void testNullConstraint() throws Exception { PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "null_constraint.drl" ) ) ); @@ -449,8 +483,9 @@ ruleBase.addPackage( pkg ); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); List foo = new ArrayList(); - workingMemory.setGlobal( "messages", foo ); - + workingMemory.setGlobal( "messages", + foo ); + Person p1 = new Person( null, "food", 40 ); @@ -458,11 +493,11 @@ workingMemory.assertObject( p1 ); workingMemory.fireAllRules(); - assertEquals(1, foo.size()); + assertEquals( 1, + foo.size() ); + } - } - public void testExists() throws Exception { PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "exists_rule_test.drl" ) ) ); @@ -1211,13 +1246,11 @@ assertEquals( "stilton", list.get( 0 ) ); - - assertTrue("cheddar".equals(list.get(1)) - || "cheddar".equals(list.get(2))); - - assertTrue("stilton".equals(list.get(1)) - || "stilton".equals(list.get(2))); + assertTrue( "cheddar".equals( list.get( 1 ) ) || "cheddar".equals( list.get( 2 ) ) ); + + assertTrue( "stilton".equals( list.get( 1 ) ) || "stilton".equals( list.get( 2 ) ) ); + list.clear(); reader = new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic3.drl" ) ); @@ -1267,7 +1300,7 @@ builder.addPackageFromDrl( new InputStreamReader( getClass().getResourceAsStream( "test_Dynamic4.drl" ) ) ); Package pkg = builder.getPackage(); - org.drools.reteoo.RuleBaseImpl ruleBase = new org.drools.reteoo.RuleBaseImpl(); + org.drools.reteoo.RuleBaseImpl ruleBase = new org.drools.reteoo.RuleBaseImpl(); ruleBase.addPackage( pkg ); WorkingMemory workingMemory = ruleBase.newWorkingMemory(); @@ -1338,7 +1371,7 @@ null ); bob.setStatus( "P1" ); Person pete = new Person( null, - null ); + null ); bob.setStatus( "P2" ); workingMemory.assertObject( bob ); workingMemory.assertObject( pete ); @@ -1346,9 +1379,11 @@ workingMemory.fireAllRules(); Assert.assertEquals( "Indexing with null values is not working correctly.", - "OK", bob.getStatus() ); + "OK", + bob.getStatus() ); Assert.assertEquals( "Indexing with null values is not working correctly.", - "OK", pete.getStatus() ); + "OK", + pete.getStatus() ); } @@ -1361,19 +1396,23 @@ assertEquals( 0, builder.getErrors().length ); - + RuleBase ruleBase = getRuleBase();//RuleBaseFactory.newRuleBase(); - + ruleBase.addPackage( pkg ); - + byte[] ast = serializeOut( ruleBase ); - ruleBase = ( RuleBase ) serializeIn( ast ); + ruleBase = (RuleBase) serializeIn( ast ); Rule[] rules = ruleBase.getPackages()[0].getRules(); - assertEquals( 3, rules.length ); - - assertEquals( "match Person 1", rules[0].getName() ); - assertEquals( "match Person 2", rules[1].getName() ); - assertEquals( "match Person 3", rules[2].getName() ); + assertEquals( 3, + rules.length ); + + assertEquals( "match Person 1", + rules[0].getName() ); + assertEquals( "match Person 2", + rules[1].getName() ); + assertEquals( "match Person 3", + rules[2].getName() ); } public void testLogicalAssertions() throws Exception { @@ -1630,8 +1669,3 @@ } } - - - - - Deleted: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldLeapsTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldLeapsTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldLeapsTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -1,88 +0,0 @@ -package org.drools.integrationtests.helloworld; -/* - * Copyright 2005 JBoss Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; - -import junit.framework.TestCase; - -import org.drools.PackageIntegrationException; -import org.drools.RuleBase; -import org.drools.RuleIntegrationException; -import org.drools.WorkingMemory; -import org.drools.compiler.DrlParser; -import org.drools.compiler.DroolsParserException; -import org.drools.compiler.PackageBuilder; -import org.drools.lang.descr.PackageDescr; - -import org.drools.reteoo.RuleBaseImpl; -import org.drools.rule.InvalidPatternException; -import org.drools.rule.Package; - - - -/** - * This shows how it all works with Leaps, identically. - */ -public class HelloWorldLeapsTest extends TestCase { - - public void testSomething() { - try { - - //load up the rulebase - RuleBase ruleBase = readRule(); - WorkingMemory workingMemory = ruleBase.newWorkingMemory(); - - //go ! - Message message = new Message("hola"); - message.addToList( "hello" ); - message.setNumber( 42 ); - - workingMemory.assertObject( message ); - - workingMemory.fireAllRules(); - assertTrue( message.isFired() ); - } catch (Throwable t) { - t.printStackTrace(); - fail(t.getMessage()); - } - } - - /** - * Please note that this is the "low level" rule assembly API. - */ - private static RuleBase readRule() throws Exception { - //read in the source - Reader reader = new InputStreamReader( HelloWorldLeapsTest.class.getResourceAsStream( "HelloWorld.drl" ) ); - 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 = new RuleBaseImpl(); - ruleBase.addPackage( pkg ); - return ruleBase; - } - -} \ No newline at end of file Deleted: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/helloworld/HelloWorldTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -1,83 +0,0 @@ -package org.drools.integrationtests.helloworld; -/* - * Copyright 2005 JBoss Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; - -import junit.framework.TestCase; - -import org.drools.PackageIntegrationException; -import org.drools.RuleBase; -import org.drools.RuleIntegrationException; -import org.drools.WorkingMemory; -import org.drools.compiler.DrlParser; -import org.drools.compiler.DroolsParserException; -import org.drools.compiler.PackageBuilder; -import org.drools.lang.descr.PackageDescr; -import org.drools.reteoo.RuleBaseImpl; -import org.drools.rule.InvalidPatternException; -import org.drools.rule.Package; - - - -/** - * This is a sample file to launch a rule package from a rule source file. - */ -public class HelloWorldTest extends TestCase { - - public void testSomething() throws Exception { - - //load up the rulebase - RuleBase ruleBase = readRule(); - WorkingMemory workingMemory = ruleBase.newWorkingMemory(); - - //go ! - Message message = new Message("hola"); - message.addToList( "hello" ); - message.setNumber( 42 ); - - workingMemory.assertObject( message ); - workingMemory.assertObject( "boo" ); - workingMemory.fireAllRules(); - assertTrue( message.isFired() ); - - } - - /** - * Please note that this is the "low level" rule assembly API. - */ - private static RuleBase readRule() throws IOException, DroolsParserException, RuleIntegrationException, PackageIntegrationException, InvalidPatternException { - //read in the source - Reader reader = new InputStreamReader( HelloWorldTest.class.getResourceAsStream( "HelloWorld.drl" ) ); - 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 - RuleBaseImpl ruleBase = new RuleBaseImpl(); - ruleBase.addPackage( pkg ); - return ruleBase; - } - -} \ No newline at end of file Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -19,8 +19,10 @@ import java.io.InputStream; import java.io.InputStreamReader; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import junit.framework.TestCase; @@ -41,6 +43,7 @@ import org.drools.lang.descr.NotDescr; import org.drools.lang.descr.OrDescr; import org.drools.lang.descr.PackageDescr; +import org.drools.lang.descr.PatternDescr; import org.drools.lang.descr.PredicateDescr; import org.drools.lang.descr.QueryDescr; import org.drools.lang.descr.ReturnValueDescr; @@ -327,6 +330,19 @@ assertFalse( parser.hasErrors() ); } + + /** Note this is only to be enabled if we agree to combine patterns from columns bound to the same var. + * At present, not a valid test. Refer to AndDescr and AndDescrTest (Michael Neale). + */ + public void xxxtestMultiBindings() throws Exception { + RuleDescr rule = parseResource( "multiple_bindings.drl" ).rule(); + assertNotNull( rule ); + assertEquals( "simple_rule", rule.getName() ); + + assertEquals(1, rule.getLhs().getDescrs().size()); + + } + public void testLhsSemicolonDelim() throws Exception { RuleDescr rule = parseResource( "lhs_semicolon_delim.drl" ).rule(); Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/AndDescrTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/AndDescrTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/AndDescrTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -0,0 +1,49 @@ +package org.drools.lang.descr; + +import junit.framework.TestCase; + +public class AndDescrTest extends TestCase { + + public void testAddUnboundColumnsEtc() { + AndDescr and = new AndDescr(); + and.addDescr( new NotDescr() ); + and.addDescr( new ColumnDescr("Foo") ); + and.addDescr( new NotDescr() ); + + assertEquals(3, and.getDescrs().size()); + } + + /** This is for combining bound columns with the same name patterns together */ + public void xxtestAddBoundCols() { + AndDescr and = new AndDescr(); + ColumnDescr col1 = new ColumnDescr("Foo"); + col1.setIdentifier( "foo" ); + col1.addDescr( new BoundVariableDescr("foo", "==", "bar") ); + and.addDescr( col1 ); + + ColumnDescr col2 = new ColumnDescr("Foo"); + col2.setIdentifier( "foo" ); + col2.addDescr( new BoundVariableDescr("bar", "==", "baz") ); + and.addDescr( col2 ); + + and.addDescr( new NotDescr() ); + + ColumnDescr col3 = new ColumnDescr("Foo"); + and.addDescr( col3 ); //will not be combined, as not bound + + ColumnDescr col4 = new ColumnDescr("Bar"); + col4.setIdentifier( "foo" ); + and.addDescr( col4 ); //even though has a name, should be left alone + + assertEquals(4, and.getDescrs().size()); + assertEquals(col1, and.getDescrs().get( 0 )); + assertTrue(and.getDescrs().get( 1 ) instanceof NotDescr); + assertEquals(col3, and.getDescrs().get( 2 )); + assertEquals(col4, and.getDescrs().get( 3 )); + + assertEquals(2, col1.getDescrs().size()); + assertEquals("bar", ((BoundVariableDescr)col1.getDescrs().get( 0 )).getIdentifier() ); + assertEquals("baz", ((BoundVariableDescr)col1.getDescrs().get( 1 )).getIdentifier() ); + } + +} Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/descr/AndDescrTest.java ___________________________________________________________________ Name: svn:eol-style + native Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLExpressionCompilerTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLExpressionCompilerTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLExpressionCompilerTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -139,4 +139,13 @@ assertEquals( "something boo eee fa", result ); } + public void testWithCurliesInTarget() { + NLGrammar g = new NLGrammar(); + g.addNLItem( new NLMappingItem("foo {bar}", "if ({bar}) { doSomething(); }", "when") ); + NLExpressionCompiler compiler = new NLExpressionCompiler(g); + String result = compiler.compile( "foo bar", "when"); + assertEquals("if (bar) { doSomething(); }", result); + + } + } \ No newline at end of file Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLGrammarTest.java =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLGrammarTest.java 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/lang/dsl/template/NLGrammarTest.java 2006-04-22 03:06:44 UTC (rev 3896) @@ -184,6 +184,12 @@ Assert.assertEquals( "Error list should have 1 error", 1, errors.size() ); error = (MappingError) errors.get( 0 ); Assert.assertEquals( "Wrong reported error", MappingError.ERROR_UNMATCHED_BRACES, error.getErrorCode()); + +//TODO: really should stop the following from barfing... +// item = new NLMappingItem("this is something {here}", "yeah here is {here} and { doSomething(); }", "*"); +// errors = g.validateMapping( item ); +// Assert.assertEquals( 0, errors.size() ); + } } \ No newline at end of file Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/HelloWorld.drl =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/HelloWorld.drl 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/HelloWorld.drl 2006-04-22 03:06:44 UTC (rev 3896) @@ -0,0 +1,15 @@ +package HelloWorld + +import org.drools.integrationtests.helloworld.Message + +rule "Hello World" + when + $m : Message(list contains "hello", + text:message == "hola", + number > 40, + birthday > "10-Jul-1974", + message matches ".*ho.*") + then + System.out.println("hello world with collections " + $m.getMessage()); + $m.setFired(true); +end Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/HelloWorld.drl ___________________________________________________________________ Name: svn:eol-style + native Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/multiple_bindings.drl =================================================================== --- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/multiple_bindings.drl 2006-04-21 23:26:33 UTC (rev 3895) +++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/multiple_bindings.drl 2006-04-22 03:06:44 UTC (rev 3896) @@ -0,0 +1,8 @@ +#trying to show how it will normalise biondings +rule simple_rule + when + foo : Bar(a==3) + foo : Bar(a!=4) + then + Baz(); +end \ No newline at end of file Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/multiple_bindings.drl ___________________________________________________________________ Name: svn:eol-style + native |