2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.datastore;
10 import static org.junit.Assert.assertSame;
11 import static org.mockito.Mockito.mock;
13 import akka.actor.ActorRef;
14 import java.util.List;
15 import org.junit.Test;
16 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
17 import org.opendaylight.controller.cluster.raft.utils.MessageCollectorActor;
18 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
20 public class ForwardingDataTreeChangeListenerTest extends AbstractActorTest {
23 public void testOnDataChanged() {
24 final ActorRef actorRef = getSystem().actorOf(MessageCollectorActor.props());
26 ForwardingDataTreeChangeListener forwardingListener = new ForwardingDataTreeChangeListener(
27 getSystem().actorSelection(actorRef.path()), ActorRef.noSender());
29 List<DataTreeCandidate> expected = List.of(mock(DataTreeCandidate.class));
30 forwardingListener.onDataTreeChanged(expected);
32 DataTreeChanged actual = MessageCollectorActor.expectFirstMatching(actorRef, DataTreeChanged.class, 5000);
33 assertSame(expected, actual.getChanges());