[jbosstools-commits] JBoss Tools SVN: r43828 - trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Sep 19 09:37:35 EDT 2012
Author: vrubezhny
Date: 2012-09-19 09:37:35 -0400 (Wed, 19 Sep 2012)
New Revision: 43828
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2BeanMapValuesOpenOnTest.java
Log:
JBIDE-12630
EL Resolver incorrectly processes EL which uses java.util.Map
JUnit Test Case ia added for the issue
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2BeanMapValuesOpenOnTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2BeanMapValuesOpenOnTest.java 2012-09-19 13:33:53 UTC (rev 43827)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/JSF2BeanMapValuesOpenOnTest.java 2012-09-19 13:37:35 UTC (rev 43828)
@@ -29,7 +29,7 @@
import org.jboss.tools.test.util.WorkbenchUtils;
/**
- * JUnit test for JBIDE-12609
+ * JUnit test for JBIDE-12609, JBIDE-12630
*
* @author Victor V. Rubezhny
*
@@ -43,6 +43,7 @@
private static final String EL = "#{group.users['admin'].name}";
private static final String EL_SEGMENT0 = "admin";
private static final String EL_SEGMENT1 = "name";
+ private static final String EL_SEGMENT2 = "users";
private static final String EDITOR_NAME = "User.java";
private ELHyperlinkDetector elHyperlinkDetector = new ELHyperlinkDetector();
@@ -62,6 +63,9 @@
super("JSF2 OpenOn on Bean Map Values test");
}
+ /*
+ * JUnit test for JBIDE-12609
+ */
public void testBeanMapValues() throws PartInitException, BadLocationException {
IEditorPart editor = WorkbenchUtils.openEditor(SOURCE_PAGE_NAME);
assertTrue(editor instanceof JSPMultiPageEditor);
@@ -138,4 +142,68 @@
assertTrue("OpenOn have not opened "+EDITOR_NAME+" editor",found);
}
+
+ /*
+ * JUnit test for JBIDE-12630
+ */
+ public void testBeanMap() throws PartInitException, BadLocationException {
+ IEditorPart editor = WorkbenchUtils.openEditor(SOURCE_PAGE_NAME);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ JSPMultiPageEditor jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ IDocument document = viewer.getDocument();
+ IRegion reg = new FindReplaceDocumentAdapter(document).find(0,
+ EL0, true, true, false, false);
+
+ assertNotNull("EL: " + EL0 + " not found",reg);
+ reg = new FindReplaceDocumentAdapter(document).find(reg.getOffset(),
+ EL0_SEGMENT, true, true, false, false);
+
+ assertNotNull("Segment: " + EL0_SEGMENT + " not found in EL",reg);
+
+ IHyperlink[] links = elHyperlinkDetector.detectHyperlinks(viewer, new Region(reg.getOffset() + reg.getLength() - 1, 0), false);
+ assertNotNull("Hyperlinks for EL Segment:"+EL0_SEGMENT+" not found",links);
+ assertTrue("Hyperlinks for EL Segment:"+EL0_SEGMENT+" not found",links.length!=0);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+
+ editor = WorkbenchUtils.openEditor(PAGE_NAME);
+ assertTrue(editor instanceof JSPMultiPageEditor);
+ jspMultyPageEditor = (JSPMultiPageEditor) editor;
+ viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
+
+ document = viewer.getDocument();
+ IRegion reg0 = new FindReplaceDocumentAdapter(document).find(0,
+ EL, true, true, false, false);
+
+ assertNotNull("EL: " + EL + " not found",reg0);
+
+ // Open On over 'users' segment should return a link to User.java
+ reg = new FindReplaceDocumentAdapter(document).find(reg0.getOffset(),
+ EL_SEGMENT2, true, true, false, false);
+
+ assertNotNull("Segment: " + EL_SEGMENT2 + " not found in EL",reg);
+
+ links = elHyperlinkDetector.detectHyperlinks(viewer, new Region(reg.getOffset() + reg.getLength() - 1, 0), false);
+
+ assertNotNull("Hyperlinks for EL Segment:"+EL_SEGMENT2+" not found",links);
+ assertTrue("Hyperlinks for EL Segment:"+EL_SEGMENT2+" not found",links.length!=0);
+
+ boolean found = false;
+ for(IHyperlink link : links){
+ assertNotNull(link.toString());
+
+ link.open();
+
+ IEditorPart resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(EDITOR_NAME.equals(resultEditor.getTitle())){
+ found = true;
+ return;
+ }
+ }
+ assertTrue("OpenOn have not opened "+EDITOR_NAME+" editor",found);
+
+ }
+
}
More information about the jbosstools-commits
mailing list