Do not use -Dmaven.test.skip (=decrecated), use -DskipTests (instead)
by Geoffrey De Smet
Since IIRC maven 2.0.8, -Dmaven.test.skip has been replaced by -DskipTests.
Use skipTests (see README.txt).
*If you're were still using the maven.test.skip, you 'll now find out
that the build fails on drools-compiler*
because drools-compiler has a test-jar dependency on drools-core (as
well as a normal dependency on drools-core).
The skipTests compiles and builds the test-jars (just doesn't run the
tests),
while maven.test.skip doesn't even compile or build the test-jars (which
is not much faster).
--
With kind regards,
Geoffrey De Smet
14 years
Test cases upgraded from JUnit 3 to JUnit 4
by Geoffrey De Smet
Hi guys,
I've updated all testcases on master to use JUnit 4 style
(except for drools-eclipse and the non-active parts of drools-grid).
The main reason is so we now let hudson report how many testcases are
ignored (annoted with @Ignore instead of disabled).
Some notes:
* *Don't disable testcases by prefixing them with FIXME_ or
disabled_ or by commenting out @Test*
o *Instead, add the @Ignore annotation*
+ This way hudson gives us a report on how many
testcases have been ignored.
* *Don't use try-catch to test if an exception is thrown. Use
@Test(expected = MyException.class)*
o I haven't migrated this in all testcases, as I couldn't
automate that.
o Please fix it in any code you come across.
* To use assertions like assertEquals(a,b), just add this import:
o import static org.junit.Assert.*;
* Don't import anything from junit.framework.*.
o Import only from org.junit.*
o Configure your Eclipse/Intellij to not propose those imports
to keep mistakes to a minimum.
* TestSuites have been removed.
o Use your Eclipse/IntelliJ to single out tests, packages of
tests or modules.
o They bring extra maintenance (and seem to be seen as legacy
since junit 4?)
* Testcases that print out their own name, no longer print out their
own name
o The junit runner prints out the name already
+ Otherwise it looks like it's run twice (while it's not)
I hope this push (many files were changed) doesn't cause to many merge
conflicts.
If it does: just take your revision and upgrade your file to junit 4
manually.
Learn more:
- Junit 4 in 60 seconds:
http://www.cavdar.net/2008/07/21/junit-4-in-60-seconds/
--
With kind regards,
Geoffrey De Smet
14 years
Regex bug in JDK 5
by Wolfgang Laun
JDK 5 doesn't handle lookbehind assertions correctly if they contain
alternatives. The fallout from this bug has been cleared up by my release
https://github.com/droolsjbpm/droolsjbpm/commit/f3a50273c91ac697b6f1a0936...
I have added comments to clarify the nature of the "strange" workaround
regex part that's now being used, which also affects the JUnit tests. If JDK
5 is dropped from the has-to-be-compatible-with list of Java releases, the
simpler regex construct might be used again.
Cheers
Wolfgang
14 years
Summary of all new features in DSL - comments, please
by Wolfgang Laun
This is a summary of the currently implemented new features for the DSL
expansion. I'll have to add tests and documentation, but before doing so,
I'd like to learn whether there are any objections (resulting in the
removal) or suggestions for improvement. Myself, I'm not sure about one or
two items which I've marked with "(?)". Also, there's a couple of items
which might gain from easy-to-implement additions, see "Votes, please". An
example showing most of the new options is given below.
1. The right hand side of entry definitions can be empty. (Useful for
deleting "filler" phrases.)
2. Long entry lines can be split without the need of escaping EOL:
- Any line beginning with # or // starts a DSL comment and is not
passed to the DSL parser.
- Any line beginning with '[' starts a new entry.
- All other lines are appended to the preceding line, with a space
replacing EOL.
- Empty lines are inserted to maintain original line numbers, and line
and column numbers in error messages from the parser are recalculated to
reflect the user view of the DSL text.
3. The special comment introduction "#/" is used to mark a line
containing debug options. Currently recognized keywords are:
- result - dumps the resulting DRL
- steps - shows all expansion operations in conditions and
consequences
- keyword, when, then - display the corresponding entry definitions
- usage - shows how often an entry was actually used in an expansion
4. Variable substitution uses the definition of that variable seen last
in the current when or then part expansion. not just from the current line.
(But this probably should keep variables from the when part for the
following then part. Votes, please.)
5. The value used in a variable substitution can be modified on the fly
by adding one of the modifiers after and '!' in the variable reference.
Currently recognized modifiers are:
- uc, lc - convert all letters to upper case or lower case,
respectively
- ucfirst - convert the first letter to upper case, and all other
letters to lower case
- num - extract all digits and a '-' preceding the first digit and
insert the numeric value; a '.' or ',' two digits from the right
is retained
as a decimal point, which is useful for monetary quantitites. (?)
6. Another modification of the value used for substituting the reference
is by providing a "multiple choice" after an '!', consisting of strings
separated alternatively by '?' and '/': If the string extracted from the
DSLR line matches the string before a '?', the string following it is used
for substitution; otherwise test the next choice. (?)
7. A DSL value starting with a hyphen ('-') can also be used in a
consequence to add another setter expression into a preceding "modify(x){}".
(Should probably be extended to be able to handle the insertion of another
parameter to any preceding method call and, as a special, but useful, case
the concatenation to a preceding x.println() or x.print() call. Votes,
please.)
DSL:
[when][][Tt]here is an?=
[when][]{entity} called {x}=
${entity!lc}: {entity!ucfirst}( $name:
name=="{x!M?Mark/E?Edson/G?Geoffrey/unknown}")
[when][]and no other with the same {attr}=not {entity!ucfirst}( {attr} ==
${attr} )
[then][]change person=modify($person)\{\}
[then][]- set {attr} to {value} = set{attr!ucfirst}( {value!num} )
DSLR:
rule "Rule 1"
when
There is a PERSON called M
and no other with the same name
then
change person
- set salary to US$9,999.99
- set rank to "colonel"
end
DRL:
8 rule "Rule 1"
9 when
10 $person: Person( $name: name=="Mark")
11 not Person( name == $name )
12 then
13 modify($person){ setSalary( 9999.99 ), setRank( "colonel" ) }
14 end
Cheers
Wolfgang
14 years
Guvnor pdf documentation
by Leandro Romero
Hi,
I have been working with the pdf documentation output from guvnor and I
noticed that the rules generated by the spread sheet and the template editor
doesn't appear in the pdf. Is this a bug or it was done on purpose? I saw
the code and it is pretty easy to fix, I can do it myself if someone
confirms me that this is a bug.
Regards, Romero Leandro
14 years
Github is loosing changes of commits: only use the command line for now
by Geoffrey De Smet
Git is more than just SVN++ apparently...
Because we're not using git properly, some committed changes have be
undone by others by uncarefull merging to the reference repo.
All commits with changes are in the commit log (even those "lost commits"):
https://github.com/droolsjbpm/droolsjbpm/commits/
I am trying to find out what's going on and how we should handle it. Not
sure yet.
I 'll also look into restoring the lost commits.
Meanwhile I'd like to ask you to follow the following instructions:
- *only use the command line to pull or push changes* (for the next
month, untill we get used to git).
- before you do "git push" do "*git log --branches --not --remotes*"
This shows you what you'll be pushing
- When doing an "svn update" from master, do "*git pull --rebase*"
instead of "git pull" (Emmanual recommends that in his blog post).
-- But when doing usin rebasing on a remote topic branch, be careful not
to break the rule "Do not rebase commits that you have pushed to a
public repository."
- Do *not* use "git reset" or "git push --force", contact me and keep
your commits local meanwhile.
HTH a bit already.
--
With kind regards,
Geoffrey De Smet
14 years
Potential bug in RuleTerminalNode
by Nathan Bell
I am pretty sure this is a bug, but would like confirmation from people
more familiar with the code base. My tests seem to show that
RuleTerminalNode can cause an NPE on two different lines of code. Both
places where a call is made to
"workingMemory.getTruthMaintenanceSystem()" in that class can result in
a null pointer exception if the "maintainTms" option is false. In my
case I discovered the issue in some unit tests where I am calling
"knowledgeBase.removeKnowledgePackage" which ends up (eventually) in
RuleTerminalNode. I have pasted an example stack trace below:
Thread [main] (Suspended (exception NullPointerException))
RuleTerminalNode$RTNCleanupAdapter.cleanUp(LeftTuple,
InternalWorkingMemory) line: 519
ObjectTypeNode.doRemove(RuleRemovalContext, ReteooBuilder,
BaseNode, InternalWorkingMemory[]) line: 347
ObjectTypeNode.remove(RuleRemovalContext, ReteooBuilder,
BaseNode, InternalWorkingMemory[]) line: 325
AlphaNode(ObjectSource).doRemove(RuleRemovalContext,
ReteooBuilder, BaseNode, InternalWorkingMemory[]) line: 209
AlphaNode(BaseNode).remove(RuleRemovalContext, ReteooBuilder,
BaseNode, InternalWorkingMemory[]) line: 109
LeftInputAdapterNode.doRemove(RuleRemovalContext, ReteooBuilder,
BaseNode, InternalWorkingMemory[]) line: 187
LeftInputAdapterNode(BaseNode).remove(RuleRemovalContext,
ReteooBuilder, BaseNode, InternalWorkingMemory[]) line: 109
RuleTerminalNode.doRemove(RuleRemovalContext, ReteooBuilder,
BaseNode, InternalWorkingMemory[]) line: 411
RuleTerminalNode(BaseNode).remove(RuleRemovalContext,
ReteooBuilder, BaseNode, InternalWorkingMemory[]) line: 109
ReteooBuilder.removeRule(Rule) line: 237
ReteooRuleBase.removeRule(Rule) line: 432
ReteooRuleBase(AbstractRuleBase).removeRule(Package, Rule) line:
831
ReteooRuleBase(AbstractRuleBase).removePackage(String) line: 751
KnowledgeBaseImpl.removeKnowledgePackage(String) line: 201
(I redacted the stack after the call to removeKnowledgePackage() because
it provides no value in this discussion)
I am using Drools 5.1.1. I have also looked at the latest version of the
code here:
https://github.com/droolsjbpm/droolsjbpm/blob/master/drools-core/src/mai
n/java/org/drools/reteoo/RuleTerminalNode.java
Can anyone confirm that this is a bug, or if not tell me what I am doing
wrong?
Thank You,
Nathan Bell
14 years
Git: Next Saterday 18-DEC-2010 we are moving to git => Tell me your github login before Thursday 16-DEC-2010
by Geoffrey De Smet
Hi guys,
We been talking a while on this on IRC,
so now, like many other JBoss projects (hibernate, infinispan, ...),
*we are moving to git on github*.
- What do you need to do? => MUST READ, *deadline Thursday 16-DEC-2010*
- Why are we moving to git?
- What will you get by moving to git?
What do you need to do?
===============
If you are a drools committer and wish to continue committing after next
Saturday 18-DEC-2010.
1) Install git for your OS
1a) Linux: Install the package git (and optionally gitk)
$ sudo apt-get install git
$ sudo apt-get install gitk
1b) Windows: Use the icon on the right on http://git-scm.com
1c) Mac OSX: Use the icon on the right on http://git-scm.com (and
optionally install gitx from http://gitx.frim.nl/ )
2) Install git in your IDE
2b) Eclipse: Install the EGit plugin. Menu Help, menu item Install
new software. Work with update site Helios, open Tree item
Collaboration, tree item Eclipse EGit.
2c) IntelliJ: Enable the git plugin (if not enabled): menu file, menu
item Other Settings, menu item Configure plugins.
3) Get a Github account: https://github.com/signup/free
4) Configure git correctly (Github also tells you this):
$ git --version
git version 1.7.1
$ git config --global user.name myUsername
$ git config --global user.email myAccount(a)gmail.com
$ git config --global -l
user.name=ge0ffrey
user.email=ge0ffrey.spam@...
5) *Mail me these details before next Thursday 16-DEC-2010*
(to gds.geoffrey.de.smet at gmail dot com or ge0ffrey.spam at gmail
dot com )
if you are a drools committer (which I 'll verify):
5a) Your Github username
5b) Your JBoss Subversion username
5c) Your full name
5d) Your e-mail address (used on github). Note: you can register more
than 1 e-mail address on GitHub.
6) Push your public key to github:
Follow the instructions on
http://github.com/guides/providing-your-ssh-key
*Do NOT commit changes to subversion after Friday evening (so after 8:00
GMT Saturday 18-DEC-2010).*
The svn to git migration will probably take hours. Sorry in advance for
the hindrance.
I 'll send a mail to the drools dev list when svn commits are forbidden
and also when git commits are open.
More info about the git URL and switching tips & tricks will follow soon.
Why are we moving to git?
=================
Subversion has been great (and much better than CVS), but git's just better.
How my life improved since last month when I used svn. by Emmanuel
Bernard (Hibernate annotations etc lead)
http://blog.emmanuelbernard.com/2010/05/git-how-my-life-has-improved-sinc...
Why is git better than subversion?
http://whygitisbetterthanx.com/#svn
What will you get by moving to git?
======================
- Less merge conflicts and therefor easier branching
- Pull requests
Pull requests are /really cool/. It's like /patches on steroids/.
Ever been in a situation where you made a big, risky change?
You wanted to commit it (to get it off your plate, it's done),
but you'd like to get it peer reviewed by colleague X (because it's risky).
But a patch file didn't work because:
- A patch file can't handle binary files
- A patch file probably results in a merge conflict on applying (so X
ignores them)
- Applying a patch file needs to be done on the correct directory
- A patch file will forget I am the author and will make X the author
- A patch file does not allow for a conversation when X wants me to
change something before committing it
With git, just commit it as a pull request. Take a look at the pull
requests (with comments!) on hibernate-core:
https://github.com/hibernate/hibernate-core/pulls
- Multitasking in isolation
You work on a big improvement but you stumble up an existing bug (in the
same file(s)).
You want to fix the bug, the unfinished changes of the big improvement
break the build.
And - even worse - the big improvement changes break because of the
existing bug.
Read "Multitasking in isolation" on
http://blog.emmanuelbernard.com/2010/05/git-how-my-life-has-improved-sinc...
--
With kind regards,
Geoffrey De Smet
14 years
Git migration fallout: svn ignores are gone + empty directories are gone
by Geoffrey De Smet
The git migration is not 100% done yet.
There is some fallout which I will be working on the next few days.
1) svn:ignore's are gone. I 'll look into this tonight and tomorrow.
They need to be replaced with .gitignore files and there's a command to
automate that but it doesn't work (I tried a lot):
http://stackoverflow.com/questions/4484643/migration-from-svn-go-git-how-...
I 'll have to re-create that one by one, manually. I might miss some
ignores.
*Closely examine your commits over the next few weeks that you are not
committing files that should be ignored!*
Only after the most basic .gitignore's are added again, I 'll start
distributing write authorization to everyone in the login list.
2) empty directories are gone. I 'll look into this over the next couple
of days.
Git cannot handle empty directories at this time. It sucks and they
might fix it someday, but currently it is not possible.
I tried several things to remedy this, but was unable to do so.
This means:
- In java or resources directories: all empty packages have been removed.
- In every module: every empty resources or test/java or test/resources
directory has been removed.
- Under drools-container/drools-seam/drools-seam2 the directory src has
been removed
- Under drools-container/drools-seam/drools-seam3 the directory src has
been removed
- Under drools-docs, under images: empty dirs:
--
/drools-docs/drools-docs-expert/src/main/docbook/en-US/images/Chapter-JSR94
--
/drools-docs/drools-docs-expert/src/main/docbook/en-US/images/Chapter-Examples/BankingExample
--
/drools-docs/drools-docs-expert/src/main/docbook/en-US/images/Chapter-Examples/ShoppingExample
--
/drools-docs/drools-docs-planner/src/main/docbook/en-US/images/Chapter-Planner_introduction
--
/drools-docs/drools-docs-planner/src/main/docbook/en-US/images/Chapter-Solver
- *and a bunch we need to look into*:
-- /drools-eclipse/org.drools.eclipse/help
-- /drools-eclipse/org.drools.eclipse/lib
-- /drools-eclipse/org.drools.eclipse.task/lib
-- /drools-examples/drools-examples-drl/log
-- /install/db/driver
-- /install/sample/evaluation/bin
-- /osgi-bundles/src
-- /osgi-bundles/btm/org.drools.osgi.wrapper.btm/lib
-- /osgi-bundles/btm/org.drools.osgi.wrapper.btm/src/main/resources/META-INF
-- /osgi-bundles/jxls/org.drools.osgi.wrapper.jxls-reader/lib
-- /osgi-bundles/jxls/org.drools.osgi.wrapper.jxls-reader/src
-- /osgi-bundles/org.mvel/org.drools.osgi.wrapper.mvel2/lib
-- /osgi-bundles/org.mvel/org.drools.osgi.wrapper.mvel2/src
-- /osgi-bundles/src
- Some planner stuff:
-- /drools-planner/src/main/assembly/emptydir
-- /drools-planner/src/main/assembly/nurseRosteringCompetition/input
-- /drools-planner/src/main/assembly/nurseRosteringCompetition/output
See the second response on
http://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory...
On the plus side, this probably solves half the split packages cases.
--
With kind regards,
Geoffrey De Smet
14 years