Merge "BUG-2288: deprecate old binding Notification API elements"
[controller.git] / opendaylight / md-sal / messagebus-impl / src / test / java / org / opendaylight / controller / messagebus / app / impl / EventSourceRegistrationImplTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.messagebus.app.impl;
9
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import org.opendaylight.controller.messagebus.spi.EventSource;
14
15 import static org.mockito.Matchers.any;
16 import static org.mockito.Mockito.mock;
17 import static org.mockito.Mockito.times;
18 import static org.mockito.Mockito.verify;
19
20 public class EventSourceRegistrationImplTest {
21
22     EventSourceRegistrationImplLocal eventSourceRegistrationImplLocal;
23     EventSourceTopology eventSourceTopologyMock;
24
25     @BeforeClass
26     public static void initTestClass() throws IllegalAccessException, InstantiationException {
27     }
28
29     @Before
30     public void setUp() throws Exception {
31         EventSource eventSourceMock = mock(EventSource.class);
32         eventSourceTopologyMock = mock(EventSourceTopology.class);
33         eventSourceRegistrationImplLocal = new EventSourceRegistrationImplLocal(eventSourceMock, eventSourceTopologyMock);
34     }
35
36     @Test
37     public void removeRegistrationTest() {
38         eventSourceRegistrationImplLocal.removeRegistration();
39         verify(eventSourceTopologyMock, times(1)).unRegister(any(EventSource.class));
40     }
41
42
43     private class EventSourceRegistrationImplLocal extends EventSourceRegistrationImpl{
44
45         /**
46          * @param instance            of EventSource that has been registered by {@link EventSourceRegistryImpl#registerEventSource(Node, org.opendaylight.controller.messagebus.spi.EventSource)}
47          * @param eventSourceTopology
48          */
49         public EventSourceRegistrationImplLocal(EventSource instance, EventSourceTopology eventSourceTopology) {
50             super(instance, eventSourceTopology);
51         }
52     }
53
54 }