@Test public void testMultistatusDuplicateChildFiltering() { Exception e1 = new Exception("Stack Trace"); e1.setStackTrace( createStacktraceForClasses( "java.lang.Object", "org.eclipse.core.internal.jobs.WorkerPool", "org.eclipse.core.internal.jobs.WorkerPool", "org.eclipse.core.internal.jobs.Worker")); IStatus s1 = new Status( IStatus.ERROR, "org.eclipse.ui.monitoring", "Thread 'Worker-3' tid=39 (TIMED_WAITING)\n" + "Waiting for: org.eclipse.core.internal.jobs.WorkerPool@416dc7fc", e1); Exception e2 = new Exception("Stack Trace"); e2.setStackTrace( TestReports.createStacktraceForClasses( "java.lang.Object", "org.eclipse.core.internal.jobs.WorkerPool", "org.eclipse.core.internal.jobs.WorkerPool", "org.eclipse.core.internal.jobs.Worker")); IStatus s2 = new Status( IStatus.ERROR, "org.eclipse.ui.monitoring", "Thread 'Worker-2' tid=36 (TIMED_WAITING)\n" + "Waiting for: org.eclipse.core.internal.jobs.WorkerPool@416dc7fc", e2); IStatus multi = new MultiStatus( "org.eclipse.ui.monitoring", 0, new IStatus[] {s1, s2}, "UI freeze of 10s at 08:09:02.936", new RuntimeException("stand-in-stacktrace")); org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus = Reports.newStatus(multi, configuration); assertThat(newStatus.getChildren().size(), is(1)); assertThat( newStatus.getMessage(), is( "UI freeze of 10s at 08:09:02.936 [1 child-status duplicates removed by Error Reporting]")); }
@Test public void testFingerprint() { Exception cause = new RuntimeException("cause"); Exception r1 = new RuntimeException("exception message"); r1.fillInStackTrace(); Exception r2 = new RuntimeException("exception message", cause); r2.fillInStackTrace(); IStatus s1 = new Status(IStatus.ERROR, "org.eclipse.epp.logging.aeri", "some error message", r1); IStatus s2 = new Status(IStatus.ERROR, "org.eclipse.epp.logging.aeri", "some error message", r2); org.eclipse.epp.internal.logging.aeri.ui.model.Status noCause = Reports.newStatus(s1, configuration); org.eclipse.epp.internal.logging.aeri.ui.model.Status withCause = Reports.newStatus(s2, configuration); Assert.assertNotEquals(noCause.getFingerprint(), withCause.getFingerprint()); }
@Test public void testMultistatusChildFilteringHandlesEmptyStacktrace() { Exception e1 = new Exception("Stack Trace 1"); e1.setStackTrace(new java.lang.StackTraceElement[0]); IStatus s1 = new Status( IStatus.ERROR, "org.eclipse.ui.monitoring", "Thread 'Signal Dispatcher' tid=4 (RUNNABLE)", e1); IStatus multi = new MultiStatus( "org.eclipse.ui.monitoring", 0, new IStatus[] {s1}, "UI freeze of 10s at 08:09:02.936", new RuntimeException("stand-in-stacktrace")); org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus = Reports.newStatus(multi, configuration); assertThat(newStatus.getChildren().size(), is(0)); }
@Test public void testMultistatusMainStacktracesNotFiltered() { Exception e1 = new Exception("Stack Trace"); java.lang.StackTraceElement[] stackTrace = createStacktraceForClasses( "java.lang.Thread", "org.eclipse.epp.logging.aeri.ui.actions.UiFreezeAction", "org.eclipse.ui.internal.PluginAction", "org.eclipse.ui.internal.WWinPluginAction", "org.eclipse.jface.action.ActionContributionItem", "org.eclipse.jface.action.ActionContributionItem", "org.eclipse.jface.action.ActionContributionItem", "org.eclipse.swt.widgets.EventTable", "org.eclipse.swt.widgets.Display", "org.eclipse.swt.widgets.Widget", "org.eclipse.swt.widgets.Display", "org.eclipse.swt.widgets.Display", "org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine", "org.eclipse.core.databinding.observable.Realm", "org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine", "org.eclipse.e4.ui.internal.workbench.E4Workbench", "org.eclipse.ui.internal.Workbench", "org.eclipse.core.databinding.observable.Realm", "org.eclipse.ui.internal.Workbench", "org.eclipse.ui.PlatformUI", "org.eclipse.ui.internal.ide.application.IDEApplication", "org.eclipse.equinox.internal.app.EclipseAppHandle", "org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher", "org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher", "org.eclipse.core.runtime.adaptor.EclipseStarter", "org.eclipse.core.runtime.adaptor.EclipseStarter", "sun.reflect.NativeMethodAccessorImpl", "sun.reflect.NativeMethodAccessorImpl", "sun.reflect.DelegatingMethodAccessorImpl", "java.lang.reflect.Method", "org.eclipse.equinox.launcher.Main", "org.eclipse.equinox.launcher.Main", "org.eclipse.equinox.launcher.Main", "org.eclipse.equinox.launcher.Main", "org.eclipse.equinox.launcher.Main"); e1.setStackTrace(stackTrace); IStatus s1 = new Status( IStatus.ERROR, "org.eclipse.ui.monitoring", "Sample at 11:25:04.447 (+1,331s)\n" + "Thread 'main' tid=1 (TIMED_WAITING)", e1); IStatus multi = new MultiStatus( "org.eclipse.ui.monitoring", 0, new IStatus[] {s1}, "UI freeze of 6,0s at 11:24:59.108", new RuntimeException("stand-in-stacktrace")); org.eclipse.epp.internal.logging.aeri.ui.model.Status newStatus = Reports.newStatus(multi, configuration); assertThat(newStatus.getChildren().size(), is(1)); assertThat( newStatus.getChildren().get(0).getException().getStackTrace().size(), is(stackTrace.length)); }