Author: vrubezhny
Date: 2011-05-05 12:40:28 -0400 (Thu, 05 May 2011)
New Revision: 31108
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/ELFunctions.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/target.taglib.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/outputWeekDays.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JspElFunctionsTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
Log:
JBIDE-5436
Code assist for JSF functions in EL.
Issue is fixed. JUnit Tets is added for the issue
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2011-05-05 16:39:12
UTC (rev 31107)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/META-INF/MANIFEST.MF 2011-05-05 16:40:28
UTC (rev 31108)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.jboss.tools.jsf.ui.test
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Bundle-Vendor: %Bundle-Vendor.0
Require-Bundle: org.junit,
org.jboss.tools.tests,
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml 2011-05-05 16:39:12 UTC (rev
31107)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/pom.xml 2011-05-05 16:40:28 UTC (rev
31108)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.jboss.tools.jsf.tests</groupId>
<artifactId>org.jboss.tools.jsf.ui.test</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/ELFunctions.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/ELFunctions.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/ELFunctions.java 2011-05-05
16:40:28 UTC (rev 31108)
@@ -0,0 +1,34 @@
+package demo.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class ELFunctions {
+
+ private ELFunctions() {
+
+ }
+
+ /**
+ * returns the model for lopping
+ *
+ * @param size
+ * @return
+ */
+ public static List getLoopModel(Integer size) {
+ List list = new ArrayList();
+ for(int i = 0; i <= size; i++)
+ list.add(i);
+ return list;
+ }
+
+ /**
+ * converts string objects into an int value
+ *
+ * @param size
+ * @return
+ */
+ public static int doConvertToInteger(Object value) {
+ return Integer.valueOf(value.toString());
+ }
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/JavaSource/demo/utils/ELFunctions.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/target.taglib.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/target.taglib.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/target.taglib.xml 2011-05-05
16:40:28 UTC (rev 31108)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib
1.0//EN"
+
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib>
+ <
namespace>http://www.jboss.org/target</namespace>
+ <function>
+ <function-name>loopModel</function-name>
+ <function-class>demo.utils.ELFunctions</function-class>
+ <function-signature>List
getLoopModel(java.lang.Integer)</function-signature>
+ </function>
+ <function>
+ <function-name>convertToInteger</function-name>
+ <function-class>demo.utils.ELFunctions</function-class>
+ <function-signature>int
doConvertToInteger(java.lang.Object)</function-signature>
+ </function>
+</facelet-taglib>
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/WEB-INF/target.taglib.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/outputWeekDays.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/outputWeekDays.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/outputWeekDays.xhtml 2011-05-05
16:40:28 UTC (rev 31108)
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:t="http://myfaces.apache.org/tomahawk"
+
xmlns:target="http://www.jboss.org/target"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html" >
+ <t:dataList value="#{someBean.weekDaysAsArrayOfString}"
+ var="weekDay" rowIndexVar="index">
+ #{index eq 0 ? '' : ', '}
+ <h:outputFormat value="#{appLabel['week_days']}">
+ <f:param
+ value="#{target:convertToInteger(weekDay)}"/>
+ <f:param
+ value="#{target:loopModel()}"/>
+ </h:outputFormat>
+ </t:dataList>
+</html>
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/testJSFProject/WebContent/templates/outputWeekDays.xhtml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JspElFunctionsTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JspElFunctionsTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JspElFunctionsTest.java 2011-05-05
16:40:28 UTC (rev 31108)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jsp.ca.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
+import org.jboss.tools.test.util.TestProjectProvider;
+
+/**
+ * Test for CA on JSP EL Functions
+ *
+ * @author Victor V. Rubezhny
+ */
+public class JspElFunctionsTest extends ContentAssistantTestCase {
+ private static final String PROJECT_NAME = "testJSFProject"; //$NON-NLS-1$
+ private static final String PAGE_NAME =
"/WebContent/templates/outputWeekDays.xhtml"; //$NON-NLS-1$
+ private TestProjectProvider provider = null;
+ private static String STRING_TO_FIND_TARGET = "target:";
+ private static String STRING_TO_FIND_CONVERT = "target:co";
+ private static String STRING_TO_FIND_LOOP = "target:lo";
+ private static String PREFIX_TO_CHECK = "#{";
+
+ public static Test suite() {
+ return new TestSuite(JspElFunctionsTest.class);
+ }
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.jsf.ui.test", null,
PROJECT_NAME,false); //$NON-NLS-1$
+ project = provider.getProject();
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+
+
+ public void testJspElFunctionsCATestFuncNamespace(){
+ final String[] proposals = new String[]{
+ "target" //$NON-NLS-1$
+ };
+
+ openEditor(PAGE_NAME);
+ IRegion reg = null;
+ try {
+ reg = new FindReplaceDocumentAdapter(this.document).find(0, STRING_TO_FIND_TARGET,
true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Cannot find text region to test: \'" +
STRING_TO_FIND_TARGET + "\'", reg);
+
+ IRegion testReg = null;
+ try {
+ testReg = new FindReplaceDocumentAdapter(this.document).find(reg.getOffset() -
PREFIX_TO_CHECK.length(), PREFIX_TO_CHECK, true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", testReg);
+ assertTrue("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", (reg.getOffset() - testReg.getOffset() ==
PREFIX_TO_CHECK.length()));
+
+
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,reg.getOffset(),
proposals, false);
+
+ closeEditor();
+ }
+
+ public void testJspElFunctionsCATestFuncs(){
+ final String[] proposals = new String[]{
+ "target:convertToInteger()", //$NON-NLS-1$
+ "target:loopModel()" //$NON-NLS-1$
+ };
+
+ openEditor(PAGE_NAME);
+ IRegion reg = null;
+ try {
+ reg = new FindReplaceDocumentAdapter(this.document).find(0, STRING_TO_FIND_TARGET,
true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Cannot find text region to test: \'" +
STRING_TO_FIND_TARGET + "\'", reg);
+
+ IRegion testReg = null;
+ try {
+ testReg = new FindReplaceDocumentAdapter(this.document).find(reg.getOffset() -
PREFIX_TO_CHECK.length(), PREFIX_TO_CHECK, true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", testReg);
+ assertTrue("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", (reg.getOffset() - testReg.getOffset() ==
PREFIX_TO_CHECK.length()));
+
+
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,reg.getOffset() +
STRING_TO_FIND_TARGET.length(), proposals, false);
+
+ closeEditor();
+ }
+
+ public void testJspElFunctionsCATestFuncsConvertFunc(){
+ final String[] proposals = new String[]{
+ "target:convertToInteger()" //$NON-NLS-1$
+ };
+
+ openEditor(PAGE_NAME);
+ IRegion reg = null;
+ try {
+ reg = new FindReplaceDocumentAdapter(this.document).find(0, STRING_TO_FIND_CONVERT,
true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Cannot find text region to test: \'" +
STRING_TO_FIND_CONVERT + "\'", reg);
+
+ IRegion testReg = null;
+ try {
+ testReg = new FindReplaceDocumentAdapter(this.document).find(reg.getOffset() -
PREFIX_TO_CHECK.length(), PREFIX_TO_CHECK, true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", testReg);
+ assertTrue("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", (reg.getOffset() - testReg.getOffset() ==
PREFIX_TO_CHECK.length()));
+
+
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,reg.getOffset() +
STRING_TO_FIND_CONVERT.length(), proposals, false);
+
+ closeEditor();
+ }
+
+ public void testJspElFunctionsCATestFuncsLoopFunc(){
+ final String[] proposals = new String[]{
+ "target:loopModel()" //$NON-NLS-1$
+ };
+
+ openEditor(PAGE_NAME);
+ IRegion reg = null;
+ try {
+ reg = new FindReplaceDocumentAdapter(this.document).find(0, STRING_TO_FIND_LOOP, true,
false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Cannot find text region to test: \'" + STRING_TO_FIND_LOOP
+ "\'", reg);
+
+ IRegion testReg = null;
+ try {
+ testReg = new FindReplaceDocumentAdapter(this.document).find(reg.getOffset() -
PREFIX_TO_CHECK.length(), PREFIX_TO_CHECK, true, false, false, false); //$NON-NLS-1$
+ } catch (BadLocationException e) {
+ fail(e.getMessage());
+ }
+ assertNotNull("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", testReg);
+ assertTrue("Text region to test doesn\'t start with prefix: \'" +
PREFIX_TO_CHECK + "\'", (reg.getOffset() - testReg.getOffset() ==
PREFIX_TO_CHECK.length()));
+
+
+ final ICompletionProposal[] rst = checkProposals(PAGE_NAME,reg.getOffset() +
STRING_TO_FIND_LOOP.length(), proposals, false);
+
+ closeEditor();
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/JspElFunctionsTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2011-05-05
16:39:12 UTC (rev 31107)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2011-05-05
16:40:28 UTC (rev 31108)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2007-2011 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,
@@ -27,6 +27,7 @@
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide1704Test;
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide1717Test;
import org.jboss.tools.jsf.jsp.ca.test.JsfJspJbide6259Test;
+import org.jboss.tools.jsf.jsp.ca.test.JspElFunctionsTest;
import org.jboss.tools.jsf.jsp.ca.test.WebContentAssistProviderTest;
import org.jboss.tools.jsf.ui.test.refactoring.ELReferencesRenameTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
@@ -35,6 +36,7 @@
public static Test suite() {
TestSuite suite = new TestSuite("JSF UI tests"); //$NON-NLS-1$
+
suite.addTestSuite(NewJSFProjectTest.class);
suite.addTestSuite(CAForUnclosedELTest.class);
suite.addTestSuite(CAForCompositeComponentTest.class);
@@ -90,6 +92,11 @@
suite.addTestSuite(JsfUiPreferencesPagesTest.class);
suite.addTestSuite(TaglibXMLUnformatedDTD_JBIDE5642.class);
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(
+ JspElFunctionsTest.class), "org.jboss.tools.jsf.ui.test", //$NON-NLS-1$
+ new String[] { "projects/testJSFProject", }, //$NON-NLS-1$
+ new String[] { "testJSFProject" })); //$NON-NLS-1$
+
return new TestWizardsProject(suite);
}
}
\ No newline at end of file