* JdkLogger passes null method name now - it's allowed in the specification explicitly.

* Better failure tracking in ServerBootStrapTest (still not sure if it's reproduceable)
This commit is contained in:
Trustin Lee 2008-08-25 12:46:33 +00:00
parent 10bc616b4b
commit e5f1639f24
3 changed files with 21 additions and 19 deletions

View File

@ -43,27 +43,27 @@ class JdkLogger implements InternalLogger {
} }
public void debug(String msg) { public void debug(String msg) {
logger.logp(Level.FINE, loggerName, "-", msg); logger.logp(Level.FINE, loggerName, null, msg);
} }
public void debug(String msg, Throwable cause) { public void debug(String msg, Throwable cause) {
logger.logp(Level.FINE, loggerName, "-", msg, cause); logger.logp(Level.FINE, loggerName, null, msg, cause);
} }
public void error(String msg) { public void error(String msg) {
logger.logp(Level.SEVERE, loggerName, "-", msg); logger.logp(Level.SEVERE, loggerName, null, msg);
} }
public void error(String msg, Throwable cause) { public void error(String msg, Throwable cause) {
logger.logp(Level.SEVERE, loggerName, "-", msg, cause); logger.logp(Level.SEVERE, loggerName, null, msg, cause);
} }
public void info(String msg) { public void info(String msg) {
logger.logp(Level.INFO, loggerName, "-", msg); logger.logp(Level.INFO, loggerName, null, msg);
} }
public void info(String msg, Throwable cause) { public void info(String msg, Throwable cause) {
logger.logp(Level.INFO, loggerName, "-", msg, cause); logger.logp(Level.INFO, loggerName, null, msg, cause);
} }
public boolean isDebugEnabled() { public boolean isDebugEnabled() {
@ -83,11 +83,11 @@ class JdkLogger implements InternalLogger {
} }
public void warn(String msg) { public void warn(String msg) {
logger.logp(Level.WARNING, loggerName, "-", msg); logger.logp(Level.WARNING, loggerName, null, msg);
} }
public void warn(String msg, Throwable cause) { public void warn(String msg, Throwable cause) {
logger.logp(Level.WARNING, loggerName, "-", msg, cause); logger.logp(Level.WARNING, loggerName, null, msg, cause);
} }
@Override @Override

View File

@ -79,7 +79,6 @@ public class ServerBootstrapTest {
} }
} }
@Test(timeout = 10000, expected = ChannelException.class) @Test(timeout = 10000, expected = ChannelException.class)
public void testFailedBindAttempt() throws Exception { public void testFailedBindAttempt() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap(); ServerBootstrap bootstrap = new ServerBootstrap();
@ -88,7 +87,7 @@ public class ServerBootstrapTest {
bootstrap.bind(); bootstrap.bind();
} }
@Test //(timeout = 10000) @Test(timeout = 10000)
public void testSuccessfulBindAttempt() throws Exception { public void testSuccessfulBindAttempt() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap( ServerBootstrap bootstrap = new ServerBootstrap(
new OioServerSocketChannelFactory(executor, executor)); new OioServerSocketChannelFactory(executor, executor));
@ -134,9 +133,12 @@ public class ServerBootstrapTest {
Thread.yield(); Thread.yield();
} }
while ("12".equals(pch.result.toString())) { // FIXME Sometimes hangs here (seems like childChannelClosed is not called at all?)
while (pch.result.length() < 2) {
Thread.yield(); Thread.yield();
} }
assertEquals("12", pch.result.toString());
} }
@Test(expected = ChannelPipelineException.class) @Test(expected = ChannelPipelineException.class)

View File

@ -99,7 +99,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.FINE, "foo", "-", "a"); mock.logp(Level.FINE, "foo", null, "a");
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -112,7 +112,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.FINE, "foo", "-", "a", e); mock.logp(Level.FINE, "foo", null, "a", e);
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -125,7 +125,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.INFO, "foo", "-", "a"); mock.logp(Level.INFO, "foo", null, "a");
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -138,7 +138,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.INFO, "foo", "-", "a", e); mock.logp(Level.INFO, "foo", null, "a", e);
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -151,7 +151,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.WARNING, "foo", "-", "a"); mock.logp(Level.WARNING, "foo", null, "a");
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -164,7 +164,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.WARNING, "foo", "-", "a", e); mock.logp(Level.WARNING, "foo", null, "a", e);
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -177,7 +177,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.SEVERE, "foo", "-", "a"); mock.logp(Level.SEVERE, "foo", null, "a");
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");
@ -190,7 +190,7 @@ public class JdkLoggerTest {
java.util.logging.Logger mock = java.util.logging.Logger mock =
createStrictMock(java.util.logging.Logger.class); createStrictMock(java.util.logging.Logger.class);
mock.logp(Level.SEVERE, "foo", "-", "a", e); mock.logp(Level.SEVERE, "foo", null, "a", e);
replay(mock); replay(mock);
InternalLogger logger = new JdkLogger(mock, "foo"); InternalLogger logger = new JdkLogger(mock, "foo");