Author: tsurdilovic
Date: 2010-04-25 02:56:48 -0400 (Sun, 25 Apr 2010)
New Revision: 12632
Added:
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
modules/drools/trunk/impl/kagenttestone.drl
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml
Removed:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java
modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl
Log:
Added kagent test and new producer method for KnowledgeAgent
Added:
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
===================================================================
---
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java
(rev 0)
+++
modules/drools/trunk/api/src/main/java/org/jboss/seam/drools/qualifiers/config/AgentConfig.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.drools.qualifiers.config;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface AgentConfig {
+
+}
Added: modules/drools/trunk/impl/kagenttestone.drl
===================================================================
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java
===================================================================
---
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/KnowledgeAgentProducer.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -59,10 +59,23 @@
ResourceProvider resourceProvider;
@Produces
+ @ApplicationScoped
+ public KnowledgeAgent produceKnowledgeAgent(DroolsConfig config) throws Exception
+ {
+ return getAgent(config);
+ }
+
+ @Produces
@Scanned
@ApplicationScoped
public KnowledgeBase produceScannedKnowledgeBase(DroolsConfig config) throws
Exception
{
+ KnowledgeAgent agent = getAgent(config);
+ return agent.getKnowledgeBase();
+ }
+
+ private KnowledgeAgent getAgent(DroolsConfig config) throws Exception
+ {
if (config.getAgentName() == null || config.getAgentName().length() < 1)
{
throw new IllegalStateException("KnowledgeAgent configuration does not
specify the name of the KnowlegeAgent.");
@@ -73,7 +86,7 @@
throw new IllegalStateException("No change set rule resource
specified.");
}
- if(config.getRuleResources().getResources().length > 0) {
+ if(config.getRuleResources().getResources().length > 1) {
throw new IllegalStateException("More than one change set rule resource
specified for KnowledgeAgent. Make sure only a single change set resource is
specified.");
}
@@ -93,7 +106,7 @@
ResourceFactory.getResourceChangeScannerService().start();
}
- return kagent.getKnowledgeBase();
+ return kagent;
}
@@ -103,7 +116,7 @@
ResourceFactory.getResourceChangeNotifierService().stop();
ResourceFactory.getResourceChangeScannerService().stop();
}
-
+
private void applyChangeSet(KnowledgeAgent kagent, String entry)
{
String[] entryParts = RuleResources.DIVIDER.split(entry.trim());
Added:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java
===================================================================
---
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java
(rev 0)
+++
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/config/AgentRuleResources.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.drools.config;
+
+import org.jboss.seam.drools.qualifiers.config.AgentConfig;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@AgentConfig
+public class AgentRuleResources extends RuleResources
+{
+
+}
Modified:
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java
===================================================================
---
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/main/java/org/jboss/seam/drools/interceptor/SignalEventInterceptor.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -85,7 +85,6 @@
}
StatefulKnowledgeSession ksession = ksessionSource.select((Annotation[])
annotationTypeList.toArray(new Annotation[annotationTypeList.size()])).get();
- System.out.println("***** SEI ksession: " + ksession);
if (ksession != null)
{
Object retObj = ctx.proceed();
@@ -101,12 +100,10 @@
{
if (event != null && event.length() > 0)
{
- System.out.println("***** signalling to process : " +
type + " - " + event);
pi.signalEvent(type, event);
}
else
{
- System.out.println("***** signalling to process : " +
type + " - " + retObj);
pi.signalEvent(type, retObj);
}
}
@@ -116,12 +113,10 @@
{
if (event != null && event.length() > 0)
{
- System.out.println("***** signalling to ksession : " + type +
" - " + event);
ksession.signalEvent(type, event);
}
else
{
- System.out.println("***** signalling to ksession : " + type +
" - " + retObj);
ksession.signalEvent(type, retObj);
}
Modified: modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-04-25 03:38:36
UTC (rev 12631)
+++ modules/drools/trunk/impl/src/main/resources/META-INF/beans.xml 2010-04-25 06:56:48
UTC (rev 12632)
@@ -117,6 +117,15 @@
</d:DroolsConfig>
</s:parameters>
</d:produceScannedKnowledgeBase>
+ <d:produceKnowledgeAgent>
+ <s:ApplyQualifiers />
+ <s:parameters>
+ <d:DroolsConfig>
+ <s:Inject />
+ <s:ApplyQualifiers />
+ </d:DroolsConfig>
+ </s:parameters>
+ </d:produceKnowledgeAgent>
<d:disposeScannedKnowledgeBase>
<s:parameters>
<drools:KnowledgeBase>
@@ -331,5 +340,42 @@
</d:RuleResources>
</s:parameters>
</d:DroolsConfig>
+
+ <d:DroolsConfig>
+ <s:specializes />
+ <d:AgentConfig />
+ <d:kagentPropertiestMap>
+ <s:entry>
+ <s:key>drools.agent.scanResources</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.scanDirectories</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.newInstance</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.monitorChangeSetEvents</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ </d:kagentPropertiestMap>
+ <d:startChangeNotifierService>true</d:startChangeNotifierService>
+ <d:startChangeScannerService>true</d:startChangeScannerService>
+ <d:scannerInterval>60</d:scannerInterval>
+ <d:agentName>
+ <s:value>kagent</s:value>
+ </d:agentName>
+ <s:parameters>
+ <d:RuleResources>
+ <d:AgentConfig />
+ <s:type>
+ <d:AgentRuleResources />
+ </s:type>
+ </d:RuleResources>
+ </s:parameters>
+ </d:DroolsConfig>
</beans>
\ No newline at end of file
Modified:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java
===================================================================
---
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTest.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -18,15 +18,82 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
+ */
package org.jboss.seam.drools.test.kagent;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.fail;
+
+
+import javax.enterprise.inject.Default;
+
+import org.drools.agent.KnowledgeAgent;
+import org.drools.io.ResourceFactory;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.rule.FactHandle;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.drools.KnowledgeBaseProducer;
+import org.jboss.seam.drools.config.DroolsConfig;
+import org.jboss.seam.drools.test.DroolsModuleFilter;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.extensions.resources.ResourceProvider;
import org.junit.Test;
+import org.junit.runner.RunWith;
+(a)RunWith(Arquillian.class)
public class KAgentTest
{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ String pkgPath =
KAgentTest.class.getPackage().getName().replaceAll("\\.", "/");
+ JavaArchive archive = ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addPackages(true, new DroolsModuleFilter("kagent"),
KnowledgeBaseProducer.class.getPackage())
+ .addPackages(true, ResourceProvider.class.getPackage())
+ .addClass(Person.class)
+ .addClass(KAgentTestConfig.class)
+ .addResource(pkgPath + "/kagenttestone.drl",
ArchivePaths.create("kagenttestone.drl"))
+ .addResource(pkgPath + "/kagenttesttwo.drl",
ArchivePaths.create("kagenttesttwo.drl"))
+ .addResource(pkgPath + "/kagenttestchangeset.xml",
ArchivePaths.create("kagenttestchangeset.xml"))
+ // .addResource(pkgPath + "/kbuilderconfig.properties",
+ // ArchivePaths.create("kbuilderconfig.properties"))
+ // .addResource(pkgPath + "/kbaseconfig.properties",
+ // ArchivePaths.create("kbaseconfig.properties"))
+ .addManifestResource(pkgPath + "/KAgentTest-beans.xml",
ArchivePaths.create("beans.xml"));
+ // System.out.println(archive.toString(Formatters.VERBOSE));
+ return archive;
+ }
+
@Test
- public void testKAgent() {
-
+ public void testKAgentConfiguration(@KAgentTestConfig DroolsConfig config)
+ {
+ assertNotNull(config);
+ assertTrue(config.isStartChangeNotifierService());
+ assertTrue(config.isStartChangeScannerService());
+ assertTrue(config.getAgentName() != null);
+ assertTrue(config.getScannerInterval() > 0);
}
+
+ @Test
+ public void testKAgent(@Default @KAgentTestConfig KnowledgeAgent agent,
ResourceProvider resourceProvider)
+ {
+ assertNotNull(agent);
+ assertNotNull(resourceProvider);
+ Person p1 = new Person(19);
+ StatefulKnowledgeSession ksession1 =
agent.getKnowledgeBase().newStatefulKnowledgeSession();
+ FactHandle fh1 = ksession1.insert(p1);
+ ksession1.fireAllRules();
+ Person p1f = (Person) ksession1.getObject(fh1);
+ assertTrue(p1f.isEligible());
+ ksession1.dispose();
+ ResourceFactory.getResourceChangeNotifierService().stop();
+ ResourceFactory.getResourceChangeScannerService().stop();
+ }
+
}
Added:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java
===================================================================
---
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java
(rev 0)
+++
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/KAgentTestConfig.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.kagent;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ *
+ * @author Tihomir Surdilovic
+ */
+@Qualifier
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface KAgentTestConfig
+{
+
+}
Added:
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java
===================================================================
--- modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java
(rev 0)
+++
modules/drools/trunk/impl/src/test/java/org/jboss/seam/drools/test/kagent/Person.java 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.seam.drools.test.kagent;
+
+public class Person
+{
+ private int age;
+ private boolean eligible;
+
+ public Person(int age) {
+ this.age = age;
+ }
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+ public boolean isEligible()
+ {
+ return eligible;
+ }
+
+ public void setEligible(boolean eligible)
+ {
+ this.eligible = eligible;
+ }
+
+
+}
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/interceptors/interceptorstestflow.drl 2010-04-25
06:56:48 UTC (rev 12632)
@@ -8,7 +8,6 @@
when
$p : Person( age >=18 )
then
- System.out.println("*****************\nIN RULE \n ***************");
modify($p) {
setEligible(true);
}
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/KAgentTest-beans.xml 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,66 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc., and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+-->
+<beans
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:s="urn:java:seam:core"
+ xmlns:d="urn:java:org.jboss.seam.drools:org.jboss.seam.drools.config"
+ xmlns:test="urn:java:org.jboss.seam.drools.test.kagent">
+
+ <d:RuleResources>
+ <s:overrides/>
+ <test:KAgentTestConfig/>
+ <d:resources>
+ <s:value>classpath;kagenttestchangeset.xml;CHANGE_SET</s:value>
+ </d:resources>
+ </d:RuleResources>
+
+ <d:DroolsConfig>
+ <test:KAgentTestConfig/>
+ <d:kagentPropertiestMap>
+ <s:entry>
+ <s:key>drools.agent.scanResources</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.scanDirectories</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.newInstance</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ <s:entry>
+ <s:key>drools.agent.monitorChangeSetEvents</s:key>
+ <s:value>true</s:value>
+ </s:entry>
+ </d:kagentPropertiestMap>
+ <d:startChangeNotifierService>true</d:startChangeNotifierService>
+ <d:startChangeScannerService>true</d:startChangeScannerService>
+ <d:scannerInterval>30</d:scannerInterval>
+ <d:agentName>
+ <s:value>testagent</s:value>
+ </d:agentName>
+ <d:ruleResources>
+ <s:Inject/>
+ <test:KAgentTestConfig/>
+ </d:ruleResources>
+ </d:DroolsConfig>
+</beans>
Deleted:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml
===================================================================
Copied:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml
(from rev 12561,
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagentestchangeset.xml)
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml
(rev 0)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestchangeset.xml 2010-04-25
06:56:48 UTC (rev 12632)
@@ -0,0 +1,7 @@
+<change-set
xmlns='http://drools.org/drools-5.0/change-set'
+
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
+
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
+ <add>
+ <resource source='classpath:kagenttestone.drl' type='DRL' />
+ </add>
+</change-set>
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttestone.drl 2010-04-25
06:56:48 UTC (rev 12632)
@@ -1,29 +1,13 @@
-#created on: Apr 19, 2010
package org.jboss.seam.drools.test.kagent
-#list any import classes here.
+import org.jboss.seam.drools.test.kagent.Person;
-
-
-#declare any global variables here
-
-
-
-
-rule "Your First Rule"
-
- when
- #conditions
- then
- #actions
-
-end
-
-rule "Your Second Rule"
- #include attributes such as "salience" here...
- when
- #conditions
- then
- #actions
-
-end
+rule "is eligible"
+lock-on-active
+when
+ $p : Person( age > 18 )
+then
+ modify($p) {
+ setEligible(true);
+ }
+end
\ No newline at end of file
Modified:
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl
===================================================================
---
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl 2010-04-25
03:38:36 UTC (rev 12631)
+++
modules/drools/trunk/impl/src/test/resources/org/jboss/seam/drools/test/kagent/kagenttesttwo.drl 2010-04-25
06:56:48 UTC (rev 12632)
@@ -1,29 +1,13 @@
-#created on: Apr 19, 2010
package org.jboss.seam.drools.test.kagent
-#list any import classes here.
+import org.jboss.seam.drools.test.kagent.Person;
-
-
-#declare any global variables here
-
-
-
-
-rule "Your First Rule"
-
- when
- #conditions
- then
- #actions
-
-end
-
-rule "Your Second Rule"
- #include attributes such as "salience" here...
- when
- #conditions
- then
- #actions
-
-end
+rule "is eligible"
+lock-on-active
+when
+ $p : Person( age > 21 )
+then
+ modify($p) {
+ setEligible(true);
+ }
+end
\ No newline at end of file