Bug 1000403 - Functions not recognized
Functions not recognized
Status: CLOSED CURRENTRELEASE
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Migration Tool (Show other bugs)
6.0.0
Unspecified Unspecified
medium Severity medium
: ER1
: 6.0.1
Assigned To: Neus Miras
Jiri Svitak
: TestBlocker
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-23 07:44 EDT by Jiri Locker
Modified: 2014-08-06 15:58 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Known Issue
Doc Text:
Cause: Using a DRL function in any guided rule. Consequence: The rule using function declared in a DRL file cannot be validated successfully. Workaround (if any): None. Result:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-08-06 15:58:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
5.6.1 repository with the example (2.25 KB, application/zip)
2014-01-15 07:54 EST, Toni Rikkola
no flags Details
5.6.1 repository with the example, just the repo zipped (347.07 KB, application/zip)
2014-01-23 07:21 EST, Toni Rikkola
no flags Details

  None (edit)
Description Jiri Locker 2013-08-23 07:44:12 EDT
Description of problem:
I have a function defined according to documentation [1] and working in Guvnor 5.x. After migrating to Workbench, the function is listed in "Others" section and opens in default editor. Validation is not available. When the function is used in DRL rule I get compiler error upon validation:

Unable to Analyse Expression System.out.println(hello("Jiri"));: [Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.hello(java.lang.String)] [Near : {... System.out.println(hello("Jiri")); ....}] ^ [Line: 5, Column: 0]

Version-Release number of selected component (if applicable):
ER1

How reproducible:
-

Steps to Reproduce:
1.
2.
3.

Actual results:
- Missing UI support (Function Editor with validation).
- Functions not recognized in rules.

Expected results:
not( Actual results )

Additional info:
Comment 2 manstis 2013-08-30 07:31:20 EDT
Hello,

Functions are created as plain DRL in 6.0.x (there is no explicit "New Function"). Functions should appear under the "DRL" section in Project Explorer. I checked operation of creating a new function and rule with 6.0.x (in the mortgages project):-

func1.drl
---------
function String hello(String name) {
    return "Hello "+name+"!";
}

rule1.drl
---------
rule "using a static function"
when 
    eval( true )
then
    System.out.println( hello( "Bob" ) );
end

Both Validated OK (after a fix I've made; see below) and the Project built OK.

I'll assign this to Jervis to check data-migration; but since (AFAIK) data migration is not supported as part of the Productization think this BZ is no longer a blocker.
Comment 4 manstis 2013-08-30 07:34:48 EDT
@Jervis, 

Could you please check functions in 5.x are migrated as .drl in 6.0.x (I had a quick look at the code and it appears to do so; but Jiri is reported a migrated function appears under "Other" and not "DRL" in Project Explorer).

@Jiri,

Can you try migrating your test project again (in case there have been other fixes that ensure functions are migrated as DRL).

Thanks.
Comment 10 Jiri Svitak 2014-01-14 04:35:28 EST
Verified in BRMS 6 ER7.

I've used Michael's steps from comment #2. Rule validation didn't produce any error nor the project deployment operation. Function are correctly listed in 'DRL' section as is should be.
Comment 11 Jiri Svitak 2014-01-14 09:21:02 EST
I've tried also to use Guided rule editor and the problem persists:

Unable to Analyse Expression System.out.println( hello( "Bob" ) );: [Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.hello(java.lang.String)] [Near : {... System.out.println( hello( "Bob" ) ); ....}] ^ [Line: 3, Column: 0]

(I've used free form drl.)
Comment 13 Toni Rikkola 2014-01-15 07:54:17 EST
Created attachment 850483 [details]
5.6.1 repository with the example
Comment 16 Toni Rikkola 2014-01-23 07:21:34 EST
Created attachment 854352 [details]
5.6.1 repository with the example, just the repo zipped
Comment 17 Neus Miras 2014-01-23 09:03:02 EST
The package reference is now added to the header of the function. It is done in this commit:

6.0.x
https://github.com/droolsjbpm/drools-wb/commit/e23b8ce96de630429c59aca4592caaa494da2046

After this change the function passes the DRL validation but not the Guided editor rule validation. I've tried a DRL with the same code and it works right. 

I've tried to create a new function and I've got the same error message using that from the guided rule editor. It seems to be related to the strict-validation more than the migrated data.
Comment 20 manstis 2014-01-23 12:21:08 EST
The same problem probably occurs for Guided Templates and Guided Decision Tables.
Comment 23 Lukáš Petrovický 2014-02-07 11:19:02 EST
This no longer has a target release of 6.0.0.
Comment 24 Jiri Svitak 2014-03-03 05:20:19 EST
I have tested again with BPMS 6.0.1.ER1, drl files pass, guided rules now work too as well.

QE test suite currently covers only drl files, so updating the qe_test_coverage flag. For further functions issues please file rather a new BZ.

Verified.

Note You need to log in before you can comment on or make changes to this bug.