Author: apodhrad
Date: 2012-06-27 11:03:15 -0400 (Wed, 27 Jun 2012)
New Revision: 42245
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/META-INF/MANIFEST.MF
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ActivityModelingTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssignActivityTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssociateRuntimeTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/BPELTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ToolingCompatibilityTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/examples/BPELExampleTest.java
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/util/ResourceHelper.java
Log:
Bpel bot tests: changes the way how bpel projects are deployed
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/META-INF/MANIFEST.MF 2012-06-27
13:32:32 UTC (rev 42244)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/META-INF/MANIFEST.MF 2012-06-27
15:03:15 UTC (rev 42245)
@@ -22,5 +22,6 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: JBoss by Red Hat
Import-Package: org.eclipse.ui.internal.views.properties.tabbed.view
+Eclipse-RegisterBuddy: org.apache.log4j
Bundle-ClassPath: lib/xmlunit-1.3.jar,
.
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ActivityModelingTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ActivityModelingTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ActivityModelingTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -1,21 +1,12 @@
package org.jboss.tools.bpel.ui.bot.test;
import org.eclipse.core.resources.IProject;
-
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
-
import org.jboss.tools.bpel.ui.bot.ext.widgets.BotBpelEditor;
import org.jboss.tools.bpel.ui.bot.test.util.ResourceHelper;
-
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
-import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
import org.jboss.tools.ui.bot.ext.view.ServersView;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -27,29 +18,22 @@
IProject project;
ServersView sView = new ServersView();
- PackageExplorer pExplorer = new PackageExplorer();
@Before
public void setupWorkspace() throws Exception {
- System.err.println("setup start!");
+ log.info("ActivityModelingTest: setup starts");
- pExplorer.deleteAllProjects();
-
+ projectExplorer.deleteAllProjects();
ResourceHelper.importProject(BUNDLE, "/projects/DiscriminantProcess",
"DiscriminantProcess");
+ projectExplorer.selectProject("DiscriminantProcess");
- //ResourcesUtils.importProject(BUNDLE, "/projects/DiscriminantProcess",
- // "DiscriminantProcess", null);
-
- bot.viewByTitle("Package Explorer").setFocus();
- pExplorer.selectProject("DiscriminantProcess");
-
- System.err.println("setup complete!");
+ log.info("ActivityModelingTest: setup complete!");
}
@After
public void cleanupWorkspace() throws Exception {
-// pExplorer.deleteAllProjects();
+ projectExplorer.deleteAllProjects();
}
/**
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssignActivityTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssignActivityTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssignActivityTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -1,23 +1,13 @@
package org.jboss.tools.bpel.ui.bot.test;
-import org.eclipse.core.resources.IProject;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.bpel.ui.bot.ext.widgets.BotBpelEditor;
import org.jboss.tools.bpel.ui.bot.test.util.ResourceHelper;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
-import org.jboss.tools.ui.bot.ext.view.ServersView;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -35,52 +25,19 @@
" </soapenv:Body>" +
"</soapenv:Envelope>";
-
-
- IProject project;
- ServersView sView = new ServersView();
- PackageExplorer pExplorer = new PackageExplorer() {
-
- @Override
- public void runOnServer(String projectName) {
- String serverName = AssignActivityTest.configuredState.getServer().name;
- serverName = "SOA-5.1"; // remove me !!!
-
- bot.viewByTitle("Servers").show();
- bot.viewByTitle("Servers").setFocus();
-
- SWTBotTree tree = bot.viewByTitle("Servers").bot().tree();
- SWTBotTreeItem server = tree.getTreeItem(serverName + " [Started,
Synchronized]").select();
-
- ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.ADD_AND_REMOVE,
false)).click();
-
- SWTBotShell shell = AssignActivityTest.bot.shell("Add and Remove...");
- shell.activate();
-
- SWTBot viewBot = shell.bot();
- // The list in the "Add and Remove..." dialog is a Tree !!! see EclipseSpy
...
- viewBot.tree().setFocus();
- viewBot.tree().select(projectName);
- viewBot.button("Add >").click();
- viewBot.button("Finish").click();
- }
-
- };
-
@Before
public void setupWorkspace() throws Exception {
- pExplorer.deleteAllProjects();
+ projectExplorer.deleteAllProjects();
// Need to use own importer. ResourceUtils does not import the project correctly when
server
// is running. TODO: Why?
+ log.info("APLog: test");
ResourceHelper.importProject(BUNDLE, "/projects/AssignerProject",
"AssignerProject");
- bot.viewByTitle("Package Explorer").setFocus();
- pExplorer.selectProject("AssignerProject");
+ projectExplorer.selectProject("AssignerProject");
}
@After
public void cleanupWorkspace() throws Exception {
- pExplorer.deleteAllProjects();
+ projectExplorer.deleteAllProjects();
}
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssociateRuntimeTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssociateRuntimeTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/AssociateRuntimeTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -3,9 +3,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/BPELTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/BPELTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/BPELTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -40,39 +40,35 @@
util.waitForNonIgnoredJobs();
bot.sleep(TIME_5S, "BPEL All Tests Finished!");
}
+
+ public static void deployProject(String projectName) {
+ String serverName = BPELTest.configuredState.getServer().name;
- protected PackageExplorer pExplorer = new PackageExplorer();
- protected ProjectExplorer projExplorer = new ProjectExplorer() {
+ bot.viewByTitle("Servers").show();
+ bot.viewByTitle("Servers").setFocus();
- @Override
- public void runOnServer(String projectName) {
- String serverName = BPELTest.configuredState.getServer().name;
- // serverName = "SOA-5.1";
+ SWTBotTree tree = bot.viewByTitle("Servers").bot().tree();
+ bot.sleep(TIME_5S);
+
+ SWTBotTreeItem server = tree.getAllItems()[0];
- bot.viewByTitle("Servers").show();
- bot.viewByTitle("Servers").setFocus();
+ assertContains(serverName, server.getText());
+// assertEquals("", serverName + " [Started, Synchronized]",
server.getText());
+
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.ADD_AND_REMOVE,
+ false)).click();
- SWTBotTree tree = bot.viewByTitle("Servers").bot().tree();
- bot.sleep(TIME_5S);
- SWTBotTreeItem server = tree.getTreeItem(serverName + " [Started,
Synchronized]")
- .select();
+ SWTBotShell shell = OdeDeployTest.bot.shell("Add and Remove...");
+ shell.activate();
- ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.ADD_AND_REMOVE,
- false)).click();
+ SWTBot viewBot = shell.bot();
+ viewBot.tree().setFocus();
+ viewBot.tree().select(projectName);
+ viewBot.button("Add >").click();
+ viewBot.button("Finish").click();
+ }
- SWTBotShell shell = OdeDeployTest.bot.shell("Add and Remove...");
- shell.activate();
-
- SWTBot viewBot = shell.bot();
- viewBot.tree().setFocus();
- viewBot.tree().select(projectName);
- viewBot.button("Add >").click();
- viewBot.button("Finish").click();
- }
-
- };
-
/**
* Creates a new process in a project identified by it's name.
*
@@ -264,7 +260,7 @@
protected void openFile(String projectName, String... path) throws Exception {
log.info("Opening file: " + path[path.length - 1] + " ...");
- pExplorer.openFile(projectName, path);
+ projectExplorer.openFile(projectName, path);
}
public static Version getServerToolsVersion() {
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/OdeDeployTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -93,8 +93,7 @@
@Test
public void deployProjectTest() throws Exception {
// Publish the process
- projExplorer.runOnServer("say_hello");
-
+ deployProject("say_hello");
assertTrue(isProjectDeployed("say_hello"));
}
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ToolingCompatibilityTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ToolingCompatibilityTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/ToolingCompatibilityTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -65,7 +65,7 @@
@Test
public void deployProjectTest() {
// Publish the process
- projExplorer.runOnServer("eclipse_tooling_proj");
+ deployProject("eclipse_tooling_proj");
assertTrue(isProjectDeployed("eclipse_tooling_proj"));
}
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/WizardTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -4,12 +4,16 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.utils.TableCollection;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.Assert;
import org.junit.Test;
@@ -147,7 +151,32 @@
SWTBotView serversView = bot.viewByTitle("Servers");
serversView.show();
serversView.setFocus();
- assertNotNull(serversView.bot().tree().getTreeItem(serverName + " Server
[Stopped]"));
+
+ // check if the new server is avialable
+ tree = serversView.bot().tree();
+ SWTBotTreeItem[] servers = tree.getAllItems();
+ SWTBotTreeItem server = null;
+ for (int i = 0; i < servers.length; i++) {
+ if(servers[i].getText().contains(serverName)) {
+ server = servers[i];
+ break;
+ }
+ }
+ assertNotNull("The new server runtime not found", server);
+
+ // delete the server
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.DELETE,
false)).click();
+ SWTBotShell shell = bot.waitForShell("Delete Server");
+ shell.bot().button("OK").click();
+ server = null;
+ for (int i = 0; i < servers.length; i++) {
+ if(servers[i].getText().contains(serverName)) {
+ server = servers[i];
+ break;
+ }
+ }
+ assertNull("The server wasn't deleted", server);
}
boolean isRuntimeSet(String projectName) throws Exception {
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/examples/BPELExampleTest.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/examples/BPELExampleTest.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/examples/BPELExampleTest.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -34,27 +34,9 @@
}
protected static void deployExamples(String... projectName) {
- String serverName = BPELTest.configuredState.getServer().name;
-
- bot.viewByTitle("Servers").show();
- bot.viewByTitle("Servers").setFocus();
-
- SWTBotTree tree = bot.viewByTitle("Servers").bot().tree();
- bot.sleep(TIME_5S);
- SWTBotTreeItem server = tree.getTreeItem(serverName + " [Started,
Synchronized]").select();
-
- ContextMenuHelper.prepareTreeItemForContextMenu(tree, server);
- new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.ADD_AND_REMOVE,
false))
- .click();
-
- SWTBotShell shell = OdeDeployTest.bot.shell("Add and Remove...");
- shell.activate();
-
- SWTBot viewBot = shell.bot();
- viewBot.tree().setFocus();
- viewBot.tree().select(projectName);
- viewBot.button("Add >").click();
- viewBot.button("Finish").click();
+ for (int i = 0; i < projectName.length; i++) {
+ BPELTest.deployProject(projectName[0]);
+ }
}
protected static void testDeployment(String projectName) {
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/util/ResourceHelper.java
===================================================================
---
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/util/ResourceHelper.java 2012-06-27
13:32:32 UTC (rev 42244)
+++
trunk/bpel/tests/org.jboss.tools.bpel.ui.bot.test/src/org/jboss/tools/bpel/ui/bot/test/util/ResourceHelper.java 2012-06-27
15:03:15 UTC (rev 42245)
@@ -3,10 +3,12 @@
import java.io.IOException;
import java.net.URL;
+import org.apache.log4j.Logger;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.osgi.framework.Bundle;
/**
@@ -15,8 +17,11 @@
*
*/
public class ResourceHelper {
+
+ public static Logger log = Logger.getLogger(SWTTestExt.class);
public static void importProject(String bundleName, String templatePath, String
projectName) throws Exception {
+ log.info("Importing project " + projectName);
try {
SWTBotExt bot = new SWTBotExt();
@@ -27,6 +32,7 @@
viewBot.tree().expandNode("General", "Existing Projects into
Workspace").select();
viewBot.button("Next >").click();
+ log.info("Setting path to " + path.toString());
viewBot.text().setText(path.toString());
viewBot.tree().select(projectName + " (" + path.substring(0, path.length() -
1) + ")");
viewBot.checkBox("Copy projects into workspace").select();