Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DelegateExecutionFake fails because no ProcessEngineConfiguration is present #206

Open
criew opened this issue Jan 19, 2022 · 0 comments
Open

Comments

@criew
Copy link

criew commented Jan 19, 2022

CamundaMockito.delegateExecutionFake().withVariable("myVar", Variables.objectValue(myObject").create()) fails.

java.lang.NullPointerException
at org.camunda.bpm.engine.impl.core.variable.VariableUtil.isJavaSerializationProhibited(VariableUtil.java:55)
at org.camunda.bpm.engine.impl.core.variable.VariableUtil.checkJavaSerialization(VariableUtil.java:82)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariableLocal(AbstractVariableScope.java:334)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:319)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:294)
at org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.setVariable(AbstractVariableScope.java:298)
at org.camunda.bpm.extension.mockito.delegate.VariableScopeFake.withVariable(VariableScopeFake.java:44)

Reason is, that a ProcessEngineConfiguration is required in the context to check, if a serialization check should be performed.

Of course we do not want to create a ProcessConfiguration and push it to the Context manually.

Simplest solution that worked well on our side is a patch in VariableScopeFake which overrides the following method:

@Override
        public void setVariableLocal(String variableName, TypedValue value,
                AbstractVariableScope sourceActivityExecution, boolean skipJavaSerializationFormatCheck) {
            super.setVariableLocal(variableName, value, sourceActivityExecution, true);
        }

This deactivates the serialization check in all cases.
Another option would be to patch AbstractVariableScope in Camunda, but seems to be unrealistic :-).

@jangalinski jangalinski added this to the BACKLOG milestone Apr 29, 2022
@jangalinski jangalinski removed this from the BACKLOG milestone Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants