Author: dazarov
Date: 2010-10-21 09:08:21 -0400 (Thu, 21 Oct 2010)
New Revision: 25968
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7312
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2010-10-21
12:53:18 UTC (rev 25967)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2010-10-21
13:08:21 UTC (rev 25968)
@@ -42,6 +42,16 @@
structure.addTextChange(change);
list.add(structure);
+ structure = new TestChangeStructure(project, "/WebContent/pages/el.jsp");
+ change = new TestTextChange(83, 8, "customer");
+ structure.addTextChange(change);
+ list.add(structure);
+
+ structure = new TestChangeStructure(project,
"/WebContent/testElRevalidation.xhtml");
+ change = new TestTextChange(601, 8, "customer");
+ structure.addTextChange(change);
+ list.add(structure);
+
IFile sourceFile =
project.getProject().getFile("/WebContent/pages/hello.jsp");
RenameELVariableProcessor processor = new RenameELVariableProcessor(sourceFile,
"user");
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2010-10-21
12:53:18 UTC (rev 25967)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2010-10-21
13:08:21 UTC (rev 25968)
@@ -14,6 +14,8 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
@@ -22,7 +24,6 @@
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.test.util.JobUtils;
public class AbstractRefactorTest extends TestCase{
@@ -38,8 +39,25 @@
checkBeforeRefactoring(changeList);
// Rename
- processor.checkInitialConditions(new NullProgressMonitor());
- processor.checkFinalConditions(new NullProgressMonitor(), null);
+ RefactoringStatus status = processor.checkInitialConditions(new
NullProgressMonitor());
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ status = processor.checkFinalConditions(new NullProgressMonitor(), null);
+
+ entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+
CompositeChange rootChange = (CompositeChange)processor.createChange(new
NullProgressMonitor());
checkChanges(rootChange, changeList);
@@ -53,9 +71,19 @@
// Move
MoveArguments arguments = new MoveArguments(destinationObject, true);
- participant.initialize(processor, oldObject, arguments);
- participant.checkConditions(new NullProgressMonitor(), null);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(),
null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Move processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
CompositeChange rootChange = (CompositeChange)participant.createChange(new
NullProgressMonitor());
Change mainChange = processor.createChange(new NullProgressMonitor());
@@ -72,9 +100,19 @@
// Rename
RenameArguments arguments = new RenameArguments(newName, true);
- participant.initialize(processor, oldObject, arguments);
- participant.checkConditions(new NullProgressMonitor(), null);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(),
null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
CompositeChange rootChange = (CompositeChange)participant.createChange(new
NullProgressMonitor());
Change mainChange = processor.createChange(new NullProgressMonitor());
@@ -109,6 +147,8 @@
MultiTextEdit edit = (MultiTextEdit)fileChange.getEdit();
+ //System.out.println("File - "+fileChange.getFile().getFullPath()+"
offset - "+edit.getOffset());
+
TestChangeStructure change = findChange(changeList, fileChange.getFile());
if(change != null){
assertEquals(change.size(), edit.getChildrenSize());