Search in sources :

Example 1 with DOMMountPointListener

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());
}
Also used : DOMMountPointListener(org.opendaylight.mdsal.dom.api.DOMMountPointListener) DOMMountPoint(org.opendaylight.mdsal.dom.api.DOMMountPoint) Test(org.junit.Test)

Example 2 with DOMMountPointListener

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());
}
Also used : DOMRpcService(org.opendaylight.mdsal.dom.api.DOMRpcService) DOMMountPointListener(org.opendaylight.mdsal.dom.api.DOMMountPointListener) DOMMountPointBuilder(org.opendaylight.mdsal.dom.api.DOMMountPointService.DOMMountPointBuilder) DOMMountPoint(org.opendaylight.mdsal.dom.api.DOMMountPoint) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 DOMMountPoint (org.opendaylight.mdsal.dom.api.DOMMountPoint)2 DOMMountPointListener (org.opendaylight.mdsal.dom.api.DOMMountPointListener)2 DOMMountPointBuilder (org.opendaylight.mdsal.dom.api.DOMMountPointService.DOMMountPointBuilder)1 DOMRpcService (org.opendaylight.mdsal.dom.api.DOMRpcService)1