logback-dev
Threads by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 9940 discussions
[JIRA] Created: (LBCORE-67) Unsecure usage of locks in AppenderAttachableImpl
by Joern Huxhorn (JIRA) 03 Dec '08
by Joern Huxhorn (JIRA) 03 Dec '08
03 Dec '08
Unsecure usage of locks in AppenderAttachableImpl
-------------------------------------------------
Key: LBCORE-67
URL: http://jira.qos.ch/browse/LBCORE-67
Project: logback-core
Issue Type: Bug
Components: Appender
Affects Versions: 0.9.10
Reporter: Joern Huxhorn
Assignee: Logback dev list
Attachments: LockPatch.patch
The unlock of a lock should, I would even say "must", always be done in
a finally block. Otherwise really bad things (deadlock) can happen if an exception
is thrown.
See http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
3
11
Author: ceki
Date: Wed Dec 3 15:53:30 2008
New Revision: 2048
Modified:
logback/trunk/logback-core/pom.xml
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/helpers/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/action/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/EventRecorderTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/InPlayFireTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/replay/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PropertySetterTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/SimpleStoreTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/FormatInfoTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/OptionTokenizerTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/FileNamePatternTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/DurationTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/FileSizeTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/OptionHelperTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/StatusPrinterTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/TimeUtilTest.java
Log:
- added references to easymock in pom.xml
- converted all tests in logback-core to JUnit 4
Modified: logback/trunk/logback-core/pom.xml
==============================================================================
--- logback/trunk/logback-core/pom.xml (original)
+++ logback/trunk/logback-core/pom.xml Wed Dec 3 15:53:30 2008
@@ -7,12 +7,12 @@
<artifactId>logback-parent</artifactId>
<version>0.9.12-SNAPSHOT</version>
</parent>
-
+
<modelVersion>4.0.0</modelVersion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>${parent.version}</version>
+ <version>${parent.version}</version>
<packaging>jar</packaging>
<name>Logback Core Module</name>
@@ -51,6 +51,15 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.4</version>
+ <scope>test</scope>
+ </dependency>
+
+
</dependencies>
@@ -92,7 +101,7 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin>
</plugins>
</build>
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/AllCoreTest.java Wed Dec 3 15:53:30 2008
@@ -9,22 +9,19 @@
*/
package ch.qos.logback.core;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class AllCoreTest extends TestCase {
+(a)RunWith(Suite.class)
+(a)SuiteClasses({ch.qos.logback.core.util.PackageTest.class,
+ ch.qos.logback.core.helpers.PackageTest.class,
+ ch.qos.logback.core.pattern.PackageTest.class,
+ ch.qos.logback.core.PackageTest.class,
+ ch.qos.logback.core.joran.PackageTest.class,
+ ch.qos.logback.core.appender.PackageTest.class,
+ ch.qos.logback.core.spi.PackageTest.class,
+ ch.qos.logback.core.rolling.PackageTest.class})
+public class AllCoreTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(ch.qos.logback.core.util.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.helpers.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.pattern.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.joran.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.appender.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.spi.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.rolling.PackageTest.suite());
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -1,15 +1,10 @@
package ch.qos.logback.core;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(WriterAppenderTest.class));
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({WriterAppenderTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/appender/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -10,18 +10,14 @@
package ch.qos.logback.core.appender;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
-public class PackageTest extends TestCase {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(DummyAppenderTest.class));
- suite.addTest(new JUnit4TestAdapter(ConsoleAppenderTest.class));
- suite.addTest(new JUnit4TestAdapter(FileAppenderTest.class));
- return suite;
- }
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses( { DummyAppenderTest.class, ConsoleAppenderTest.class,
+ FileAppenderTest.class})
+
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/helpers/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/helpers/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/helpers/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -1,15 +1,11 @@
package ch.qos.logback.core.helpers;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
+(a)RunWith(Suite.class)
+(a)SuiteClasses({ThrowableToStringArrayTest.class})
+public class PackageTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(ch.qos.logback.core.helpers.ThrowableToStringArrayTest.class));
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,22 +9,17 @@
*/
package ch.qos.logback.core.joran;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
+(a)RunWith(Suite.class)
+(a)SuiteClasses({SkippingInInterpreterTest.class, TrivialcConfiguratorTest.class, ch.qos.logback.core.joran.action.PackageTest.class,
+ ch.qos.logback.core.joran.event.PackageTest.class,
+ ch.qos.logback.core.joran.spi.PackageTest.class,
+ ch.qos.logback.core.joran.replay.PackageTest.class,
+ ch.qos.logback.core.joran.implicitAction.PackageTest.class
+ })
+public class PackageTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(SkippingInInterpreterTest.class));
- suite.addTest(new JUnit4TestAdapter(TrivialcConfiguratorTest.class));
- suite.addTest(ch.qos.logback.core.joran.action.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.joran.event.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.joran.spi.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.joran.replay.PackageTest.suite());
- suite.addTest(ch.qos.logback.core.joran.implicitAction.PackageTest.suite());
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/action/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/action/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/action/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,18 +9,11 @@
*/
package ch.qos.logback.core.joran.action;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(PropertyActionTest.class));
- suite.addTest(new JUnit4TestAdapter(IncludeActionTest.class));
-
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({PropertyActionTest.class, IncludeActionTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/EventRecorderTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/EventRecorderTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/EventRecorderTest.java Wed Dec 3 15:53:30 2008
@@ -9,24 +9,19 @@
*/
package ch.qos.logback.core.joran.event;
+import static org.junit.Assert.*;
+
import java.io.FileInputStream;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import org.junit.Test;
import org.xml.sax.Attributes;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.joran.event.BodyEvent;
-import ch.qos.logback.core.joran.event.SaxEvent;
-import ch.qos.logback.core.joran.event.SaxEventRecorder;
-import ch.qos.logback.core.joran.event.StartEvent;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.StatusManager;
import ch.qos.logback.core.util.Constants;
@@ -36,30 +31,16 @@
*
* @author Ceki Gulcu
*/
-public class EventRecorderTest extends TestCase {
+public class EventRecorderTest {
Context context = new ContextBase();
- public EventRecorderTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
SAXParser createParser() throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
return spf.newSAXParser();
}
-
+
public List<SaxEvent> doTest(String filename) throws Exception {
SaxEventRecorder recorder = new SaxEventRecorder();
recorder.setContext(context);
@@ -82,6 +63,7 @@
*
* @throws Exception
*/
+ @Test
public void test1() throws Exception {
List<SaxEvent> seList = doTest("event1.xml");
StatusManager sm = context.getStatusManager();
@@ -91,6 +73,7 @@
}
+ @Test
public void test2() throws Exception {
List<SaxEvent> seList = doTest("ampEvent.xml");
StatusManager sm = context.getStatusManager();
@@ -102,6 +85,7 @@
assertEquals("xxx & yyy", be.getText());
}
+ @Test
public void test3() throws Exception {
List<SaxEvent> seList = doTest("inc.xml");
StatusManager sm = context.getStatusManager();
@@ -115,11 +99,4 @@
assertEquals("1", attr.getValue("increment"));
}
- public static Test XXXsuite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new EventRecorderTest("test2"));
- // suite.addTestSuite(SkippingInInterpreterTest.class);
- return suite;
- }
-
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/InPlayFireTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/InPlayFireTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/InPlayFireTest.java Wed Dec 3 15:53:30 2008
@@ -9,9 +9,13 @@
*/
package ch.qos.logback.core.joran.event;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.HashMap;
-import junit.framework.TestCase;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.joran.TrivialConfigurator;
@@ -20,11 +24,12 @@
import ch.qos.logback.core.joran.spi.Pattern;
import ch.qos.logback.core.util.Constants;
-public class InPlayFireTest extends TestCase {
+public class InPlayFireTest {
Context context = new ContextBase();
HashMap<Pattern, Action> rulesMap = new HashMap<Pattern, Action>();
+ @Test
public void testBasic() throws JoranException {
ListenAction listenAction = new ListenAction();
@@ -44,6 +49,7 @@
assertTrue(listenAction.getSeList().get(3) instanceof EndEvent);
}
+ @Test
public void testReplay() throws JoranException {
ListenAction listenAction = new ListenAction();
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/event/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,16 +9,11 @@
*/
package ch.qos.logback.core.joran.event;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(EventRecorderTest.class);
- suite.addTestSuite(InPlayFireTest.class);
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({EventRecorderTest.class, InPlayFireTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/implicitAction/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,16 +9,11 @@
*/
package ch.qos.logback.core.joran.implicitAction;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(ImplicitActionTest.class));
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({ImplicitActionTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/replay/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/replay/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/replay/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,16 +9,12 @@
*/
package ch.qos.logback.core.joran.replay;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
+(a)RunWith(Suite.class)
+(a)SuiteClasses({FruitConfigurationTest.class})
+public class PackageTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(FruitConfigurationTest.class));
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,18 +9,11 @@
*/
package ch.qos.logback.core.joran.spi;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(PatternTest.class));
- suite.addTestSuite(SimpleStoreTest.class);
- suite.addTestSuite(PropertySetterTest.class);
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({PatternTest.class, SimpleStoreTest.class, PropertySetterTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PropertySetterTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PropertySetterTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PropertySetterTest.java Wed Dec 3 15:53:30 2008
@@ -1,9 +1,12 @@
package ch.qos.logback.core.joran.spi;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.joran.action.IADataForComplexProperty;
@@ -13,8 +16,9 @@
import ch.qos.logback.core.util.FileSize;
import ch.qos.logback.core.util.StatusPrinter;
-public class PropertySetterTest extends TestCase {
+public class PropertySetterTest {
+ @Test
public void testCanAggregateComponent() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
@@ -41,6 +45,7 @@
System.out.println();
}
+ @Test
public void testSetProperty() {
{
House house = new House();
@@ -67,6 +72,7 @@
}
}
+ @Test
public void testSetCamelProperty() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
@@ -78,6 +84,7 @@
assertEquals("gh", house.getCamelCase());
}
+ @Test
public void testSetComplexProperty() {
House house = new House();
Door door = new Door();
@@ -86,6 +93,7 @@
assertEquals(door, house.getDoor());
}
+ @Test
public void testSetComplexProperty2() {
House house = new House();
//Door door = new Door();
@@ -100,6 +108,8 @@
//setter.setComplexProperty("door", door);
//assertEquals(door, house.getDoor());
}
+
+ @Test
public void testPropertyCollection() {
House house = new House();
Context context = new ContextBase();
@@ -113,6 +123,7 @@
assertEquals("big", house.adjectiveList.get(1));
}
+ @Test
public void testComplexCollection() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
@@ -128,6 +139,7 @@
assertEquals(20, house.windowList.get(1).handle);
}
+ @Test
public void testSetComplexWithCamelCaseName() {
House house = new House();
SwimmingPool pool = new SwimmingPool();
@@ -136,6 +148,7 @@
assertEquals(pool, house.getSwimmingPool());
}
+ @Test
public void testDuration() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
@@ -143,6 +156,7 @@
assertEquals(1400, house.getDuration().getMilliseconds());
}
+ @Test
public void testFileSize() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
@@ -150,6 +164,7 @@
assertEquals(2*1024, house.getFs().getSize());
}
+ @Test
public void testFilterReply() {
//test case reproducing bug #52
House house = new House();
@@ -158,6 +173,7 @@
assertEquals(FilterReply.ACCEPT, house.getFilterReply());
}
+ @Test
public void testEnum() {
House house = new House();
PropertySetter setter = new PropertySetter(house);
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/SimpleStoreTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/SimpleStoreTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/SimpleStoreTest.java Wed Dec 3 15:53:30 2008
@@ -1,19 +1,23 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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.
*/
-
package ch.qos.logback.core.joran.spi;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import junit.framework.TestCase;
+import java.util.List;
+import org.junit.Test;
import org.xml.sax.Attributes;
import ch.qos.logback.core.ContextBase;
@@ -23,23 +27,9 @@
*
* @author Ceki Gulcu
*/
-public class SimpleStoreTest extends TestCase {
-
- public SimpleStoreTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+public class SimpleStoreTest {
+ @Test
public void test1() throws Exception {
// Document doc = getW3Document("file:input/joran/parser1.xml");
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
@@ -71,6 +61,7 @@
}
+ @Test
public void testSlashSuffix() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
Pattern pa = new Pattern("a/");
@@ -86,6 +77,8 @@
}
+
+ @Test
public void testTail1() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("*/b"), new XAction());
@@ -101,6 +94,7 @@
}
+ @Test
public void testTail2() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("*/c"), new XAction());
@@ -115,6 +109,7 @@
}
}
+ @Test
public void testTail3() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("*/b"), new XAction());
@@ -131,6 +126,7 @@
}
}
+ @Test
public void testTail4() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("*/b"), new XAction());
@@ -148,6 +144,7 @@
}
}
+ @Test
public void testSuffix() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("a"), new XAction());
@@ -159,6 +156,7 @@
assertTrue(r.get(0) instanceof YAction);
}
+ @Test
public void testDeepSuffix() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("a"), new XAction(1));
@@ -168,6 +166,7 @@
assertNull(r);
}
+ @Test
public void testPrefixSuffixInteraction1() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("a"), new ZAction());
@@ -184,6 +183,7 @@
assertEquals(3, xaction.id);
}
+ @Test
public void testPrefixSuffixInteraction2() throws Exception {
SimpleRuleStore srs = new SimpleRuleStore(new ContextBase());
srs.addRule(new Pattern("testGroup"), new XAction());
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -1,16 +1,10 @@
package ch.qos.logback.core.pattern;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(ch.qos.logback.core.pattern.SpacePadderTest.class));
- suite.addTest(ch.qos.logback.core.pattern.parser.PackageTest.suite());
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({SpacePadderTest.class, ch.qos.logback.core.pattern.parser.PackageTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/CompilerTest.java Wed Dec 3 15:53:30 2008
@@ -9,10 +9,15 @@
*/
package ch.qos.logback.core.pattern.parser;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.pattern.Converter;
@@ -22,24 +27,16 @@
import ch.qos.logback.core.util.StatusPrinter;
-public class CompilerTest extends TestCase {
+public class CompilerTest {
Map<String, String> converterMap = new HashMap<String, String>();
Context context = new ContextBase();
- public CompilerTest(String arg0) {
- super(arg0);
+ @Before public void setUp() {
converterMap.put("OTT", Converter123.class.getName());
converterMap.put("hello", ConverterHello.class.getName());
}
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
String write(final Converter<Object> head, Object event) {
StringBuffer buf = new StringBuffer();
@@ -51,6 +48,7 @@
return buf.toString();
}
+ @Test
public void testLiteral() throws Exception {
Parser<Object> p = new Parser<Object>("hello");
Node t = p.parse();
@@ -59,6 +57,7 @@
assertEquals("hello", result);
}
+ @Test
public void testBasic() throws Exception {
{
Parser<Object> p = new Parser<Object>("abc %hello");
@@ -78,6 +77,7 @@
}
}
+ @Test
public void testFormat() throws Exception {
{
Parser<Object> p = new Parser<Object>("abc %7hello");
@@ -149,6 +149,7 @@
}
}
+ @Test
public void testComposite() throws Exception {
// {
// Parser<Object> p = new Parser<Object>("%(ABC)");
@@ -178,6 +179,7 @@
}
}
+ @Test
public void testCompositeFormatting() throws Exception {
{
Parser<Object> p = new Parser<Object>("xyz %4.10(ABC)");
@@ -225,6 +227,7 @@
}
}
+ @Test
public void testUnknownWord() throws Exception {
Parser<Object> p = new Parser<Object>("%unknown");
p.setContext(context);
@@ -235,6 +238,7 @@
.containsMatch("\\[unknown] is not a valid conversion word"));
}
+ @Test
public void testWithNopEscape() throws Exception {
{
Parser<Object> p = new Parser<Object>("xyz %hello\\_world");
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/FormatInfoTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/FormatInfoTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/FormatInfoTest.java Wed Dec 3 15:53:30 2008
@@ -9,12 +9,17 @@
*/
package ch.qos.logback.core.pattern.parser;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
import ch.qos.logback.core.pattern.FormatInfo;
-import junit.framework.TestCase;
-public class FormatInfoTest extends TestCase {
+public class FormatInfoTest {
+ @Test
public void testEndingInDot() {
try {
FormatInfo.valueOf("45.");
@@ -24,6 +29,7 @@
}
}
+ @Test
public void testBasic() {
{
FormatInfo fi = FormatInfo.valueOf("45");
@@ -41,6 +47,7 @@
}
}
+ @Test
public void testRightPad() {
{
FormatInfo fi = FormatInfo.valueOf("-40");
@@ -70,6 +77,7 @@
}
}
+ @Test
public void testMinOnly() {
{
FormatInfo fi = FormatInfo.valueOf("49");
@@ -88,6 +96,7 @@
}
+ @Test
public void testMaxOnly() {
{
FormatInfo fi = FormatInfo.valueOf(".49");
@@ -103,7 +112,5 @@
witness.setLeftTruncate(false);
assertEquals(witness, fi);
}
-
}
-
}
\ No newline at end of file
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/OptionTokenizerTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/OptionTokenizerTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/OptionTokenizerTest.java Wed Dec 3 15:53:30 2008
@@ -10,16 +10,16 @@
package ch.qos.logback.core.pattern.parser;
+import static org.junit.Assert.assertEquals;
+
import java.util.ArrayList;
import java.util.List;
-import ch.qos.logback.core.pattern.parser.OptionTokenizer;
-import ch.qos.logback.core.pattern.parser.ScanException;
-
-import junit.framework.TestCase;
+import org.junit.Test;
-public class OptionTokenizerTest extends TestCase {
+public class OptionTokenizerTest {
+ @Test
public void testEmpty() throws ScanException {
{
List ol = new OptionTokenizer("").tokenize();
@@ -34,6 +34,7 @@
}
}
+ @Test
public void testSimple() throws ScanException {
{
List ol = new OptionTokenizer("abc").tokenize();
@@ -43,6 +44,7 @@
}
}
+ @Test
public void testSingleQuote() throws ScanException {
{
List ol = new OptionTokenizer("' '").tokenize();
@@ -73,6 +75,7 @@
}
}
+ @Test
public void testDoubleQuote() throws ScanException {
{
List ol = new OptionTokenizer("\" \"").tokenize();
@@ -103,6 +106,7 @@
}
}
+ @Test
public void testMultiple() throws ScanException {
{
List ol = new OptionTokenizer("a, b").tokenize();
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -10,21 +10,16 @@
package ch.qos.logback.core.pattern.parser;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(TokenStreamTest.class);
- suite.addTestSuite(OptionTokenizerTest.class);
- suite.addTestSuite(ParserTest.class);
- suite.addTestSuite(FormatInfoTest.class);
- suite.addTestSuite(CompilerTest.class);
- suite.addTest(new JUnit4TestAdapter(SamplePatternLayoutTest.class));
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)SuiteClasses({TokenStreamTest.class,
+ OptionTokenizerTest.class,
+ ParserTest.class,
+ FormatInfoTest.class,
+ CompilerTest.class,
+ SamplePatternLayoutTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/ParserTest.java Wed Dec 3 15:53:30 2008
@@ -9,45 +9,18 @@
*/
package ch.qos.logback.core.pattern.parser;
+import static org.junit.Assert.assertEquals;
+
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Test;
import ch.qos.logback.core.pattern.FormatInfo;
-import ch.qos.logback.core.pattern.parser.CompositeNode;
-import ch.qos.logback.core.pattern.parser.FormattingNode;
-import ch.qos.logback.core.pattern.parser.KeywordNode;
-import ch.qos.logback.core.pattern.parser.Node;
-import ch.qos.logback.core.pattern.parser.Parser;
-
-public class ParserTest extends TestCase {
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
- /**
- * Constructor for PatternTest.
- *
- * @param arg0
- */
- public ParserTest(String arg0) {
- super(arg0);
- }
+public class ParserTest {
+ @Test
public void testBasic() throws Exception {
Parser p = new Parser("hello");
Node t = p.parse();
@@ -55,6 +28,7 @@
assertEquals("hello", t.getValue());
}
+ @Test
public void testKeyword() throws Exception {
{
@@ -78,6 +52,7 @@
}
}
+ @Test
public void testComposite() throws Exception {
{
Parser p = new Parser("hello%(%child)");
@@ -156,7 +131,8 @@
}
}
-
+
+ @Test
public void testNested() throws Exception {
{
Parser p = new Parser("%top %(%child%(%h))");
@@ -175,6 +151,7 @@
}
}
+ @Test
public void testFormattingInfo() throws Exception {
{
Parser p = new Parser("%45x");
@@ -218,6 +195,7 @@
}
}
+ @Test
public void testOptions() throws Exception {
{
Parser p = new Parser("%45x{'test '}");
@@ -243,6 +221,7 @@
}
}
+ @Test
public void testCompositeFormatting() throws Exception {
{
@@ -259,10 +238,4 @@
assertEquals(witness, t);
}
}
-
- public static Test Xsuite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new ParserTest("testFormattingInfo"));
- return suite;
- }
}
\ No newline at end of file
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/pattern/parser/TokenStreamTest.java Wed Dec 3 15:53:30 2008
@@ -10,33 +10,28 @@
package ch.qos.logback.core.pattern.parser;
-import java.util.ArrayList;
-import java.util.List;
-import ch.qos.logback.core.pattern.util.AlmostAsIsEscapeUtil;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
-public class TokenStreamTest extends TestCase {
+import org.junit.Test;
- public TokenStreamTest(String arg0) {
- super(arg0);
- }
+import ch.qos.logback.core.pattern.util.AlmostAsIsEscapeUtil;
- protected void setUp() throws Exception {
- super.setUp();
- }
+public class TokenStreamTest {
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void testEmpty() throws ScanException {
List tl = new TokenStream("").tokenize();
List witness = new ArrayList();
assertEquals(witness, tl);
}
+ @Test
public void testSingleLiteral() throws ScanException {
List tl = new TokenStream("hello").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -44,6 +39,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testLiteralWithPercent() throws ScanException {
{
List tl = new TokenStream("hello\\%world").tokenize();
@@ -67,6 +63,7 @@
}
}
+ @Test
public void testBasic() throws ScanException {
// test "%c"
@@ -101,6 +98,7 @@
}
}
+ @Test
public void testComplexNR() throws ScanException {
List tl = new TokenStream("%d{1234} [%34.-67toto] %n").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -117,6 +115,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testEmptyP() throws ScanException {
List tl = new TokenStream("()").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -125,6 +124,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testEmptyP2() throws ScanException {
List tl = new TokenStream("%()").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -134,6 +134,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testEscape() throws ScanException {
{
List tl = new TokenStream("\\%").tokenize();
@@ -186,6 +187,7 @@
}
}
+ @Test
public void testOptions() throws ScanException {
{
List tl = new TokenStream("%x{t}").tokenize();
@@ -224,6 +226,7 @@
}
}
+ @Test
public void testSimpleP() throws ScanException {
List tl = new TokenStream("%(hello %class{.4?})").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -237,6 +240,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testSimpleP2() throws ScanException {
List tl = new TokenStream("X %a %-12.550(hello %class{.4?})").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -255,6 +259,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testMultipleRecursion() throws ScanException {
List tl = new TokenStream("%-1(%d %45(%class %file))").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -278,6 +283,7 @@
assertEquals(witness, tl);
}
+ @Test
public void testNested() throws ScanException {
List tl = new TokenStream("%(%a%(%b))").tokenize();
List<Token> witness = new ArrayList<Token>();
@@ -296,6 +302,7 @@
}
+ @Test
public void testEscapedParanteheses() throws ScanException {
{
List tl = new TokenStream("\\(%h\\)").tokenize();
@@ -317,6 +324,7 @@
}
}
+ @Test
public void testWindowsLikeBackSlashes() throws ScanException {
{
List tl = new TokenStream("c:\\hello\\world.%i", new AlmostAsIsEscapeUtil())
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -1,18 +1,11 @@
package ch.qos.logback.core.rolling;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(RenamingTest.class);
- suite.addTest(new JUnit4TestAdapter(SizeBasedRollingTest.class));
- suite.addTest(new JUnit4TestAdapter(TimeBasedRollingTest.class));
- suite.addTest(ch.qos.logback.core.rolling.helper.PackageTest.suite());
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses( { RenamingTest.class, SizeBasedRollingTest.class,
+ TimeBasedRollingTest.class,
+ ch.qos.logback.core.rolling.helper.PackageTest.class })
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java Wed Dec 3 15:53:30 2008
@@ -1,7 +1,7 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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
@@ -10,17 +10,21 @@
package ch.qos.logback.core.rolling;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.layout.EchoLayout;
import ch.qos.logback.core.util.Compare;
import ch.qos.logback.core.util.Constants;
-import junit.framework.TestCase;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
/**
*
@@ -30,17 +34,13 @@
* @author Ceki
*
*/
-public class RenamingTest extends TestCase {
+public class RenamingTest {
Layout<Object> layout;
Context context = new ContextBase();
- public RenamingTest(String arg0) {
- super(arg0);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
layout = new EchoLayout<Object>();
File target = new File(Constants.OUTPUT_DIR_PREFIX + "test.log");
@@ -48,25 +48,23 @@
target.delete();
}
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
+ @Test
public void testRename() throws Exception {
RollingFileAppender<Object> rfa = new RollingFileAppender<Object>();
rfa.setLayout(layout);
rfa.setContext(context);
rfa.setFile(Constants.OUTPUT_DIR_PREFIX + "test.log");
-
+
// rollover by the second
String datePattern = "yyyy-MM-dd_HH_mm_ss";
SimpleDateFormat sdf = new SimpleDateFormat(datePattern);
String[] filenames = new String[2];
TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy();
- tbrp.setFileNamePattern(Constants.OUTPUT_DIR_PREFIX + "test-%d{" + datePattern + "}");
- //tbrp.setActiveFileName("src/test/output/test.log");
+ tbrp.setFileNamePattern(Constants.OUTPUT_DIR_PREFIX + "test-%d{"
+ + datePattern + "}");
+ // tbrp.setActiveFileName("src/test/output/test.log");
tbrp.setContext(context);
tbrp.setParent(rfa);
tbrp.start();
@@ -74,21 +72,22 @@
rfa.setRollingPolicy(tbrp);
rfa.start();
- //StatusPrinter.print(context.getStatusManager());
+ // StatusPrinter.print(context.getStatusManager());
Calendar cal = Calendar.getInstance();
rfa.doAppend("Hello 0");
DelayerUtil.delayUntilNextSecond(50);
rfa.doAppend("Hello 1");
- filenames[0] = Constants.OUTPUT_DIR_PREFIX + "test-" + sdf.format(cal.getTime());
+ filenames[0] = Constants.OUTPUT_DIR_PREFIX + "test-"
+ + sdf.format(cal.getTime());
filenames[1] = Constants.OUTPUT_DIR_PREFIX + "test.log";
for (int i = 0; i < filenames.length; i++) {
- //System.out.println("before i=" + i);
- assertTrue(Compare.compare(filenames[i],
- Constants.TEST_DIR_PREFIX + "witness/rolling/renaming." + i));
- //System.out.println("post i=" + i);
+ // System.out.println("before i=" + i);
+ assertTrue(Compare.compare(filenames[i], Constants.TEST_DIR_PREFIX
+ + "witness/rolling/renaming." + i));
+ // System.out.println("post i=" + i);
}
}
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/CompressTest.java Wed Dec 3 15:53:30 2008
@@ -9,6 +9,9 @@
*/
package ch.qos.logback.core.rolling.helper;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -16,7 +19,9 @@
import java.io.InputStream;
import java.io.OutputStream;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.util.Compare;
@@ -26,10 +31,11 @@
/**
* @author Ceki Gulcu
*/
-public class CompressTest extends TestCase {
+public class CompressTest {
Context context = new ContextBase();
+ @Before
public void setUp() throws IOException {
// Copy source files
// Delete output files
@@ -63,9 +69,8 @@
}
}
- public void tearDown() {
- }
+ @Test
public void test1() throws Exception {
Compressor compressor = new Compressor(CompressionMode.GZ,
Constants.TEST_DIR_PREFIX + "input/compress1.txt",
@@ -80,6 +85,7 @@
+ "witness/compress1.txt.gz"));
}
+ @Test
public void test2() throws Exception {
Compressor compressor = new Compressor(CompressionMode.GZ,
Constants.TEST_DIR_PREFIX + "input/compress2.txt",
@@ -94,6 +100,7 @@
+ "witness/compress2.txt.gz"));
}
+ @Test
public void test3() throws Exception {
Compressor compressor = new Compressor(CompressionMode.ZIP,
Constants.TEST_DIR_PREFIX + "input/compress3.txt",
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/FileNamePatternTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/FileNamePatternTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/FileNamePatternTest.java Wed Dec 3 15:53:30 2008
@@ -9,30 +9,26 @@
*/
package ch.qos.logback.core.rolling.helper;
+import static org.junit.Assert.*;
+
import java.util.Calendar;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
-import ch.qos.logback.core.rolling.helper.FileNamePattern;
import ch.qos.logback.core.util.StatusPrinter;
/**
* @author Ceki
*
*/
-public class FileNamePatternTest extends TestCase {
+public class FileNamePatternTest {
Context context = new ContextBase();
- public FileNamePatternTest(String arg) {
- super(arg);
- }
-
-
+ @Test
public void testSmoke() {
// System.out.println("Testing [t]");
FileNamePattern pp = new FileNamePattern("t", context);
@@ -67,6 +63,7 @@
assertEquals("%foo", pp.convertInt(3));
}
+ @Test
// test ways for dealing with flowing i converter, as in "foo%ix"
public void testFlowingI() {
// System.out.println("Testing [foo%ibar%i]");
@@ -81,6 +78,7 @@
}
}
+ @Test
public void testDate() {
Calendar cal = Calendar.getInstance();
cal.set(2003, 4, 20, 17, 55);
@@ -96,18 +94,12 @@
assertEquals("2003.05.20 17:55 foo", pp.convertDate(cal.getTime()));
}
-
+
+ @Test
public void testWithBackslash() {
FileNamePattern pp = new FileNamePattern("c:\\foo\\bar.%i", context);
assertEquals("c:\\foo\\bar.3", pp.convertInt(3));
}
- public static Test xsuite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new FileNamePatternTest("test1"));
- suite.addTest(new FileNamePatternTest("test2"));
- // suite.addTest(new FileNamePatternTestCase("test3"));
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/rolling/helper/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -1,27 +1,23 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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.
*/
-package ch.qos.logback.core.rolling.helper;
-
+package ch.qos.logback.core.rolling.helper;
-import junit.framework.Test;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses( { CompressTest.class, FileNamePatternTest.class,
+ RollingCalendarTest.class })
public class PackageTest extends TestCase {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(CompressTest.class);
- suite.addTestSuite(FileNamePatternTest.class);
- suite.addTestSuite(RollingCalendarTest.class);
- return suite;
- }
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/DurationTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/DurationTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/DurationTest.java Wed Dec 3 15:53:30 2008
@@ -10,25 +10,18 @@
package ch.qos.logback.core.util;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
-public class DurationTest extends TestCase {
+import org.junit.Test;
+
+
+public class DurationTest {
static long HOURS_CO = 60*60;
static long DAYS_CO = 24*60*60;
- public DurationTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void test() {
{
Duration d = Duration.valueOf("12");
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/FileSizeTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/FileSizeTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/FileSizeTest.java Wed Dec 3 15:53:30 2008
@@ -10,26 +10,19 @@
package ch.qos.logback.core.util;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
-public class FileSizeTest extends TestCase {
+import org.junit.Test;
+
+
+public class FileSizeTest{
static long KB_CO = 1024;
static long MB_CO = 1024*1024;
static long GB_CO = 1024*MB_CO;
- public FileSizeTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+ @Test
public void test() {
{
FileSize fs = FileSize.valueOf("8");
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/OptionHelperTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/OptionHelperTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/OptionHelperTest.java Wed Dec 3 15:53:30 2008
@@ -1,14 +1,19 @@
package ch.qos.logback.core.util;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.util.HashMap;
import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
-import junit.framework.TestCase;
-public class OptionHelperTest extends TestCase {
+public class OptionHelperTest {
String text = "Testing ${v1} variable substitution ${v2}";
String expected = "Testing if variable substitution works";
@@ -17,24 +22,19 @@
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
secondaryMap = new HashMap<String, String>();
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
}
+ @Test
public void testLiteral() {
String noSubst = "hello world";
String result = OptionHelper.substVars(noSubst, context);
assertEquals(noSubst, result);
}
-
+ @Test
public void testUndefinedValues() {
String withUndefinedValues = "${axyz}";
@@ -42,6 +42,7 @@
assertEquals("axyz"+OptionHelper._IS_UNDEFINED, result);
}
+ @Test
public void testSubstVarsVariableNotClosed() {
String noSubst = "testing if ${v1 works";
@@ -53,7 +54,7 @@
//ok
}
}
-
+ @Test
public void testSubstVarsContextOnly() {
context.putProperty("v1", "if");
context.putProperty("v2", "works");
@@ -62,7 +63,7 @@
assertEquals(expected, result);
}
-
+ @Test
public void testSubstVarsSystemProperties() {
System.setProperty("v1", "if");
System.setProperty("v2", "works");
@@ -74,6 +75,7 @@
System.clearProperty("v2");
}
+ @Test
public void testSubstVarsWithDefault() {
context.putProperty("v1", "if");
String textWithDefault = "Testing ${v1} variable substitution ${v2:-toto}";
@@ -83,6 +85,7 @@
assertEquals(resultWithDefault, result);
}
+ @Test
public void testSubstVarsRecursive() {
context.putProperty("v1", "if");
context.putProperty("v2", "${v3}");
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/PackageTest.java Wed Dec 3 15:53:30 2008
@@ -9,22 +9,17 @@
*/
package ch.qos.logback.core.util;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
-
-public class PackageTest extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(DurationTest.class);
- suite.addTestSuite(FileSizeTest.class);
- suite.addTest(new JUnit4TestAdapter(FileUtilTest.class));
- suite.addTestSuite(OptionHelperTest.class);
- suite.addTestSuite(StatusPrinterTest.class);
- suite.addTestSuite(TimeUtilTest.class);
- return suite;
- }
+(a)RunWith(Suite.class)
+@SuiteClasses({
+ DurationTest.class,
+ FileSizeTest.class,
+ FileUtilTest.class,
+ OptionHelperTest.class,
+ StatusPrinterTest.class,
+ TimeUtilTest.class})
+public class PackageTest {
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/StatusPrinterTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/StatusPrinterTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/StatusPrinterTest.java Wed Dec 3 15:53:30 2008
@@ -1,9 +1,14 @@
package ch.qos.logback.core.util;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.status.ErrorStatus;
@@ -11,37 +16,35 @@
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.WarnStatus;
-public class StatusPrinterTest extends TestCase {
+public class StatusPrinterTest {
ByteArrayOutputStream outputStream;
PrintStream ps;
- public StatusPrinterTest(String arg0) {
- super(arg0);
- }
-
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
outputStream = new ByteArrayOutputStream();
ps = new PrintStream(outputStream);
StatusPrinter.setPrintStream(ps);
- super.setUp();
}
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
StatusPrinter.setPrintStream(System.out);
ps = null;
outputStream = null;
- super.tearDown();
}
+ @Test
public void testBasic() {
Context context = new ContextBase();
context.getStatusManager().add(new InfoStatus("test", this));
StatusPrinter.print(context);
String result = outputStream.toString();
- assertTrue(result.contains("|-INFO in testBasic"));
+ assertTrue(result.contains("|-INFO in "+this.getClass().getName()));
}
+ @Test
public void testNested() {
Status s0 = new ErrorStatus("test0", this);
Status s1 = new InfoStatus("test1", this);
@@ -67,11 +70,12 @@
StatusPrinter.print(context);
String result = outputStream.toString();
- assertTrue(result.contains("+ INFO in testNested"));
- assertTrue(result.contains("+ WARN in testNested"));
- assertTrue(result.contains(" |-WARN in testNested"));
+ assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
+ assertTrue(result.contains("+ WARN in "+this.getClass().getName()));
+ assertTrue(result.contains(" |-WARN in "+this.getClass().getName()));
}
-
+
+ @Test
public void testWithException() {
Status s0 = new ErrorStatus("test0", this);
Status s1 = new InfoStatus("test1", this, new Exception("testEx"));
@@ -95,8 +99,8 @@
context.getStatusManager().add(s2);
StatusPrinter.print(context);
String result = outputStream.toString();
- assertTrue(result.contains("|-ERROR in testWithException"));
- assertTrue(result.contains("+ INFO in testWithException"));
+ assertTrue(result.contains("|-ERROR in "+this.getClass().getName()));
+ assertTrue(result.contains("+ INFO in "+this.getClass().getName()));
assertTrue(result.contains("ch.qos.logback.core.util.StatusPrinterTest.testWithException"));
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/TimeUtilTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/TimeUtilTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/util/TimeUtilTest.java Wed Dec 3 15:53:30 2008
@@ -1,25 +1,16 @@
package ch.qos.logback.core.util;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
-public class TimeUtilTest extends TestCase {
+import org.junit.Test;
- public TimeUtilTest(String arg0) {
- super(arg0);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+public class TimeUtilTest {
+ @Test
public void testSecond() {
// Mon Nov 20 18:05:17,522 CET 2006
long now = 1164042317522L;
@@ -29,7 +20,8 @@
assertEquals(expected - now, 478);
assertEquals(expected, computed);
}
-
+
+ @Test
public void testMinute() {
// Mon Nov 20 18:05:17,522 CET 2006
long now = 1164042317522L;
@@ -40,7 +32,8 @@
assertEquals(expected - now, 1000 * 42 + 478);
assertEquals(expected, computed);
}
-
+
+ @Test
public void testHour() {
// Mon Nov 20 18:05:17,522 GMT 2006
long now = 1164045917522L;
@@ -53,7 +46,8 @@
assertEquals(expected - now, 1000 * (42 + 60 * 54) + 478);
assertEquals(expected, computed);
}
-
+
+ @Test
public void testDay() {
// Mon Nov 20 18:05:17 GMT 2006
long now = 1164045917522L;
@@ -66,7 +60,8 @@
assertEquals(expected - now, 1000 * (3600 * 5 + 60 * 54 + 42) + 478);
assertEquals(expected, computed);
}
-
+
+ @Test
public void testWeek() {
// Mon Nov 20 18:05:17 GMT 2006
long now = 1164045917522L;
@@ -91,7 +86,8 @@
1000 * (3600 * (5 + 24 * (5 + dayOffset)) + 60 * 54 + 42) + 478);
assertEquals(expected, computed);
}
-
+
+ @Test
public void testMonth() {
// Mon Nov 20 18:05:17 GMT 2006
long now = 1164045917522L;
1
0
svn commit: r2047 - logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi
by noreply.cekiļ¼ qos.ch 03 Dec '08
by noreply.cekiļ¼ qos.ch 03 Dec '08
03 Dec '08
Author: ceki
Date: Wed Dec 3 15:52:36 2008
New Revision: 2047
Added:
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/AppenderAttachableImplLockTest.java
Modified:
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/PackageTest.java
Log:
Added test case related to LBCORE-67 as provided by Joern
Added: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/AppenderAttachableImplLockTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/AppenderAttachableImplLockTest.java Wed Dec 3 15:52:36 2008
@@ -0,0 +1,94 @@
+package ch.qos.logback.core.spi;
+
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.makeThreadSafe;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import org.junit.Test;
+
+import ch.qos.logback.core.Appender;
+
+/**
+ * This test shows the general problem I described in LBCORE-67.
+ *
+ * In the two test cases below, an appender that throws an OutOfMemoryError
+ * while getName is called - but this is just an example to show the general
+ * problem.
+ *
+ * The tests below fail without fixing LBCORE-67 and pass when Joern Huxhorn's
+ * patch is applied.
+ *
+ * Additionally, the following, probably more realistic, situations could
+ * happen:
+ *
+ * -addAppender: appenderList.add() could throw OutOfMemoryError. This could
+ * only be shown by using an appenderList mock but appenderList does not (and
+ * should not) have a setter. This would leave the write lock locked.
+ *
+ * -iteratorForAppenders: new ArrayList() could throw an OutOfMemoryError,
+ * leaving the read lock locked.
+ *
+ * I can't imagine a bad situation in isAttached, detachAppender(Appender) or
+ * detachAppender(String) but I'd change the code anyway for consistency. I'm
+ * also pretty sure that something stupid can happen at any time so it's best to
+ * just stick to conventions.
+ *
+ * @author Joern Huxhorn
+ */
+public class AppenderAttachableImplLockTest {
+ private AppenderAttachableImpl<Integer> aai = new AppenderAttachableImpl<Integer>();
+
+ @SuppressWarnings("unchecked")
+ @Test(timeout = 1000)
+ public void getAppenderBoom() {
+
+ Appender<Integer> mockAppender1 = createStrictMock(Appender.class);
+ expect(mockAppender1.getName()).andThrow(new OutOfMemoryError("oops"));
+ replay(mockAppender1);
+
+ aai.addAppender(mockAppender1);
+ try {
+ // appender.getName called as a result of next statement
+ aai.getAppender("foo");
+ } catch (OutOfMemoryError e) {
+ // this leaves the read lock locked.
+ }
+
+ Appender<Integer> mockAppender2=createStrictMock(Appender.class);
+ // the next call will lock
+ aai.addAppender(mockAppender2);
+ verify(mockAppender1);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(timeout = 1000)
+ public void detachAppenderBoom() throws InterruptedException {
+ Appender<Integer> mockAppender = createStrictMock(Appender.class);
+ makeThreadSafe(mockAppender, true);
+ expect(mockAppender.getName()).andThrow(new OutOfMemoryError("oops"));
+ mockAppender.doAppend(17);
+ replay(mockAppender);
+
+ aai.addAppender(mockAppender);
+ Thread t = new Thread(new Runnable() {
+
+ public void run() {
+ try {
+ // appender.getName called as a result of next statement
+ aai.detachAppender("foo");
+ } catch (OutOfMemoryError e) {
+ // this leaves the write lock locked.
+ }
+ }
+ });
+ t.start();
+ t.join();
+
+ // the next call will lock
+ aai.appendLoopOnAppenders(17);
+ verify(mockAppender);
+ }
+
+}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/spi/PackageTest.java Wed Dec 3 15:52:36 2008
@@ -9,16 +9,12 @@
*/
package ch.qos.logback.core.spi;
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
-public class PackageTest {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTest(new JUnit4TestAdapter(AppenderAttachableImplTest.class));
- return suite;
- }
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({AppenderAttachableImplTest.class ,AppenderAttachableImplLockTest.class})
+public class PackageTest {
}
1
0
svn commit: r2046 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/spi
by noreply.cekiļ¼ qos.ch 02 Dec '08
by noreply.cekiļ¼ qos.ch 02 Dec '08
02 Dec '08
Author: ceki
Date: Tue Dec 2 20:37:44 2008
New Revision: 2046
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java
Log:
Fixed LBCORE-67
I prefer
try {
r.lock();
doSomething();
} finally {
r.unlock();
}
instead of
r.lock();
try {
doSomething();
} finally {
r.unlock();
}
because I think that the lock is held for a shorter time (however small it may be).
In case r.lock() throws an exception, we are probably screwed in both approaches.
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/spi/AppenderAttachableImpl.java Tue Dec 2 20:37:44 2008
@@ -1,11 +1,11 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
- *
- * Copyright (C) 1999-2006, QOS.ch
- *
- * This library 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.
+ * Logback: the generic, reliable, fast and flexible logging framework.
+ *
+ * Copyright (C) 2000-2008, QOS.ch
+ *
+ * This library 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.
*/
package ch.qos.logback.core.spi;
@@ -19,7 +19,8 @@
import ch.qos.logback.core.Appender;
/**
- * A straightforward implementation of the {@link AppenderAttachable} interface.
+ * A ReentrantReadWriteLock based implementation of the
+ * {@link AppenderAttachable} interface.
*
* @author Ceki Gülcü
*/
@@ -38,11 +39,14 @@
if (newAppender == null) {
throw new IllegalArgumentException("Null argument disallowed");
}
- w.lock();
- if (!appenderList.contains(newAppender)) {
- appenderList.add(newAppender);
+ try {
+ w.lock();
+ if (!appenderList.contains(newAppender)) {
+ appenderList.add(newAppender);
+ }
+ } finally {
+ w.unlock();
}
- w.unlock();
}
/**
@@ -50,8 +54,8 @@
*/
public int appendLoopOnAppenders(E e) {
int size = 0;
- r.lock();
try {
+ r.lock();
for (Appender<E> appender : appenderList) {
appender.doAppend(e);
size++;
@@ -70,33 +74,40 @@
*/
public Iterator<Appender<E>> iteratorForAppenders() {
List<Appender<E>> copy;
- r.lock();
- copy = new ArrayList<Appender<E>>(appenderList);
- r.unlock();
+ try {
+ r.lock();
+ copy = new ArrayList<Appender<E>>(appenderList);
+ } finally {
+ r.unlock();
+ }
return copy.iterator();
}
/**
* Look for an attached appender named as <code>name</code>.
*
- * <p>
- * Return the appender with that name if in the list. Return null otherwise.
+ * <p> Return the appender with that name if in the list. Return null
+ * otherwise.
*
*/
public Appender<E> getAppender(String name) {
if (name == null) {
return null;
}
- r.lock();
+ Appender<E> found = null;
- for (Appender<E> appender : appenderList) {
- if (name.equals(appender.getName())) {
- r.unlock();
- return appender;
+ try {
+ r.lock();
+ for (Appender<E> appender : appenderList) {
+ if (name.equals(appender.getName())) {
+ found = appender;
+ break;
+ }
}
+ } finally {
+ r.unlock();
}
- r.unlock();
- return null;
+ return found;
}
/**
@@ -109,15 +120,19 @@
if (appender == null) {
return false;
}
- r.lock();
- for (Appender<E> a : appenderList) {
- if (a == appender) {
- r.unlock();
- return true;
+ boolean attached = false;
+ try {
+ r.lock();
+ for (Appender<E> a : appenderList) {
+ if (a == appender) {
+ attached = true;
+ break;
+ }
}
+ } finally {
+ r.unlock();
}
- r.unlock();
- return false;
+ return attached;
}
/**
@@ -125,11 +140,11 @@
*/
public void detachAndStopAllAppenders() {
try {
- w.lock();
+ w.lock();
for (Appender<E> a : appenderList) {
- a.stop();
- }
- appenderList.clear();
+ a.stop();
+ }
+ appenderList.clear();
} finally {
w.unlock();
}
@@ -143,9 +158,13 @@
if (appender == null) {
return false;
}
- w.lock();
- boolean result = appenderList.remove(appender);
- w.unlock();
+ boolean result;
+ try {
+ w.lock();
+ result = appenderList.remove(appender);
+ } finally {
+ w.unlock();
+ }
return result;
}
@@ -157,14 +176,18 @@
if (name == null) {
return false;
}
- w.lock();
- for (Appender<E> a : appenderList) {
- if (name.equals((a).getName())) {
- w.unlock();
- return appenderList.remove(a);
+ boolean removed = false;
+ try {
+ w.lock();
+ for (Appender<E> a : appenderList) {
+ if (name.equals((a).getName())) {
+ removed = appenderList.remove(a);
+ break;
+ }
}
+ } finally {
+ w.unlock();
}
- w.unlock();
- return false;
+ return removed;
}
}
1
0
[JIRA] Created: (LBGENERAL-22) problem converting log4j.properties file
by Ceki Gulcu (JIRA) 02 Dec '08
by Ceki Gulcu (JIRA) 02 Dec '08
02 Dec '08
problem converting log4j.properties file
----------------------------------------
Key: LBGENERAL-22
URL: http://jira.qos.ch/browse/LBGENERAL-22
Project: logback-general
Issue Type: Bug
Reporter: Ceki Gulcu
Assignee: Logback dev list
Rob Ross wrote:
I have a few comments for you. First, the log4j properties translator ( http://logback.qos.ch/translator/Welcome.do ) does not quite work. Maybe it's based on an old version and is now out of date, but you should think about updating it. The file it produced did not translate my properties that I used in log4j.properties to specify the log file path into the equivalent substitutionProperty elements, and it did not translate the Levels I had set on the log4j appenders.
It did wrap them in Threshold elements, but the current XML schema wants these specified in a "filter" element on the appender. Also, it did not translate the settings for the rolling file appender into the FileNamePattern element. However, the Joran configurator gave me detailed enough Exception messages that it was easy to determine what the problems were and fix them.
ref: http://www.qos.ch/pipermail/logback-user/2008-July/000492.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
1
2
svn commit: r2045 - in logback/trunk/logback-site/src/site/pages: . manual templates
by noreply.cekiļ¼ qos.ch 02 Dec '08
by noreply.cekiļ¼ qos.ch 02 Dec '08
02 Dec '08
Author: ceki
Date: Tue Dec 2 16:15:58 2008
New Revision: 2045
Modified:
logback/trunk/logback-site/src/site/pages/.htaccess
logback/trunk/logback-site/src/site/pages/manual/.htaccess
logback/trunk/logback-site/src/site/pages/templates/left.js
Log:
- minor corrections
Modified: logback/trunk/logback-site/src/site/pages/.htaccess
==============================================================================
--- logback/trunk/logback-site/src/site/pages/.htaccess (original)
+++ logback/trunk/logback-site/src/site/pages/.htaccess Tue Dec 2 16:15:58 2008
@@ -1 +1 @@
-Redirect jmxConfig.html manual/jmxConfig.html
\ No newline at end of file
+Redirect jmxConfig.html http://logback.qos.ch/manual/jmxConfig.html
\ No newline at end of file
Modified: logback/trunk/logback-site/src/site/pages/manual/.htaccess
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/.htaccess (original)
+++ logback/trunk/logback-site/src/site/pages/manual/.htaccess Tue Dec 2 16:15:58 2008
@@ -1 +1 @@
-Redirect contextSelector.html loggingSeparation.html
\ No newline at end of file
+Redirect contextSelector.html http://logback.qos.ch/manual/loggingSeparation.html
\ No newline at end of file
Modified: logback/trunk/logback-site/src/site/pages/templates/left.js
==============================================================================
--- logback/trunk/logback-site/src/site/pages/templates/left.js (original)
+++ logback/trunk/logback-site/src/site/pages/templates/left.js Tue Dec 2 16:15:58 2008
@@ -1,6 +1,6 @@
document.write('<p class="menu_header">Logback project</p>');
-document.write('<p class="menu"><a href="index.html">Introduction</a></p>');
+document.write('<p class="menu"><a href="' + prefix + 'index.html">Introduction</a></p>');
document.write('<p class="menu"><a href="' + prefix + 'news.html">News</a></p>');
document.write('<p class="menu"><a href="' + prefix + 'download.html">Download</a></p>');
document.write('<p class="menu"><a href="' + prefix + 'documentation.html">Documentation</a></p>');
1
0
01 Dec '08
Author: ravn
Date: Mon Dec 1 14:03:06 2008
New Revision: 2043
Modified:
logback-incubator/trunk/logback-as400/pom.xml
Log:
added logback dependencies
Modified: logback-incubator/trunk/logback-as400/pom.xml
==============================================================================
--- logback-incubator/trunk/logback-as400/pom.xml (original)
+++ logback-incubator/trunk/logback-as400/pom.xml Mon Dec 1 14:03:06 2008
@@ -38,6 +38,16 @@
<artifactId>jt400-full</artifactId>
<version>5.0</version>
</dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.11</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.11</version>
+ </dependency>
</dependencies>
1
0
svn commit: r2042 - in logback/trunk/logback-core/src: main/java/ch/qos/logback/core/joran/spi test/java/ch/qos/logback/core/joran/spi
by noreply.cekiļ¼ qos.ch 01 Dec '08
by noreply.cekiļ¼ qos.ch 01 Dec '08
01 Dec '08
Author: ceki
Date: Mon Dec 1 12:30:02 2008
New Revision: 2042
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java
logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PatternTest.java
Log:
- cosmetic changes only
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/spi/Pattern.java Mon Dec 1 12:30:02 2008
@@ -1,7 +1,7 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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
@@ -12,20 +12,12 @@
import java.util.ArrayList;
-
public class Pattern {
-
+
// contains String instances
- ArrayList<String> components;
+ ArrayList<String> partList = new ArrayList<String>();
public Pattern() {
- components = new ArrayList<String>();
- }
-
- public Object clone() {
- Pattern p = new Pattern();
- p.components.addAll(this.components);
- return p;
}
/**
@@ -50,48 +42,54 @@
// System.out.println("k is "+ k);
if (k == -1) {
String lastPart = p.substring(lastIndex);
- if(lastPart != null && lastPart.length() > 0) {
- components.add(p.substring(lastIndex));
+ if (lastPart != null && lastPart.length() > 0) {
+ partList.add(p.substring(lastIndex));
}
break;
} else {
String c = p.substring(lastIndex, k);
if (c.length() > 0) {
- components.add(c);
+ partList.add(c);
}
lastIndex = k + 1;
}
}
- //System.out.println(components);
+ // System.out.println(components);
+ }
+
+ public Object clone() {
+ Pattern p = new Pattern();
+ p.partList.addAll(this.partList);
+ return p;
}
public void push(String s) {
- components.add(s);
+ partList.add(s);
}
public int size() {
- return components.size();
+ return partList.size();
}
public String get(int i) {
- return (String) components.get(i);
+ return (String) partList.get(i);
}
public void pop() {
- if (!components.isEmpty()) {
- components.remove(components.size() - 1);
+ if (!partList.isEmpty()) {
+ partList.remove(partList.size() - 1);
}
}
-
+
public String peekLast() {
- if (!components.isEmpty()) {
- int size = components.size();
- return (String) components.get(size - 1);
+ if (!partList.isEmpty()) {
+ int size = partList.size();
+ return (String) partList.get(size - 1);
} else {
- return null;
+ return null;
}
}
@@ -105,8 +103,8 @@
return 0;
}
- int lSize = this.components.size();
- int rSize = p.components.size();
+ int lSize = this.partList.size();
+ int rSize = p.partList.size();
// no match possible for empty sets
if ((lSize == 0) || (rSize == 0)) {
@@ -118,8 +116,8 @@
// loop from the end to the front
for (int i = 1; i <= minLen; i++) {
- String l = (String) this.components.get(lSize - i);
- String r = (String) p.components.get(rSize - i);
+ String l = (String) this.partList.get(lSize - i);
+ String r = (String) p.partList.get(rSize - i);
if (l.equals(r)) {
match++;
@@ -141,8 +139,8 @@
return 0;
}
- int lSize = this.components.size();
- int rSize = p.components.size();
+ int lSize = this.partList.size();
+ int rSize = p.partList.size();
// no match possible for empty sets
if ((lSize == 0) || (rSize == 0)) {
@@ -153,10 +151,10 @@
int match = 0;
for (int i = 0; i < minLen; i++) {
- String l = (String) this.components.get(i);
- String r = (String) p.components.get(i);
+ String l = (String) this.partList.get(i);
+ String r = (String) p.partList.get(i);
- //if (l.equals(r) || "*".equals(l) || "*".equals(r)) {
+ // if (l.equals(r) || "*".equals(l) || "*".equals(r)) {
if (l.equals(r)) {
match++;
} else {
@@ -167,23 +165,21 @@
return match;
}
-
-
@Override
public boolean equals(Object o) {
- //System.out.println("in equals:" +this+ " vs. " + o);
+ // System.out.println("in equals:" +this+ " vs. " + o);
if ((o == null) || !(o instanceof Pattern)) {
return false;
}
- //System.out.println("both are Patterns");
+ // System.out.println("both are Patterns");
Pattern r = (Pattern) o;
if (r.size() != size()) {
return false;
}
- //System.out.println("both are size compatible");
+ // System.out.println("both are size compatible");
int len = size();
for (int i = 0; i < len; i++) {
@@ -204,7 +200,7 @@
for (int i = 0; i < len; i++) {
hc ^= get(i).hashCode();
- //System.out.println("i = "+i+", hc="+hc);
+ // System.out.println("i = "+i+", hc="+hc);
}
return hc;
@@ -212,10 +208,10 @@
@Override
public String toString() {
- int size = components.size();
+ int size = partList.size();
String result = "";
- for(int i = 0; i < size; i++) {
- result += "[" + components.get(i) + "]";
+ for (int i = 0; i < size; i++) {
+ result += "[" + partList.get(i) + "]";
}
return result;
}
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PackageTest.java Mon Dec 1 12:30:02 2008
@@ -1,7 +1,7 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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
@@ -9,6 +9,7 @@
*/
package ch.qos.logback.core.joran.spi;
+import junit.framework.JUnit4TestAdapter;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -17,7 +18,7 @@
public static Test suite() {
TestSuite suite = new TestSuite();
- suite.addTestSuite(PatternTest.class);
+ suite.addTest(new JUnit4TestAdapter(PatternTest.class));
suite.addTestSuite(SimpleStoreTest.class);
suite.addTestSuite(PropertySetterTest.class);
return suite;
Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PatternTest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PatternTest.java (original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/spi/PatternTest.java Mon Dec 1 12:30:02 2008
@@ -1,7 +1,7 @@
/**
- * LOGBack: the generic, reliable, fast and flexible logging framework.
+ * Logback: the generic, reliable, fast and flexible logging framework.
*
- * Copyright (C) 1999-2006, QOS.ch
+ * Copyright (C) 2000-2008, QOS.ch
*
* This library 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
@@ -10,38 +10,18 @@
package ch.qos.logback.core.joran.spi;
-import ch.qos.logback.core.joran.spi.Pattern;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
/**
* Test pattern manipulation code.
*
* @author Ceki Gulcu
*/
-public class PatternTest extends TestCase {
- /**
- * Constructor for PatternTestCase.
- *
- * @param name
- */
- public PatternTest(String name) {
- super(name);
- }
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
+public class PatternTest {
+ @Test
public void test1() {
Pattern p = new Pattern("a");
assertEquals(1, p.size());
@@ -49,6 +29,7 @@
assertEquals("a", p.get(0));
}
+ @Test
public void testSuffix() {
Pattern p = new Pattern("a/");
assertEquals(1, p.size());
@@ -56,6 +37,7 @@
assertEquals("a", p.get(0));
}
+ @Test
public void test2() {
Pattern p = new Pattern("a/b");
assertEquals(2, p.size());
@@ -64,6 +46,7 @@
assertEquals("b", p.get(1));
}
+ @Test
public void test3() {
Pattern p = new Pattern("a123/b1234/cvvsdf");
assertEquals(3, p.size());
@@ -72,6 +55,7 @@
assertEquals("cvvsdf", p.get(2));
}
+ @Test
public void test4() {
Pattern p = new Pattern("/a123/b1234/cvvsdf");
assertEquals(3, p.size());
@@ -80,12 +64,14 @@
assertEquals("cvvsdf", p.get(2));
}
+ @Test
public void test5() {
Pattern p = new Pattern("//a");
assertEquals(1, p.size());
assertEquals("a", p.get(0));
}
+ @Test
public void test6() {
Pattern p = new Pattern("//a//b");
assertEquals(2, p.size());
@@ -95,6 +81,7 @@
// test tail matching
+ @Test
public void testTailMatch() {
{
Pattern p = new Pattern("/a/b");
@@ -123,6 +110,7 @@
}
// test prefix matching
+ @Test
public void testPrefixMatch() {
{
Pattern p = new Pattern("/a/b");
1
0
svn commit: r2041 - logback-incubator/trunk/logback-as400/src/main/java/foo
by noreply.ravnļ¼ qos.ch 01 Dec '08
by noreply.ravnļ¼ qos.ch 01 Dec '08
01 Dec '08
Author: ravn
Date: Mon Dec 1 10:44:55 2008
New Revision: 2041
Modified:
logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java
Log:
Class.getCanonicalName() does not exist in Java 1.4
Modified: logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java
==============================================================================
--- logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java (original)
+++ logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java Mon Dec 1 10:44:55 2008
@@ -3,6 +3,6 @@
public class Bar {
public static void main(String[] args) throws Exception {
- System.out.println(Class.forName("com.ibm.as400.access.AS400").getCanonicalName());
+ System.out.println(Class.forName("com.ibm.as400.access.AS400").getName());
}
}
\ No newline at end of file
1
0
svn commit: r2040 - in logback-incubator/trunk: . logback-as400 logback-as400/src/main/java/foo
by noreply.ravnļ¼ qos.ch 29 Nov '08
by noreply.ravnļ¼ qos.ch 29 Nov '08
29 Nov '08
Author: ravn
Date: Sat Nov 29 00:54:26 2008
New Revision: 2040
Modified:
logback-incubator/trunk/logback-as400/pom.xml
logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java
logback-incubator/trunk/pom.xml
Log:
got correct jt400 dependency
Modified: logback-incubator/trunk/logback-as400/pom.xml
==============================================================================
--- logback-incubator/trunk/logback-as400/pom.xml (original)
+++ logback-incubator/trunk/logback-as400/pom.xml Sat Nov 29 00:54:26 2008
@@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
+ <artifactId>logback-as400</artifactId>
<version>${parent.version}</version>
<packaging>jar</packaging>
<name>Logback AS400 Module</name>
@@ -33,9 +33,11 @@
</licenses>
<dependencies>
- <groupId>net.sf.jt400</groupId>
- <artifactId>jt400-full</artifactId>
- <version>5.2</version>
+ <dependency>
+ <groupId>net.sf.jt400</groupId>
+ <artifactId>jt400-full</artifactId>
+ <version>5.0</version>
+ </dependency>
</dependencies>
Modified: logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java
==============================================================================
--- logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java (original)
+++ logback-incubator/trunk/logback-as400/src/main/java/foo/Bar.java Sat Nov 29 00:54:26 2008
@@ -1,7 +1,8 @@
package foo;
+
public class Bar {
- public static void main(String[] args) {
- System.out.println("Bar: " + java.util.Arrays.asList(args));
- }
+ public static void main(String[] args) throws Exception {
+ System.out.println(Class.forName("com.ibm.as400.access.AS400").getCanonicalName());
+ }
}
\ No newline at end of file
Modified: logback-incubator/trunk/pom.xml
==============================================================================
--- logback-incubator/trunk/pom.xml (original)
+++ logback-incubator/trunk/pom.xml Sat Nov 29 00:54:26 2008
@@ -22,12 +22,13 @@
</modules>
<dependencies>
- <dependency>
+<!-- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
+-->
</dependencies>
<properties>
1
0