Obtain contents of global variable java.util.List results after rules have fired.
by mvanders
Hi all,
I'm attempting to output the results of action results embedded in Decision
Tables (Excel)
Our ACTION's in the excel table creates a HashMap<String, Object> and then
this HashMap is added to a global variable java.util.List results variable,
as can be seen below (ie column1 & column2)
*/ACTION (Column 1)/*
Map result = new HashMap();
results.add(result);
result.put(""itemCode"",""$param"");"
*/ACTION (Column 2)/*
result.put("quantity",calculateQuantity(incomingDataMap,"$param"));
calculateQuantity is a function that determines a quantity based on
Conditions and values in the incomingDataMap
This works well, and the results variable is populated and available for use
in code works.
/Now the Problem Im facing/ is ni regards to business user testing.
When running regression testing I would like to somehow display the contents
of the List of HashMap.
It is important to the Business User to see that correct quantities are also
being generated, not just the correct rule was fired.
The approach I've been searching for is this; Is it possible to output extra
lines of text into the file generated when clicking on the *URL for running
tests*. A text file generates with SUCCESS or FAIL and the Test Scenario
name.
Is this possible?
Otherwise i may need to somehow create a separate FACT Model and alter my 2
ACTION column in the decision table to also output information into a FACT
model then use it to trigger another rule, that can read the value generated
in the calculateQuantity function.
Hopefully you can work out what im attempting to do here and offer some
advice, im not sure on the best practice on presenting this sort of
information and have trouble finding much info with dealing with the output
of actions in this way.
Cheers and thanks for you help in advance
Mark
--
View this message in context: http://drools.46999.n3.nabble.com/Obtain-contents-of-global-variable-java...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Hide a Rule that has fired
by mvanders
Hi all,
This is more visual aid when reviewing Test Scenarios than a must have but,
is it possible to "hide" a rule that has fired from the list of fired rules.
If you look at the below Rule "JobMapRule", once it has fired and populated
the incomnigData Map it is no longer necessary to know if the rule fired or
not. Its purely a rule to setup up Fact details.
The below rule will appear in every Test Scenario but it is not necessary to
be seen, is there a way to "remove" it from the "fired rules" list that
appears. Just trying to make this as simple as possible for the business
user so they don't see things that they don't need to worry about when
creating to Test Scenarios
rule "JobMapRule"
dialect "mvel"
when
job : Job( )
then
Map incomingData = new HashMap();
incomingData.put('workType', job.workType);
incomingData.put('status', job.status);
insert(incomingData)
retract(job)
end
Cheers
Mark
--
View this message in context: http://drools.46999.n3.nabble.com/Hide-a-Rule-that-has-fired-tp4028051.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
[Drools Activation-group] / how to set many activation groups
by jcarpene
Hello,
I am trying to implement some rules that need more that a unique
Activation-group.
My case is related to some Voucher codes for online shopping. A simple case
works great, by defining an Activation-group to make sure 2 Voucher codes
cannot be used at the same time.
But now I need 2 Voucher codes (say Code 1, Code 2) to be compatible (no
activation-group) and a 3rd code (Code 3) to be disabled if Code 1 or Code 2
is used. If I use a XOR group name as an Activation-group, then Code 1 and
Code 2 will have a same Activation-group and will be exclusive (which I do
not want).
Do you know a way of setting multiple Activation-Groups for example, or any
workaround for that case ?
Regards,
Jerome
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Activation-group-how-to-set-many...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Incremental working memory synchronization
by Ievgenii
Hello all,
The question is -
We have 2 nodes of drools working memory and one is active second is
passive. Currently the persistence and synchronization is triggered on each
change in working memory and if this memory has lots of facts - we have huge
bottleneck with serialization of whole memory into single stream. Is there a
way/plans to implement incremental sync of two drools nodes?
Best regards,
Ievgenii Drozd
--
View this message in context: http://drools.46999.n3.nabble.com/Incremental-working-memory-synchronizat...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Drools fusion
by Raja Sekhar
Hi All,
How can i perform aggregation on group with drools fusion.
Regards,
Raja Sekhar A
--
Raja Sekhar Amirapu
------------------------------------------------------
"If any anyone can do it, i can do it. If no one else can do it, i must do
it"
10 years, 9 months
Drools : 2 identical calls to the same knowledgeBase don't give the same result… why?
by antoine
Hello,
I've faced some weird result using Drools 5.5.0.Final, and I would like to
know if I am doing something wrong ?
I am using drools to process some user rules (the Excel way). If I call the
rules with the exact same data at different time in the process, I don't get
the same result. (I am using a StateLessSession)
After digging a bit more, I managed to extract a very simple maven-based
unit-test to reproduce the problem. (the archive can be downloaded here :
http://www.filedropper.com/using-drools
<http://www.filedropper.com/using-drools> )
In fact, I call many times to execute the same rule, and after the 23rd
times I don't get the same expected result :
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ "classpath:status-rules-config.xml" })
public class StatusRuleTest {
@Autowired StatusRule ruleRunner;
@Test public void do_not_work_at_25th_call() throws Exception {
for(int i = 0 ; i < 35 ; i++){
MyFact fact = new MyFact();
assertThat(fact.getStatus()).isEqualTo("NONE");
ruleRunner.defineStatus(fact);
assertThat(fact.getStatus()).isEqualTo("DONE");
}
}
}
with rule definition as :
public class StatusRuleImpl implements StatusRule {
@Setter private StatelessKnowledgeSession ksessionStatus;
@Override
public void defineStatus(MyFact myFact) {
ksessionStatus.addEventListener(new DebugAgendaEventListener() );
ksessionStatus.addEventListener(new
DebugWorkingMemoryEventListener());
ksessionStatus.execute(myFact);
}
}
It uses a statelessSession, with sequential mode and ACTIVATION-GROUP
column.
I also posted more details and more logs here :
http://stackoverflow.com/questions/21585666/drools-2-identical-calls-to-t...
<http://stackoverflow.com/questions/21585666/drools-2-identical-calls-to-t...>
>From what I checked, it might be coming from the negative BigDecimal (If I
change it to 10 in both of the code and the Excel, it seems to work)
If someone has an Idea, I will be pleased to read it !
Thanks in advance,
Antoine
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-2-identical-calls-to-the-same-kn...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Deploying pre-compiled rules files with maven?
by Scott Thibault
I thought when you used the maven plugin that the rules files were compiled
into a binary form so that you could deploy with a minimal set of
dependencies. It's not working for me though. This is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie</groupId>
<artifactId>kie-parent-with-dependencies</artifactId>
<version>6.0.1.Final</version>
<!-- relativePath causes out-of-date problems on hudson slaves -->
<!--<relativePath>../droolsjbpm-build-bootstrap/pom.xml</relativePath>-->
</parent>
<packaging>kjar</packaging>
<artifactId>default-kiesession</artifactId>
<name>Drools API examples - Default KieSession</name>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>6.0.1.Final</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<repositories>
<!-- Bootstrap repository to locate the parent pom when the parent
pom has not been build locally. -->
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
<scm>
<connection>scm:git:git@github.com:droolsjbpm/drools.git</connection>
<developerConnection>scm:git:git@github.com:droolsjbpm/drools.git</developerConnection>
<url>https://github.com/droolsjbpm/drools</url>
</scm>
</project>
I build with the mvn package command. The resulting jar file isn't any
different then when not using the plugin. When I try to execute the code I
get the error:
The Eclipse JDT Core jar is not in the classpath
Any suggestions?
10 years, 9 months
Simple ruleflow and java conditionExpression example
by mattmadhavan
Hello,
I have the following requirements.
I have 3 stages of rule-flow group execution.
1. Set of rules to evaluate validation (ruleflow-group "Validation Group")
2. Set of rules to evaluate eligibility (ruleflow-group "Eligibility Group")
3. Set of rules to compute Cancer Measures (ruleflow-group "MeasureCompute
Group");
Validation group will collect all the Validation errors to be saved. After
this group is executed I want to write a* Java condition* to see if any
validation errors present. If they are exit. If not continue to
ruleflow-group Eligibility. Test again after the rules are fired using a
java condition. And so on.
<http://drools.46999.n3.nabble.com/file/n4028039/ruleflow.png>
Can some one please provide me a sample? I am not too keen on too much JBPM
stuff now - Just a simple sample will suffice!
I thank you in advance!
Thanks
Matt
--
View this message in context: http://drools.46999.n3.nabble.com/Simple-ruleflow-and-java-conditionExpre...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months