*/
package org.opendaylight.protocol.bgp.rib.impl;
-import static org.opendaylight.protocol.bgp.rib.impl.CheckUtil.waitFutureSuccess;
+
+import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
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.util.InetSocketAddressUtil;
public class BGPDispatcherImplTest extends AbstractBGPDispatcherTest {
public void testCreateClient() throws InterruptedException, ExecutionException {
final InetSocketAddress serverAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final Channel serverChannel = createServer(serverAddress);
- Thread.sleep(1000);
- final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress, serverAddress, this.registry, 2, true);
+ final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress,
+ serverAddress, 2, true);
waitFutureSuccess(futureClient);
final BGPSessionImpl session = futureClient.get();
- Assert.assertEquals(BGPSessionImpl.State.UP, this.clientListener.getState());
- Assert.assertEquals(BGPSessionImpl.State.UP, this.serverListener.getState());
+ 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());
@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);
+ final Future<Void> future = this.clientDispatcher.createReconnectingClient(serverAddress, RETRY_TIMER,
+ Optional.absent(), this.clientAddress, true);
waitFutureSuccess(future);
final Channel serverChannel = createServer(serverAddress);
- Assert.assertEquals(BGPSessionImpl.State.UP, this.serverListener.getState());
+ Assert.assertEquals(State.UP, this.serverListener.getState());
Assert.assertTrue(serverChannel.isWritable());
future.cancel(true);
this.serverListener.releaseConnection();