Remove use of {String,UUID}Identifier
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DataTreeChangeListenerRegistrationActorTest.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.cluster.datastore;
9
10 import akka.actor.ActorRef;
11 import akka.actor.Props;
12 import akka.testkit.JavaTestKit;
13 import com.google.common.util.concurrent.MoreExecutors;
14 import org.junit.Test;
15 import org.mockito.Mockito;
16 import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeChangeListenerRegistration;
17 import org.opendaylight.controller.cluster.datastore.messages.CloseDataTreeChangeListenerRegistrationReply;
18 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
19 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
20 import org.opendaylight.yangtools.concepts.ListenerRegistration;
21
22 public class DataTreeChangeListenerRegistrationActorTest extends AbstractActorTest {
23     private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService());
24
25     static {
26         store.onGlobalContextUpdated(TestModel.createTestContext());
27     }
28
29     @SuppressWarnings("rawtypes")
30     @Test
31     public void testOnReceiveCloseListenerRegistration() throws Exception {
32         new JavaTestKit(getSystem()) {{
33             final ListenerRegistration mockListenerReg = Mockito.mock(ListenerRegistration.class);
34             final Props props = DataTreeChangeListenerRegistrationActor.props(mockListenerReg);
35             final ActorRef subject = getSystem().actorOf(props, "testCloseListenerRegistration");
36
37             subject.tell(CloseDataTreeChangeListenerRegistration.getInstance(), getRef());
38
39             expectMsgClass(duration("1 second"), CloseDataTreeChangeListenerRegistrationReply.class);
40
41             Mockito.verify(mockListenerReg).close();
42         }};
43     }
44 }