[jbosstools-commits] JBoss Tools SVN: r22058 - in trunk/jsf: tests/org.jboss.tools.jsf.ui.bot.test/resources and 4 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu May 13 09:05:49 EDT 2010
Author: yzhishko
Date: 2010-05-13 09:05:47 -0400 (Thu, 13 May 2010)
New Revision: 22058
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2MoveTestPageRefactor.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameTestPageRefactor.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2TestPage.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2MoveParticipantTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5942 - swtbot test were added
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java 2010-05-13 12:53:58 UTC (rev 22057)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -92,11 +92,11 @@
if (!"org.eclipse.wst.html.core.htmlsource".equals(contentType.getId())) { //$NON-NLS-1$
return false;
}
- if ((JSF2ComponentModelManager.getManager()
- .checkCompositeInterface(JSF2ComponentModelManager
- .getReadableDOMDocument(file))) == null) {
- return false;
- }
+// if ((JSF2ComponentModelManager.getManager()
+// .checkCompositeInterface(JSF2ComponentModelManager
+// .getReadableDOMDocument(file))) == null) {
+// return false;
+// }
return true;
}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2MoveTestPageRefactor.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2MoveTestPageRefactor.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2MoveTestPageRefactor.html 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:mycomp="http://java.sun.com/jsf/composite/mycomp1/mycomp">
+
+<mycomp:echo echo="test" />
+
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameTestPageRefactor.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameTestPageRefactor.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2RenameTestPageRefactor.html 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:mycomp="http://java.sun.com/jsf/composite/mycomp">
+
+<mycomp:echo1 echo="test" />
+
+</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2TestPage.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2TestPage.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/jsf2TestPage.html 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:mycomp="http://java.sun.com/jsf/composite/mycomp">
+
+<mycomp:echo echo="test" />
+
+</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2010-05-13 12:53:58 UTC (rev 22057)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -9,6 +9,8 @@
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE3579Test;
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE3920Test;
import org.jboss.tools.jsf.ui.bot.test.cssdialog.jbide.JBIDE4391Test;
+import org.jboss.tools.jsf.ui.bot.test.jsf2.refactor.JSF2MoveParticipantTest;
+import org.jboss.tools.jsf.ui.bot.test.jsf2.refactor.JSF2RenameParticipantTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.AddRemoveJSFCapabilitiesTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.CreateNewJSFProjectTest;
import org.jboss.tools.jsf.ui.bot.test.templates.SetTemplateForUnknownTagTest;
@@ -32,6 +34,8 @@
suite.addTestSuite(UnknownTemplateTest.class);
suite.addTestSuite(SetTemplateForUnknownTagTest.class);
suite.addTestSuite(CSSSelectorJBIDE3288.class);
+ suite.addTestSuite(JSF2MoveParticipantTest.class);
+ suite.addTestSuite(JSF2RenameParticipantTest.class);
return suite;
}
}
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2010-05-13 12:53:58 UTC (rev 22057)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAutoTestCase.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.IOException;
+import java.util.Scanner;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
@@ -36,23 +37,23 @@
String filePath = FileLocator
.toFileURL(
Platform.getBundle(Activator.PLUGIN_ID).getEntry("/")).getFile() + "resources/" + testPage; //$NON-NLS-1$ //$NON-NLS-2$
-
- File file = new File(filePath);
- if (!file.exists() || !file.isFile()) {
- filePath = FileLocator
- .toFileURL(
- Platform.getBundle(Activator.PLUGIN_ID).getEntry("/")).getFile() + testPage; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
+
+ File file = new File(filePath);
+ if (!file.exists() || !file.isFile()) {
+ filePath = FileLocator
+ .toFileURL(
+ Platform.getBundle(Activator.PLUGIN_ID).getEntry(
+ "/")).getFile() + testPage; //$NON-NLS-1$
+ }
return filePath;
-
}
protected void openTestPage() {
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
.bot();
SWTBotTree tree = innerBot.tree();
- tree.expandNode(JBT_TEST_PROJECT_NAME)
+ tree
+ .expandNode(JBT_TEST_PROJECT_NAME)
.expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -61,6 +62,7 @@
performContentTestByDocument(testPage, bot
.multiPageEditorByTitle(TEST_PAGE));
}
+
@Override
protected void closeUnuseDialogs() {
}
@@ -84,4 +86,14 @@
super.tearDown();
}
+ protected String loadFileContent(String resourceRelativePath) throws IOException {
+ File file = new File(getPathToResources(resourceRelativePath));
+ StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
+ Scanner scanner = new Scanner(file);
+ while (scanner.hasNextLine()) {
+ builder.append(scanner.nextLine());
+ }
+ return builder.toString();
+ }
+
}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,101 @@
+package org.jboss.tools.jsf.ui.bot.test.jsf2.refactor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+
+public abstract class JSF2AbstractRefactorTest extends JSFAutoTestCase {
+
+ protected static final String JSF2_Test_Page_Name = "jsf2TestPage"; //$NON-NLS-1$
+
+ protected void createCompositeComponent() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ try {
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").select(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.textWithLabel("Folder name:").setText("resources"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ }
+ try {
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.textWithLabel("Folder name:").setText("mycomp"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ }
+ try {
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.textWithLabel("Folder name:").setText("mycomp"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ }
+ try {
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ bot.menu("File").menu("New").menu("Other...").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.shell("New").activate(); //$NON-NLS-1$
+ tree = bot.tree();
+ tree.expandNode("JBoss Tools Web").select("XHTML Page"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Next >").click(); //$NON-NLS-1$
+ bot.textWithLabel("File name:").setText("echo"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ bot.sleep(2000);
+ bot.editorByTitle("echo.xhtml").close(); //$NON-NLS-1$
+ }
+ }
+
+ protected void createTestPage() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ try {
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent"). //$NON-NLS-1$ //$NON-NLS-2$
+ getNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).select(); //$NON-NLS-1$
+ bot.menu("File").menu("New").menu("Other...").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.shell("New").activate(); //$NON-NLS-1$
+ tree = bot.tree();
+ tree.expandNode("JBoss Tools Web").select("XHTML Page"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Next >").click(); //$NON-NLS-1$
+ bot.textWithLabel("File name:").setText(JSF2_Test_Page_Name); //$NON-NLS-1$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ }
+ SWTBotEclipseEditor editor = bot.editorByTitle(
+ JSF2_Test_Page_Name + ".xhtml").toTextEditor(); //$NON-NLS-1$
+ editor.setFocus();
+ bot.sleep(2000);
+ bot.menu("Edit").menu("Select All").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$//$NON-NLS-2$
+ bot.sleep(2000);
+ editor.setText(loadFileContent("refactor/jsf2TestPage.html")); //$NON-NLS-1$
+ bot.sleep(2000);
+ editor.saveAndClose();
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2MoveParticipantTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2MoveParticipantTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2MoveParticipantTest.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,87 @@
+package org.jboss.tools.jsf.ui.bot.test.jsf2.refactor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+
+public class JSF2MoveParticipantTest extends JSF2AbstractRefactorTest {
+
+ public void testJSF2MoveParticipant() throws Exception {
+ createTestPage();
+ createCompositeComponent();
+ createDistResFolder();
+ moveCurrResFolder();
+ checkContent();
+ }
+
+ private void checkContent() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ delay();
+ SWTBotEclipseEditor editor = bot.editorByTitle(
+ JSF2_Test_Page_Name + ".xhtml").toTextEditor(); //$NON-NLS-1$
+ assertEquals(
+ loadFileContent("refactor/jsf2MoveTestPageRefactor.html"), editor.getText()); //$NON-NLS-1$
+ delay();
+ editor.close();
+ }
+
+ private void moveCurrResFolder() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ bot.menu("Refactor").menu("Move...").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ innerBot = bot.shell("Move").bot(); //$NON-NLS-1$
+ tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp1").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ delay();
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ }
+
+ private void createDistResFolder() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ try {
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp1").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ } catch (WidgetNotFoundException e) {
+ tree
+ .getTreeItem(
+ projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.textWithLabel("Folder name:").setText("mycomp1"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("Finish").click(); //$NON-NLS-1$
+ delay();
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ delay();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp1").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ super.tearDown();
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2RenameParticipantTest.java 2010-05-13 13:05:47 UTC (rev 22058)
@@ -0,0 +1,62 @@
+package org.jboss.tools.jsf.ui.bot.test.jsf2.refactor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.test.WidgetVariables;
+
+public class JSF2RenameParticipantTest extends JSF2AbstractRefactorTest {
+
+ public void testJSF2RenameParticipant() throws Exception {
+ createTestPage();
+ createCompositeComponent();
+ renameCompositeComponent();
+ checkContent();
+ }
+
+ private void renameCompositeComponent() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ bot.menu("Refactor").menu("Rename...").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.textWithLabel("New name:").setText("echo1.xhtml"); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ }
+
+ private void checkContent() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ delay();
+ SWTBotEclipseEditor editor = bot.editorByTitle(
+ JSF2_Test_Page_Name + ".xhtml").toTextEditor(); //$NON-NLS-1$
+ assertEquals(
+ loadFileContent("refactor/jsf2RenameTestPageRefactor.html"), editor.getText()); //$NON-NLS-1$
+ delay();
+ editor.close();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
+ .bot();
+ SWTBotTree tree = innerBot.tree();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ tree
+ .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo1.xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.button("OK").click(); //$NON-NLS-1$
+ delay();
+ super.tearDown();
+ }
+
+}
More information about the jbosstools-commits
mailing list