This commit is contained in:
Trustin Lee 2013-02-11 16:28:57 +09:00
parent a22725d9fa
commit 6f8a69b956
7 changed files with 18 additions and 68 deletions

View File

@ -18,25 +18,17 @@ package io.netty.test.udt.nio;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtByteAcceptorChannel; import io.netty.channel.udt.nio.NioUdtByteAcceptorChannel;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class NioUdtByteAcceptorChannelTest extends AbstractUdtTest { public class NioUdtByteAcceptorChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.BYTE, new NioUdtByteAcceptorChannel().metadata().bufferType());
assertEquals(BufType.BYTE, new NioUdtByteAcceptorChannel().metadata()
.bufferType());
} }
} }

View File

@ -18,26 +18,17 @@ package io.netty.test.udt.nio;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtByteConnectorChannel; import io.netty.channel.udt.nio.NioUdtByteConnectorChannel;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class NioUdtByteConnectorChannelTest extends AbstractUdtTest { public class NioUdtByteConnectorChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.BYTE, new NioUdtByteConnectorChannel().metadata().bufferType());
assertEquals(BufType.BYTE, new NioUdtByteConnectorChannel().metadata()
.bufferType());
} }
} }

View File

@ -22,13 +22,12 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.udt.nio.NioUdtByteRendezvousChannel; import io.netty.channel.udt.nio.NioUdtByteRendezvousChannel;
import io.netty.logging.InternalLogger;
import io.netty.logging.InternalLoggerFactory;
import io.netty.test.udt.util.BootHelp; import io.netty.test.udt.util.BootHelp;
import io.netty.test.udt.util.EchoByteHandler; import io.netty.test.udt.util.EchoByteHandler;
import io.netty.test.udt.util.UnitHelp; import io.netty.test.udt.util.UnitHelp;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -37,17 +36,14 @@ import static org.junit.Assert.*;
public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest { public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class); private static final InternalLogger log = InternalLoggerFactory.getInstance(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.BYTE, new NioUdtByteRendezvousChannel().metadata().bufferType());
assertEquals(BufType.BYTE, new NioUdtByteRendezvousChannel().metadata()
.bufferType());
} }
/** /**
@ -82,7 +78,7 @@ public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest {
while (handler1.meter().count() < transferLimit while (handler1.meter().count() < transferLimit
&& handler2.meter().count() < transferLimit) { && handler2.meter().count() < transferLimit) {
NioUdtByteAcceptorChannelTest.log.info("progress : {} {}", handler1.meter().count(), handler2 log.info("progress : {} {}", handler1.meter().count(), handler2
.meter().count()); .meter().count());
Thread.sleep(1000); Thread.sleep(1000);
@ -92,8 +88,8 @@ public class NioUdtByteRendezvousChannelTest extends AbstractUdtTest {
connectFuture1.channel().close().sync(); connectFuture1.channel().close().sync();
connectFuture2.channel().close().sync(); connectFuture2.channel().close().sync();
NioUdtByteAcceptorChannelTest.log.info("handler1 : {}", handler1.meter().count()); log.info("handler1 : {}", handler1.meter().count());
NioUdtByteAcceptorChannelTest.log.info("handler2 : {}", handler2.meter().count()); log.info("handler2 : {}", handler2.meter().count());
assertTrue(handler1.meter().count() >= transferLimit); assertTrue(handler1.meter().count() >= transferLimit);
assertTrue(handler2.meter().count() >= transferLimit); assertTrue(handler2.meter().count() >= transferLimit);

View File

@ -18,26 +18,17 @@ package io.netty.test.udt.nio;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel; import io.netty.channel.udt.nio.NioUdtMessageAcceptorChannel;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class NioUdtMessageAcceptorChannelTest extends AbstractUdtTest { public class NioUdtMessageAcceptorChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.MESSAGE, new NioUdtMessageAcceptorChannel().metadata().bufferType());
assertEquals(BufType.MESSAGE, new NioUdtMessageAcceptorChannel()
.metadata().bufferType());
} }
} }

View File

@ -18,26 +18,17 @@ package io.netty.test.udt.nio;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel; import io.netty.channel.udt.nio.NioUdtMessageConnectorChannel;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class NioUdtMessageConnectorChannelTest extends AbstractUdtTest { public class NioUdtMessageConnectorChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.MESSAGE, new NioUdtMessageConnectorChannel().metadata().bufferType());
assertEquals(BufType.MESSAGE, new NioUdtMessageConnectorChannel()
.metadata().bufferType());
} }
} }

View File

@ -22,13 +22,12 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.BufType; import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.udt.nio.NioUdtMessageRendezvousChannel; import io.netty.channel.udt.nio.NioUdtMessageRendezvousChannel;
import io.netty.logging.InternalLogger;
import io.netty.logging.InternalLoggerFactory;
import io.netty.test.udt.util.BootHelp; import io.netty.test.udt.util.BootHelp;
import io.netty.test.udt.util.EchoMessageHandler; import io.netty.test.udt.util.EchoMessageHandler;
import io.netty.test.udt.util.UnitHelp; import io.netty.test.udt.util.UnitHelp;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -37,16 +36,14 @@ import static org.junit.Assert.*;
public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest { public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtByteAcceptorChannelTest.class); private static final InternalLogger log = InternalLoggerFactory.getInstance(NioUdtByteAcceptorChannelTest.class);
/** /**
* verify channel meta data * verify channel meta data
*/ */
@Test @Test
public void metadata() throws Exception { public void metadata() throws Exception {
assertEquals(BufType.MESSAGE, new NioUdtMessageRendezvousChannel().metadata().bufferType());
assertEquals(BufType.MESSAGE, new NioUdtMessageRendezvousChannel()
.metadata().bufferType());
} }
@ -86,7 +83,7 @@ public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest {
while (handler1.meter().count() < transferLimit while (handler1.meter().count() < transferLimit
&& handler2.meter().count() < transferLimit) { && handler2.meter().count() < transferLimit) {
NioUdtByteAcceptorChannelTest.log.info("progress : {} {}", handler1.meter().count(), handler2 log.info("progress : {} {}", handler1.meter().count(), handler2
.meter().count()); .meter().count());
Thread.sleep(1000); Thread.sleep(1000);
@ -96,8 +93,8 @@ public class NioUdtMessageRendezvousChannelTest extends AbstractUdtTest {
connectFuture1.channel().close().sync(); connectFuture1.channel().close().sync();
connectFuture2.channel().close().sync(); connectFuture2.channel().close().sync();
NioUdtByteAcceptorChannelTest.log.info("handler1 : {}", handler1.meter().count()); log.info("handler1 : {}", handler1.meter().count());
NioUdtByteAcceptorChannelTest.log.info("handler2 : {}", handler2.meter().count()); log.info("handler2 : {}", handler2.meter().count());
assertTrue(handler1.meter().count() >= transferLimit); assertTrue(handler1.meter().count() >= transferLimit);
assertTrue(handler2.meter().count() >= transferLimit); assertTrue(handler2.meter().count() >= transferLimit);

View File

@ -18,23 +18,17 @@ package io.netty.test.udt.nio;
import io.netty.channel.udt.UdtServerChannel; import io.netty.channel.udt.UdtServerChannel;
import io.netty.channel.udt.nio.NioUdtProvider; import io.netty.channel.udt.nio.NioUdtProvider;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class NioUdtProviderTest extends AbstractUdtTest { public class NioUdtProviderTest extends AbstractUdtTest {
protected static final Logger log = LoggerFactory.getLogger(NioUdtProviderTest.class);
/** /**
* verify factory * verify factory
*/ */
@Test @Test
public void provideFactory() { public void provideFactory() {
// bytes // bytes
assertNotNull(NioUdtProvider.BYTE_ACCEPTOR.newChannel()); assertNotNull(NioUdtProvider.BYTE_ACCEPTOR.newChannel());
assertNotNull(NioUdtProvider.BYTE_CONNECTOR.newChannel()); assertNotNull(NioUdtProvider.BYTE_CONNECTOR.newChannel());
@ -48,7 +42,5 @@ public class NioUdtProviderTest extends AbstractUdtTest {
// acceptor types // acceptor types
assertTrue(NioUdtProvider.BYTE_ACCEPTOR.newChannel() instanceof UdtServerChannel); assertTrue(NioUdtProvider.BYTE_ACCEPTOR.newChannel() instanceof UdtServerChannel);
assertTrue(NioUdtProvider.MESSAGE_ACCEPTOR.newChannel() instanceof UdtServerChannel); assertTrue(NioUdtProvider.MESSAGE_ACCEPTOR.newChannel() instanceof UdtServerChannel);
} }
} }