EntityOwnershipShard extends Shard { private void onUnregisterCandidateLocal(final UnregisterCandidateLocal unregisterCandidate) { LOG.debug("{}: onUnregisterCandidateLocal: {}", persistenceId(), unregisterCandidate); DOMEntity entity = unregisterCandidate.getEntity(); YangInstanceIdentifier candidatePath = candidatePath(entity.getType(), entity.getIdentifier(), localMemberName.getName()); commitCoordinator.commitModification(new DeleteModification(candidatePath), this); getSender().tell(SuccessReply.INSTANCE, getSelf()); } protected  EntityOwnershipShard(final Builder builder); @Override void handleNonRaftCommand(final Object message); static Builder newBuilder();  }
@Test public void testOnUnregisterCandidateLocal() { testLog.info("testOnUnregisterCandidateLocal starting"); ShardTestKit kit = new ShardTestKit(getSystem()); TestActorRef<EntityOwnershipShard> shard = actorFactory.createTestActor(newLocalShardProps()); ShardTestKit.waitUntilLeader(shard); DOMEntity entity = new DOMEntity(ENTITY_TYPE, ENTITY_ID1); shard.tell(new RegisterCandidateLocal(entity), kit.getRef()); kit.expectMsgClass(SuccessReply.class); verifyCommittedEntityCandidate(shard, ENTITY_TYPE, ENTITY_ID1, LOCAL_MEMBER_NAME); verifyOwner(shard, ENTITY_TYPE, ENTITY_ID1, LOCAL_MEMBER_NAME); shard.tell(new UnregisterCandidateLocal(entity), kit.getRef()); kit.expectMsgClass(SuccessReply.class); verifyOwner(shard, ENTITY_TYPE, ENTITY_ID1, ""); shard.tell(new RegisterCandidateLocal(entity), kit.getRef()); kit.expectMsgClass(SuccessReply.class); verifyCommittedEntityCandidate(shard, ENTITY_TYPE, ENTITY_ID1, LOCAL_MEMBER_NAME); verifyOwner(shard, ENTITY_TYPE, ENTITY_ID1, LOCAL_MEMBER_NAME); testLog.info("testOnUnregisterCandidateLocal ending"); }