[jbosstools-commits] JBoss Tools SVN: r43952 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Sep 24 02:16:26 EDT 2012
Author: ljelinko
Date: 2012-09-24 02:16:26 -0400 (Mon, 24 Sep 2012)
New Revision: 43952
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/MacSpecifics.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
Log:
Extracted Mac specific setup. Added selection of default JDK.
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/MacSpecifics.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/MacSpecifics.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/MacSpecifics.java 2012-09-24 06:16:26 UTC (rev 43952)
@@ -0,0 +1,55 @@
+package org.jboss.tools.ui.bot.ext;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class MacSpecifics {
+
+ private static final Logger log = Logger.getLogger(MacSpecifics.class);
+
+ public static final void setupToolkit(){
+ if (SWTJBTExt.isRunningOnMacOs()){
+ setupToolkitInternal();
+ }
+ }
+
+ public static final void setupJava(){
+ if (SWTJBTExt.isRunningOnMacOs()){
+ setupJavaInternal();
+ }
+ }
+
+ private static final void setupToolkitInternal(){
+ String javaVersion = System.getProperty("java.specification.version");
+ log.info("Is running on MacOS: " + SWTJBTExt.isRunningOnMacOs());
+ log.info("Java version: " + javaVersion);
+ if ("1.7".equals(javaVersion)){
+ log.info("default AWT toolkit: " + System.getProperty("awt.toolkit"));
+ System.setProperty("awt.toolkit", "sun.lwawt.macosx.LWCToolkit");
+ log.info("AWT toolkit changed to: " + System.getProperty("awt.toolkit"));
+ }
+ }
+
+ public static final void setupJavaInternal(){
+ SWTBot bot = SWTBotFactory.getOpen().preferenceOpen(ActionItem.Preference.JavaInstalledJREs.LABEL);
+ setDefaultJava(bot);
+ SWTBotFactory.getOpen().finish(bot, IDELabel.Button.OK);
+ }
+
+ private static void setDefaultJava(SWTBot bot) {
+ String javaLocation = System.getProperty("java.home");
+ SWTBotTable table = bot.table();
+
+ for (int i = 0; i < table.rowCount(); i++){
+ if (javaLocation.equals(table.cell(i, 1))){
+ table.getTableItem(i).check();
+ return;
+ }
+ }
+
+ throw new IllegalStateException("No java with required location " + javaLocation + " is defined");
+ }
+}
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2012-09-24 06:09:40 UTC (rev 43951)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2012-09-24 06:16:26 UTC (rev 43952)
@@ -198,19 +198,15 @@
RequirementAwareSuite.startScreenRecorder(getTestClass().getJavaClass().getSimpleName());
}
- String javaVersion = System.getProperty("java.specification.version");
- log.info("Is running on MacOS: " + SWTJBTExt.isRunningOnMacOs());
- log.info("Java version: " + javaVersion);
- if (SWTJBTExt.isRunningOnMacOs() && "1.7".equals(javaVersion)){
- log.info("default AWT toolkit: " + System.getProperty("awt.toolkit"));
- System.setProperty("awt.toolkit", "sun.lwawt.macosx.LWCToolkit");
- log.info("AWT toolkit changed to: " + System.getProperty("awt.toolkit"));
- }
+ MacSpecifics.setupToolkit();
if (RequirementAwareSuite.runManageBlockingWindow){
SWTJBTExt.manageBlockingWidows(false, false);
RequirementAwareSuite.runManageBlockingWindow = false;
}
+
+ MacSpecifics.setupJava();
+
if (!this.config.equals(TestConfigurator.currentConfig)) {
TestConfigurator.currentConfig = this.config;
}
More information about the jbosstools-commits
mailing list