use of org.opendaylight.mdsal.binding.api.Transaction in project netconf by opendaylight.
the class MountPointEndToEndTest method setupSlave.
private void setupSlave() throws Exception {
AbstractConcurrentDataBrokerTest dataBrokerTest = newDataBrokerTest();
slaveDataBroker = dataBrokerTest.getDataBroker();
slaveSystem = ActorSystem.create(ACTOR_SYSTEM_NAME, ConfigFactory.load().getConfig("Slave"));
doReturn(slaveSystem).when(mockSlaveActorSystemProvider).getActorSystem();
doReturn(mockSlaveClusterSingletonServiceReg).when(mockSlaveClusterSingletonServiceProvider).registerClusterSingletonService(any());
slaveNetconfTopologyManager = new NetconfTopologyManager(BASE_SCHEMAS, slaveDataBroker, mockRpcProviderRegistry, mockActionProviderRegistry, mockSlaveClusterSingletonServiceProvider, mockKeepaliveExecutor, mockThreadPool, mockSlaveActorSystemProvider, eventExecutor, mockClientDispatcher, TOPOLOGY_ID, config, slaveMountPointService, mockEncryptionService, mockRpcProviderService, deviceActionFactory, resourceManager) {
@Override
protected NetconfTopologyContext newNetconfTopologyContext(final NetconfTopologySetup setup, final ServiceGroupIdentifier serviceGroupIdent, final Timeout actorResponseWaitTime, final DeviceActionFactory actionFactory) {
NetconfTopologyContext spiedContext = spy(super.newNetconfTopologyContext(setup, serviceGroupIdent, actorResponseWaitTime, actionFactory));
slaveNetconfTopologyContextFuture.set(spiedContext);
return spiedContext;
}
};
slaveNetconfTopologyManager.init();
verifyTopologyNodesCreated(slaveDataBroker);
slaveTxChain = slaveDataBroker.createTransactionChain(new TransactionChainListener() {
@Override
public void onTransactionChainSuccessful(final TransactionChain chain) {
}
@Override
public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction, final Throwable cause) {
LOG.error("Slave transaction chain failed", cause);
}
});
}
use of org.opendaylight.mdsal.binding.api.Transaction in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method onTransactionChainFailedTest.
/**
* Increases {@link DataStoreBackEnd} code coverage.
*/
@Test
public void onTransactionChainFailedTest() {
Transaction asyncTransactionMock = Mockito.mock(Transaction.class);
Mockito.when(asyncTransactionMock.getIdentifier()).thenReturn(new Object());
dataStoreBackEnd.onTransactionChainFailed(Mockito.mock(TransactionChain.class), asyncTransactionMock, Mockito.mock(Throwable.class));
}
use of org.opendaylight.mdsal.binding.api.Transaction in project netconf by opendaylight.
the class NetconfDeviceTopologyAdapterTest method setUp.
@Before
public void setUp() throws Exception {
doReturn(writeTx).when(txChain).newWriteOnlyTransaction();
doNothing().when(writeTx).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(Node.class));
doNothing().when(writeTx).merge(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(NetworkTopology.class));
doReturn(txIdent).when(writeTx).getIdentifier();
ConcurrentDataBrokerTestCustomizer customizer = new ConcurrentDataBrokerTestCustomizer(true);
domDataBroker = customizer.getDOMDataBroker();
dataBroker = customizer.createDataBroker();
customizer.updateSchema(RUNTIME_CONTEXT);
transactionChain = dataBroker.createTransactionChain(new TransactionChainListener() {
@Override
public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction, final Throwable cause) {
}
@Override
public void onTransactionChainSuccessful(final TransactionChain chain) {
}
});
}
Aggregations