Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 381564

Summary: [e4] fix failing Java context tests
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mik.kersten, shawn.minto
Version: unspecified   
Target Milestone: 3.8   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 381902    
Bug Blocks: 375057, 376368    

Description Steffen Pingel CLA 2012-06-04 08:21:59 EDT
Several Java tests are failing, e.g.:

junit.framework.AssertionFailedError: expected:<0> but was:<2>
	at junit.framework.Assert.fail(Assert.java:50)
	at junit.framework.Assert.failNotEquals(Assert.java:287)
	at junit.framework.Assert.assertEquals(Assert.java:67)
	at junit.framework.Assert.assertEquals(Assert.java:199)
	at junit.framework.Assert.assertEquals(Assert.java:205)
	at org.eclipse.mylyn.java.tests.ContentOutlineRefreshTest.testContents(ContentOutlineRefreshTest.java:88)
Comment 1 Steffen Pingel CLA 2012-06-04 08:54:50 EDT
It looks like opening the editor does indeed cause a selection event on the method which I'm not seeing when I run the same test case against Eclipse 3.7. This is the 4.2 stack trace that causes interest to be increased on the Java element:

Thread [main] (Suspended)	
	JavaEditingMonitor.handleWorkbenchPartSelection(IWorkbenchPart, ISelection, boolean) line: 92	
	JavaEditingMonitor(AbstractUserInteractionMonitor).selectionChanged(IWorkbenchPart, ISelection) line: 72	
	SelectionService.notifyListeners(String, IWorkbenchPart, ISelection) line: 140	
	SelectionService.access$3(SelectionService, String, IWorkbenchPart, ISelection) line: 137	
	SelectionService$1.selectionChanged(MPart, Object) line: 72	
	SelectionAggregator.notifyListeners(MPart, Object) line: 109	
	SelectionAggregator.access$4(SelectionAggregator, MPart, Object) line: 106	
	SelectionAggregator$4(RunAndTrack).runExternalCode(Runnable) line: 53	
	SelectionAggregator$4.changed(IEclipseContext) line: 161	
	TrackableComputationExt.update(ContextChangeEvent) line: 109	
	EclipseContext.processScheduled(Set<Scheduled>) line: 308	
	EclipseContext.set(String, Object) line: 322	
	SelectionServiceImpl.setSelection(Object) line: 30	
	CompatibilityEditor(CompatibilityPart).selectionChanged(SelectionChangedEvent) line: 420	
	CompilationUnitEditor$AdaptedSourceViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 162	
	CompilationUnitEditor$AdaptedSourceViewer(TextViewer).fireSelectionChanged(int, int) line: 2738	
	CompilationUnitEditor$AdaptedSourceViewer(TextViewer).selectionChanged(int, int) line: 2717	
	CompilationUnitEditor$AdaptedSourceViewer(TextViewer).setSelectedRange(int, int) line: 2402	
	CompilationUnitEditor$AdaptedSourceViewer(SourceViewer).setRangeIndication(int, int, boolean) line: 1108	
	CompilationUnitEditor$AdaptedSourceViewer(ProjectionViewer).setRangeIndication(int, int, boolean) line: 1315	
	CompilationUnitEditor(AbstractTextEditor).setHighlightRange(int, int, boolean) line: 6240	
	CompilationUnitEditor(JavaEditor).setSelection(ISourceReference, boolean) line: 2342	
	CompilationUnitEditor(JavaEditor).setSelection(IJavaElement) line: 2407	
	EditorUtility.revealInEditor(IEditorPart, IJavaElement) line: 252	
	JavaUI.openInEditor(IJavaElement, boolean, boolean) line: 700	
	JavaUI.openInEditor(IJavaElement) line: 676	
	ContentOutlineRefreshTest.testContents() line: 65	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 592	
	ContentOutlineRefreshTest(TestCase).runTest() line: 168	
	ContentOutlineRefreshTest(TestCase).runBare() line: 134	
	TestResult$1.protect() line: 110	
	TestResult.runProtected(Test, Protectable) line: 128	
	TestResult.run(TestCase) line: 113	
	ContentOutlineRefreshTest(TestCase).run(TestResult) line: 124	
	TestSuite.runTest(Test, TestResult) line: 243	
	TestSuite.run(TestResult) line: 238	
	JUnit38ClassRunner.run(RunNotifier) line: 83	
	JUnit4TestMethodReference(JUnit4TestReference).run(TestExecution) line: 50	
	TestExecution.run(ITestReference[]) line: 38	
	RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 467	
	RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 683	
	RemotePluginTestRunner(RemoteTestRunner).run() line: 390	
	RemotePluginTestRunner.main(String[]) line: 62	
	PlatformUITestHarness$1.run() line: 47	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 135	
	Display.runAsyncMessages(boolean) line: 3529	
	Display.readAndDispatch() line: 3182	
	PartRenderingEngine$9.run() line: 1022	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 916	
	E4Workbench.createAndRunUI(MApplicationElement) line: 86	
	Workbench$5.run() line: 585	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 540	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 124	
	UITestApplication(NonUIThreadTestApplication).runApp(Object, IApplicationContext, String[]) line: 54	
	UITestApplication.runApp(Object, IApplicationContext, String[]) line: 41	
	UITestApplication(NonUIThreadTestApplication).start(IApplicationContext) line: 48	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 353	
	EclipseStarter.run(String[], Runnable) line: 180	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 592	
	Main.invokeFramework(String[], URL[]) line: 629	
	Main.basicRun(String[]) line: 584	
	Main.run(String[]) line: 1438	
	Main.main(String[]) line: 1414
Comment 2 Steffen Pingel CLA 2012-06-05 18:03:11 EDT
Tests are now passing. We are now running separate test cases on 3.x and 4.x since e4 generates additional selection events when files are opened and selections in the editor are made through API. We need to watch how that affects the DOI model.