Author: dgolovin
Date: 2012-01-16 21:08:45 -0500 (Mon, 16 Jan 2012)
New Revision: 37886
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/OpenOnsTest.java
Log:
test added for converterId attribute openon
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2012-01-17
00:45:13 UTC (rev 37885)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/META-INF/MANIFEST.MF 2012-01-17
02:08:45 UTC (rev 37886)
@@ -25,7 +25,8 @@
org.jboss.tools.jsf.ui,
org.eclipse.jst.standard.schemas,
org.jboss.tools.jst.text.ext.test;bundle-version="3.3.0",
- org.eclipse.jdt.ui;bundle-version="3.7.0"
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.jboss.tools.jsf;bundle-version="3.3.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Export-Package: org.jboss.tools.jsf.text.ext.test
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/OpenOnsTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/OpenOnsTest.java 2012-01-17
00:45:13 UTC (rev 37885)
+++
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/OpenOnsTest.java 2012-01-17
02:08:45 UTC (rev 37886)
@@ -3,6 +3,7 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
@@ -10,6 +11,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IEditorPart;
@@ -19,6 +21,7 @@
import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
import org.jboss.tools.common.model.ui.editors.multipage.DefaultMultipageEditor;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.jboss.tools.jsf.jsf2.bean.model.JSF2ProjectFactory;
import org.jboss.tools.jsf.text.ext.hyperlink.JsfJSPTagNameHyperlinkDetector;
import org.jboss.tools.jsf.text.ext.hyperlink.TLDTagHyperlink;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
@@ -36,6 +39,11 @@
project = ResourcesPlugin.getWorkspace().getRoot().getProject(
OPENON_TEST_PROJECT);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ } catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
IWorkbench workbench = PlatformUI.getWorkbench();
}
@@ -639,6 +647,30 @@
assertModelObjectSelection(links[0], "myattr");
}
+
+ public static final String CONVERTER_TEST_FILE = OPENON_TEST_PROJECT +
"/WebContent/converterHiperlinkTest.jsp";
+
+ public void testConverterTagOpenOn() throws BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(CONVERTER_TEST_FILE);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+ IDocument document =
jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ "testConverter", true, true, false, false);
+ JSF2ProjectFactory.getJSF2Project(ResourcesPlugin.getWorkspace().getRoot().getProject(OPENON_TEST_PROJECT),true);
+ JobUtils.waitForIdle();
+ IHyperlink[] links = new HyperlinkDetector().detectHyperlinks(viewer, reg, true);
+ assertNotNull(links);
+ assertTrue(links.length!=0);
+ //assertNotNull(links[0].getHyperlinkText());
+ assertNotNull(links[0].toString());
+ links[0].open();
+
+ editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+ // TODO: add assert for opened faces-config.xml editor with converter selected
+ }
void assertModelObjectSelection(IHyperlink link, String name) {
assertTrue(link instanceof TLDTagHyperlink);
Show replies by date