- transaction.tell(batched, getRef());
- BatchedModificationsReply reply = expectMsgClass(duration("5 seconds"), BatchedModificationsReply.class);
- assertEquals("getNumBatched", 1, reply.getNumBatched());
-
- batched = new BatchedModifications("tx1", DataStoreVersions.CURRENT_VERSION, null);
- batched.setReady(true);
- batched.setTotalMessagesSent(2);
-
- transaction.tell(batched, getRef());
- expectMsgClass(duration("5 seconds"), ReadyTransactionReply.class);
- watcher.expectMsgClass(duration("5 seconds"), Terminated.class);
- }};
- }
-
- @Test
- public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception {
- new JavaTestKit(getSystem()) {{
-
- final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(),
- "testOnReceiveBatchedModificationsReadyWithImmediateCommit");
-
- JavaTestKit watcher = new JavaTestKit(getSystem());
- watcher.watch(transaction);
-
- YangInstanceIdentifier writePath = TestModel.TEST_PATH;
- NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).
- withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build();
-
- BatchedModifications batched = new BatchedModifications("tx1", DataStoreVersions.CURRENT_VERSION, null);
- batched.addModification(new WriteModification(writePath, writeData));
- batched.setReady(true);
- batched.setDoCommitOnReady(true);
- batched.setTotalMessagesSent(1);
-
- transaction.tell(batched, getRef());
- expectMsgClass(duration("5 seconds"), CommitTransactionReply.SERIALIZABLE_CLASS);
- watcher.expectMsgClass(duration("5 seconds"), Terminated.class);
- }};
- }