public void testRead() throws Exception {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_ONLY);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
doReturn(readSerializedDataReply(null)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedReadData());
doReturn(Futures.successful(new Object())).when(mockActorContext).
executeOperationAsync(eq(actorSelection(actorRef)), eqSerializedReadData());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
transactionProxy.read(TestModel.TEST_PATH).checkedGet(5, TimeUnit.SECONDS);
}
doReturn(Futures.failed(new TestException())).when(mockActorContext).
executeOperationAsync(eq(actorSelection(actorRef)), eqSerializedReadData());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
propagateReadFailedExceptionCause(transactionProxy.read(TestModel.TEST_PATH));
}
doReturn(Futures.failed(exToThrow)).when(mockActorContext).executeOperationAsync(
any(ActorSelection.class), any());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
propagateReadFailedExceptionCause(invoker.invoke(transactionProxy));
}
doReturn(readSerializedDataReply(expectedNode)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedReadData());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.write(TestModel.TEST_PATH, expectedNode);
@Test(expected=IllegalStateException.class)
public void testReadPreConditionCheck() {
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.read(TestModel.TEST_PATH);
}
doReturn(Futures.successful(new Object())).when(mockActorContext).executeOperationAsync(
eq(getSystem().actorSelection(actorRef.path())), eqCreateTransaction(memberName, READ_ONLY));
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
propagateReadFailedExceptionCause(transactionProxy.read(TestModel.TEST_PATH));
}
public void testExists() throws Exception {
ActorRef actorRef = setupActorContextWithInitialCreateTransaction(getSystem(), READ_ONLY);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
doReturn(dataExistsSerializedReply(false)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedDataExists());
doReturn(Futures.successful(new Object())).when(mockActorContext).
executeOperationAsync(eq(actorSelection(actorRef)), eqSerializedDataExists());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
- READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
transactionProxy.exists(TestModel.TEST_PATH).checkedGet(5, TimeUnit.SECONDS);
}
doReturn(Futures.failed(new TestException())).when(mockActorContext).
executeOperationAsync(eq(actorSelection(actorRef)), eqSerializedDataExists());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
propagateReadFailedExceptionCause(transactionProxy.exists(TestModel.TEST_PATH));
}
doReturn(dataExistsSerializedReply(true)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedDataExists());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
@Test(expected=IllegalStateException.class)
public void testExistsPreConditionCheck() {
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.exists(TestModel.TEST_PATH);
}
expectBatchedModifications(actorRef, 1);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
final NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
- final TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ final TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
final CountDownLatch readComplete = new CountDownLatch(1);
final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
@Test(expected=IllegalStateException.class)
public void testWritePreConditionCheck() {
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
transactionProxy.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
}
@Test(expected=IllegalStateException.class)
public void testWriteAfterReadyPreConditionCheck() {
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.ready();
expectBatchedModifications(actorRef, 1);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite);
expectBatchedModifications(actorRef, 1);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.delete(TestModel.TEST_PATH);
expectBatchedModifications(actorRef, 1);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.read(TestModel.TEST_PATH);
expectBatchedModificationsReady(actorRef, true);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.read(TestModel.TEST_PATH);
expectBatchedModificationsReady(actorRef, true);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.read(TestModel.TEST_PATH);
expectBatchedModificationsReady(actorRef1);
expectBatchedModificationsReady(actorRef2);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.write(TestModel.JUNK_PATH, ImmutableNodes.containerNode(TestModel.JUNK_QNAME));
transactionProxy.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
expectBatchedModificationsReady(actorRef, true);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
expectBatchedModificationsReady(actorRef, true);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
expectFailedBatchedModifications(actorRef);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite);
private void testWriteOnlyTxWithFindPrimaryShardFailure(Exception toThrow) throws Exception {
doReturn(Futures.failed(toThrow)).when(mockActorContext).findPrimaryShardAsync(anyString());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
expectBatchedModificationsReady(actorRef2);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, WRITE_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, WRITE_ONLY);
transactionProxy.write(TestModel.JUNK_PATH, ImmutableNodes.containerNode(TestModel.JUNK_QNAME));
transactionProxy.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
@Test
public void testGetIdentifier() {
setupActorContextWithInitialCreateTransaction(getSystem(), READ_ONLY);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
- TransactionType.READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
Object id = transactionProxy.getIdentifier();
assertNotNull("getIdentifier returned null", id);
doReturn(readSerializedDataReply(null)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedReadData());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.read(TestModel.TEST_PATH);
setupActorContextWithInitialCreateTransaction(getSystem(), READ_ONLY);
doReturn(true).when(mockActorContext).isPathLocal(anyString());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
// negative test case with null as the reply
doReturn(readDataReply(null)).when(mockActorContext).executeOperationAsync(
expectBatchedModificationsReady(actorRef, true);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
doReturn(true).when(mockActorContext).isPathLocal(actorPath);
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
long start = System.nanoTime();
doReturn(true).when(mockActorContext).isPathLocal(anyString());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
long start = System.nanoTime();
YangInstanceIdentifier deletePath1 = TestModel.TEST_PATH;
YangInstanceIdentifier deletePath2 = TestModel.OUTER_LIST_PATH;
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, type);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, type);
transactionProxy.write(writePath1, writeNode1);
transactionProxy.write(writePath2, writeNode2);
doReturn(dataExistsSerializedReply(true)).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), eqSerializedDataExists());
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_WRITE);
transactionProxy.write(writePath1, writeNode1);
transactionProxy.write(writePath2, writeNode2);
doReturn(getSystem().dispatchers().defaultGlobalDispatcher()).when(mockActorContext).getClientDispatcher();
- TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_ONLY);
+ TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
Optional<NormalizedNode<?, ?>> readOptional = transactionProxy.read(
YangInstanceIdentifier.builder().build()).get(5, TimeUnit.SECONDS);