From c68c2e5ddc0ed589b0f1e24bac7b9300a0ea5153 Mon Sep 17 00:00:00 2001 From: Marcus Ljungberg Date: Sun, 15 Jan 2017 18:37:43 +0100 Subject: [PATCH] Update to latest logback and jackson version (#16) --- .../eclipse/EclipseLogAppenderTest.java | 43 ++++++++++--------- .../contrib/json/access/JsonLayoutTest.java | 6 +-- pom.xml | 4 +- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/eclipse/src/test/java/ch/qos/logback/contrib/eclipse/EclipseLogAppenderTest.java b/eclipse/src/test/java/ch/qos/logback/contrib/eclipse/EclipseLogAppenderTest.java index 2c6d60d..b83f679 100644 --- a/eclipse/src/test/java/ch/qos/logback/contrib/eclipse/EclipseLogAppenderTest.java +++ b/eclipse/src/test/java/ch/qos/logback/contrib/eclipse/EclipseLogAppenderTest.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; +import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.encoder.PatternLayoutEncoder; import ch.qos.logback.contrib.eclipse.EclipseLogAppender; import ch.qos.logback.contrib.eclipse.IPlatform; @@ -51,16 +52,18 @@ public class EclipseLogAppenderTest { private EclipseLogAppenderWithMockPlatform appender = null; private PatternLayoutEncoder encoder = null; - + @Before public void before() { // create the encoder and start it so that it initializes inner parameters // needed by the appender + LoggerContext context = new LoggerContext(); encoder = new PatternLayoutEncoder(); encoder.setPattern("%msg"); + encoder.setContext(context); encoder.start(); assertNotNull(encoder.getLayout()); - + appender = new EclipseLogAppenderWithMockPlatform(); appender.setEncoder(encoder); } @@ -72,7 +75,7 @@ public void testNullBundleName() { appender.start(); // then appender should still start because the field is optional assertTrue(appender.isStarted()); - + // verify valid default bundle name assertNotNull(appender.getBundleName()); assertEquals(EclipseLogAppender.DEFAULT_BUNDLE_SYMBOLIC_NAME, appender.getBundleName()); @@ -104,12 +107,12 @@ public void testNullEncoder() { // then appender should not start assertFalse(appender.isStarted()); } - + @Test public void testAppendInfo() { MockEclipseErrorLog log = (MockEclipseErrorLog)appender.getPlatform().getLog(null); List events = log.getLog(); - + //TODO: write me... } } @@ -121,12 +124,12 @@ public void testAppendInfo() { class EclipseLogAppenderWithMockPlatform extends EclipseLogAppender { static private final IPlatform _platform = new IPlatform() { private final MockEclipseErrorLog log = new MockEclipseErrorLog(); - + @Override public ILog getLog(Bundle bundle) { return log; } - + @Override public Bundle getBundle(String bundleName) { if (log.getBundle().getSymbolicName().equals(bundleName)) { @@ -135,7 +138,7 @@ public Bundle getBundle(String bundleName) { return null; } }; - + @Override protected IPlatform getPlatform() { return _platform; @@ -148,11 +151,11 @@ protected IPlatform getPlatform() { class MockEclipseErrorLog implements ILog { static private final MockEclipseBundle BUNDLE = new MockEclipseBundle(); private List log; - + @Override public void addLogListener(ILogListener listener) { // TODO Auto-generated method stub - + } @Override @@ -168,9 +171,9 @@ public void log(IStatus status) { @Override public void removeLogListener(ILogListener listener) { // TODO Auto-generated method stub - + } - + public List getLog() { return log; } @@ -190,43 +193,43 @@ public int getState() { @Override public void start(int options) throws BundleException { // TODO Auto-generated method stub - + } @Override public void start() throws BundleException { // TODO Auto-generated method stub - + } @Override public void stop(int options) throws BundleException { // TODO Auto-generated method stub - + } @Override public void stop() throws BundleException { // TODO Auto-generated method stub - + } @Override public void update(InputStream input) throws BundleException { // TODO Auto-generated method stub - + } @Override public void update() throws BundleException { // TODO Auto-generated method stub - + } @Override public void uninstall() throws BundleException { // TODO Auto-generated method stub - + } @Override @@ -314,7 +317,7 @@ public long getLastModified() { @Override public Enumeration findEntries(String path, String filePattern, - boolean recurse) { + boolean recurse) { // TODO Auto-generated method stub return null; } diff --git a/json/access/src/test/java/ch/qos/logback/contrib/json/access/JsonLayoutTest.java b/json/access/src/test/java/ch/qos/logback/contrib/json/access/JsonLayoutTest.java index 68d420f..8525322 100644 --- a/json/access/src/test/java/ch/qos/logback/contrib/json/access/JsonLayoutTest.java +++ b/json/access/src/test/java/ch/qos/logback/contrib/json/access/JsonLayoutTest.java @@ -12,7 +12,6 @@ */ package ch.qos.logback.contrib.json.access; -import ch.qos.logback.access.TeztConstants; import ch.qos.logback.access.dummy.DummyAccessEventBuilder; import ch.qos.logback.access.joran.JoranConfigurator; import ch.qos.logback.access.spi.AccessContext; @@ -26,6 +25,7 @@ import java.util.LinkedHashMap; import java.util.Map; +import static ch.qos.logback.access.AccessTestConstants.TEST_DIR_PREFIX; import static ch.qos.logback.contrib.json.access.JsonLayout.REQUESTTIME_ATTR_NAME; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.not; @@ -139,7 +139,7 @@ public void addMapToJsonMap() throws Exception { @Test public void jsonLayout() throws Exception { - configure(TeztConstants.TEST_DIR_PREFIX + "input/json/jsonLayout.xml"); + configure(TEST_DIR_PREFIX + "input/json/jsonLayout.xml"); ListAppender listAppender = (ListAppender) context.getAppender("STR_LIST"); IAccessEvent event = DummyAccessEventBuilder.buildNewAccessEvent(); listAppender.doAppend(event); @@ -168,7 +168,7 @@ public void jsonLayout() throws Exception { @Test public void jsonLayoutIncludeDefaultOff() throws Exception { - configure(TeztConstants.TEST_DIR_PREFIX + "input/json/jsonLayout.xml"); + configure(TEST_DIR_PREFIX + "input/json/jsonLayout.xml"); ListAppender listAppender = (ListAppender) context.getAppender("STR_LIST"); IAccessEvent event = DummyAccessEventBuilder.buildNewAccessEvent(); listAppender.doAppend(event); diff --git a/pom.xml b/pom.xml index da4c1aa..d5f3b91 100755 --- a/pom.xml +++ b/pom.xml @@ -106,8 +106,8 @@ UTF-8 - 1.1.3 - 2.1.3 + 1.1.8 + 2.8.5 2.10.1 false