小编use*_*873的帖子

Java提供Akka多节点测试?

我已阅读有关多节点测试的Akka Java文档,但所有代码都在Scala中.有什么理由吗?谷歌搜索也没有成功.

编辑:为了减少这个问题的风滚草,我尝试了:).现有Scala代码migth对Java的简单翻译如下所示:

public class ClusterTest {

    protected RoleName first;

    @Test
    public void SimpleClusterListenerClusterJoinTest() throws Exception {
        new MultiNodeSpec(new MultiNodeConfig() {{
            first = this.role("first");
            second = this.role("second");
            third = this.role("third");
            this.commonConfig(ConfigFactory.parseString(
                "akka.crdt.convergent.leveldb.destroy-on-shutdown = on\n" +
                    "akka.actor.provider = akka.cluster.ClusterActorRefProvider\n" +
                "akka.cluster.auto-join = off\n" +
                "akka.cluster.auto-down = on\n" +
                "akka.loggers = [\"akka.testkit.TestEventListener\"]\n" +
                "akka.loglevel = INFO\n" +
                "akka.remote.log-remote-lifecycle-events = off")); }}) {
                    {
                        Address firstAddress = node(first).address();
                        @SuppressWarnings("serial")
                        ArrayList<RoleName> firstnode = new ArrayList<RoleName>() {{
                        add(first);
                        }};
                        Seq<RoleName> fisrtnodeseq = (Seq<RoleName>)JavaConversions.asScalaBuffer(firstnode).toList(); …
Run Code Online (Sandbox Code Playgroud)

integration-testing akka

7
推荐指数
0
解决办法
701
查看次数

标签 统计

akka ×1

integration-testing ×1