Author: dgolovin
Date: 2012-01-11 21:01:29 -0500 (Wed, 11 Jan 2012)
New Revision: 37780
Added:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/QueryParticipantTestUtils.java
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/model/
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/model/XProjectImportTestSetUp.java
Removed:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/XProjectImportTestSetUp.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java
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/FiveDependentProjectsSearchParticipantTest.java
trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
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/kb/test/JsfKbAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
Log:
removed dependency to mode.test plugin
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 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/ELReferencesQueryParticipantTest.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -4,9 +4,9 @@
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils.MatchStructure;
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 TCKTest{
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -35,9 +35,9 @@
import org.jboss.tools.cdi.ui.search.CDIMatch;
import org.jboss.tools.cdi.ui.search.InjectionPointQueryParticipant;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils.MatchStructure;
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 FiveDependentProjectsSearchParticipantTest extends TestCase {
IProject project1 = null;
Modified: trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-12
01:31:34 UTC (rev 37779)
+++ trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-12
02:01:29 UTC (rev 37780)
@@ -8,6 +8,8 @@
Bundle-Localization: plugin
Export-Package: org.jboss.tools.common.base.test,
org.jboss.tools.common.base.test.contentassist,
+ org.jboss.tools.common.base.test.kb,
+ org.jboss.tools.common.base.test.model,
org.jboss.tools.common.base.test.validation
Require-Bundle: org.jboss.tools.common,
org.eclipse.core.runtime;bundle-version="3.7.0",
@@ -30,7 +32,9 @@
org.jboss.tools.common.validation,
org.eclipse.wst.validation;bundle-version="1.2.300",
org.eclipse.wst.common.frameworks;bundle-version="1.2.100",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.0"
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
+ org.jboss.tools.common.model;bundle-version="3.3.0",
+ org.eclipse.search;bundle-version="3.7.0"
Bundle-Version: 3.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Copied:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/QueryParticipantTestUtils.java
(from rev 37773,
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java)
===================================================================
---
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/QueryParticipantTestUtils.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/QueryParticipantTestUtils.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -0,0 +1,148 @@
+package org.jboss.tools.common.base.test.kb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
+import org.eclipse.jdt.ui.search.ElementQuerySpecification;
+import org.eclipse.jdt.ui.search.IQueryParticipant;
+import org.eclipse.jdt.ui.search.ISearchRequestor;
+import org.eclipse.jdt.ui.search.QuerySpecification;
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.util.FileUtil;
+
+public class QueryParticipantTestUtils extends TestCase {
+ public static final int FIELD_SEARCH = 1;
+ public static final int METHOD_SEARCH = 2;
+ public static final int TYPE_SEARCH = 3;
+ public static final int PARAMETER_SEARCH = 4;
+
+ public static void testSearchParticipant(IProject project, String fileName, int
searchType, String elementName, String parameterName, IQueryParticipant participant,
List<MatchStructure> matches) throws CoreException{
+ IFile file = project.getFile(fileName);
+ 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){
+ element = getMethod(type, elementName);
+ } else if(searchType == TYPE_SEARCH){
+ element = type;
+ } else if(searchType == PARAMETER_SEARCH){
+ IMethod method = getMethod(type, elementName);
+ element = getParameter(method, parameterName);
+ }
+
+ assertNotNull("Java Element not found", element);
+
+ SearchRequestor requestor = new SearchRequestor();
+
+ JavaSearchScopeFactory factory = JavaSearchScopeFactory.getInstance();
+ IJavaSearchScope scope = factory.createWorkspaceScope(true);
+ String description = factory.getWorkspaceScopeDescription(true);
+ QuerySpecification specification = new ElementQuerySpecification(element,
IJavaSearchConstants.REFERENCES, scope, description);
+
+ participant.search(requestor, specification, new NullProgressMonitor());
+
+ List<Match> matchesForCheck = requestor.getMatches();
+
+ checkMatches(matchesForCheck, matches);
+ }
+
+ private static IMethod getMethod(IType type, String name) throws JavaModelException{
+ IMethod[] methods = type.getMethods();
+ for(IMethod method : methods){
+ if(method.getElementName().equals(name))
+ return method;
+ }
+ return null;
+ }
+
+ private static ILocalVariable getParameter(IMethod method, String name) throws
JavaModelException{
+ ILocalVariable[] parameters = method.getParameters();
+ for(ILocalVariable parameter : parameters) {
+ if(parameter.getElementName().equals(name)) {
+ return parameter;
+ }
+ }
+ return null;
+ }
+
+ 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);
+
+ 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+" name -
"+ms.name+")", ms.checked);
+ }
+ }
+
+ 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("Match found (file - "+ms.path+" name -
"+ms.name+")");
+ return ms;
+ }
+ }
+ return null;
+ }
+
+ static class SearchRequestor implements ISearchRequestor {
+ ArrayList<Match> matches = new ArrayList<Match>();
+
+ public void reportMatch(Match match){
+ matches.add(match);
+ }
+
+ public List<Match> getMatches(){
+ return matches;
+ }
+ }
+
+ public static class MatchStructure{
+ String path;
+ String name; // label
+ boolean checked;
+
+ public MatchStructure(String path, String name){
+ this.path = path;
+ this.name = name;
+ checked = false;
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/kb/QueryParticipantTestUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/model/XProjectImportTestSetUp.java
(from rev 37773,
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/XProjectImportTestSetUp.java)
===================================================================
---
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/model/XProjectImportTestSetUp.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/model/XProjectImportTestSetUp.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -0,0 +1,24 @@
+package org.jboss.tools.common.base.test.model;
+
+import junit.framework.Test;
+
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+public class XProjectImportTestSetUp extends ProjectImportTestSetup {
+
+ public XProjectImportTestSetUp(Test test, String bundleName, String projectPath, String
projectName) {
+ super(test,bundleName, projectPath, projectName);
+ }
+
+ public XProjectImportTestSetUp(Test test, String bundleName, String[] projectPaths,
String[] projectNames) {
+ super(test, bundleName, projectPaths, projectNames);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ PreferenceModelUtilities.getPreferenceModel();
+ super.setUp();
+ }
+
+}
Deleted:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/XProjectImportTestSetUp.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/XProjectImportTestSetUp.java 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/XProjectImportTestSetUp.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -1,24 +0,0 @@
-package org.jboss.tools.common.model.util.test;
-
-import junit.framework.Test;
-
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.test.util.ProjectImportTestSetup;
-
-public class XProjectImportTestSetUp extends ProjectImportTestSetup {
-
- public XProjectImportTestSetUp(Test test, String bundleName, String projectPath, String
projectName) {
- super(test,bundleName, projectPath, projectName);
- }
-
- public XProjectImportTestSetUp(Test test, String bundleName, String[] projectPaths,
String[] projectNames) {
- super(test, bundleName, projectPaths, projectNames);
- }
-
- @Override
- protected void setUp() throws Exception {
- PreferenceModelUtilities.getPreferenceModel();
- super.setUp();
- }
-
-}
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 2012-01-12 01:31:34 UTC
(rev 37779)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/META-INF/MANIFEST.MF 2012-01-12 02:01:29 UTC
(rev 37780)
@@ -36,7 +36,6 @@
org.eclipse.wst.validation,
org.jboss.tools.common.el.core,
org.jboss.tools.jst.jsp,
- org.jboss.tools.common.model.test,
org.eclipse.wst.common.project.facet.core,
org.eclipse.jst.jsf.core,
org.eclipse.jst.j2ee,
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/kb/test/JsfKbAllTests.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -13,8 +13,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.tools.common.model.util.test.XProjectImportTestSetUp;
-import org.jboss.tools.jsf.kb.test.WebWithModuleTest;
+import org.jboss.tools.common.base.test.model.XProjectImportTestSetUp;
import org.jboss.tools.test.util.ProjectImportTestSetup;
/**
Modified:
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 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/ELReferencesQueryParticipantTest.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -8,9 +8,9 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils.MatchStructure;
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;
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -13,8 +13,8 @@
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.tools.common.base.test.model.XProjectImportTestSetUp;
import org.jboss.tools.common.base.test.validation.ValidationProjectTestSetup;
-import org.jboss.tools.common.model.util.test.XProjectImportTestSetUp;
import org.jboss.tools.jst.web.kb.test.validation.BuilderOrderMarkerResolutionTest;
import org.jboss.tools.jst.web.kb.test.validation.KBValidationTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
Deleted:
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 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/QueryParticipantTestUtils.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -1,148 +0,0 @@
-package org.jboss.tools.jst.web.kb.test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.ILocalVariable;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
-import org.eclipse.jdt.ui.search.ElementQuerySpecification;
-import org.eclipse.jdt.ui.search.IQueryParticipant;
-import org.eclipse.jdt.ui.search.ISearchRequestor;
-import org.eclipse.jdt.ui.search.QuerySpecification;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.util.FileUtil;
-
-public class QueryParticipantTestUtils extends TestCase {
- public static final int FIELD_SEARCH = 1;
- public static final int METHOD_SEARCH = 2;
- public static final int TYPE_SEARCH = 3;
- public static final int PARAMETER_SEARCH = 4;
-
- public static void testSearchParticipant(IProject project, String fileName, int
searchType, String elementName, String parameterName, IQueryParticipant participant,
List<MatchStructure> matches) throws CoreException{
- IFile file = project.getFile(fileName);
- 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){
- element = getMethod(type, elementName);
- } else if(searchType == TYPE_SEARCH){
- element = type;
- } else if(searchType == PARAMETER_SEARCH){
- IMethod method = getMethod(type, elementName);
- element = getParameter(method, parameterName);
- }
-
- assertNotNull("Java Element not found", element);
-
- SearchRequestor requestor = new SearchRequestor();
-
- JavaSearchScopeFactory factory = JavaSearchScopeFactory.getInstance();
- IJavaSearchScope scope = factory.createWorkspaceScope(true);
- String description = factory.getWorkspaceScopeDescription(true);
- QuerySpecification specification = new ElementQuerySpecification(element,
IJavaSearchConstants.REFERENCES, scope, description);
-
- participant.search(requestor, specification, new NullProgressMonitor());
-
- List<Match> matchesForCheck = requestor.getMatches();
-
- checkMatches(matchesForCheck, matches);
- }
-
- private static IMethod getMethod(IType type, String name) throws JavaModelException{
- IMethod[] methods = type.getMethods();
- for(IMethod method : methods){
- if(method.getElementName().equals(name))
- return method;
- }
- return null;
- }
-
- private static ILocalVariable getParameter(IMethod method, String name) throws
JavaModelException{
- ILocalVariable[] parameters = method.getParameters();
- for(ILocalVariable parameter : parameters) {
- if(parameter.getElementName().equals(name)) {
- return parameter;
- }
- }
- return null;
- }
-
- 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);
-
- 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+" name -
"+ms.name+")", ms.checked);
- }
- }
-
- 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("Match found (file - "+ms.path+" name -
"+ms.name+")");
- return ms;
- }
- }
- return null;
- }
-
- static class SearchRequestor implements ISearchRequestor {
- ArrayList<Match> matches = new ArrayList<Match>();
-
- public void reportMatch(Match match){
- matches.add(match);
- }
-
- public List<Match> getMatches(){
- return matches;
- }
- }
-
- public static class MatchStructure{
- String path;
- String name; // label
- boolean checked;
-
- public MatchStructure(String path, String name){
- this.path = path;
- this.name = name;
- checked = false;
- }
- }
-}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java 2012-01-12
01:31:34 UTC (rev 37779)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELReferencesQueryParticipantTest.java 2012-01-12
02:01:29 UTC (rev 37780)
@@ -7,9 +7,9 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils;
+import org.jboss.tools.common.base.test.kb.QueryParticipantTestUtils.MatchStructure;
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 TestCase{
IProject project = null;