Author: jjankovi
Date: 2012-04-05 06:39:31 -0400 (Thu, 05 Apr 2012)
New Revision: 40069
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImportHelper.java
Log:
method for importing project from resource folder of bot test added
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImportHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImportHelper.java 2012-04-05
10:33:33 UTC (rev 40068)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ImportHelper.java 2012-04-05
10:39:31 UTC (rev 40069)
@@ -1,23 +1,29 @@
package org.jboss.tools.ui.bot.ext.helper;
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+import static org.junit.Assert.fail;
+import java.io.File;
+import java.io.IOException;
+
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
* Heper class for project imports
*/
public class ImportHelper {
-
+
+ private static SWTBotExt bot = new SWTBotExt();
+
/**
* Import all projects from from given path to current workspace
*/
public static void importAllProjects(String path) {
int timeout = 100000; // 100s max timeout
- SWTBotExt bot = new SWTBotExt();
bot.menu("File").menu("Import...").click();
SWTBot dlgBot = bot.shell("Import").activate().bot();
@@ -33,4 +39,27 @@
dlgBot.button(IDELabel.Button.FINISH).click();
bot.waitUntil(shellCloses(s),timeout);
}
+
+ /**
+ * Import project from given location to destination directory
+ * @param projectLocation
+ * @param dir
+ * @param activatorPlugIn
+ */
+ public static void importProject(String projectLocation, String dir, String
activatorPlugIn) {
+ String rpath = ResourceHelper.getResourceAbsolutePath(activatorPlugIn,
projectLocation);
+ String wpath = ResourceHelper.getWorkspaceAbsolutePath() + "/" + dir;
+ File rfile = new File(rpath);
+ File wfile = new File(wpath);
+
+ wfile.mkdirs();
+ try {
+ FileHelper.copyFilesBinaryRecursively(rfile, wfile, null);
+ } catch (IOException e) {
+ fail("Unable to copy test project");
+ }
+ ImportHelper.importAllProjects(wpath);
+ SWTUtilExt util = new SWTUtilExt(bot);
+ util.waitForNonIgnoredJobs();
+ }
}
Show replies by date