gpt4 book ai didi

java - Camunda Process Engine 配置与 Wildfly 的 MockExpressionManager

转载 作者:太空宇宙 更新时间:2023-11-04 13:57:12 29 4
gpt4 key购买 nike

我们已将 Camunda 作为 Wildfly8 的模块安装。一切工作正常,但我需要一种方法来模拟 java 委托(delegate)以进行单元测试(使用 Arquillian)。据我了解, org.camunda.bpm.engine.test.mock.Mocks 可用于提供模拟委托(delegate)。根据 JavaDoc,我应该在流程引擎配置中注册 MockExpressionManager。我在这里找到了一些与 MockExpressingManager 类似的配置 https://github.com/camunda/camunda-bpm-assert/blob/master/camunda-bpm-assert-examples/src/test/resources/camunda.cfg.xml

但是 Wildfly 的 camunda 模块是在standalone-full.xml 中配置的:

        <subsystem xmlns="urn:org.camunda.bpm.jboss:1.1">
<process-engines>
<process-engine name="default" default="true">
<datasource>
java:jboss/datasources/ProcessEngine
</datasource>
<history-level>
full
</history-level>
<configuration>
org.camunda.bpm.engine.cdi.CdiJtaProcessEngineConfiguration
</configuration>
<properties>
<property name="jobExecutorAcquisitionName">
default
</property>
<property name="isAutoSchemaUpdate">
true
</property>
<property name="authorizationEnabled">
true
</property>
<property name="jobExecutorDeploymentAware">
true
</property>
<property name="expressionManager">
org.camunda.bpm.engine.test.mock.MockExpressionManager
</property>
</properties>

但这不起作用,在 Wildfly 启动时我看到了

16:45:31,930 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 61) MSC000001: Failed to start service org.camunda.bpm.platform.process-engine.default: org.jboss.msc.service.StartException in service org.camunda.bpm.platform.process-engine.default: org.camunda.bpm.engine.ProcessEngineException: Could not set value for property 'expressionManager' on class org.camunda.bpm.engine.cdi.CdiJtaProcessEngineConfiguration
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_11]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_11]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_11]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]
Caused by: org.camunda.bpm.engine.ProcessEngineException: Could not set value for property 'expressionManager' on class org.camunda.bpm.engine.cdi.CdiJtaProcessEngineConfiguration
at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperty(PropertyHelper.java:76)
at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperties(PropertyHelper.java:94)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startProcessEngine(MscManagedProcessEngineController.java:173)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:131)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:129)
at org.camunda.bpm.container.impl.jboss.util.Tccl.runWithTccl(Tccl.java:53)
at org.camunda.bpm.container.impl.jboss.util.Tccl.runUnderClassloader(Tccl.java:45)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startInternal(MscManagedProcessEngineController.java:129)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:90)
... 6 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_11]
at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0_11]
at org.camunda.bpm.container.impl.metadata.PropertyHelper.applyProperty(PropertyHelper.java:74)
... 14 more

如何正确设置此 MockExpressionManager 的配置?

或者可能还有其他方法来模拟 java 委托(delegate)?

最佳答案

通过查看 Camunda 代码,他们期望传入对表达式管理器的引用。如果我不得不猜测,这是作为字符串传入的。我能想到的处理此问题的一种肮脏方法是创建 CdiJtaProcessEngineConfiguration 的子类,它配置正确的表达式管理器,将该 JAR 部署到其模块并将其连接起来。

就我个人而言,我发现他们的配置对我来说在直接 Wildfly 集成中有点太紧,因此选择直接在我的应用程序中配置他们的库。

关于java - Camunda Process Engine 配置与 Wildfly 的 MockExpressionManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29701148/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com