cancel
Showing results for 
Search instead for 
Did you mean: 

Error in evaluating expressions when run as unit test

vickyc1
Champ in-the-making
Champ in-the-making
Hello!

I am facing strange issue, wherein when I have the flow condition configured as simple expression, then the unit testing works. However, when I configure flow condition as Simple or Advanced condition using flow variables, then it gives error as

org.activiti.engine.ActivitiException: Unknown property used in expression: ${(!(activiti_flowConditionsBean.isEmpty(execution, 'ProductId')) )and(activiti_flowConditionsBean.exists(execution, 'ProductId') && ProductId == 'ABC')}

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'activiti_flowConditionsBean'

Unit tests are taken from https://github.com/Activiti/activiti-unit-test-template.git

Config :

No error case :

-<conditionExpression xsi:type="tFormalExpression">

<![CDATA[${FieldValidationStatus == 'SUCCESS'}]]>

</conditionExpression>

Error case :

-<conditionExpression xsi:type="tFormalExpression">

<![CDATA[${(!(activiti_flowConditionsBean.isEmpty(execution, 'ProductId')) )and(activiti_flowConditionsBean.exists(execution, 'ProductId') && ProductId == 'ABC')}]]>

</conditionExpression>

Please suggest the solution
8 REPLIES 8

vickyc1
Champ in-the-making
Champ in-the-making
Working:


-<conditionExpression xsi:type="tFormalExpression">

<![CDATA[${FieldValidationStatus == 'SUCCESS'}]]>

</conditionExpression>

Error:

-<conditionExpression xsi:type="tFormalExpression">

<![CDATA[${(!(activiti_flowConditionsBean.isEmpty(execution, 'ProductId')) )and(activiti_flowConditionsBean.exists(execution, 'ProductId') && ProductId == 'ABC')}]]>

</conditionExpression>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Vicky,

activiti_flowConditionsBean is missing. Add the bean to the configuration. It would be better to post a ling to the whole project with your failing jUnit test.

Regards
Martin

Hi Martin,

Thanks for the reply.
Actually, I am not using any bean with name 'activiti_flowConditionsBean'. This is internally inserted by activiti when the condition is configured using 'Simple' or 'Advanced' tab.

Please see the images in the below links:

1) https://s11.postimg.io/5o6nnsg5f/No_Error.png If I configure condition as expression (as shown in image), it works from normal flow execution as well as unit test execution
2) https://s22.postimg.io/di9iaivy9/Error.png If I configure condition using Simple or Advanced tab (as shown in image), it works from normal flow execution, but fails from unit test execution (since it encounters activiti_flowConditionsBean missing error)

The normal flow is executed using ACTVITI-REST interface to start process instance.
The unit test is done using https://github.com/Activiti/activiti-unit-test-template.git

ProcessInstance processInstance = activitiRule.getRuntimeService().startProcessInstanceByKeyAndTenantId("XYZ",variables,"tenant_1");

Please suggest any possible solution. Also, let me know if anything else is required

Hi Martin,

Thanks for the reply.
Actually, I am not using any bean with name 'activiti_flowConditionsBean'. This is internally inserted by activiti when the condition is configured using 'Simple' or 'Advanced' tab.

Please see the images in the below links:

1) https://s11.postimg.io/5o6nnsg5f/No_Error.png If I configure condition as expression (as shown in image), it works from normal flow execution as well as unit test execution
2) https://s22.postimg.io/di9iaivy9/Error.png If I configure condition using Simple or Advanced tab (as shown in image), it works from normal flow execution, but fails from unit test execution (since it encounters activiti_flowConditionsBean missing error)

The normal flow is executed using ACTVITI-REST interface to start process instance.
The unit test is done using https://github.com/Activiti/activiti-unit-test-template.git

ProcessInstance processInstance = activitiRule.getRuntimeService().startProcessInstanceByKeyAndTenantId("XYZ",variables,"tenant_1");

Please suggest any possible solution. Also, let me know if anything else is required

Hi Martin,

Thanks for the reply.
Actually, I am not using any bean with name 'activiti_flowConditionsBean'. This is internally inserted by activiti when the condition is configured using 'Simple' or 'Advanced' tab.

Please see the images in the below links:

1) https://s11.postimg.io/5o6nnsg5f/No_Error.png If I configure condition as expression (as shown in image), it works from normal flow execution as well as unit test execution
2) https://s22.postimg.io/di9iaivy9/Error.png If I configure condition using Simple or Advanced tab (as shown in image), it works from normal flow execution, but fails from unit test execution (since it encounters activiti_flowConditionsBean missing error)

The normal flow is executed using ACTVITI-REST interface to start process instance.
The unit test is done using https://github.com/Activiti/activiti-unit-test-template.git

ProcessInstance processInstance = activitiRule.getRuntimeService().startProcessInstanceByKeyAndTenantId("XYZ",variables,"tenant_1");

Please suggest any possible solution. Also, let me know if anything else is required

martin_grofcik
Confirmed Champ
Confirmed Champ
Can you post the link to your jUnit test?

Regards
Martin

vickyc1
Champ in-the-making
Champ in-the-making
Hi Martin,

The source code is inside enterprise gitlab server, hence I cant share the exact link. However, I have attached all the files used in unit test.

As a reference, attaching images of activiti UI:

1) https://s11.postimg.io/5o6nnsg5f/No_Error.png If I configure condition as expression (as shown in image), it works from normal flow execution as well as unit test execution
2) https://s22.postimg.io/di9iaivy9/Error.png If I configure condition using Simple or Advanced tab (as shown in image), it works from normal flow execution, but fails from unit test execution (since it encounters activiti_flowConditionsBean missing error)

vickyc1
Champ in-the-making
Champ in-the-making
Hello,

Can any1 help please?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.