use of org.opendaylight.mdsal.dom.api.DOMMountPointService.DOMMountPointBuilder in project mdsal by opendaylight.
the class DOMMountPointServiceImplTest method testMountPointRegistration.
@Test
public void testMountPointRegistration() {
final DOMMountPointListener mountPointListener = mock(DOMMountPointListener.class);
doNothing().when(mountPointListener).onMountPointCreated(PATH);
mountPointService.registerProvisionListener(mountPointListener);
// Create a mount point with schema context and a DOMService
final DOMMountPointBuilder mountPointBuilder = mountPointService.createMountPoint(PATH);
final DOMRpcService rpcService = mock(DOMRpcService.class);
mountPointBuilder.addService(DOMRpcService.class, rpcService);
mountPointBuilder.register();
// Verify listener has been notified and mount point is accessible from mount point service
verify(mountPointListener).onMountPointCreated(eq(PATH));
assertTrue(mountPointService.getMountPoint(PATH).isPresent());
// Verify mount point schema context and service
final DOMMountPoint mountPoint = mountPointService.getMountPoint(PATH).get();
assertTrue(mountPoint.getService(DOMRpcService.class).isPresent());
assertEquals(rpcService, mountPoint.getService(DOMRpcService.class).get());
}
Aggregations