Author: dazarov
Date: 2011-08-12 18:03:50 -0400 (Fri, 12 Aug 2011)
New Revision: 33867
Added:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.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/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF 2011-08-12 21:36:57
UTC (rev 33866)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF 2011-08-12 22:03:50
UTC (rev 33867)
@@ -28,5 +28,6 @@
org.eclipse.search;bundle-version="3.7.0",
org.jboss.tools.common.el.core;bundle-version="3.3.0",
org.jboss.tools.jst.web.kb,
- org.eclipse.wst.validation;bundle-version="1.2.300"
+ org.eclipse.wst.validation;bundle-version="1.2.300",
+ org.jboss.tools.jst.web.kb.test
Export-Package: org.jboss.tools.cdi.ui.test
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2011-08-12
21:36:57 UTC (rev 33866)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2011-08-12
22:03:50 UTC (rev 33867)
@@ -35,6 +35,7 @@
import org.jboss.tools.cdi.ui.test.perspective.CDIPerspectiveTest;
import org.jboss.tools.cdi.ui.test.preferences.CDIPreferencePageTest;
import org.jboss.tools.cdi.ui.test.search.CDISearchParticipantTest;
+import org.jboss.tools.cdi.ui.test.search.ELReferencesQueryParticipantTest;
import org.jboss.tools.cdi.ui.test.wizard.AddQualifiersToBeanWizardTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIClassWizardFactoryTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIWizardTest;
@@ -68,6 +69,7 @@
suite.addTestSuite(CDISearchParticipantTest.class);
+ suite.addTestSuite(ELReferencesQueryParticipantTest.class);
suiteAll.addTest(new CDICoreTestSetup(suite) {
@Override
protected void setUp() throws Exception {
Added:
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
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java 2011-08-12
22:03:50 UTC (rev 33867)
@@ -0,0 +1,49 @@
+package org.jboss.tools.cdi.ui.test.search;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.cdi.ui.test.TCKUITest;
+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;
+
+public class ELReferencesQueryParticipantTest extends TCKUITest{
+
+ 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,
+ "Sheep",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+
+ 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",
+ QueryParticipantTestUtils.METHOD_SEARCH,
+ "getName",
+ "",
+ new ELReferencesQueryParticipant(),
+ matches);
+ }
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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
21:36:57 UTC (rev 33866)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2011-08-12
22:03:50 UTC (rev 33867)
@@ -90,24 +90,28 @@
private static void checkMatches(List<Match> matchesForCheck,
List<MatchStructure> matchList) throws CoreException {
for(Match match : matchesForCheck){
assertTrue("Match must return IFile", match.getElement() instanceof IFile);
- MatchStructure ms = findMatch(matchList, match);
- assertNotNull("Unexpected match found (file -
"+((IFile)match.getElement()).getFullPath()+")", ms);
+
+ IFile file = (IFile)match.getElement();
+ String filePath = file.getFullPath().toString();
+ String text = FileUtil.getContentFromEditorOrFile(file);
+ String name = text.substring(match.getOffset(), match.getOffset()+match.getLength());
+
+ MatchStructure ms = findMatch(matchList, match, filePath, name);
+
+ assertNotNull("Unexpected match found (file - "+filePath+" name -
"+name+")", ms);
ms.checked = true;
}
for(MatchStructure ms : matchList){
- assertTrue("Match not found (file - "+ms.path+")", ms.checked);
+ assertTrue("Match not found (file - "+ms.path+" name -
"+ms.name+")", ms.checked);
}
}
- protected static MatchStructure findMatch(List<MatchStructure> matchList, Match
match){
- IFile file = (IFile)match.getElement();
- String filePath = file.getFullPath().toString();
- String text = FileUtil.getContentFromEditorOrFile(file);
- String name = text.substring(match.getOffset(), match.getOffset()+match.getLength());
+ protected static MatchStructure findMatch(List<MatchStructure> matchList, Match
match, String filePath, String name){
+
for(MatchStructure ms : matchList){
if(!ms.checked && ms.path.equals(filePath) && ms.name.equals(name)){
- System.out.println("found!");
+ //System.out.println("Match found (file - "+ms.path+" name -
"+ms.name+")");
return ms;
}
}