[logback-dev] svn commit: r1484 - in logbackPDE/trunk/plugins: ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views ConsolePluginTest ConsolePluginTest/META-INF ConsolePluginTest/lib ConsolePluginTest/src/ch/qos/logback/eclipse/test

noreply.seb at qos.ch noreply.seb at qos.ch
Thu Mar 29 14:04:30 CEST 2007


Author: seb
Date: Thu Mar 29 14:04:30 2007
New Revision: 1484

Added:
   logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-classic-0.9.3.jar   (contents, props changed)
   logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-core-0.9.3.jar   (contents, props changed)
Removed:
   logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-classic-0.9.1-SNAPSHOT.jar
   logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-core-0.9.1-SNAPSHOT.jar
Modified:
   logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java
   logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
   logbackPDE/trunk/plugins/ConsolePluginTest/META-INF/MANIFEST.MF
   logbackPDE/trunk/plugins/ConsolePluginTest/build.properties
   logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/AbstractPluginTest.java
   logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/LogbackViewTest.java
   logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/SendEventTest.java

Log:
Corrected a bug in event manager
Updating test cases

Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/dialog/LogbackFilterDialog.java	Thu Mar 29 14:04:30 2007
@@ -9,7 +9,6 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;

Modified: logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePlugin/src/main/java/ch/qos/logback/eclipse/views/LogbackView.java	Thu Mar 29 14:04:30 2007
@@ -267,6 +267,8 @@
     this.memento = memento;
     initServer();
     if (memento != null) {
+      LoggingEventManager.getManager().init(memento);
+      
       IMemento mem = memento.getChild(TAG_DISPLAY);
       if (mem == null) {
         return;
@@ -275,7 +277,6 @@
       tmpFontSize = mem.getInteger(TAG_FONTSIZE);
       tmpFontName = mem.getString(TAG_FONTNAME);
     }
-    LoggingEventManager.getManager().init(memento);
   }
 
   public Viewer getViewer() {

Modified: logbackPDE/trunk/plugins/ConsolePluginTest/META-INF/MANIFEST.MF
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePluginTest/META-INF/MANIFEST.MF	(original)
+++ logbackPDE/trunk/plugins/ConsolePluginTest/META-INF/MANIFEST.MF	Thu Mar 29 14:04:30 2007
@@ -10,9 +10,13 @@
  ch.qos.logback.eclipse,
  org.junit,
  org.eclipse.ui.console,
- org.eclipse.jface.text
+ org.eclipse.jface.text,
+ org.eclipse.jdt.core,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.jdt.debug.ui
 Eclipse-LazyStart: true
-Bundle-ClassPath: lib/logback-classic-0.9.1-SNAPSHOT.jar,
- lib/logback-core-0.9.1-SNAPSHOT.jar,
- lib/slf4j-api-1.3.0.jar,
- .
+Bundle-ClassPath: lib/slf4j-api-1.3.0.jar,
+ .,
+ lib/logback-classic-0.9.3.jar,
+ lib/logback-core-0.9.3.jar

Modified: logbackPDE/trunk/plugins/ConsolePluginTest/build.properties
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePluginTest/build.properties	(original)
+++ logbackPDE/trunk/plugins/ConsolePluginTest/build.properties	Thu Mar 29 14:04:30 2007
@@ -2,6 +2,6 @@
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               lib/logback-classic-0.9.1-SNAPSHOT.jar,\
-               lib/logback-core-0.9.1-SNAPSHOT.jar,\
-               lib/slf4j-api-1.3.0.jar
+               lib/slf4j-api-1.3.0.jar,\
+               lib/logback-classic-0.9.3.jar,\
+               lib/logback-core-0.9.3.jar

Added: logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-classic-0.9.3.jar
==============================================================================
Binary file. No diff available.

Added: logbackPDE/trunk/plugins/ConsolePluginTest/lib/logback-core-0.9.3.jar
==============================================================================
Binary file. No diff available.

Modified: logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/AbstractPluginTest.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/AbstractPluginTest.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/AbstractPluginTest.java	Thu Mar 29 14:04:30 2007
@@ -3,17 +3,38 @@
 import junit.framework.TestCase;
 
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.ui.PlatformUI;
 
 import ch.qos.logback.eclipse.views.LogbackView;
 
 public abstract class AbstractPluginTest extends TestCase {
 
+  private LogbackView view;
+  
   public AbstractPluginTest(String name) {
     super(name);
   }
+  
+  @Override
+  protected void setUp() throws Exception {
+    try {
+      view = (LogbackView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+      .showView(LogbackView.ID);
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+    super.setUp();
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    super.tearDown();
+  }
+
+
 
   /**
    * Process UI input but do not return for the specified time interval.
@@ -23,14 +44,15 @@
    */
   public void delay(long waitTimeMillis) {
     Display display = Display.getCurrent();
-
+//
     // If this is the UI thread,
     // then process input.
     if (display != null) {
       long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
       while (System.currentTimeMillis() < endTimeMillis) {
-        if (!display.readAndDispatch())
+        if (!display.readAndDispatch()) {
           display.sleep();
+        }
       }
       display.update();
     }
@@ -49,22 +71,25 @@
    * Wait until all background tasks are complete.
    */
   public void waitForJobs() {
-    while (Platform.getJobManager().currentJob() != null)
+    while (Platform.getJobManager().currentJob() != null) {
       delay(1000);
+    }
   }
 
-  protected void assertLogbackViewContent(LogbackView logbackView, String expectedContent) {
-//    String consoleText = logbackView.getViewer().getTextWidget().getText();
-//    assertEquals(expectedContent, consoleText);
+  protected void assertLogbackViewContent(LogbackView view, int numberOfLines, String lastLineText) {
+    TableViewer viewer = (TableViewer) view.getViewer();
+    TableItem[] items = viewer.getTable().getItems();
+    assertEquals(numberOfLines, items.length);
+    if (lastLineText != null) {
+      if (items.length == 0) {
+        fail("Nothing to compare to expected text");
+      }
+      TableItem lastItem = items[items.length-1];
+      assertEquals(lastLineText, lastItem.getText());
+    }
   }
 
   protected LogbackView getLogbackView() {
-    try {
-      return (LogbackView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
-          .showView(LogbackView.ID);
-    } catch (PartInitException e) {
-      e.printStackTrace();
-      return null;
-    }
+    return view;
   }
 }

Modified: logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/LogbackViewTest.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/LogbackViewTest.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/LogbackViewTest.java	Thu Mar 29 14:04:30 2007
@@ -17,8 +17,7 @@
     // Initialize the test fixture for each test
     // that is run.
     waitForJobs();
-    testView = (LogbackView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
-        .showView(LogbackView.ID);
+    testView = getLogbackView();
 
     // Delay for 3 seconds so that
     // the Favorites view can be seen.
@@ -36,6 +35,6 @@
 
   public void testView() {
     // check that the view is open and empty
-    assertLogbackViewContent(testView, "");
+    assertLogbackViewContent(testView, 0, null);
   }
 }
\ No newline at end of file

Modified: logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/SendEventTest.java
==============================================================================
--- logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/SendEventTest.java	(original)
+++ logbackPDE/trunk/plugins/ConsolePluginTest/src/ch/qos/logback/eclipse/test/SendEventTest.java	Thu Mar 29 14:04:30 2007
@@ -49,8 +49,8 @@
   public void testSendEvent() throws InterruptedException {
     rootLogger.debug("testing");
     waitForJobs();
-    delay(3000);
-    assertLogbackViewContent(view, "testing\n");
+    //delay(3000);
+    assertLogbackViewContent(view, 1, "testing\n");
   }
   
 }



More information about the logback-dev mailing list