Author: mareshkau
Date: 2009-06-29 12:43:33 -0400 (Mon, 29 Jun 2009)
New Revision: 16261
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4534Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.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:
https://jira.jboss.org/jira/browse/JBIDE-4534, calls of revalidate tlf hasbeen removed
from vpe initialization code
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-06-29
15:49:41 UTC (rev 16260)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-06-29
16:43:33 UTC (rev 16261)
@@ -62,6 +62,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4373Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4509Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4510Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4534Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -151,6 +152,7 @@
suite.addTestSuite(JBIDE4179Test.class);
suite.addTestSuite(JBIDE4509Test.class);
suite.addTestSuite(JBIDE4510Test.class);
+ suite.addTestSuite(JBIDE4534Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4534Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4534Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4534Test.java 2009-06-29
16:43:33 UTC (rev 16261)
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfTestPlugin;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.web.project.WebProject;
+import org.jboss.tools.jst.web.tld.TaglibMapping;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class JBIDE4534Test extends VpeTest{
+
+ private VpeController vpeController;
+ private Job nonUIJob;
+ private IProject project;
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.ui.test.VpeTest#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setVpeController(null);
+ this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
+ this.nonUIJob = new Job("Revalidate Taglibs Test Job name"){ //$NON-NLS-1$
+ @SuppressWarnings("synthetic-access")
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ XModel xm = null;
+ IModelNature mn = EclipseResourceUtil.getModelNature(JBIDE4534Test.this.project);
+ if (mn != null) {
+ xm = mn.getModel();
+ }
+ TaglibMapping taglibMapping = WebProject.getInstance(xm).getTaglibMapping();
+ final long timeOfEndExecution = System.currentTimeMillis()+TestUtil.MAX_IDLE;
+ synchronized (taglibMapping) {
+ while(getVpeController()==null) {
+ if(timeOfEndExecution<System.currentTimeMillis()) {
+ return new Status(IStatus.ERROR, JsfTestPlugin.PLUGIN_ID, "Visual page
editor hasn't been initialized in time, possibly it's
sleeped");//$NON-NLS-1$
+ }
+ if(monitor.isCanceled()) {
+ return new Status(IStatus.CANCEL, JsfTestPlugin.PLUGIN_ID, "Job Execution
has been canceled");//$NON-NLS-1$
+ }
+ try {
+ Thread.sleep(5);
+ } catch (InterruptedException e) {
+ fail(e.getStackTrace()+""); //$NON-NLS-1$
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }};
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.vpe.ui.test.VpeTest#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ this.nonUIJob.cancel();
+ setVpeController(null);
+ super.tearDown();
+ }
+
+ public JBIDE4534Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE4534Test() throws Throwable {
+
+ this.nonUIJob.schedule();
+ while(this.nonUIJob.getState()!=Job.RUNNING) {
+ TestUtil.delay(4);
+ }
+ IFile file = (IFile) TestUtil.getComponentPath("index.xhtml", //$NON-NLS-1$
+ JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+ // open and get editor
+ final JSPMultiPageEditor part = openEditor(input);
+ setVpeController(TestUtil.getVpeController(part));
+ TestUtil.waitForIdle();
+ IStatus result = this.nonUIJob.getResult();
+ if(result==null
+ ||result.matches(IStatus.ERROR)
+ ||result.matches(IStatus.CANCEL)){
+ fail("Test failed becouse "+result); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return the vpeController
+ */
+ private VpeController getVpeController() {
+ return this.vpeController;
+ }
+
+ /**
+ * @param vpeControllerParam the vpeController to set
+ */
+ private void setVpeController(VpeController vpeControllerParam) {
+ this.vpeController = vpeControllerParam;
+ }
+}
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 2009-06-29
15:49:41 UTC (rev 16260)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-06-29
16:43:33 UTC (rev 16261)
@@ -255,19 +255,20 @@
sourceModel.addModelLifecycleListener(this);
IEditorInput editorInput = pageContext.getEditPart().getEditorInput();
- if(editorInput instanceof IFileEditorInput) {
- XModel xm = null;
- IProject project = ((IFileEditorInput) editorInput).getFile()
- .getProject();
- IModelNature mn = EclipseResourceUtil.getModelNature(project);
- if (mn != null) {
- xm = mn.getModel();
- }
- if (xm != null) {
- WebProject.getInstance(xm).getTaglibMapping().revalidate(
- WebAppHelper.getWebApp(xm));
- }
- }
+ //commented by Maksim Areshkau, as fix for
https://jira.jboss.org/jira/browse/JBIDE-4534
+// if(editorInput instanceof IFileEditorInput) {
+// XModel xm = null;
+// IProject project = ((IFileEditorInput) editorInput).getFile()
+// .getProject();
+// IModelNature mn = EclipseResourceUtil.getModelNature(project);
+// if (mn != null) {
+// xm = mn.getModel();
+// }
+// if (xm != null) {
+// WebProject.getInstance(xm).getTaglibMapping().revalidate(
+// WebAppHelper.getWebApp(xm));
+// }
+// }
IDOMDocument sourceDocument = sourceModel.getDocument();
// FIXED FOR JBIDE-3799 by sdzmitrovich, moved calling of this method to buid dom
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 2009-06-29
15:49:41 UTC (rev 16260)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2009-06-29
16:43:33 UTC (rev 16261)
@@ -61,7 +61,7 @@
protected final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
/** The Constant MAX_IDLE. */
- private static final long MAX_IDLE = 15*1000L;
+ public static final long MAX_IDLE = 15*1000L;
/**