import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo;
import org.opendaylight.controller.cluster.datastore.messages.ReadData;
import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply;
+import org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction;
import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply;
import org.opendaylight.controller.cluster.datastore.modification.AbstractModification;
import org.opendaylight.controller.cluster.datastore.modification.Modification;
import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
-import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
+import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
}
protected ReadData eqReadData() {
+ return eqReadData(TestModel.TEST_PATH);
+ }
+
+ protected ReadData eqReadData(final YangInstanceIdentifier path) {
ArgumentMatcher<ReadData> matcher = new ArgumentMatcher<ReadData>() {
@Override
public boolean matches(Object argument) {
- return (argument instanceof ReadData) &&
- ((ReadData)argument).getPath().equals(TestModel.TEST_PATH);
+ return (argument instanceof ReadData) && ((ReadData)argument).getPath().equals(path);
}
};
return Futures.successful((Object)new ReadyTransactionReply(path));
}
- protected Future<Object> readSerializedDataReply(NormalizedNode<?, ?> data,
- short transactionVersion) {
- return Futures.successful(new ReadDataReply(data, transactionVersion).toSerializable());
- }
-
- protected Future<Object> readSerializedDataReply(NormalizedNode<?, ?> data) {
- return readSerializedDataReply(data, DataStoreVersions.CURRENT_VERSION);
- }
protected Future<ReadDataReply> readDataReply(NormalizedNode<?, ?> data) {
return Futures.successful(new ReadDataReply(data, DataStoreVersions.CURRENT_VERSION));
}
- protected Future<Object> dataExistsSerializedReply(boolean exists) {
- return Futures.successful(DataExistsReply.create(exists).toSerializable());
- }
-
protected Future<DataExistsReply> dataExistsReply(boolean exists) {
return Futures.successful(DataExistsReply.create(exists));
}
eq(actorSelection(actorRef)), isA(BatchedModifications.class));
}
+ protected void expectReadyLocalTransaction(ActorRef actorRef, boolean doCommitOnReady) {
+ doReturn(doCommitOnReady ? Futures.successful(new CommitTransactionReply().toSerializable()) :
+ readyTxReply(actorRef.path().toString())).when(mockActorContext).executeOperationAsync(
+ eq(actorSelection(actorRef)), isA(ReadyLocalTransaction.class), any(Timeout.class));
+ }
+
protected CreateTransactionReply createTransactionReply(ActorRef actorRef, int transactionVersion){
return CreateTransactionReply.newBuilder()
.setTransactionActorPath(actorRef.path().toString())
TransactionType type, short transactionVersion, String prefix, ActorRef shardActorRef) {
ActorRef txActorRef;
- if(type == TransactionType.WRITE_ONLY && transactionVersion >= DataStoreVersions.LITHIUM_VERSION &&
+ if(type == TransactionType.WRITE_ONLY &&
dataStoreContextBuilder.build().isWriteOnlyTransactionOptimizationsEnabled()) {
txActorRef = shardActorRef;
} else {