Barrier turn on/off-add switcher value to Config-Subsystem
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / connection / ChannelOutboundQueue02Test.java
index ccc24e5547640c43cfc5a36e0264b75cef9a59e9..5f080dc571e6032e4ed2015158d792f4bf515ac2 100644 (file)
@@ -7,36 +7,28 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelOutboundHandlerAdapter;
 import io.netty.channel.ChannelPromise;
 import io.netty.channel.embedded.EmbeddedChannel;
-
 import java.net.InetSocketAddress;
 import java.util.concurrent.TimeUnit;
-
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ChannelOutboundQueue;
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;
-import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageListenerWrapper;
-import org.opendaylight.openflowjava.protocol.impl.core.connection.ResponseExpectedRpcListener;
-import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
 
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
-
 /**
  * @author madamjak
  *
@@ -82,12 +74,12 @@ public class ChannelOutboundQueue02Test {
      */
     @Test
     public void test01() throws Exception {
-        EmbeddedChannel ec = new EmbeddedChannel(new EmbededChannelHandler());
-        adapter = new ConnectionAdapterImpl(ec,InetSocketAddress.createUnresolved("localhost", 9876));
+        final EmbeddedChannel ec = new EmbeddedChannel(new EmbededChannelHandler());
+        adapter = new ConnectionAdapterImpl(ec, InetSocketAddress.createUnresolved("localhost", 9876), true);
         cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
                 .removalListener(REMOVAL_LISTENER).build();
         adapter.setResponseCache(cache);
-        ChannelOutboundQueue cq = (ChannelOutboundQueue) ec.pipeline().last();
+        final ChannelOutboundQueue cq = (ChannelOutboundQueue) ec.pipeline().last();
         counter=0;
         adapter.barrier(barrierInput);
         adapter.echo(echoInput);
@@ -107,8 +99,8 @@ public class ChannelOutboundQueue02Test {
      */
     @Test
     public void test02(){
-        ChangeWritableEmbededChannel ec = new ChangeWritableEmbededChannel(new EmbededChannelHandler());
-        adapter = new ConnectionAdapterImpl(ec,InetSocketAddress.createUnresolved("localhost", 9876));
+        final ChangeWritableEmbededChannel ec = new ChangeWritableEmbededChannel(new EmbededChannelHandler());
+        adapter = new ConnectionAdapterImpl(ec, InetSocketAddress.createUnresolved("localhost", 9876), true);
         cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
                 .removalListener(REMOVAL_LISTENER).build();
         adapter.setResponseCache(cache);
@@ -132,8 +124,8 @@ public class ChannelOutboundQueue02Test {
      */
     private class EmbededChannelHandler extends ChannelOutboundHandlerAdapter {
         @Override
-        public void write(ChannelHandlerContext ctx, Object msg,
-                ChannelPromise promise) throws Exception {
+        public void write(final ChannelHandlerContext ctx, final Object msg,
+                final ChannelPromise promise) throws Exception {
             if(msg instanceof MessageListenerWrapper){
                 counter++;
             }
@@ -147,7 +139,7 @@ public class ChannelOutboundQueue02Test {
      */
     private class ChangeWritableEmbededChannel extends EmbeddedChannel {
         private boolean isWrittable;
-        public ChangeWritableEmbededChannel(ChannelHandler channelHandler){
+        public ChangeWritableEmbededChannel(final ChannelHandler channelHandler){
             super(channelHandler);
             setReadOnly();
         }