Author: yzhishko
Date: 2010-02-03 08:31:57 -0500 (Wed, 03 Feb 2010)
New Revision: 20093
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
A workaround to avoid junit failures connected to StructuredRegionProcessor
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 2010-02-03
11:43:39 UTC (rev 20092)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1105Test.java 2010-02-03
13:31:57 UTC (rev 20093)
@@ -1,13 +1,13 @@
/*******************************************************************************
-* Copyright (c) 2007 Red Hat, Inc.
-* Distributed under license by Red Hat, Inc. All rights reserved.
-* This program is made available under the terms of the
-* Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at
http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Red Hat, Inc. - initial API and implementation
-******************************************************************************/
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
import org.eclipse.core.resources.IFile;
@@ -21,59 +21,57 @@
/**
* @author mareshkau
- *
+ *
*/
public class JBIDE1105Test extends VpeTest {
- private static final String TEST_PAGE_NAME="JBIDE/1105/employee.xhtml";
//$NON-NLS-1$
-
+ private static final String TEST_PAGE_NAME = "JBIDE/1105/employee.xhtml";
//$NON-NLS-1$
+
public JBIDE1105Test(String name) {
super(name);
}
-
+
public void testJBIDE1105() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- setException(null);
- // get test page path
- IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME,
- JsfAllTests.IMPORT_PROJECT_NAME);
+ // wait
+ TestUtil.waitForJobs();
+ setException(null);
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME,
+ JsfAllTests.IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
//$NON-NLS-1$
+ assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
//$NON-NLS-1$
- IEditorInput input = new FileEditorInput(file);
+ IEditorInput input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input); //$NON-NLS-1$
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
- final JSPMultiPageEditor parts = openEditor(input);
- TestUtil.waitForIdle();
- assertNotNull(parts);
+ final JSPMultiPageEditor parts = openEditor(input);
+ TestUtil.waitForIdle();
+ assertNotNull(parts);
- StyledText styledText = parts.getSourceEditor().getTextViewer()
- .getTextWidget();
- String delimiter = styledText.getLineDelimiter();
- for (int i = 0; i < 10; i++) {
- int offset = styledText.getOffsetAtLine(21);
- styledText.setCaretOffset(offset - delimiter.length());
- styledText.insert(delimiter);
+ StyledText styledText = parts.getSourceEditor().getTextViewer()
+ .getTextWidget();
+ String delimiter = styledText.getLineDelimiter();
+ for (int i = 0; i < 10; i++) {
+ int offset = styledText.getOffsetAtLine(21);
+ styledText.setCaretOffset(offset - delimiter.length());
+ styledText.insert(delimiter);
+ TestUtil.waitForIdle();
+ }
+ for (int i = 0; i < 10; i++) {
+ int offset = styledText.getOffsetAtLine(23);
+ styledText.setCaretOffset(offset - " Test ".length() //$NON-NLS-1$
+ - delimiter.length());
+ styledText.insert(" Test "); //$NON-NLS-1$
+ TestUtil.waitForIdle();
+ }
+
TestUtil.waitForIdle();
+ TestUtil.delay(1000L);
+
+ if (getException() != null) {
+ throw getException();
+ }
}
- for (int i = 0; i < 10; i++) {
- int offset = styledText.getOffsetAtLine(23);
- styledText.setCaretOffset(offset - " Test ".length() //$NON-NLS-1$
- - delimiter.length());
- styledText.insert(" Test "); //$NON-NLS-1$
- TestUtil.waitForIdle();
- }
-
- TestUtil.waitForIdle();
- TestUtil.delay(1000L);
-
- closeEditors();
-
- if (getException() != null) {
- throw getException();
- }
- }
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-02-03
11:43:39 UTC (rev 20092)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-02-03
13:31:57 UTC (rev 20093)
@@ -23,6 +23,7 @@
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -31,6 +32,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
@@ -109,7 +111,20 @@
*/
@Override
protected void tearDown() throws Exception {
-
+
+ boolean isJobsCheck = true;
+ while (isJobsCheck){
+ isJobsCheck = false;
+ Job[] jobs = Job.getJobManager().find(null);
+ for (Job job : jobs) {
+ if (job instanceof StructuredRegionProcessor) {
+ TestUtil.delay(50);
+ isJobsCheck = true;
+ break;
+ }
+ }
+ }
+
closeEditors();
Platform.removeLogListener(this);