Bump versions to 0.21.8-SNAPSHOT
[bgpcep.git] / bgp / rib-impl / src / test / java / org / opendaylight / protocol / bgp / rib / impl / BGPDispatcherImplTest.java
index 17c801c15da422ef5d607ea5f1eaf19f62fba59d..6268c0039b3235517d18d0cf1ce1daaf13d8bcd5 100755 (executable)
@@ -7,51 +7,50 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.opendaylight.protocol.bgp.rib.impl.CheckUtil.checkIdleState;
 
-import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
-
-import com.google.common.base.Optional;
 import com.google.common.collect.Sets;
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Future;
 import java.net.InetSocketAddress;
 import java.util.concurrent.ExecutionException;
-import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.State;
+import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.util.InetSocketAddressUtil;
 
 public class BGPDispatcherImplTest extends AbstractBGPDispatcherTest {
-    @Test
+    @Test(timeout = 20000)
     public void testCreateClient() throws InterruptedException, ExecutionException {
         final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
         final Channel serverChannel = createServer(serverAddress);
-        final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress, serverAddress, this.registry, 2, true);
-        waitFutureSuccess(futureClient);
+        final Future<BGPSessionImpl> futureClient = clientDispatcher.createClient(clientAddress, serverAddress, 2,
+            true);
+        futureClient.sync();
         final BGPSessionImpl session = futureClient.get();
-        Assert.assertEquals(State.UP, this.clientListener.getState());
-        Assert.assertEquals(State.UP, this.serverListener.getState());
-        Assert.assertEquals(AS_NUMBER, session.getAsNumber());
-        Assert.assertEquals(Sets.newHashSet(IPV_4_TT), session.getAdvertisedTableTypes());
-        Assert.assertTrue(serverChannel.isWritable());
+        assertEquals(State.UP, clientListener.getState());
+        assertEquals(State.UP, serverListener.getState());
+        assertEquals(AS_NUMBER, session.getAsNumber());
+        assertEquals(Sets.newHashSet(IPV_4_TT), session.getAdvertisedTableTypes());
+        assertTrue(serverChannel.isWritable());
         session.close();
-        this.serverListener.releaseConnection();
-        checkIdleState(this.clientListener);
-        checkIdleState(this.serverListener);
+        serverListener.releaseConnection();
+        checkIdleState(clientListener);
+        checkIdleState(serverListener);
     }
 
     @Test
     public void testCreateReconnectingClient() throws Exception {
         final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
-        final Future<Void> future = this.clientDispatcher.createReconnectingClient(serverAddress, this.registry, RETRY_TIMER, Optional.absent(),
-            this.clientAddress, true);
-        waitFutureSuccess(future);
+        final Future<Void> future = clientDispatcher.createReconnectingClient(serverAddress, RETRY_TIMER,
+            KeyMapping.of(), clientAddress, true);
         final Channel serverChannel = createServer(serverAddress);
-        Assert.assertEquals(State.UP, this.serverListener.getState());
-        Assert.assertTrue(serverChannel.isWritable());
+        assertEquals(State.UP, serverListener.getState());
+        assertTrue(serverChannel.isWritable());
         future.cancel(true);
-        this.serverListener.releaseConnection();
-        checkIdleState(this.serverListener);
+        serverListener.releaseConnection();
+        checkIdleState(serverListener);
     }
-
 }