import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.opendaylight.controller.cluster.datastore.DataStoreVersions.CURRENT_VERSION;
+
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.Props;
// it does do a persist)
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
if(message instanceof ElectionTimeout && firstElectionTimeout) {
// Got the first ElectionTimeout. We don't forward it to the
// base Shard yet until we've sent the RegisterChangeListener
onFirstElectionTimeout.countDown();
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
};
public Shard create() throws Exception {
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
+ public void handleCommand(final Object message) {
if(message instanceof ElectionTimeout && firstElectionTimeout) {
firstElectionTimeout = false;
final ActorRef self = getSelf();
onFirstElectionTimeout.countDown();
} else {
- super.onReceiveCommand(message);
+ super.handleCommand(message);
}
}
};
final ShardDataTreeCohort cohort1 = mock(ShardDataTreeCohort.class, "cohort1");
doReturn(Futures.immediateFuture(Boolean.TRUE)).when(cohort1).canCommit();
doReturn(Futures.immediateFuture(null)).when(cohort1).preCommit();
- doReturn(Futures.immediateFailedFuture(new IllegalStateException("mock"))).when(cohort1).commit();
+ doReturn(Futures.immediateFailedFuture(new RuntimeException("mock"))).when(cohort1).commit();
doReturn(mockCandidate("cohort1-candidate")).when(cohort1).getCandidate();
final String transactionID2 = "tx2";
final DataTreeCandidateNode candidateRoot = mock(DataTreeCandidateNode.class);
doReturn(ModificationType.UNMODIFIED).when(candidateRoot).getModificationType();
doReturn(candidateRoot).when(candidate).getRootNode();
+ doReturn(YangInstanceIdentifier.EMPTY).when(candidate).getRootPath();
doReturn(candidate).when(cohort).getCandidate();
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification, true), getRef());
final DataTreeCandidateNode candidateRoot = mock(DataTreeCandidateNode.class);
doReturn(ModificationType.UNMODIFIED).when(candidateRoot).getModificationType();
doReturn(candidateRoot).when(candidate).getRootNode();
+ doReturn(YangInstanceIdentifier.EMPTY).when(candidate).getRootPath();
doReturn(candidate).when(cohort).getCandidate();
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification, true), getRef());
public Shard create() throws Exception {
return new Shard(newShardBuilder()) {
@Override
- public void onReceiveCommand(final Object message) throws Exception {
- super.onReceiveCommand(message);
- if(message.equals(TX_COMMIT_TIMEOUT_CHECK_MESSAGE)) {
+ public void handleCommand(final Object message) {
+ super.handleCommand(message);
+ if(TX_COMMIT_TIMEOUT_CHECK_MESSAGE.equals(message)) {
if(cleaupCheckLatch.get() != null) {
cleaupCheckLatch.get().countDown();
}
public void handleCommand(final Object message) {
super.handleCommand(message);
- if (message instanceof SaveSnapshotSuccess || message.equals("commit_snapshot")) {
+ // XXX: commit_snapshot equality check references RaftActorSnapshotMessageSupport.COMMIT_SNAPSHOT
+ if (message instanceof SaveSnapshotSuccess || "commit_snapshot".equals(message.toString())) {
latch.get().countDown();
}
}
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testFollowerInitialSyncStatus");
- shard.underlyingActor().onReceiveCommand(new FollowerInitialSyncUpStatus(false, "member-1-shard-inventory-operational"));
+ shard.underlyingActor().handleNonRaftCommand(new FollowerInitialSyncUpStatus(false, "member-1-shard-inventory-operational"));
assertEquals(false, shard.underlyingActor().getShardMBean().getFollowerInitialSyncStatus());
- shard.underlyingActor().onReceiveCommand(new FollowerInitialSyncUpStatus(true, "member-1-shard-inventory-operational"));
+ shard.underlyingActor().handleNonRaftCommand(new FollowerInitialSyncUpStatus(true, "member-1-shard-inventory-operational"));
assertEquals(true, shard.underlyingActor().getShardMBean().getFollowerInitialSyncStatus());
}