use of org.opendaylight.mdsal.dom.api.DOMDataBrokerExtension 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);
}
}
Aggregations