BUG-5280: handle NotLeaderException
[controller.git] / opendaylight / md-sal / cds-access-client / src / test / java / org / opendaylight / controller / cluster / access / client / ConnectedClientConnectionTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.access.client;
9
10 import static org.mockito.Matchers.any;
11 import static org.mockito.Matchers.same;
12 import static org.mockito.Mockito.mock;
13 import static org.mockito.Mockito.verify;
14
15 import org.junit.Test;
16 import org.opendaylight.controller.cluster.access.ABIVersion;
17
18 public class ConnectedClientConnectionTest
19         extends AbstractClientConnectionTest<ConnectedClientConnection<BackendInfo>, BackendInfo> {
20
21     @Override
22     protected ConnectedClientConnection createConnection() {
23         final BackendInfo backend = new BackendInfo(backendProbe.ref(), 0L, ABIVersion.BORON, 10);
24         return new ConnectedClientConnection<>(context, 0L, backend);
25     }
26
27     @Override
28     @Test
29     public void testReconnectConnection() throws Exception {
30         final ClientActorBehavior<BackendInfo> behavior = mock(ClientActorBehavior.class);
31         connection.lockedReconnect(behavior);
32         verify(behavior).reconnectConnection(same(connection), any(ReconnectingClientConnection.class));
33     }
34
35 }