X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fcore%2Fconnection%2FChannelOutboundQueue02Test.java;h=5f080dc571e6032e4ed2015158d792f4bf515ac2;hb=8910e62151c4a5b6285c38bf398b5a479b939fe2;hp=ccc24e5547640c43cfc5a36e0264b75cef9a59e9;hpb=7d2311dd81ec104024944110b3d682cc5a63d1e8;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueue02Test.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueue02Test.java index ccc24e55..5f080dc5 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueue02Test.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueue02Test.java @@ -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(); }