Author: akazakov
Date: 2010-04-08 13:37:44 -0400 (Thu, 08 Apr 2010)
New Revision: 21359
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5808
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -37,11 +37,7 @@
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeParameter;
-import org.jboss.tools.cdi.internal.core.impl.CDIAnnotationElement;
-import org.jboss.tools.cdi.internal.core.impl.ParametedType;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationHelper;
-import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
import org.jboss.tools.cdi.internal.core.scanner.CDIBuilderDelegate;
import org.jboss.tools.cdi.internal.core.scanner.FileSet;
import org.jboss.tools.common.EclipseUtil;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -12,9 +12,7 @@
import java.io.File;
import java.io.IOException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -12,8 +12,6 @@
import java.util.Set;
-import org.eclipse.jdt.core.IType;
-
/**
* Represents a parameter of a method which is a member of bean class.
*
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -12,8 +12,6 @@
import java.util.Set;
-import org.eclipse.jdt.core.IType;
-
/**
* This interface if common protocol to have access to scoped of bean class or
* producer method or field or stereotype.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -10,9 +10,11 @@
******************************************************************************/
package org.jboss.tools.cdi.core.test;
+import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.jdt.internal.core.JavaModelManager;
import org.jboss.tools.cdi.core.test.tck.NamedBeanRefactoringTest;
import org.jboss.tools.tests.AbstractPluginsLoadTest;
@@ -24,8 +26,9 @@
public static Test suite() {
TestSuite suite = new TestSuite("CDI Core Tests");
suite.addTest(new CDICoreTestSetup(CDICoreTestSuite.suite()));
- suite.addTest(new NamedBeanRefactoringTest().suite());
- return suite;
+ suite.addTest(NamedBeanRefactoringTest.suite());
+
+ return new DisableJavaIndexingSetup(suite);
}
public class CDIPluginsLoadTest extends AbstractPluginsLoadTest {
@@ -33,4 +36,21 @@
testBundlesAreLoadedFor("org.jboss.tools.cdi.feature");
}
}
+
+ public static class DisableJavaIndexingSetup extends TestSetup {
+
+ public DisableJavaIndexingSetup(Test test) {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ JavaModelManager.getIndexManager().disable();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ JavaModelManager.getIndexManager().enable();
+ }
+ }
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -14,7 +14,6 @@
import junit.framework.Test;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.internal.core.JavaModelManager;
import org.jboss.tools.cdi.core.test.tck.TCKTest;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -32,7 +31,6 @@
@Override
protected void setUp() throws Exception {
- JavaModelManager.getIndexManager().disable();
tckProject = TCKTest.importPreparedProject("/");
}
@@ -43,6 +41,5 @@
tckProject.delete(true, true, null);
JobUtils.waitForIdle();
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
- JavaModelManager.getIndexManager().enable();
}
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java 2010-04-08
16:30:42 UTC (rev 21358)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java 2010-04-08
17:37:44 UTC (rev 21359)
@@ -23,26 +23,27 @@
private static final String FILE_NAME3 = "WebContent/HomePage.xhtml";
private static final String FILE_NAME4 = "WebContent/index.jsp";
static IProject project;
-
- public NamedBeanRefactoringTest(){
+
+ public NamedBeanRefactoringTest() {
super("Named Bean Refactoring Test");
}
-
+
public static Test suite() {
return new TestSuite(NamedBeanRefactoringTest.class);
}
- public void testNamedBeanRename() throws Exception {
+ public void testNamedBeanRename() throws Exception {
IProject project = TCKTest.importPreparedProject(PROJECT_NAME);
doTest(project);
TCKTest.cleanProject(PROJECT_NAME);
}
-
+
public void doTest(IProject project) throws CoreException {
final String newName = "abcd";
ArrayList<TestChangeStructure> list = new
ArrayList<TestChangeStructure>();
- TestChangeStructure structure = new TestChangeStructure(project.getProject(),
FILE_NAME1);
+ TestChangeStructure structure = new TestChangeStructure(project
+ .getProject(), FILE_NAME1);
TestTextChange change = new TestTextChange(324, 4, newName);
structure.addTextChange(change);
list.add(structure);
@@ -63,36 +64,33 @@
change = new TestTextChange(293, 4, newName);
structure.addTextChange(change);
list.add(structure);
-
+
IFile sourceFile = project.getProject().getFile(FILE_NAME1);
-
+
IBean bean = getBean(sourceFile, "game");
-
+ assertNotNull("Can't get the bean.", bean);
+
RenameNamedBeanProcessor processor = new RenameNamedBeanProcessor(bean);
processor.setNewName(newName);
checkRename(processor, list);
}
-
- private IBean getBean(IFile file, String name){
+
+ private IBean getBean(IFile file, String name) {
CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
- if(cdiNature == null)
- return null;
-
+ assertNotNull("Can't get CDI nature.", cdiNature);
+
ICDIProject cdiProject = cdiNature.getDelegate();
-
- if(cdiProject == null)
- return null;
-
+
+ assertNotNull("Can't get CDI project.", cdiProject);
+
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
-
- for(IBean bean : beans){
- if(bean.getName() != null && name.equals(bean.getName()))
+
+ for (IBean bean : beans) {
+ if (bean.getName() != null && name.equals(bean.getName())) {
return bean;
-
+ }
}
return null;
}
-
-
-}
+}
\ No newline at end of file