Search in sources :

Example 1 with DOMMountPointBuilder

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());
}
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)1 DOMMountPoint (org.opendaylight.mdsal.dom.api.DOMMountPoint)1 DOMMountPointListener (org.opendaylight.mdsal.dom.api.DOMMountPointListener)1 DOMMountPointBuilder (org.opendaylight.mdsal.dom.api.DOMMountPointService.DOMMountPointBuilder)1 DOMRpcService (org.opendaylight.mdsal.dom.api.DOMRpcService)1