当前位置: 首页>>代码示例>>Java>>正文


Java JavaTestKit.expectMsgClass方法代码示例

本文整理汇总了Java中akka.testkit.JavaTestKit.expectMsgClass方法的典型用法代码示例。如果您正苦于以下问题:Java JavaTestKit.expectMsgClass方法的具体用法?Java JavaTestKit.expectMsgClass怎么用?Java JavaTestKit.expectMsgClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在akka.testkit.JavaTestKit的用法示例。


在下文中一共展示了JavaTestKit.expectMsgClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testInitialChangeListenerEventWithContainerPath

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testInitialChangeListenerEventWithContainerPath() throws DataValidationFailedException {
    writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));

    Entry<MockDataTreeChangeListener, ActorSelection> entry = registerChangeListener(TEST_PATH, 1);
    MockDataTreeChangeListener listener = entry.getKey();

    listener.waitForChangeEvents();
    listener.verifyNotifiedData(TEST_PATH);

    listener.reset(1);

    writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
    listener.waitForChangeEvents();
    listener.verifyNotifiedData(TEST_PATH);

    listener.reset(1);
    JavaTestKit kit = new JavaTestKit(getSystem());
    entry.getValue().tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
    kit.expectMsgClass(JavaTestKit.duration("5 seconds"), CloseDataTreeNotificationListenerRegistrationReply.class);

    writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
    listener.verifyNoNotifiedData(TEST_PATH);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:25,代码来源:DataTreeChangeListenerSupportTest.java

示例2: waitForShardInitialized

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
private static void waitForShardInitialized(final ActorRef shardManager, final String shardName,
        final JavaTestKit kit) {
    AssertionError last = null;
    Stopwatch sw = Stopwatch.createStarted();
    while (sw.elapsed(TimeUnit.SECONDS) <= 5) {
        try {
            shardManager.tell(new FindLocalShard(shardName, true), kit.getRef());
            kit.expectMsgClass(LocalShardFound.class);
            return;
        } catch (AssertionError e) {
            last = e;
        }

        Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
    }

    throw last;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:ShardManagerTest.java

示例3: testDoLoadAsyncWithRetry

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testDoLoadAsyncWithRetry() throws IOException  {
    createSnapshotFile(PERSISTENCE_ID, "one", 0, 1000);
    createSnapshotFile(PERSISTENCE_ID, null, 1, 2000);

    SnapshotMetadata metadata = new SnapshotMetadata(PERSISTENCE_ID, 0, 1000);

    JavaTestKit probe = new JavaTestKit(system);
    snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
            SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
    LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
    Option<SelectedSnapshot> possibleSnapshot = result.snapshot();

    assertEquals("SelectedSnapshot present", TRUE, possibleSnapshot.nonEmpty());
    assertEquals("SelectedSnapshot metadata", metadata, possibleSnapshot.get().metadata());
    assertEquals("SelectedSnapshot snapshot", "one", possibleSnapshot.get().snapshot());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:LocalSnapshotStoreTest.java

示例4: testCorrectFacebookFriends

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testCorrectFacebookFriends() {
    new JavaTestKit(system) {{
        JavaTestKit probe = new JavaTestKit(system);

        Bundle bundle = Mockito.mock(Bundle.class);
        MockGraphRequestWrapper request = new MockGraphRequestWrapper(new CorrectMockingStrategy());
        getFbManagerActor().tell(new FbRequestFriendsMsgMock(bundle, request), probe.getRef());

        FbResponseFriendsMsg message = probe.expectMsgClass(defaultDuration, FbResponseFriendsMsg.class);
        assertTrue(message.getData().size() > 0);
        assertTrue(message.getErrorMessage() == null || message.getErrorMessage().equals(""));
    }};
}
 
开发者ID:simoneapp,项目名称:S3-16-simone,代码行数:15,代码来源:FacebookManagerTest.java

示例5: killActor

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
protected void killActor(TestActorRef<TestRaftActor> actor) {
    JavaTestKit testkit = new JavaTestKit(getSystem());
    testkit.watch(actor);

    actor.tell(PoisonPill.getInstance(), null);
    testkit.expectMsgClass(JavaTestKit.duration("5 seconds"), Terminated.class);

    testkit.unwatch(actor);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:AbstractRaftActorIntegrationTest.java

示例6: testRouteRemove

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testRouteRemove() throws URISyntaxException, InterruptedException {
    new JavaTestKit(system) {
        {
            // Test announcements
            final JavaTestKit probeReg = new JavaTestKit(system);
            final ActorRef rpcRegistry = probeReg.getRef();

            final RpcListener rpcListener = new RpcListener(rpcRegistry);
            rpcListener.onRpcUnavailable(Collections.singleton(RPC_ID));
            probeReg.expectMsgClass(RpcRegistry.Messages.RemoveRoutes.class);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:RpcListenerTest.java

示例7: retrieveBuckets

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
private static Map<Address, Bucket<RoutingTable>> retrieveBuckets(final ActorRef bucketStore,
        final JavaTestKit testKit, final Address... addresses) {
    int numTries = 0;
    while (true) {
        bucketStore.tell(GET_ALL_BUCKETS, testKit.getRef());
        @SuppressWarnings("unchecked")
        Map<Address, Bucket<RoutingTable>> buckets = testKit.expectMsgClass(Duration.create(3, TimeUnit.SECONDS),
                Map.class);

        boolean foundAll = true;
        for (Address addr : addresses) {
            Bucket<RoutingTable> bucket = buckets.get(addr);
            if (bucket == null) {
                foundAll = false;
                break;
            }
        }

        if (foundAll) {
            return buckets;
        }

        if (++numTries >= 50) {
            Assert.fail("Missing expected buckets for addresses: " + Arrays.toString(addresses)
                    + ", Actual: " + buckets);
        }

        Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:31,代码来源:RpcRegistryTest.java

示例8: testAddRoutesConcurrency

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testAddRoutesConcurrency() throws Exception {
    final JavaTestKit testKit = new JavaTestKit(node1);

    final int nRoutes = 500;
    final Collection<DOMRpcIdentifier> added = new ArrayList<>(nRoutes);
    for (int i = 0; i < nRoutes; i++) {
        final DOMRpcIdentifier routeId = DOMRpcIdentifier.create(SchemaPath.create(true,
                new QName(new URI("/mockrpc"), "type" + i)));
        added.add(routeId);

        //Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
        registry1.tell(new AddOrUpdateRoutes(Arrays.asList(routeId)),
                ActorRef.noSender());
    }

    FiniteDuration duration = Duration.create(3, TimeUnit.SECONDS);
    int numTries = 0;
    while (true) {
        registry1.tell(GET_ALL_BUCKETS, testKit.getRef());
        @SuppressWarnings("unchecked")
        Map<Address, Bucket<RoutingTable>> buckets = testKit.expectMsgClass(duration, Map.class);

        Bucket<RoutingTable> localBucket = buckets.values().iterator().next();
        RoutingTable table = localBucket.getData();
        if (table != null && table.size() == nRoutes) {
            for (DOMRpcIdentifier r : added) {
                Assert.assertTrue("RoutingTable contains " + r, table.contains(r));
            }

            break;
        }

        if (++numTries >= 50) {
            Assert.fail("Expected # routes: " + nRoutes + ", Actual: " + table.size());
        }

        Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:41,代码来源:RpcRegistryTest.java

示例9: testGetSnapshotTimeout

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testGetSnapshotTimeout() {
    JavaTestKit kit = new JavaTestKit(getSystem());

    ActorRef replyActor = getSystem().actorOf(ShardManagerGetSnapshotReplyActor.props(
            Arrays.asList("shard1"), "config", null, kit.getRef(), "shard-manager",
            Duration.create(100, TimeUnit.MILLISECONDS)), "testGetSnapshotTimeout");

    kit.watch(replyActor);

    Failure failure = kit.expectMsgClass(Failure.class);
    assertEquals("Failure cause type", TimeoutException.class, failure.cause().getClass());
    kit.expectTerminated(replyActor);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:ShardManagerGetSnapshotReplyActorTest.java

示例10: testServerChangeWhenAlreadyInProgress

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
public void testServerChangeWhenAlreadyInProgress(final String shardName, final Object firstServerChange,
                                                  final Class<?> firstForwardedServerChangeClass,
                                                  final Object secondServerChange) throws Exception {
    new JavaTestKit(getSystem()) {
        {
            JavaTestKit mockShardLeaderKit = new JavaTestKit(getSystem());
            final JavaTestKit secondRequestKit = new JavaTestKit(getSystem());

            MockConfiguration mockConfig = new MockConfiguration(ImmutableMap.<String, List<String>>builder()
                    .put(shardName, Arrays.asList("member-2")).build());

            final TestActorRef<TestShardManager> shardManager = TestActorRef.create(getSystem(),
                    newTestShardMgrBuilder().configuration(mockConfig).shardActor(mockShardActor)
                            .cluster(new MockClusterWrapper()).props()
                            .withDispatcher(Dispatchers.DefaultDispatcherId()),
                    shardMgrID);

            shardManager.underlyingActor()
                    .setMessageInterceptor(newFindPrimaryInterceptor(mockShardLeaderKit.getRef()));

            shardManager.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());

            shardManager.tell(firstServerChange, getRef());

            mockShardLeaderKit.expectMsgClass(firstForwardedServerChangeClass);

            shardManager.tell(secondServerChange, secondRequestKit.getRef());

            secondRequestKit.expectMsgClass(duration("5 seconds"), Failure.class);
        }
    };
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:33,代码来源:ShardManagerTest.java

示例11: testDoLoadAsync

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testDoLoadAsync() throws IOException {
    createSnapshotFile(PERSISTENCE_ID, "one", 0, 1000);
    createSnapshotFile(PERSISTENCE_ID, "two", 1, 2000);
    createSnapshotFile(PERSISTENCE_ID, "three", 1, 3000);

    createSnapshotFile(PREFIX_BASED_SHARD_PERSISTENCE_ID, "foo", 0, 1000);
    createSnapshotFile(PREFIX_BASED_SHARD_PERSISTENCE_ID, "bar", 1, 2000);
    createSnapshotFile(PREFIX_BASED_SHARD_PERSISTENCE_ID, "foobar", 1, 3000);

    createSnapshotFile("member-1-shard-default-oper", "foo", 0, 1000);
    createSnapshotFile("member-1-shard-toaster-oper", "foo", 0, 1000);
    new File(SNAPSHOT_DIR, "other").createNewFile();
    new File(SNAPSHOT_DIR, "other-1485349217290").createNewFile();

    SnapshotMetadata metadata3 = new SnapshotMetadata(PERSISTENCE_ID, 1, 3000);

    JavaTestKit probe = new JavaTestKit(system);
    snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
            SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
    LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
    Option<SelectedSnapshot> possibleSnapshot = result.snapshot();

    assertEquals("SelectedSnapshot present", TRUE, possibleSnapshot.nonEmpty());
    assertEquals("SelectedSnapshot metadata", metadata3, possibleSnapshot.get().metadata());
    assertEquals("SelectedSnapshot snapshot", "three", possibleSnapshot.get().snapshot());

    snapshotStore.tell(new LoadSnapshot(PREFIX_BASED_SHARD_PERSISTENCE_ID,
            SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
    result = probe.expectMsgClass(LoadSnapshotResult.class);
    possibleSnapshot = result.snapshot();

    SnapshotMetadata prefixBasedShardMetada3 = new SnapshotMetadata(PREFIX_BASED_SHARD_PERSISTENCE_ID, 1, 3000);

    assertEquals("SelectedSnapshot present", TRUE, possibleSnapshot.nonEmpty());
    assertEquals("SelectedSnapshot metadata", prefixBasedShardMetada3, possibleSnapshot.get().metadata());
    assertEquals("SelectedSnapshot snapshot", "foobar", possibleSnapshot.get().snapshot());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:39,代码来源:LocalSnapshotStoreTest.java

示例12: testDoLoadAsyncWithNoSnapshots

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testDoLoadAsyncWithNoSnapshots() throws IOException {
    JavaTestKit probe = new JavaTestKit(system);
    snapshotStore.tell(new LoadSnapshot(PERSISTENCE_ID,
            SnapshotSelectionCriteria.latest(), Long.MAX_VALUE), probe.getRef());
    LoadSnapshotResult result = probe.expectMsgClass(LoadSnapshotResult.class);
    Option<SelectedSnapshot> possibleSnapshot = result.snapshot();

    assertEquals("SelectedSnapshot present", FALSE, possibleSnapshot.nonEmpty());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:LocalSnapshotStoreTest.java

示例13: setupIsolatedLeaderCheckTestWithTwoFollowers

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
private RaftActorBehavior setupIsolatedLeaderCheckTestWithTwoFollowers(final RaftPolicy raftPolicy) {
    ActorRef followerActor1 = getSystem().actorOf(MessageCollectorActor.props(), "follower-1");
    ActorRef followerActor2 = getSystem().actorOf(MessageCollectorActor.props(), "follower-2");

    MockRaftActorContext leaderActorContext = createActorContext();

    Map<String, String> peerAddresses = new HashMap<>();
    peerAddresses.put("follower-1", followerActor1.path().toString());
    peerAddresses.put("follower-2", followerActor2.path().toString());

    leaderActorContext.setPeerAddresses(peerAddresses);
    leaderActorContext.setRaftPolicy(raftPolicy);

    leader = new Leader(leaderActorContext);

    leader.markFollowerActive("follower-1");
    leader.markFollowerActive("follower-2");
    RaftActorBehavior newBehavior = leader.handleMessage(leaderActor, Leader.ISOLATED_LEADER_CHECK);
    assertTrue("Behavior not instance of Leader when all followers are active", newBehavior instanceof Leader);

    // kill 1 follower and verify if that got killed
    final JavaTestKit probe = new JavaTestKit(getSystem());
    probe.watch(followerActor1);
    followerActor1.tell(PoisonPill.getInstance(), ActorRef.noSender());
    final Terminated termMsg1 = probe.expectMsgClass(Terminated.class);
    assertEquals(termMsg1.getActor(), followerActor1);

    leader.markFollowerInActive("follower-1");
    leader.markFollowerActive("follower-2");
    newBehavior = leader.handleMessage(leaderActor, Leader.ISOLATED_LEADER_CHECK);
    assertTrue("Behavior not instance of Leader when majority of followers are active",
            newBehavior instanceof Leader);

    // kill 2nd follower and leader should change to Isolated leader
    followerActor2.tell(PoisonPill.getInstance(), null);
    probe.watch(followerActor2);
    followerActor2.tell(PoisonPill.getInstance(), ActorRef.noSender());
    final Terminated termMsg2 = probe.expectMsgClass(Terminated.class);
    assertEquals(termMsg2.getActor(), followerActor2);

    leader.markFollowerInActive("follower-2");
    return leader.handleMessage(leaderActor, Leader.ISOLATED_LEADER_CHECK);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:44,代码来源:LeaderTest.java

示例14: testAddServerWithOperationInProgress

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testAddServerWithOperationInProgress() throws Exception {
    LOG.info("testAddServerWithOperationInProgress starting");

    setupNewFollower();
    RaftActorContext initialActorContext = new MockRaftActorContext();

    TestActorRef<MockLeaderRaftActor> leaderActor = actorFactory.createTestActor(
            MockLeaderRaftActor.props(ImmutableMap.<String, String>of(),
                    initialActorContext).withDispatcher(Dispatchers.DefaultDispatcherId()),
            actorFactory.generateActorId(LEADER_ID));

    MockLeaderRaftActor leaderRaftActor = leaderActor.underlyingActor();
    final RaftActorContext leaderActorContext = leaderRaftActor.getRaftActorContext();

    final ActorRef leaderCollectorActor = newLeaderCollectorActor(leaderRaftActor);

    RaftActorContext follower2ActorContext = newFollowerContext(NEW_SERVER_ID2, followerActor);
    Follower newFollower2 = new Follower(follower2ActorContext);
    followerActor.underlyingActor().setBehavior(newFollower2);

    MockNewFollowerRaftActor newFollowerRaftActorInstance = newFollowerRaftActor.underlyingActor();
    newFollowerRaftActorInstance.setDropMessageOfType(InstallSnapshot.class);

    leaderActor.tell(new AddServer(NEW_SERVER_ID, newFollowerRaftActor.path().toString(), true), testKit.getRef());

    // Wait for leader's install snapshot and capture it

    InstallSnapshot installSnapshot = expectFirstMatching(newFollowerCollectorActor, InstallSnapshot.class);

    // Send a second AddServer - should get queued
    JavaTestKit testKit2 = new JavaTestKit(getSystem());
    leaderActor.tell(new AddServer(NEW_SERVER_ID2, followerActor.path().toString(), false), testKit2.getRef());

    // Continue the first AddServer
    newFollowerRaftActorInstance.setDropMessageOfType(null);
    newFollowerRaftActor.tell(installSnapshot, leaderActor);

    // Verify both complete successfully
    AddServerReply addServerReply = testKit.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
    assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());

    addServerReply = testKit2.expectMsgClass(JavaTestKit.duration("5 seconds"), AddServerReply.class);
    assertEquals("getStatus", ServerChangeStatus.OK, addServerReply.getStatus());

    // Verify ServerConfigurationPayload entries in leader's log

    expectMatching(leaderCollectorActor, ApplyState.class, 2);
    assertEquals("Leader journal last index", 1, leaderActorContext.getReplicatedLog().lastIndex());
    assertEquals("Leader commit index", 1, leaderActorContext.getCommitIndex());
    assertEquals("Leader last applied index", 1, leaderActorContext.getLastApplied());
    verifyServerConfigurationPayloadEntry(leaderActorContext.getReplicatedLog(),
            votingServer(LEADER_ID), votingServer(NEW_SERVER_ID), nonVotingServer(NEW_SERVER_ID2));

    // Verify ServerConfigurationPayload entry in the new follower

    expectMatching(newFollowerCollectorActor, ApplyState.class, 2);
    assertEquals("New follower peers", Sets.newHashSet(LEADER_ID, NEW_SERVER_ID2),
           newFollowerActorContext.getPeerIds());

    LOG.info("testAddServerWithOperationInProgress ending");
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:63,代码来源:RaftActorServerConfigurationSupportTest.java

示例15: testOnDataTreeChanged

import akka.testkit.JavaTestKit; //导入方法依赖的package包/类
@Test
public void testOnDataTreeChanged() throws Exception {
    JavaTestKit kit = new JavaTestKit(getSystem());

    new CandidateListChangeListener(kit.getRef(), "test").init(shardDataTree);

    String memberName1 = "member-1";
    writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, ENTITY_ID1, memberName1));

    CandidateAdded candidateAdded = kit.expectMsgClass(CandidateAdded.class);
    assertEquals("getEntityId", entityPath(ENTITY_TYPE, ENTITY_ID1), candidateAdded.getEntityPath());
    assertEquals("getNewCandidate", memberName1, candidateAdded.getNewCandidate());
    assertEquals("getAllCandidates", ImmutableSet.of(memberName1),
            ImmutableSet.copyOf(candidateAdded.getAllCandidates()));

    writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, ENTITY_ID1, memberName1));
    kit.expectNoMsg(FiniteDuration.create(500, TimeUnit.MILLISECONDS));

    String memberName2 = "member-2";
    writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, ENTITY_ID1, memberName2));

    candidateAdded = kit.expectMsgClass(CandidateAdded.class);
    assertEquals("getEntityId", entityPath(ENTITY_TYPE, ENTITY_ID1), candidateAdded.getEntityPath());
    assertEquals("getNewCandidate", memberName2, candidateAdded.getNewCandidate());
    assertEquals("getAllCandidates", ImmutableSet.of(memberName1, memberName2),
            ImmutableSet.copyOf(candidateAdded.getAllCandidates()));

    writeNode(ENTITY_OWNERS_PATH, entityOwnersWithCandidate(ENTITY_TYPE, ENTITY_ID2, memberName1));

    candidateAdded = kit.expectMsgClass(CandidateAdded.class);
    assertEquals("getEntityId", entityPath(ENTITY_TYPE, ENTITY_ID2), candidateAdded.getEntityPath());
    assertEquals("getNewCandidate", memberName1, candidateAdded.getNewCandidate());
    assertEquals("getAllCandidates", ImmutableSet.of(memberName1),
            ImmutableSet.copyOf(candidateAdded.getAllCandidates()));

    deleteNode(candidatePath(ENTITY_TYPE, ENTITY_ID1, memberName1));

    CandidateRemoved candidateRemoved = kit.expectMsgClass(CandidateRemoved.class);
    assertEquals("getEntityId", entityPath(ENTITY_TYPE, ENTITY_ID1), candidateRemoved.getEntityPath());
    assertEquals("getRemovedCandidate", memberName1, candidateRemoved.getRemovedCandidate());
    assertEquals("getRemainingCandidates", ImmutableSet.of(memberName2),
            ImmutableSet.copyOf(candidateRemoved.getRemainingCandidates()));

    deleteNode(candidatePath(ENTITY_TYPE, ENTITY_ID1, memberName2));

    candidateRemoved = kit.expectMsgClass(CandidateRemoved.class);
    assertEquals("getEntityId", entityPath(ENTITY_TYPE, ENTITY_ID1), candidateRemoved.getEntityPath());
    assertEquals("getRemovedCandidate", memberName2, candidateRemoved.getRemovedCandidate());
    assertEquals("getRemainingCandidates", ImmutableSet.of(),
            ImmutableSet.copyOf(candidateRemoved.getRemainingCandidates()));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:52,代码来源:CandidateListChangeListenerTest.java


注:本文中的akka.testkit.JavaTestKit.expectMsgClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。