Search in sources :

Example 1 with ShardedDOMDataTree

use of org.opendaylight.mdsal.dom.broker.ShardedDOMDataTree in project controller by opendaylight.

the class DistributedShardFrontendTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    shardedDOMDataTree = new ShardedDOMDataTree();
    client = mock(DataStoreClient.class);
    cursor = mock(DOMDataTreeWriteCursor.class);
    clientTransaction = mock(ClientTransaction.class);
    clientHistory = mock(ClientLocalHistory.class);
    commitCohort = mock(DOMStoreThreePhaseCommitCohort.class);
    doReturn(SUCCESS_FUTURE).when(commitCohort).canCommit();
    doReturn(SUCCESS_FUTURE).when(commitCohort).preCommit();
    doReturn(SUCCESS_FUTURE).when(commitCohort).commit();
    doReturn(SUCCESS_FUTURE).when(commitCohort).abort();
    doReturn(clientTransaction).when(client).createTransaction();
    doReturn(clientTransaction).when(clientHistory).createTransaction();
    doNothing().when(clientHistory).close();
    doNothing().when(client).close();
    doReturn(clientHistory).when(client).createLocalHistory();
    doReturn(cursor).when(clientTransaction).openCursor();
    doNothing().when(cursor).close();
    doNothing().when(cursor).write(any(), any());
    doNothing().when(cursor).merge(any(), any());
    doNothing().when(cursor).delete(any());
    doReturn(commitCohort).when(clientTransaction).ready();
}
Also used : ShardedDOMDataTree(org.opendaylight.mdsal.dom.broker.ShardedDOMDataTree) DOMDataTreeWriteCursor(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor) ClientTransaction(org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction) DataStoreClient(org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient) DOMStoreThreePhaseCommitCohort(org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort) ClientLocalHistory(org.opendaylight.controller.cluster.databroker.actors.dds.ClientLocalHistory) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ClientLocalHistory (org.opendaylight.controller.cluster.databroker.actors.dds.ClientLocalHistory)1 ClientTransaction (org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction)1 DataStoreClient (org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient)1 DOMDataTreeWriteCursor (org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor)1 ShardedDOMDataTree (org.opendaylight.mdsal.dom.broker.ShardedDOMDataTree)1 DOMStoreThreePhaseCommitCohort (org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort)1