如何在同一个CorDapp中测试两个不同的响应者流? [英] How can I test two different responder flows in the same CorDapp?

查看:63
本文介绍了如何在同一个CorDapp中测试两个不同的响应者流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下一系列流程:


  • 发起人流量

  • AliceFlow ,交易对手用来响应 Initiator

  • BobFlow ,另一方对手用来响应 Initiator

  • Initiator, my initiating flow
  • AliceFlow, which one counterparty uses to respond to Initiator
  • BobFlow, which the other counterparty uses to respond to Initiator

通常,两个响应流将在单独的CorDapps中定义。但是,出于测试目的,我已经在同一文件中定义了它们。

Normally, the two response flows would be defined in separate CorDapps. However, for testing purposes, I have defined them in the same file.

在运行流测试时,出现以下错误。我该如何解决?

When I run flow tests, I get the error below. How can I fix this?


java.lang.IllegalArgumentException:com.template.Initiator已被指定为
作为启动流通过com.template.BobResponder和
com.template.AliceResponder

java.lang.IllegalArgumentException: com.template.Initiator has been specified as the initiating flow by both com.template.BobResponder and com.template.AliceResponder


推荐答案

您需要在不同的程序包中定义响应者。例如,如果在 com.template 中定义了 AliceFlow ,则 BobFlow 可以在 com.template2 中定义。

You need to define your responders in different packages. For example, if AliceFlow is defined in com.template, BobFlow could be defined in com.template2.

然后在您的流程中注册两个软件包:

Then, in your flows, register both packages:

setCordappPackages("com.template", "com.template2")

这篇关于如何在同一个CorDapp中测试两个不同的响应者流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆