Added an option to exclude timing tests
This commit is contained in:
parent
832ed0c198
commit
0a72ffeacd
@ -34,6 +34,7 @@ import org.jboss.netty.bootstrap.ClientBootstrap;
|
|||||||
import org.jboss.netty.channel.ChannelFuture;
|
import org.jboss.netty.channel.ChannelFuture;
|
||||||
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
|
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
|
||||||
import org.jboss.netty.util.DummyHandler;
|
import org.jboss.netty.util.DummyHandler;
|
||||||
|
import org.jboss.netty.util.TimingTestUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +49,10 @@ public class NioClientSocketShutdownTimeTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShutdownTime() throws Throwable {
|
public void testShutdownTime() throws Throwable {
|
||||||
|
if (!TimingTestUtil.isTimingTestEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ServerSocketChannel serverSocket = ServerSocketChannel.open();
|
ServerSocketChannel serverSocket = ServerSocketChannel.open();
|
||||||
serverSocket.socket().bind(new InetSocketAddress(0));
|
serverSocket.socket().bind(new InetSocketAddress(0));
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ import org.jboss.netty.channel.ChannelPipelineCoverage;
|
|||||||
import org.jboss.netty.channel.ChannelStateEvent;
|
import org.jboss.netty.channel.ChannelStateEvent;
|
||||||
import org.jboss.netty.channel.SimpleChannelHandler;
|
import org.jboss.netty.channel.SimpleChannelHandler;
|
||||||
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
||||||
|
import org.jboss.netty.util.TimingTestUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
@ -51,6 +52,10 @@ public class NioServerSocketShutdownTimeTest {
|
|||||||
|
|
||||||
@Test(timeout = 10000)
|
@Test(timeout = 10000)
|
||||||
public void testSuccessfulBindAttempt() throws Exception {
|
public void testSuccessfulBindAttempt() throws Exception {
|
||||||
|
if (!TimingTestUtil.isTimingTestEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap(
|
ServerBootstrap bootstrap = new ServerBootstrap(
|
||||||
new NioServerSocketChannelFactory(
|
new NioServerSocketChannelFactory(
|
||||||
Executors.newCachedThreadPool(),
|
Executors.newCachedThreadPool(),
|
||||||
|
46
src/test/java/org/jboss/netty/util/TimingTestUtil.java
Normal file
46
src/test/java/org/jboss/netty/util/TimingTestUtil.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* JBoss, Home of Professional Open Source
|
||||||
|
*
|
||||||
|
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
||||||
|
* by the @author tags. See the COPYRIGHT.txt in the distribution for a
|
||||||
|
* full listing of individual contributors.
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this software; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
||||||
|
*/
|
||||||
|
package org.jboss.netty.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||||
|
* @author Trustin Lee (tlee@redhat.com)
|
||||||
|
* @version $Rev$, $Date$
|
||||||
|
*/
|
||||||
|
public final class TimingTestUtil {
|
||||||
|
private static final boolean ENABLED;
|
||||||
|
|
||||||
|
static {
|
||||||
|
String value = System.getProperty("exclude-timing-tests", "false");
|
||||||
|
ENABLED = !ConversionUtil.toBoolean(value);
|
||||||
|
System.out.println("Timing tests will be disabled as requested.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isTimingTestEnabled() {
|
||||||
|
return ENABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TimingTestUtil() {
|
||||||
|
// Unused
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user