[logback-dev] svn commit: r2177 - logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db

noreply.ceki at qos.ch noreply.ceki at qos.ch
Fri Feb 27 19:55:24 CET 2009


Author: ceki
Date: Fri Feb 27 19:55:24 2009
New Revision: 2177

Modified:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java

Log:
more tests

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/db/DBAppenderTest.java	Fri Feb 27 19:55:24 2009
@@ -9,9 +9,7 @@
 import java.util.Map;
 
 import org.junit.After;
-import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import ch.qos.logback.classic.Level;
@@ -29,21 +27,13 @@
   DBAppender appender;
   DriverManagerConnectionSource connectionSource;
 
-  static DBAppenderTestFixture DB_APPENDER_TEST_FIXTURE;
-  
-  @BeforeClass
-  public  static  void fixtureSetUp() throws SQLException {
-    DB_APPENDER_TEST_FIXTURE = new DBAppenderTestFixture();
-    DB_APPENDER_TEST_FIXTURE.setUp();
-  }
-  
-  @AfterClass
-  public static void fixtureTearDown() throws SQLException {
-    DB_APPENDER_TEST_FIXTURE.tearDown();
-  }
+  DBAppenderTestFixture dbAppenderTestFixture;
   
   @Before
   public void setUp() throws SQLException {
+    dbAppenderTestFixture = new DBAppenderTestFixture();
+    dbAppenderTestFixture.setUp();
+
     lc = new LoggerContext();
     lc.setName("default");
     logger = lc.getLogger("root");
@@ -53,9 +43,9 @@
     connectionSource = new DriverManagerConnectionSource();
     connectionSource.setContext(lc);
     connectionSource.setDriverClass(DBAppenderTestFixture.HSQLDB_DRIVER_CLASS);
-    connectionSource.setUrl(DB_APPENDER_TEST_FIXTURE.url);
-    connectionSource.setUser(DB_APPENDER_TEST_FIXTURE.user);
-    connectionSource.setPassword(DB_APPENDER_TEST_FIXTURE.password);
+    connectionSource.setUrl(dbAppenderTestFixture.url);
+    connectionSource.setUser(dbAppenderTestFixture.user);
+    connectionSource.setPassword(dbAppenderTestFixture.password);
     connectionSource.start();
     appender.setConnectionSource(connectionSource);
     appender.start();
@@ -67,6 +57,7 @@
     lc = null;
     appender = null;
     connectionSource = null;
+    dbAppenderTestFixture.tearDown();
   }
 
   @Test
@@ -98,6 +89,7 @@
     stmt.close();
   }
   
+  @Test
   public void testAppendThrowable() throws SQLException {
     ILoggingEvent event = createLoggingEvent();
 
@@ -116,6 +108,7 @@
     stmt.close();
   }
   
+  @Test
   public void testContextInfo() throws SQLException {
     ILoggingEvent event = createLoggingEvent();
     lc.putProperty("testKey1", "testValue1");
@@ -136,6 +129,7 @@
     stmt.close();
   }
   
+  @Test
   public void testAppendMultipleEvents() throws SQLException {
     for (int i = 0; i < 10; i++) {
       ILoggingEvent event = createLoggingEvent();


More information about the logback-dev mailing list