Custom validation during deployment

Hi there,
I want to validate that, giving a BPMN file during deployment, it meets some requirements.
I was taking a look to class AbstractBpmnParseListener, that allows to interact during the parsing process. Issue with this class, is that does not allow to throw errors, e.g.:
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
if (!isValid(processElement))
{
throw new Exception(“You are missing something here!!”)
}
}

Is there a way to do a proper validation during the deployment process?

Thx in advance,

Eddie.

Hi Eddie,

You already found the right place. Just throw a runtime exception :slight_smile:

Cheers,
Thorben

1 Like

HI Thorben,

Thx for the quick reply. You’re right, that worked!!

Thank you so much,

Eddie.

I’d like to chime in here: What kind of custom validation are you looking for during deployment?
Maybe you could have a look at the vPAV, which provides a customizable validator for certain cases.

Though it has to be mentioned that said tool is used as a JUnit test and therefore has to be run prior deployment. Maybe this still helps

Best regards
Sascha

@sdibernardo neat tool

1 Like

Hallo @sdibernardo

thank you for your suggestion. I’m traying to use your tool but I cannot let it find the *.bmpn files under src/test/resources/.

The vpav.properties file with:

outputhtml=true
language=de_DE
basepath=src/test/resources/

is being ignored and the *.bpmn files are found only in case they are put under src/main/resources

I suppose my test is wrong…some configuration is missing:

image

Thank you for any tip!
Bye
Fabio

At first glance, I see that you called your RuleSet “ruleSetDefault.xml”. The exact file is already provided by the tool, so if you want to provide your own rules, just rename the file to “ruleSet.xml”. Additionally, I see that you have a file called application.yaml, so I assume this is a Spring based application. For that, I highly recommend using the ApplicationContext, for more accurate validations. Did you check the GitHub page for using JUnit with Spring? See here.

I just ran a test with the same configuration and it worked fine. Can you provide more details?

Cheers
Sascha

Hi @sdibernardo

many thanks for your prompt antwort. It was a problem of mine: I wrote vpav.properties instead of vPav.properties. So they couldn’t be found and the default were chosen. Sorry!

Now it works as expected: my compliments! Without something like your tool the proper management of dpmn and dmn files could become cumbersome and error prone. I think is very important to enforce standards for Variables, Parameters and so on.

I have only a litte problem with Call Activity Tasks left: are they supported?
With this task:

 <bpmn:callActivity id="Task_create_new_document" name="create new document" calledElement="process_create_new_filenet_document" camunda:variableMappingClass="ch.suva.ecms.camunda.delegates.DelegatedVarMapping">
  <bpmn:extensionElements>
    <camunda:in variables="all" />
    <camunda:out variables="all" />
    <camunda:in businessKey="#{execution.processBusinessKey}" />
    <camunda:inputOutput>
      <camunda:inputParameter name="Input_38gat01">a</camunda:inputParameter>
      <camunda:outputParameter name="Output_3s99c0c">b</camunda:outputParameter>
    </camunda:inputOutput>
    <camunda:properties>
      <camunda:property name="aProperty" value="a" />
    </camunda:properties>
  </bpmn:extensionElements>
  <bpmn:incoming>SequenceFlow_0xbs9vz</bpmn:incoming>
  <bpmn:incoming>SequenceFlow_1iiqzg8</bpmn:incoming>
  <bpmn:outgoing>SequenceFlow_01kq5ud</bpmn:outgoing>
  <bpmn:dataOutputAssociation id="DataOutputAssociation_18h6keo">
    <bpmn:targetRef>DataObjectReference_0a8xj2b</bpmn:targetRef>
  </bpmn:dataOutputAssociation>
</bpmn:callActivity>

a null expression parameter causes a NPE hier:


Is there a way to avoid the Call Activity Tasks are checked?

Thank you very much in advance!
Regards
Fabio

Hi @Fabio_Salvi

you´re more than welcome. What do you mean by “are they supported”? Generally speaking, we scan for any kind of process variable usage going into a Call Activity as well as coming out while taking the scope into consideration.

Can you show how you configured the Call Activity, so I can check why the NPE is happening?

Cheers
Sascha

Hi @sdibernardo

it were the Call Activity create new document


Here can you find the definition of the java Delegate:
image
I configured only the parameters on the right and the Variables Tab:
image
I tried specifying Input/Output and Extensions values but it was the same…

It must be something wrong in the Extensions Tab…

I could successfully test it by means of the camunda-bpm-assert-scenario framework and in Camunda SpringBoot …it is only a dummy process with external Workers but it seems to work :slight_smile:

Thank you for your help!
Bye
Fabio

Before I dig deeper, can you tell me which version you are currently using? Have you tried using the latest version from our development branch? Because I could not replicate the NPE.

Best regards
Sascha

Hallo @sdibernardo
I’m using the 3.0.3.

Could you kindly give me an example how you can properly define a Call Activity in order to let the test pass? It would help me a lot!

I must admit I don’t know Camunda very well :sleepy:

Thank you!
Bye
Fabio

Can you give me the expression that leads to the NPE? I guess it is the Business Key Expression?
I’m trying to replicate the problem

Hi @sdibernardo,

sorry für the Delay. I’m uploading my bpmns (the main one and the sub one): there’s sure something wrong there :slight_smile:

Many thanks for any tip!
main_vmax_create_document.bpmn (17.2 KB)
sub_vmax_create_filenet_document.bpmn (6.2 KB)

Thanks for the upload. Indeed we discovered a bug with your help and are trying to fix it asap. Hopefully it’ll be part of the next release. Unfortunately, there is no free option to discard certain elements from the analysis.

Cheers
Sascha

@sdibernardo thank you very much for your reply.

Bye
Fabio