use of org.opendaylight.mdsal.dom.spi.store.DOMStore in project controller by opendaylight.
the class ConcurrentDOMDataBrokerTest method setup.
@Before
public void setup() {
doReturn("tx").when(transaction).getIdentifier();
DOMStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
coordinator = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, store), futureExecutor);
}
use of org.opendaylight.mdsal.dom.spi.store.DOMStore in project controller by opendaylight.
the class ConcurrentDOMDataBrokerTest method testLazySubTransactionCreationForReadWriteTransactions.
@Test
public void testLazySubTransactionCreationForReadWriteTransactions() {
DOMStore configDomStore = mock(DOMStore.class);
DOMStore operationalDomStore = mock(DOMStore.class);
DOMStoreReadWriteTransaction storeTxn = mock(DOMStoreReadWriteTransaction.class);
doReturn(storeTxn).when(operationalDomStore).newReadWriteTransaction();
doReturn(storeTxn).when(configDomStore).newReadWriteTransaction();
try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, operationalDomStore, LogicalDatastoreType.CONFIGURATION, configDomStore), futureExecutor)) {
DOMDataTreeReadWriteTransaction dataTxn = dataBroker.newReadWriteTransaction();
dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
verify(configDomStore, never()).newReadWriteTransaction();
verify(operationalDomStore, times(1)).newReadWriteTransaction();
dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
verify(configDomStore, times(1)).newReadWriteTransaction();
verify(operationalDomStore, times(1)).newReadWriteTransaction();
}
}
use of org.opendaylight.mdsal.dom.spi.store.DOMStore in project controller by opendaylight.
the class ConcurrentDOMDataBrokerTest method testCreateTransactionChain.
@Test
public void testCreateTransactionChain() {
DOMStore domStore = mock(DOMStore.class);
try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, domStore, LogicalDatastoreType.CONFIGURATION, domStore), futureExecutor)) {
dataBroker.createTransactionChain(mock(TransactionChainListener.class));
verify(domStore, times(2)).createTransactionChain();
}
}
Aggregations