Search in sources :

Example 1 with DOMDataTreeCommitCohortRegistry

use of org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry in project controller by opendaylight.

the class ConcurrentDOMDataBrokerTest method testExtensions.

@Test
public void testExtensions() {
    DistributedDataStore mockConfigStore = mock(DistributedDataStore.class);
    DistributedDataStore mockOperStore = mock(DistributedDataStore.class);
    try (ConcurrentDOMDataBroker dataBroker = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, mockOperStore, LogicalDatastoreType.CONFIGURATION, mockConfigStore), futureExecutor)) {
        Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> supportedExtensions = dataBroker.getSupportedExtensions();
        assertNotNull(supportedExtensions.get(DOMDataTreeChangeService.class));
        DOMDataTreeCommitCohortRegistry cohortRegistry = (DOMDataTreeCommitCohortRegistry) supportedExtensions.get(DOMDataTreeCommitCohortRegistry.class);
        assertNotNull(cohortRegistry);
        DOMDataTreeCommitCohort mockCohort = mock(DOMDataTreeCommitCohort.class);
        DOMDataTreeIdentifier path = new DOMDataTreeIdentifier(org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);
        cohortRegistry.registerCommitCohort(path, mockCohort);
        verify(mockConfigStore).registerCommitCohort(path, mockCohort);
    }
}
Also used : DOMDataTreeChangeService(org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService) DistributedDataStore(org.opendaylight.controller.cluster.datastore.DistributedDataStore) DOMDataTreeIdentifier(org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier) DOMDataBrokerExtension(org.opendaylight.mdsal.dom.api.DOMDataBrokerExtension) DOMDataTreeCommitCohortRegistry(org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry) DOMDataTreeCommitCohort(org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DistributedDataStore (org.opendaylight.controller.cluster.datastore.DistributedDataStore)1 DOMDataBrokerExtension (org.opendaylight.mdsal.dom.api.DOMDataBrokerExtension)1 DOMDataTreeChangeService (org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService)1 DOMDataTreeCommitCohort (org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort)1 DOMDataTreeCommitCohortRegistry (org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry)1 DOMDataTreeIdentifier (org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier)1