Author: jjankovi
Date: 2012-05-24 09:40:53 -0400 (Thu, 24 May 2012)
New Revision: 41355
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ModifyingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/dialog/ArchivePublishSettingsDialog.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
Log:
DeployingArchiveTest is now included in suite + refactoring
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -27,7 +27,7 @@
CreatingArchiveTest.class,
DeletingArchiveTest.class,
ModifyingArchiveTest.class,
-// DeployingArchiveTest.class,
+ DeployingArchiveTest.class,
})
public class ArchivesAllBotTests {
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -10,12 +10,15 @@
******************************************************************************/
package org.jboss.tools.archives.ui.bot.test;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.archives.ui.bot.test.explorer.ProjectArchivesExplorer;
import org.jboss.tools.archives.ui.bot.test.view.ProjectArchivesView;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.helper.ImportHelper;
+import org.jboss.tools.ui.bot.ext.view.ServersView;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -61,6 +64,43 @@
assertFalse(explorer.itemExists(path));
}
+ protected void assertArchiveIsDeployed(String archive) {
+ ServersView serversView = showServersView();
+ SWTBotTreeItem server = findConfiguredServer(serversView);
+ server.collapse();
+ server.expand();
+ boolean found = false;
+ for (SWTBotTreeItem ti : server.getItems()) {
+ if (ti.getText().contains(archive)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue(archive + " was not deployed", found);
+ }
+
+ protected void removeArchiveFromServer(String archive) {
+ ServersView serversView = showServersView();
+ serversView.removeProjectFromServers(archive);
+ }
+
+ protected SWTBotTreeItem findConfiguredServer(ServersView serversView) {
+ SWTBotTreeItem server = null;
+ try {
+ server = serversView. findServerByName(serversView.bot().tree(),
+ configuredState.getServer().name);
+ } catch (WidgetNotFoundException exc) {
+ fail("Server is not configured - missing in servers view");
+ }
+ return server;
+ }
+
+ private ServersView showServersView() {
+ ServersView serversView = new ServersView();
+ serversView.show();
+ return serversView;
+ }
+
protected static void importProject(String projectName) {
String location = "/resources/prj/" + projectName;
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -55,31 +55,43 @@
@Test
public void testCreatingArchivetWithView() {
+
+ /* prepare view for testing */
ProjectArchivesView view = viewForProject(project);
/* creating JAR archive from project - standard way */
NewJarDialog dialog = view.createNewJarArchive(project);
createArchive(dialog, ARCHIVE_STANDARD_1, true);
+
+ /* test archive was created */
assertItemExistsInView(view, project, ARCHIVE_STANDARD_1_PATH);
/* creating JAR archive from project - no compression way */
dialog = view.createNewJarArchive(project);
createArchive(dialog, ARCHIVE_NO_COMPRESSION_1, false);
+
+ /* test archive was created */
assertItemExistsInView(view, project, ARCHIVE_NO_COMPRESSION_1_PATH);
}
@Test
public void testCreatingArchiveWithExplorer() {
+
+ /* prepare explorer for testing */
ProjectArchivesExplorer explorer = explorerForProject(project);
/* creating JAR archive from project - standard way */
NewJarDialog dialog = explorer.createNewJarArchive();
createArchive(dialog, ARCHIVE_STANDARD_2, true);
+
+ /* test archive was created */
assertItemExistsInExplorer(explorer, ARCHIVE_STANDARD_2_PATH);
/* creating JAR archive from project - no compression way */
dialog = explorer.createNewJarArchive();
createArchive(dialog, ARCHIVE_NO_COMPRESSION_2, false);
+
+ /* test archive was created */
assertItemExistsInExplorer(explorer, ARCHIVE_NO_COMPRESSION_2_PATH);
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -40,15 +40,27 @@
@Test
public void testDeletingArchivetWithView() {
+
+ /* prepare view for testing */
ProjectArchivesView view = viewForProject(project);
+
+ /* delete archive in view */
view.deleteArchive(project, PATH_ARCHIVE_1);
+
+ /* test archive was deleted */
assertItemNotExistsInView(view, project, PATH_ARCHIVE_1);
}
@Test
public void testDeletingArchiveWithExplorer() {
+
+ /* prepare explorer for testing */
ProjectArchivesExplorer explorer = explorerForProject(project);
+
+ /* delete archive in explorer */
explorer.deleteArchive(PATH_ARCHIVE_2);
+
+ /* test archive was deleted */
assertItemNotExistsInExplorer(explorer, PATH_ARCHIVE_2);
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ModifyingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ModifyingArchiveTest.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ModifyingArchiveTest.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -50,22 +50,30 @@
@Test
public void testModifyingArchivetWithView() {
+
+ /* prepare view for testing */
ProjectArchivesView view = viewForProject(project);
/* modifying archive name with Project Archive view */
EditArchiveDialog dialog = view.editArchive(project, PATH_ARCHIVE_1);
editArchive(dialog, ARCHIVE_NAME_1_NEW);
+
+ /* test archive was modified */
assertItemNotExistsInView(view, project, PATH_ARCHIVE_1);
assertItemExistsInView(view, project, PATH_ARCHIVE_1_NEW);
}
@Test
public void testModifyingArchiveWithExplorer() {
+
+ /* prepare explorer for testing */
ProjectArchivesExplorer explorer = new ProjectArchivesExplorer(project);
/* modifying archive name with Project Archive explorer */
EditArchiveDialog dialog = explorer.editArchive(PATH_ARCHIVE_2);
editArchive(dialog, ARCHIVE_NAME_2_NEW);
+
+ /* test archive was modified */
assertItemNotExistsInExplorer(explorer, PATH_ARCHIVE_2);
assertItemExistsInExplorer(explorer, PATH_ARCHIVE_2_NEW);
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/context/ArchiveContextMenu.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -70,12 +70,16 @@
}
public ArchivePublishSettingsDialog publishToServer(SWTBotTree tree,
- SWTBotTreeItem item) {
+ SWTBotTreeItem item, boolean returnDialog) {
ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
SWTBotMenu menu = new SWTBotMenu(ContextMenuHelper.
getContextMenu(tree, "Publish To Server", false));
menu.click();
- return new ArchivePublishSettingsDialog();
+ if (returnDialog) {
+ return new ArchivePublishSettingsDialog();
+ } else {
+ return null;
+ }
}
public ArchivePublishSettingsDialog editPublishSettings(SWTBotTree tree,
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/dialog/ArchivePublishSettingsDialog.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/dialog/ArchivePublishSettingsDialog.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/dialog/ArchivePublishSettingsDialog.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -78,6 +78,11 @@
return this;
}
+ public ArchivePublishSettingsDialog unselectAllServers() {
+ table().unselect();
+ return this;
+ }
+
public ArchivePublishSettingsDialog checkAlwaysPublish() {
this.bot.checkBox(0).select();
return this;
@@ -108,6 +113,7 @@
public void finish() {
bot.button("Finish").click();
+ SWTBotFactory.getUtil().waitForNonIgnoredJobs();
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/explorer/ProjectArchivesExplorer.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -67,10 +67,11 @@
contextTool.deleteArchive(tree, treeItem);
}
- public ArchivePublishSettingsDialog publishToServer(String archive) {
+ public ArchivePublishSettingsDialog publishToServer(
+ boolean returnDialog, String archive) {
SWTBotTree tree = this.bot().tree();
SWTBotTreeItem treeItem = explorer.getNode(archive);
- return contextTool.publishToServer(tree, treeItem);
+ return contextTool.publishToServer(tree, treeItem, returnDialog);
}
public ArchivePublishSettingsDialog editPublishSettings(String archive) {
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java 2012-05-24
13:40:19 UTC (rev 41354)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/view/ProjectArchivesView.java 2012-05-24
13:40:53 UTC (rev 41355)
@@ -72,10 +72,11 @@
contextTool.deleteArchive(tree, treeItem);
}
- public ArchivePublishSettingsDialog publishToServer(String... pathToArchive) {
+ public ArchivePublishSettingsDialog publishToServer(boolean returnDialog,
+ String... pathToArchive) {
SWTBotTree tree = this.bot().tree();
SWTBotTreeItem treeItem = TreeHelper.expandNode(this.bot(), pathToArchive);
- return contextTool.publishToServer(tree, treeItem);
+ return contextTool.publishToServer(tree, treeItem, returnDialog);
}
public ArchivePublishSettingsDialog editPublishSettings(String... pathToArchive) {