Author: dazarov
Date: 2011-08-12 20:31:54 -0400 (Fri, 12 Aug 2011)
New Revision: 33882
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java
trunk/jsf/tests/org.jboss.tools.jsf.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java 2011-08-12
23:55:18 UTC (rev 33881)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java 2011-08-13
00:31:54 UTC (rev 33882)
@@ -13,13 +13,10 @@
public void testELReferencesQueryParticipantForType() throws CoreException{
ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
- //matches.add(new
MatchStructure("/tck/JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/JSFTestPage.jsp",
"sheep"));
matches.add(new MatchStructure("/tck/WebContent/test.jsp",
"sheep"));
matches.add(new
MatchStructure("/tck/WebContent/el/integration/JSFTestPage.jsp",
"sheep"));
matches.add(new
MatchStructure("/tck/WebContent/tests/lookup/el/integration/JSFTestPage.jsp",
"sheep"));
-// matches.add(new
MatchStructure("/tck/JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/JSFTestPage.jsp",
"sheep"));
-
QueryParticipantTestUtils.testSearchParticipant(tckProject,
"JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/Sheep.java",
QueryParticipantTestUtils.TYPE_SEARCH,
@@ -32,11 +29,9 @@
public void testELReferencesQueryParticipantForMethod() throws CoreException{
ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
- //matches.add(new
MatchStructure("/tck/JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/JSFTestPage.jsp",
"name"));
matches.add(new MatchStructure("/tck/WebContent/test.jsp",
"name"));
matches.add(new
MatchStructure("/tck/WebContent/el/integration/JSFTestPage.jsp",
"name"));
matches.add(new
MatchStructure("/tck/WebContent/tests/lookup/el/integration/JSFTestPage.jsp",
"name"));
-// matches.add(new
MatchStructure("/tck/JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/JSFTestPage.jsp",
"name"));
QueryParticipantTestUtils.testSearchParticipant(tckProject,
"JavaSource/org/jboss/jsr299/tck/tests/lookup/el/integration/Sheep.java",
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/META-INF/MANIFEST.MF 2011-08-12 23:55:18 UTC
(rev 33881)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/META-INF/MANIFEST.MF 2011-08-13 00:31:54 UTC
(rev 33882)
@@ -43,7 +43,8 @@
org.eclipse.wst.web,
org.eclipse.jst.jee.ejb,
org.eclipse.jst.jee.web,
- org.eclipse.jst.jsf.common
+ org.eclipse.jst.jsf.common,
+ org.jboss.tools.jst.web.kb.test
Bundle-Activator: org.jboss.tools.jsf.plugin.JsfTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java 2011-08-13
00:31:54 UTC (rev 33882)
@@ -0,0 +1,61 @@
+package org.jboss.tools.jsf.test;
+
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.jst.web.kb.refactoring.ELReferencesQueryParticipant;
+import org.jboss.tools.jst.web.kb.test.QueryParticipantTestUtils;
+import org.jboss.tools.jst.web.kb.test.QueryParticipantTestUtils.MatchStructure;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+public class ELReferencesQueryParticipantTest extends TestCase{
+ static String projectName = "JSF2ComponentsValidator";
+ static IProject project;
+
+ public ELReferencesQueryParticipantTest(){
+ super("ELReferencesQueryParticipantTest");
+ }
+
+ protected void setUp() throws Exception {
+ project = ProjectImportTestSetup.loadProject(projectName);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle(2000);
+ }
+
+ public void testELReferencesQueryParticipantForType() throws CoreException{
+ ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
+
+ matches.add(new
MatchStructure("/JSF2ComponentsValidator/WebContent/pages/greeting.xhtml",
"person"));
+ matches.add(new
MatchStructure("/JSF2ComponentsValidator/WebContent/resources/demo/input.xhtml",
"person"));
+ matches.add(new
MatchStructure("/JSF2ComponentsValidator/WebContent/resources/demo/input.xhtml",
"person"));
+
+ QueryParticipantTestUtils.testSearchParticipant(project,
+ "JavaSource/demo/Person.java",
+ QueryParticipantTestUtils.TYPE_SEARCH,
+ "Person",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+
+ public void testELReferencesQueryParticipantForMethod() throws CoreException{
+ ArrayList<MatchStructure> matches = new ArrayList<MatchStructure>();
+
+ matches.add(new
MatchStructure("/JSF2ComponentsValidator/WebContent/pages/greeting.xhtml",
"name"));
+ matches.add(new
MatchStructure("/JSF2ComponentsValidator/WebContent/resources/demo/input.xhtml",
"name"));
+
+ QueryParticipantTestUtils.testSearchParticipant(project,
+ "JavaSource/demo/Person.java",
+ QueryParticipantTestUtils.METHOD_SEARCH,
+ "getName",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-08-12
23:55:18 UTC (rev 33881)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-08-13
00:31:54 UTC (rev 33882)
@@ -79,6 +79,10 @@
JSF2RefactoringTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
new String[] { "projects/JSF2ComponentsValidator" }, //$NON-NLS-1$
new String[] { "JSF2ComponentsValidator" })); //$NON-NLS-1$
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(
+ ELReferencesQueryParticipantTest.class), "org.jboss.tools.jsf.test",
//$NON-NLS-1$
+ new String[] { "projects/JSF2ComponentsValidator" }, //$NON-NLS-1$
+ new String[] { "JSF2ComponentsValidator" })); //$NON-NLS-1$
// suite.addTest(new ProjectImportTestSetup(new TestSuite(
// I18nValidatorTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
// new String[] { "projects/i18nTestProject" }, //$NON-NLS-1$
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-12
23:55:18 UTC (rev 33881)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-13
00:31:54 UTC (rev 33882)
@@ -37,10 +37,15 @@
assertNotNull("File - "+fileName+" not found", file);
ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
+
+ assertNotNull("CompilationUnit not found", compilationUnit);
+
IJavaElement element = null;
IType type = compilationUnit.findPrimaryType();
+ assertNotNull("Primary type not found", type);
+
if(searchType == FIELD_SEARCH){
element = type.getField(elementName);
}else if(searchType == METHOD_SEARCH){