Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » WST Validation Threads
WST Validation Threads [message #197539] Mon, 30 July 2007 10:50 Go to next message
Hristo Sabev is currently offline Hristo Sabev
Messages: 6
Registered: July 2009
Junior Member
Hi,

I'm having problems writting PDE Junit test for my application and I need
some help/advice. Although the problem doesn't seem to be directly
connected to wtp some of the classes and Jobs described are comming from
wtp.

What the application does is to register for java model events and based
on these events to update an EMF model.

The testing strategy is to do a change and then in the same trhead check
whether the model has been updated.

This ussaly works as the event broadcast is done in the thread performing
the java model change. However in some very rare cases the event is
delivered in a different thread.

Can you point me why sometimes the Java Model Event gets delivered by a
different thread. Bellow I'm providing the stack-traces of 1. Normal event
delivery i.e. the change and event happens in one and the same thread, 2.
Stack traces of the thread doing the change and a stack trace of the
thread delivering the event. The event itself is about an oppened project
and looks like:

org.eclipse.jdt.core.ElementChangedEvent[source=Java Model[*]: {CHILDREN |
CONTENT}
TestEJBProject3_1185799757714 11[*]: {OPENED}
ResourceDelta(/TestEJBProject3_1185799757714 11)[*]]

While this may not be the correct place for this post, the
ValiationOperation run by the thread delivering the event is from package
org.eclipse.wst.validation.internal.operations

Thanks,
Hristo

1. StackTrace of a normal event delivery:
Thread [main] (Suspended (exception AssertionFailedError))
Assert.fail(String) line: 47
Assert.assertTrue(String, boolean) line: 20
Assert.assertNotNull(String, Object) line: 217
ModelSynchronizationTests.test_openedWsProjectSynched() line: 183
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: 585
ModelSynchronizationTests(TestCase).runTest() line: 164
ModelSynchronizationTests(VerifyingTestCase).runBare() line: 39
ModelSynchronizationTests(MockObjectTestCase).runBareInterna l() line: 38
BeforeAfterEnabler.runBare() line: 30
ModelSynchronizationTests(MockObjectTestCase).runBare() line: 44
TestResult$1.protect() line: 106
TestResult.runProtected(Test, Protectable) line: 124
TestResult.run(TestCase) line: 109
ModelSynchronizationTests(TestCase).run(TestResult) line: 120
TestSuite.runTest(Test, TestResult) line: 230
TestSuite.run(TestResult) line: 225
JUnit3TestReference.run(TestExecution) line: 130
TestExecution.run(ITestReference[]) line: 38
RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String,
TestExecution) line: 460
RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecut ion) line:
673
RemotePluginTestRunner(RemoteTestRunner).run() line: 386
RemotePluginTestRunner.main(String[]) line: 58
UITestApplication$1.run() line: 122
RunnableLock.run() line: 35
UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123
Display.runAsyncMessages(boolean) line: 3659
Display.readAndDispatch() line: 3296
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389
Workbench.runUI() line: 2353
Workbench.access$4(Workbench) line: 2219
Workbench$4.run() line: 466
Realm.runWithDefault(Realm, Runnable) line: 289
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
IDEApplication.start(IApplicationContext) line: 106
UITestApplication.start(IApplicationContext) line: 52
EclipseAppHandle.run(Object) line: 153
EclipseAppLauncher.runApplication(Object) line: 106
EclipseAppLauncher.start(Object) line: 76
EclipseStarter.run(Object) line: 363
EclipseStarter.run(String[], Runnable) line: 176
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: 585
Main.invokeFramework(String[], URL[]) line: 504
Main.basicRun(String[]) line: 443
Main.run(String[]) line: 1169
Main.main(String[]) line: 1144


2. Stack traces of thread doing the change and thread delivering the event
2.1 Stack trace of thrace doing the change:

Thread [main] (Suspended (breakpoint at line 41 in
OnEventModelSynchronizer))
OnEventModelSynchronizer.elementChanged(ElementChangedEvent) line: 41
DeltaProcessor$3.run() line: 1552
SafeRunner.run(ISafeRunnable) line: 37
DeltaProcessor.notifyListeners(IJavaElementDelta, int,
IElementChangedListener[], int[], int) line: 1542
DeltaProcessor.firePostChangeDelta(IJavaElementDelta,
IElementChangedListener[], int[], int) line: 1377
DeltaProcessor.fire(IJavaElementDelta, int) line: 1353
DeltaProcessor.resourceChanged(IResourceChangeEvent) line: 1916
DeltaProcessingState.resourceChanged(IResourceChangeEvent) line: 368
NotificationManager$2.run() line: 282
SafeRunner.run(ISafeRunnable) line: 37
NotificationManager.notify(ResourceChangeListenerList$Listen erEntry[],
IResourceChangeEvent, boolean) line: 276
NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent,
boolean) line: 148
Workspace.broadcastPostChange() line: 311
Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line:
1018
Project(Resource).delete(int, IProgressMonitor) line: 725
Project.delete(boolean, boolean, IProgressMonitor) line: 289
TestProject.dispose() line: 158
ModelSynchronizationTests.test_openedWsProjectSynched() line: 196
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
<unknown receiving type>(NativeMethodAccessorImpl).invoke(Object,
Object[]) line: 39
<unknown receiving type>(DelegatingMethodAccessorImpl).invoke(Object,
Object[]) line: 25
<unknown receiving type>(Method).invoke(Object, Object...) line: 585
<unknown receiving type>(TestCase).runTest() line: 164
<unknown receiving type>(VerifyingTestCase).runBare() line: 39
<unknown receiving type>(MockObjectTestCase).runBareInternal() line: 38
<unknown receiving type>(BeforeAfterEnabler).runBare() line: 30
<unknown receiving type>(MockObjectTestCase).runBare() line: 44
<unknown receiving type>(TestResult$1).protect() line: 106
TestResult.runProtected(Test, Protectable) line: 124
TestResult.run(TestCase) line: 109
ModelSynchronizationTests(TestCase).run(TestResult) line: 120
TestSuite.runTest(Test, TestResult) line: 230
TestSuite.run(TestResult) line: 225
JUnit3TestReference.run(TestExecution) line: 130
TestExecution.run(ITestReference[]) line: 38
RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String,
TestExecution) line: 460
RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecut ion) line:
673
RemotePluginTestRunner(RemoteTestRunner).run() line: 386
RemotePluginTestRunner.main(String[]) line: 58
UITestApplication$1.run() line: 122
RunnableLock.run() line: 35
UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 123
Display.runAsyncMessages(boolean) line: 3659
Display.readAndDispatch() line: 3296
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2389
Workbench.runUI() line: 2353
Workbench.access$4(Workbench) line: 2219
Workbench$4.run() line: 466
Realm.runWithDefault(Realm, Runnable) line: 289
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 461
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
IDEApplication.start(IApplicationContext) line: 106
UITestApplication.start(IApplicationContext) line: 52
EclipseAppHandle.run(Object) line: 153
EclipseAppLauncher.runApplication(Object) line: 106
EclipseAppLauncher.start(Object) line: 76
EclipseStarter.run(Object) line: 363
EclipseStarter.run(String[], Runnable) line: 176
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: 585
Main.invokeFramework(String[], URL[]) line: 504
Main.basicRun(String[]) line: 443
Main.run(String[]) line: 1169
Main.main(String[]) line: 1144


2.2 Stack trace of thread delivering the event:
Thread [Worker-8] (Suspended (breakpoint at line 55 in
OnEventModelSynchronizer))
OnEventModelSynchronizer.elementChanged(ElementChangedEvent) line: 55
DeltaProcessor$3.run() line: 1552
SafeRunner.run(ISafeRunnable) line: 37
DeltaProcessor.notifyListeners(IJavaElementDelta, int,
IElementChangedListener[], int[], int) line: 1542
DeltaProcessor.firePostChangeDelta(IJavaElementDelta,
IElementChangedListener[], int[], int) line: 1377
DeltaProcessor.fire(IJavaElementDelta, int) line: 1353
DeltaProcessor.resourceChanged(IResourceChangeEvent) line: 1916
DeltaProcessingState.resourceChanged(IResourceChangeEvent) line: 368
NotificationManager$2.run() line: 282
SafeRunner.run(ISafeRunnable) line: 37
NotificationManager.notify(ResourceChangeListenerList$Listen erEntry[],
IResourceChangeEvent, boolean) line: 276
NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent,
boolean) line: 148
Workspace.broadcastPostChange() line: 311
Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line:
1018
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)
line: 1806
ValidationOperation$1.done(IJobChangeEvent) line: 1767
JobListeners$3.notify(IJobChangeListener, IJobChangeEvent) line: 39
JobListeners.doNotify(JobListeners$IListenerDoit, IJobChangeEvent) line:
112
JobListeners.done(Job, IStatus, boolean) line: 152
JobManager.endJob(InternalJob, IStatus, boolean) line: 550
WorkerPool.endJob(InternalJob, IStatus) line: 105
Worker.run() line: 71
Re: WST Validation Threads [message #197562 is a reply to message #197539] Mon, 30 July 2007 11:10 Go to previous message
Eclipse User
Originally posted by: kosta.bea.com

This is a question for JDT and/or Platform. You can try posting to those
newsgroups. It looks like JDT updates the model in response to resource
change events. Platform does not guarantee which thread will deliver
these events. Sometimes it is necessary for it hold events if multiple
threads are running. In that case, the combined delta will be delivered
on whichever thread finishes last.

- Konstantin
Previous Topic:WTP Web Page Editor - CSS editor?
Next Topic:Servlet creation problem
Goto Forum:
  


Current Time: Thu Apr 17 17:44:46 EDT 2014

Powered by FUDForum. Page generated in 0.03974 seconds