import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.yangtools.util.StringIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
public void testRegisterChangeListener() throws Exception {
new ShardTestKit(getSystem()) {{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
- newShardProps(), "testRegisterChangeListener");
+ newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testRegisterChangeListener");
waitUntilLeader(shard);
public void testRegisterDataTreeChangeListener() throws Exception {
new ShardTestKit(getSystem()) {{
final TestActorRef<Shard> shard = actorFactory.createTestActor(
- newShardProps(), "testRegisterDataTreeChangeListener");
+ newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testRegisterDataTreeChangeListener");
waitUntilLeader(shard);
@Test
public void testApplyState() throws Exception {
- final TestActorRef<Shard> shard = actorFactory.createTestActor(newShardProps(), "testApplyState");
+ final TestActorRef<Shard> shard = actorFactory.createTestActor(
+ newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()), "testApplyState");
ShardTestKit.waitUntilLeader(shard);
writeMod.write(TestModel.TEST_PATH, node);
writeMod.ready();
- final ApplyState applyState = new ApplyState(null, new StringIdentifier("test"),
- new ReplicatedLogImplEntry(1, 2, payloadForModification(source, writeMod)));
+ final TransactionIdentifier tx = nextTransactionId();
+ final ApplyState applyState = new ApplyState(null, tx,
+ new ReplicatedLogImplEntry(1, 2, payloadForModification(source, writeMod, tx)));
shard.tell(applyState, shard);
InMemoryJournal.addEntry(shardID.toString(), 0, DUMMY_DATA);
// Set up the InMemoryJournal.
- InMemoryJournal.addEntry(shardID.toString(), 1, new ReplicatedLogImplEntry(0, 1, payloadForModification(source, writeMod)));
+ InMemoryJournal.addEntry(shardID.toString(), 1, new ReplicatedLogImplEntry(0, 1,
+ payloadForModification(source, writeMod, nextTransactionId())));
final int nListEntries = 16;
final Set<Integer> listEntryKeys = new HashSet<>();
final DataTreeModification mod = source.takeSnapshot().newModification();
mod.merge(path, ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i));
mod.ready();
+
InMemoryJournal.addEntry(shardID.toString(), i+1, new ReplicatedLogImplEntry(i, 1,
- payloadForModification(source, mod)));
+ payloadForModification(source, mod, nextTransactionId())));
}
InMemoryJournal.addEntry(shardID.toString(), nListEntries + 2,
};
final TestActorRef<Shard> shard = actorFactory.createTestActor(
- Props.create(new DelegatingShardCreator(creator)), "testOnBatchedModificationsWhenNotLeader");
+ Props.create(new DelegatingShardCreator(creator)).
+ withDispatcher(Dispatchers.DefaultDispatcherId()), "testOnBatchedModificationsWhenNotLeader");
waitUntilLeader(shard);
testCreateSnapshot(false, "testCreateSnapshotWithNonPersistentData");
}
- @SuppressWarnings("serial")
private void testCreateSnapshot(final boolean persistent, final String shardActorName) throws Exception{
final AtomicReference<CountDownLatch> latch = new AtomicReference<>(new CountDownLatch(1));
final Creator<Shard> creator = () -> new TestShard(newShardBuilder());
final TestActorRef<Shard> shard = actorFactory.createTestActor(
- Props.create(new DelegatingShardCreator(creator)), shardActorName);
+ Props.create(new DelegatingShardCreator(creator)).
+ withDispatcher(Dispatchers.DefaultDispatcherId()), shardActorName);
waitUntilLeader(shard);
writeToStore(shard, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));