Author: dazarov
Date: 2010-10-01 11:47:43 -0400 (Fri, 01 Oct 2010)
New Revision: 25401
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7157
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java 2010-10-01
15:33:41 UTC (rev 25400)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java 2010-10-01
15:47:43 UTC (rev 25401)
@@ -13,6 +13,7 @@
import org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceProcessor;
import org.jboss.tools.jsf.jsf2.refactoring.JSF2RenameParticipant;
import org.jboss.tools.jsf.jsf2.refactoring.JSf2MoveParticipant;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.tests.AbstractRefactorTest;
@@ -27,6 +28,7 @@
protected void setUp() throws Exception {
project = ProjectImportTestSetup.loadProject(projectName);
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle(2000);
}
public void testRenameCompositeComponentFile() throws CoreException {
@@ -40,6 +42,7 @@
IFile sourceFile =
project.getProject().getFile("/WebContent/resources/demo/input.xhtml");
RenameResourceProcessor processor = new RenameResourceProcessor(sourceFile);
+ processor.setNewResourceName("input2.xhtml");
JSF2RenameParticipant participant = new JSF2RenameParticipant();
@@ -57,6 +60,7 @@
IFolder sourceFolder =
project.getProject().getFolder("/WebContent/resources/demo");
RenameResourceProcessor processor = new RenameResourceProcessor(sourceFolder);
+ processor.setNewResourceName("demo2");
JSF2RenameParticipant participant = new JSF2RenameParticipant();
@@ -67,14 +71,15 @@
ArrayList<TestChangeStructure> list = new
ArrayList<TestChangeStructure>();
TestChangeStructure structure = new TestChangeStructure(project.getProject(),
"/WebContent/pages/inputname.xhtml");
- TestTextChange change = new TestTextChange(776, 6, "input2");
+ TestTextChange change = new TestTextChange(382, 3, "new");
structure.addTextChange(change);
list.add(structure);
- IFile sourceFile =
project.getProject().getFile("/WebContent/resources/demo/input.xhtml");
+ IFile sourceFile =
project.getProject().getFile("/WebContent/resources/demo2/input2.xhtml");
IFolder destinationFolder =
project.getProject().getFolder("/WebContent/resources/new");
MoveResourcesProcessor processor = new MoveResourcesProcessor(new
IResource[]{sourceFile});
+ processor.setDestination(destinationFolder);
JSf2MoveParticipant participant = new JSf2MoveParticipant();
@@ -85,14 +90,15 @@
ArrayList<TestChangeStructure> list = new
ArrayList<TestChangeStructure>();
TestChangeStructure structure = new TestChangeStructure(project.getProject(),
"/WebContent/pages/inputname.xhtml");
- TestTextChange change = new TestTextChange(776, 6, "input2");
+ TestTextChange change = new TestTextChange(382, 9, "demo2/new");
structure.addTextChange(change);
list.add(structure);
- IFolder sourceFolder =
project.getProject().getFolder("/WebContent/resources/demo");
- IFolder destinationFolder =
project.getProject().getFolder("/WebContent/resources/new");
+ IFolder sourceFolder =
project.getProject().getFolder("/WebContent/resources/new");
+ IFolder destinationFolder =
project.getProject().getFolder("/WebContent/resources/demo2");
MoveResourcesProcessor processor = new MoveResourcesProcessor(new
IResource[]{sourceFolder});
+ processor.setDestination(destinationFolder);
JSf2MoveParticipant participant = new JSf2MoveParticipant();
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-01
15:33:41 UTC (rev 25400)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2010-10-01
15:47:43 UTC (rev 25401)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
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.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
@@ -21,6 +22,7 @@
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{
@@ -56,6 +58,9 @@
CompositeChange rootChange = (CompositeChange)participant.createChange(new
NullProgressMonitor());
+ Change mainChange = processor.createChange(new NullProgressMonitor());
+ mainChange.perform(new NullProgressMonitor());
+
checkChanges(rootChange, changeList);
}
@@ -72,6 +77,9 @@
CompositeChange rootChange = (CompositeChange)participant.createChange(new
NullProgressMonitor());
+ Change mainChange = processor.createChange(new NullProgressMonitor());
+ mainChange.perform(new NullProgressMonitor());
+
checkChanges(rootChange, changeList);
}