use of org.opendaylight.mdsal.dom.api.DOMMountPointListener in project mdsal by opendaylight.
the class DOMMountPointServiceImplTest method testMountPointDestruction.
@Test
public void testMountPointDestruction() {
final DOMMountPointListener mountPointListener = mock(DOMMountPointListener.class);
doNothing().when(mountPointListener).onMountPointRemoved(PATH);
final ObjectRegistration<DOMMountPoint> mountPointRegistration = mountPointService.createMountPoint(PATH).register();
mountPointService.registerProvisionListener(mountPointListener);
mountPointRegistration.close();
// Verify listener has been notified and mount point is not present in mount point service
verify(mountPointListener).onMountPointRemoved(eq(PATH));
assertFalse(mountPointService.getMountPoint(PATH).isPresent());
}
use of org.opendaylight.mdsal.dom.api.DOMMountPointListener 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