Author: jjankovi
Date: 2012-03-22 06:49:03 -0400 (Thu, 22 Mar 2012)
New Revision: 39753
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/pom.xml
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
Log:
RenameFileInExplorerBase method added + moving getProposalList from BeansXML test to
EditorResourceHelper
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/pom.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/pom.xml 2012-03-22 10:11:58 UTC (rev
39752)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/pom.xml 2012-03-22 10:49:03 UTC (rev
39753)
@@ -40,16 +40,11 @@
<artifactId>org.jboss.ide.eclipse.as.feature.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
- <dependency>
+ <dependency>
<type>p2-installable-unit</type>
<artifactId>org.jboss.tools.jsf.feature.feature.group</artifactId>
<version>0.0.0</version>
</dependency>
- <!-- <dependency>
- <type>p2-installable-unit</type>
- <artifactId>org.jboss.tools.cdi.seam.feature.feature.group</artifactId>
- <version>0.0.0</version>
- </dependency> -->
</dependencies>
</configuration>
</plugin>
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-03-22
10:11:58 UTC (rev 39752)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/beansxml/BeansXMLCompletionTest.java 2012-03-22
10:49:03 UTC (rev 39753)
@@ -17,12 +17,7 @@
import org.jboss.tools.cdi.bot.test.CDIConstants;
import org.jboss.tools.cdi.bot.test.CDITestBase;
import org.jboss.tools.cdi.bot.test.annotations.CDIWizardType;
-import org.jboss.tools.ui.bot.ext.SWTJBTExt;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.helper.ContentAssistHelper;
-import org.jboss.tools.ui.bot.ext.parts.ContentAssistBot;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.junit.Test;
/**
@@ -69,7 +64,8 @@
beansHelper.createBeansXMLWithInterceptor(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with interceptors tag was created");
- List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
CDIConstants.CLASS_END_TAG, 0, 0);
+ List<String> proposalList = editResourceUtil.getProposalList(
+ CDIConstants.BEANS_XML, CDIConstants.CLASS_END_TAG, 0, 0);
for (String interceptor : INTERCEPTOR_NAMES) {
assertTrue(proposalList.contains(interceptor + " - " + getPackageName()));
}
@@ -84,7 +80,7 @@
beansHelper.createBeansXMLWithDecorator(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with decorators tag was created");
- List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ List<String> proposalList =
editResourceUtil.getProposalList(CDIConstants.BEANS_XML,
CDIConstants.CLASS_END_TAG, 0, 0);
for (String decorator : DECORATORS_NAMES) {
assertTrue(proposalList.contains(decorator + " - " + getPackageName()));
@@ -101,7 +97,7 @@
beansHelper.createBeansXMLWithStereotype(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with stereotype tag was created");
- List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ List<String> proposalList =
editResourceUtil.getProposalList(CDIConstants.BEANS_XML,
CDIConstants.STEREOTYPE_END_TAG, 0, 0);
for (String stereotype : STEREOTYPES_NAMES) {
assertTrue(proposalList.contains(stereotype + " - " + getPackageName()));
@@ -118,7 +114,7 @@
beansHelper.createBeansXMLWithAlternative(getProjectName(), getPackageName(), null);
LOGGER.info("Beans.xml with alternative tag was created");
- List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
+ List<String> proposalList =
editResourceUtil.getProposalList(CDIConstants.BEANS_XML,
CDIConstants.CLASS_END_TAG, 0, 0);
for (String alternative : ALTERNATIVES_NAMES) {
assertTrue(proposalList.contains(alternative + " - " + getPackageName()));
@@ -145,7 +141,8 @@
beansHelper.createBeansXMLWithEmptyTag(getProjectName());
LOGGER.info("Clear beans.xml with empty tag was created");
- List<String> proposalList = getProposalList(CDIConstants.BEANS_XML,
"<>", 1, 0);
+ List<String> proposalList = editResourceUtil.getProposalList(
+ CDIConstants.BEANS_XML, "<>", 1, 0);
List<String> nonSupportedComponents = Arrays.asList(components);
for (String nonSupportedComponent : nonSupportedComponents) {
@@ -177,26 +174,4 @@
editResourceUtil.replaceInEditor(text, "");
}
- /**
- * Method returns proposal list for given text on given position
- * @param editorTitle
- * @param textToSelect
- * @param selectionOffset
- * @param selectionLength
- * @return
- */
- private List<String> getProposalList(String editorTitle, String textToSelect, int
selectionOffset,
- int selectionLength) {
- SWTJBTExt.selectTextInSourcePane(bot,
- editorTitle, textToSelect, selectionOffset, selectionLength,
- 0);
-
- bot.sleep(Timing.time1S());
-
- SWTBotEditorExt editor = SWTTestExt.bot.swtBotEditorExtByTitle(editorTitle);
- ContentAssistBot contentAssist = editor.contentAssist();
- List<String> currentProposalList = contentAssist.getProposalList();
- return currentProposalList;
- }
-
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-03-22
10:11:58 UTC (rev 39752)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-03-22
10:49:03 UTC (rev 39753)
@@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
+import java.util.List;
import java.util.Scanner;
import org.eclipse.core.resources.IFile;
@@ -25,9 +26,14 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.cdi.bot.test.CDIBase;
import org.jboss.tools.cdi.bot.test.editor.BeansEditorTest;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.helper.TreeHelper;
+import org.jboss.tools.ui.bot.ext.parts.ContentAssistBot;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.view.ExplorerBase;
public class EditorResourceHelper extends CDIBase {
@@ -127,15 +133,38 @@
}
/**
- * in Project Explorer View, the file which is located in "sourceFolder"
+ * Method returns proposal list for given text on given position
+ * @param editorTitle
+ * @param textToSelect
+ * @param selectionOffset
+ * @param selectionLength
+ * @return
+ */
+ public List<String> getProposalList(String editorTitle, String textToSelect, int
selectionOffset,
+ int selectionLength) {
+ SWTJBTExt.selectTextInSourcePane(bot,
+ editorTitle, textToSelect, selectionOffset, selectionLength,
+ 0);
+
+ bot.sleep(Timing.time1S());
+
+ SWTBotEditorExt editor = SWTTestExt.bot.swtBotEditorExtByTitle(editorTitle);
+ ContentAssistBot contentAssist = editor.contentAssist();
+ List<String> currentProposalList = contentAssist.getProposalList();
+ return currentProposalList;
+ }
+
+ /**
+ * in explorer base View, the file which is located in "sourceFolder"
* is moved to location "destFolder"
* @param file
* @param sourceFolder
* @param destFolder
*/
- public void moveFileInProjectExplorer(String file, String sourceFolder, String
destFolder) {
+ public void moveFileInExplorerBase(ExplorerBase explorerBase,
+ String file, String sourceFolder, String destFolder) {
- projectExplorer.selectTreeItem(file, sourceFolder.split("/"));
+ explorerBase.selectTreeItem(file, sourceFolder.split("/"));
bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.MOVE).click();
bot.waitForShell(IDELabel.Shell.MOVE_RESOURCES);
@@ -150,6 +179,29 @@
}
/**
+ * in explorer base View, the file which is located in "path"
+ * is renamed to newFileName value
+ * @param explorerBase
+ * @param file
+ * @param path
+ * @param newFileName
+ */
+ public void renameFileInExplorerBase(ExplorerBase explorerBase,
+ String file, String path, String newFileName) {
+
+ explorerBase.selectTreeItem(file, path.split("/"));
+
+ bot.menu(IDELabel.Menu.FILE).menu(IDELabel.Menu.RENAME_WITH_DOTS).click();
+ bot.waitForShell(IDELabel.Shell.RENAME_RESOURCE);
+
+ bot.text().setText(newFileName);
+
+ bot.button(IDELabel.Button.OK).click();
+ util.waitForNonIgnoredJobs();
+
+ }
+
+ /**
* Method deletes whole package with given name for entered project
* @param projectName
* @param packageName