-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid Thread Leak when used dynamically in a Route (#143)
* WIP testing * Cleanup * Set success on failure
- Loading branch information
1 parent
1331913
commit d971d81
Showing
4 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
appender-log4j2/src/test/java/com/van/logging/log4j2/Log4j2AppenderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.van.logging.log4j2; | ||
|
||
import com.van.logging.LoggingEventCache; | ||
import junit.framework.TestCase; | ||
import org.apache.logging.log4j.core.Filter; | ||
import org.apache.logging.log4j.core.Layout; | ||
|
||
import static org.easymock.EasyMock.expect; | ||
import static org.easymock.EasyMock.mock; | ||
import static org.easymock.EasyMock.replay; | ||
import static org.easymock.EasyMock.verify; | ||
|
||
public class Log4j2AppenderTest extends TestCase { | ||
|
||
public void testClose() { | ||
final String name = "test"; | ||
final Filter filter = mock(Filter.class); | ||
final Layout layout = mock(Layout.class); | ||
final LoggingEventCache loggingEventCache = mock(LoggingEventCache.class); | ||
final Log4j2Appender appender = new Log4j2Appender(name, filter, layout, false, loggingEventCache); | ||
|
||
expect(loggingEventCache.flushAndPublish(true)).andReturn(null); | ||
expect(loggingEventCache.stop()).andReturn(true); | ||
replay(loggingEventCache); | ||
appender.stop(); | ||
verify(loggingEventCache); | ||
} | ||
} |