import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy;
-import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
@Test
public void testNewReadOnlyTransaction() throws Exception {
- DOMStoreTransaction dst = new TransactionChainProxy(mockActorContext).newReadOnlyTransaction();
+ DOMStoreTransaction dst = new TransactionChainProxy(mockComponentFactory).newReadOnlyTransaction();
Assert.assertTrue(dst instanceof DOMStoreReadTransaction);
}
@SuppressWarnings("resource")
@Test
public void testNewReadWriteTransaction() throws Exception {
- DOMStoreTransaction dst = new TransactionChainProxy(mockActorContext).newReadWriteTransaction();
+ DOMStoreTransaction dst = new TransactionChainProxy(mockComponentFactory).newReadWriteTransaction();
Assert.assertTrue(dst instanceof DOMStoreReadWriteTransaction);
}
@SuppressWarnings("resource")
@Test
public void testNewWriteOnlyTransaction() throws Exception {
- DOMStoreTransaction dst = new TransactionChainProxy(mockActorContext).newWriteOnlyTransaction();
+ DOMStoreTransaction dst = new TransactionChainProxy(mockComponentFactory).newWriteOnlyTransaction();
Assert.assertTrue(dst instanceof DOMStoreWriteTransaction);
}
@Test
public void testClose() throws Exception {
- new TransactionChainProxy(mockActorContext).close();
+ new TransactionChainProxy(mockComponentFactory).close();
verify(mockActorContext, times(1)).broadcast(anyObject());
}
@Test
public void testTransactionChainsHaveUniqueId(){
- TransactionChainProxy one = new TransactionChainProxy(mock(ActorContext.class));
- TransactionChainProxy two = new TransactionChainProxy(mock(ActorContext.class));
+ TransactionChainProxy one = new TransactionChainProxy(mockComponentFactory);
+ TransactionChainProxy two = new TransactionChainProxy(mockComponentFactory);
Assert.assertNotEquals(one.getTransactionChainId(), two.getTransactionChainId());
}
@Test
public void testRateLimitingUsedInReadWriteTxCreation(){
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
txChainProxy.newReadWriteTransaction();
@Test
public void testRateLimitingUsedInWriteOnlyTxCreation(){
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
txChainProxy.newWriteOnlyTransaction();
@Test
public void testRateLimitingNotUsedInReadOnlyTxCreation(){
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
txChainProxy.newReadOnlyTransaction();
public void testChainedWriteOnlyTransactions() throws Exception {
dataStoreContextBuilder.writeOnlyTransactionOptimizationsEnabled(true);
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
ActorRef txActorRef1 = setupActorContextWithoutInitialCreateTransaction(getSystem());
*/
@Test
public void testChainedReadWriteTransactions() throws Exception {
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
ActorRef txActorRef1 = setupActorContextWithInitialCreateTransaction(getSystem(), READ_WRITE);
expectBatchedModifications(actorRef, 1);
- TransactionChainProxy txChainProxy = new TransactionChainProxy(mockActorContext);
+ TransactionChainProxy txChainProxy = new TransactionChainProxy(mockComponentFactory);
DOMStoreWriteTransaction writeTx1 = txChainProxy.newWriteOnlyTransaction();