Author: snjeza
Date: 2008-04-27 17:07:02 -0400 (Sun, 27 Apr 2008)
New Revision: 7841
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1479Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Log:
JBIDE-2128 Error when executing the testCAforIncludeTaglibInInenerNodes VPE JUnit test
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java 2008-04-27
20:50:20 UTC (rev 7840)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java 2008-04-27
21:07:02 UTC (rev 7841)
@@ -52,41 +52,32 @@
assertNotNull("Editor input is null", input);
- TestUtil.waitForJobs();
final JSPMultiPageEditor parts = openEditor(input);
- TestUtil.delay(1000L);
+ TestUtil.waitForIdle();
assertNotNull(parts);
- Job job = new UIJob("Test JBIDE-1105") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- StyledText styledText = parts.getSourceEditor().getTextViewer()
+ StyledText styledText = parts.getSourceEditor().getTextViewer()
.getTextWidget();
- String delimiter = styledText.getLineDelimiter();
- for (int i = 0; i < 200; i++) {
- int offset = styledText.getOffsetAtLine(21);
- styledText.setCaretOffset(offset - delimiter.length());
- styledText.insert(delimiter);
- TestUtil.delay(50L);
- }
- for (int i = 0; i < 200; i++) {
- int offset = styledText.getOffsetAtLine(23);
- styledText.setCaretOffset(offset - " Test ".length() -
delimiter.length());
- styledText.insert(" Test ");
- TestUtil.delay(50L);
- }
- return Status.OK_STATUS;
- }
-
- };
- job.setPriority(Job.SHORT);
- job.schedule(0L);
+ String delimiter = styledText.getLineDelimiter();
+ for (int i = 0; i < 200; i++) {
+ int offset = styledText.getOffsetAtLine(21);
+ styledText.setCaretOffset(offset - delimiter.length());
+ styledText.insert(delimiter);
+ TestUtil.waitForIdle();
+ }
+ for (int i = 0; i < 200; i++) {
+ int offset = styledText.getOffsetAtLine(23);
+ styledText.setCaretOffset(offset - " Test ".length()
+ - delimiter.length());
+ styledText.insert(" Test ");
+ TestUtil.waitForIdle();
+ }
+
+ TestUtil.waitForIdle();
TestUtil.delay(1000L);
- TestUtil.waitForJobs();
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors(false);
-
+
+ closeEditors();
+
if (getException() != null) {
throw getException();
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1479Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1479Test.java 2008-04-27
20:50:20 UTC (rev 7840)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1479Test.java 2008-04-27
21:07:02 UTC (rev 7841)
@@ -37,15 +37,12 @@
public static final String TEST_PAGE_NAME = "JBIDE/1479/employee.xhtml";
//$NON-NLS-1$
- private boolean finished;
-
public JBIDE1479Test(String name) {
super(name);
}
public void testJBIDE1479() throws Throwable {
// wait
- TestUtil.waitForJobs();
setException(null);
// get test page path
final IFile file = (IFile) TestUtil.getComponentPath(
@@ -60,14 +57,10 @@
assertNotNull("Editor input is null", input); //$NON-NLS-1$
- TestUtil.waitForJobs();
JSPMultiPageEditor part = openEditor(input);
- TestUtil.delay(10000L);
+ TestUtil.waitForIdle();
assertNotNull(part);
- final StyledTextContent content=
part.getSourceEditor().getTextViewer().getTextWidget().getContent();
- finished = false;
-
Job job = new WorkspaceJob("Test JBIDE-1479"){ //$NON-NLS-1$
public IStatus runInWorkspace(IProgressMonitor monitor) {
@@ -79,21 +72,16 @@
* exception, so we just ignore it's.
*/
}
- finished = true;
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
job.schedule(0L);
- TestUtil.delay(15000L);
- TestUtil.waitForJobs();
-
- while (!finished) {
- TestUtil.delay(1000L);
- }
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors(false);
+ job.join();
+ TestUtil.waitForIdle();
+ TestUtil.delay(1000L);
+ closeEditors();
+
/*
* we ignore this code, because we are testint JBIDE-1479,
* it's test fot crash of eclipse.And if we modifying content from non-ui thread, we
almost
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-04-27
20:50:20 UTC (rev 7840)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-04-27
21:07:02 UTC (rev 7841)
@@ -20,7 +20,6 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.vpe.ui.test.TestUtil;
@@ -259,6 +258,9 @@
.getTextViewer(), position);
assertNotNull(results);
assertEquals(numberOfProposals, results.length);
+
+ closeEditors();
+ TestUtil.delay(1000L);
}
/**
@@ -329,6 +331,8 @@
assertEquals(true, displayString.startsWith(partOfString));
}
+ closeEditors();
+ TestUtil.delay(1000L);
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-04-27
20:50:20 UTC (rev 7840)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-04-27
21:07:02 UTC (rev 7841)
@@ -315,6 +315,10 @@
}
public void dispose() {
+ if (job != null) {
+ job.cancel();
+ job = null;
+ }
if (optionsListener != null) {
XModelObject optionsObject = ModelUtilities.getPreferenceModel()
.getByPath(VpePreference.EDITOR_PATH);
@@ -436,7 +440,7 @@
public void notifyChangedInUiThread(INodeNotifier notifier, int eventType,
Object feature, Object oldValue, Object newValue, int pos) {
- if (!switcher
+ if (switcher == null || !switcher
.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
return;
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-04-27
20:50:20 UTC (rev 7840)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-04-27
21:07:02 UTC (rev 7841)
@@ -42,6 +42,8 @@
private static final String WEBCONTENT_PATH = "WebContent"; //$NON-NLS-1$
+ private static final long MAX_IDLE = 30*60*1000L;
+
@SuppressWarnings("restriction")
static void importProjectIntoWorkspace(String path, String projectName) {
@@ -163,6 +165,15 @@
while (Job.getJobManager().currentJob() != null)
delay(100);
}
+
+ public static void waitForIdle() {
+ long start = System.currentTimeMillis();
+ while (!Job.getJobManager().isIdle()) {
+ delay(500);
+ if ( (System.currentTimeMillis()-start) > MAX_IDLE )
+ throw new RuntimeException("A long running task detected");
+ }
+ }
/**
* find elements by name
Show replies by date