Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 42277 Details for
Bug 129929
IDE no longer responsive when junit tests are running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix2
142190_129929.patch (text/plain), 8.68 KB, created by
Markus Keller
on 2006-05-23 12:33:14 EDT
(
hide
)
Description:
Fix2
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2006-05-23 12:33:14 EDT
Size:
8.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.junit >Index: src/org/eclipse/jdt/internal/junit/ui/TestViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java,v >retrieving revision 1.12 >diff -u -r1.12 TestViewer.java >--- src/org/eclipse/jdt/internal/junit/ui/TestViewer.java 5 May 2006 15:01:44 -0000 1.12 >+++ src/org/eclipse/jdt/internal/junit/ui/TestViewer.java 23 May 2006 16:22:15 -0000 >@@ -12,10 +12,10 @@ > package org.eclipse.jdt.internal.junit.ui; > > import java.util.AbstractList; >-import java.util.ArrayList; > import java.util.Arrays; > import java.util.HashSet; > import java.util.Iterator; >+import java.util.LinkedHashSet; > import java.util.LinkedList; > import java.util.List; > import java.util.ListIterator; >@@ -461,34 +461,33 @@ > > private void updateElementInTree(final TestElement testElement) { > if (isShown(testElement)) { >- ArrayList toCreate= null; >- TestElement current= testElement; >- while (! (current instanceof TestRoot)) { >- if (fTreeViewer.testFindItem(current) == null) { >- if (toCreate == null) >- toCreate= new ArrayList(); >- toCreate.add(current); >- } else { >- TestElement parent= current; >- if (toCreate != null) { >- ListIterator iter= toCreate.listIterator(toCreate.size()); // backwards, top first >- while (iter.hasPrevious()) { >- TestElement child= (TestElement) iter.previous(); >- fTreeViewer.add(parent, child); >- parent= child; >- } >- } >- fTreeViewer.update(current, null); >- } >- current= (TestElement) fTreeContentProvider.getParent(current); >- } >- >+ updateShownElementInTree(testElement); > } else { > TestElement current= testElement; > do { >- fTreeViewer.remove(current); >+ if (fTreeViewer.testFindItem(current) != null) >+ fTreeViewer.remove(current); > current= current.getParent(); > } while (! (current instanceof TestRoot) && ! isShown(current)); >+ >+ while (current != null && ! (current instanceof TestRoot)) { >+ fTreeViewer.update(current, null); >+ current= current.getParent(); >+ } >+ } >+ } >+ >+ private void updateShownElementInTree(TestElement testElement) { >+ if (testElement == null || testElement instanceof TestRoot) // paranoia null check >+ return; >+ >+ TestSuiteElement parent= testElement.getParent(); >+ updateShownElementInTree(parent); // make sure parent is shown and up-to-date >+ >+ if (fTreeViewer.testFindItem(testElement) == null) { >+ fTreeViewer.add(parent, testElement); // if not yet in tree: add >+ } else { >+ fTreeViewer.update(testElement, null); // if in tree: update > } > } > >@@ -640,7 +639,7 @@ > } > > private void clearUpdateAndExpansion() { >- fNeedUpdate= new HashSet(); >+ fNeedUpdate= new LinkedHashSet(); > fAutoClose= new LinkedList(); > fAutoExpand= new HashSet(); > } >Index: src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 TestSessionLabelProvider.java >--- src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java 11 May 2006 16:19:03 -0000 1.8 >+++ src/org/eclipse/jdt/internal/junit/ui/TestSessionLabelProvider.java 23 May 2006 16:22:14 -0000 >@@ -73,12 +73,12 @@ > Status status=testCaseElement.getStatus(); > if (status.isNotRun()) > return fTestRunnerPart.fTestIcon; >+ else if (status.isRunning()) >+ return fTestRunnerPart.fTestRunningIcon; > else if (status.isError()) > return fTestRunnerPart.fTestErrorIcon; > else if (status.isFailure()) > return fTestRunnerPart.fTestFailIcon; >- else if (status.isRunning()) >- return fTestRunnerPart.fTestRunningIcon; > else if (status.isOK()) > return fTestRunnerPart.fTestOkIcon; > else >@@ -88,12 +88,12 @@ > Status status= ((TestSuiteElement) element).getStatus(); > if (status.isNotRun()) > return fTestRunnerPart.fSuiteIcon; >+ else if (status.isRunning()) >+ return fTestRunnerPart.fSuiteRunningIcon; > else if (status.isError()) > return fTestRunnerPart.fSuiteErrorIcon; > else if (status.isFailure()) > return fTestRunnerPart.fSuiteFailIcon; >- else if (status.isRunning()) >- return fTestRunnerPart.fSuiteRunningIcon; > else if (status.isOK()) > return fTestRunnerPart.fSuiteOkIcon; > else >Index: src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java,v >retrieving revision 1.5 >diff -u -r1.5 TestSuiteElement.java >--- src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java 5 May 2006 15:01:44 -0000 1.5 >+++ src/org/eclipse/jdt/internal/junit/model/TestSuiteElement.java 23 May 2006 16:22:14 -0000 >@@ -19,26 +19,56 @@ > > private List/*<TestElement>*/ fChildren; > >+ private Status fCachedStatus; >+ > public TestSuiteElement(TestSuiteElement parent, String id, String testName, int childrenCount) { > super(parent, id, testName); > fChildren= new ArrayList(childrenCount); > } > >- public void addChild(TestElement child) { >+ public synchronized void addChild(TestElement child) { > fChildren.add(child); >+ fCachedStatus= null; > } > >- public TestElement[] getChildren() { >+ public synchronized TestElement[] getChildren() { > return (TestElement[]) fChildren.toArray(new TestElement[fChildren.size()]); > } > > public Status getStatus() { >+ synchronized (this) { >+ if (fCachedStatus != null) { >+ return fCachedStatus; >+ } else { >+ fCachedStatus= Status.NOT_RUN; // fill cache with dummy value (to find out later whether cache has been reset in the meantime) >+ } >+ } >+ >+ /* >+ * Child stati can be changed by another thread, since internalGetStatus() is not synchronized. >+ * However, this is not a problem, since every change triggers a UI update event, which in turn >+ * causes another call to getStatus() later. >+ */ >+ Status status= internalGetStatus(); // do not synchronize call to collect child stati >+ >+ synchronized (this) { >+ if (fCachedStatus == null) { >+ return status; // cache has been reset -> return current status, but don't store in cache >+ } else { >+ fCachedStatus= status; // cache not reset -> flush parents >+ return status; >+ } >+ } >+ >+ } >+ >+ private Status internalGetStatus() { > //TODO: Cache failure count in hierarchy? Recheck behavior when introducing filters > Status suiteStatus= getSuiteStatus(); > // Assert.isTrue(suiteStatus.isNotRun() > // || (suiteStatus == Status.FAILURE || suiteStatus == Status.ERROR)); > >- TestElement[] children= (TestElement[]) fChildren.toArray(new TestElement[fChildren.size()]); // copy list to avoid concurreny problems >+ TestElement[] children= getChildren(); // copy list to avoid concurreny problems > if (children.length == 0) > return suiteStatus; > >@@ -62,4 +92,11 @@ > return super.toString() + " (" + fChildren.size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ > } > >+ public synchronized void childChangedStatus() { >+ fCachedStatus= null; >+ TestSuiteElement parent= getParent(); >+ if (parent != null) >+ parent.childChangedStatus(); >+ } >+ > } >Index: src/org/eclipse/jdt/internal/junit/model/TestElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/model/TestElement.java,v >retrieving revision 1.8 >diff -u -r1.8 TestElement.java >--- src/org/eclipse/jdt/internal/junit/model/TestElement.java 5 May 2006 16:09:34 -0000 1.8 >+++ src/org/eclipse/jdt/internal/junit/model/TestElement.java 23 May 2006 16:22:14 -0000 >@@ -155,9 +155,9 @@ > fParent= parent; > fId= id; > fTestName= testName; >+ fStatus= Status.NOT_RUN; > if (parent != null) > parent.addChild(this); >- fStatus= Status.NOT_RUN; > } > > /** >@@ -183,6 +183,9 @@ > //TODO: notify about change? > //TODO: multiple errors/failures per test https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296 > fStatus= status; >+ TestSuiteElement parent= getParent(); >+ if (parent != null) >+ parent.childChangedStatus(); > } > > public void setStatus(Status status, String trace, String expected, String actual) { >@@ -192,6 +195,9 @@ > fTrace= trace; > fExpected= expected; > fActual= actual; >+ TestSuiteElement parent= getParent(); >+ if (parent != null) >+ parent.childChangedStatus(); > } > > public Status getStatus() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 129929
:
42042
|
42137
|
42277
|
42878