Author: vpakan(a)redhat.com
Date: 2012-01-03 11:25:30 -0500 (Tue, 03 Jan 2012)
New Revision: 37613
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
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/SWTJBTExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
Manage all possible Usage Reporting Windows to not block UI.
Modified:
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java
===================================================================
---
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/build/aggregate/bottests-site/tests/org.jboss.tools.drools.ui.bot.test/src/org/jboss/tools/drools/ui/bot/test/DroolsAllBotTests.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -25,6 +25,7 @@
import org.jboss.tools.drools.ui.bot.test.smoke.OpenDroolsPerspective;
import org.jboss.tools.drools.ui.bot.test.smoke.RuleFlowTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -114,7 +115,7 @@
@BeforeClass
public static void setUpTest() {
- jbt.closeReportUsageWindowIfOpened(false);
+ SWTJBTExt.manageBlockingWidows(false, false);
props = util.loadProperties(Activator.PLUGIN_ID);
String guvnorRepositoryUrl =
props.getProperty(DroolsAllBotTests.GUVNOR_REPOSITORY_URL_PROPERTY_NAME);
if (guvnorRepositoryUrl != null){
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-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
@@ -43,6 +42,7 @@
* @author lzoubek(a)redhat.com
*/
public class RequirementAwareSuite extends Suite {
+ private static boolean runManageBlockingWindow = true;
// we have one global instance of cleanup listener
final static DoAfterAllTestsRunListener cleanUp = new DoAfterAllTestsRunListener();
@@ -184,6 +184,10 @@
@Override
protected Statement withBeforeClasses(Statement statement) {
+ if (RequirementAwareSuite.runManageBlockingWindow){
+ SWTJBTExt.manageBlockingWidows(false, false);
+ RequirementAwareSuite.runManageBlockingWindow = false;
+ }
if (!this.config.equals(TestConfigurator.currentConfig)) {
TestConfigurator.currentConfig = this.config;
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTJBTExt.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -23,10 +23,13 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
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.types.ViewType;
@@ -43,7 +46,7 @@
private static final boolean runningOnMacOs =
Platform.getOS().equalsIgnoreCase("macosx");
SWTWorkbenchBot bot;
- Logger log = Logger.getLogger(SWTJBTExt.class);
+ static Logger log = Logger.getLogger(SWTJBTExt.class);
public SWTJBTExt(SWTWorkbenchBot bot) {
this.bot = bot;
@@ -499,32 +502,80 @@
return SWTJBTExt.getDefinedServerRuntimeVersion(bot,index);
}
-
+ /**
+ * Closes Report Usage Windows and enable Atlassian Connector Usage Reporting Window.
+ * Did not find other way how to disable Atlassian Connector Usage Reporting Window
displaying
+ * @param reportJbtUsage
+ * @param reportSubclipseUsage
+ */
+ public static void manageBlockingWidows(boolean reportJbtUsage,
+ boolean reportSubclipseUsage) {
+ // Manage JBT/JBDS and Subclipse Usage Reporting
+ SWTWorkbenchBot bot = new SWTWorkbenchBot();
+ SWTBotShell shJbtUsage = null;
+ SWTBotShell shSubclipseUsage = null;
+ SWTBotShell[] shells = bot.shells();
+ int index = 0;
+ while ((shJbtUsage == null || shSubclipseUsage == null)
+ && index < shells.length) {
+ if (shells[index].getText().equals(IDELabel.Shell.JBOSS_DEVELOPER_STUDIO_USAGE)
+ || shells[index].getText().equals(IDELabel.Shell.JBOSS_TOOLS_USAGE)) {
+ shJbtUsage = shells[index];
+ } else if (shells[index].getText().equals(IDELabel.Shell.SUBCLIPSE_USAGE)) {
+ shSubclipseUsage = shells[index];
+ }
+ index++;
+ }
+ if (shJbtUsage != null && shJbtUsage.isActive()) {
+ closeJBossToolsUsageWindow(shJbtUsage, reportJbtUsage);
+ if (shSubclipseUsage != null) {
+ closeSubclipseUsageWindow(shSubclipseUsage, reportSubclipseUsage);
+ }
+ } else if (shSubclipseUsage != null && shSubclipseUsage.isActive()) {
+ closeSubclipseUsageWindow(shSubclipseUsage, reportSubclipseUsage);
+ if (shJbtUsage != null) {
+ closeJBossToolsUsageWindow(shJbtUsage, reportJbtUsage);
+ }
+ }
+ // Manage Atlassian Connector Usage Reporting
+ try{
+ SWTBot prefBot = new SWTOpenExt(new SWTBotExt())
+ .preferenceOpen(ActionItem.Preference.AtlassianConnectorUsageData.LABEL);
+ SWTBotCheckBox chbEnableMonitoring = prefBot.checkBox();
+ if (!chbEnableMonitoring.isChecked()){
+ chbEnableMonitoring.click();
+ }
+ prefBot.button(IDELabel.Button.OK).click();
+ } catch (WidgetNotFoundException wnfe){
+ // do nothing there is no Atlassian Connector installed
+ }
+ }
/**
- * Closes RH Report Usage Dialog if found
- *
- * @param cancel
- * select if ok or cancel button is used
+ * Closes JBoss Tools / JBoss Developer Studio Report Usage Window
+ * @param shell
+ * @param report
*/
- public void closeReportUsageWindowIfOpened(boolean cancel) {
+ private static void closeJBossToolsUsageWindow(SWTBotShell shell , boolean report) {
+ shell.bot().button(report ? IDELabel.Button.YES : IDELabel.Button.NO).click();
+ log.info("JBT/JBDS Report Usage window closed");
+ }
+ /**
+ * Closes Subclipse Report Usage Window
+ * @param shell
+ * @param report
+ */
+ private static void closeSubclipseUsageWindow(SWTBotShell shell , boolean report) {
+ SWTBot shellBot = shell.bot();
+ SWTBotCheckBox chbReportUsage = shellBot
+ .checkBox(IDELabel.SubclipseUsageDialog.REPORT_USAGE_CHECK_BOX);
+ if ((report && (!chbReportUsage.isChecked())) ||
+ ((!report) && chbReportUsage.isChecked())) {
+ chbReportUsage.click();
+ }
+ shellBot.button(IDELabel.Button.OK).click();
+ log.info("Sublcipse Report Usage window closed");
+ }
- String title;
- if (isJBDSRun()) {
- title = "JBoss Developer Studio Usage";
- } else {
- title = "JBoss Tools Usage";
- }
- try {
-
- bot.shell(title).activate();
- bot.button(cancel ? IDELabel.Button.NO : IDELabel.Button.YES)
- .click();
- log.info("Report usage window closed");
- } catch (WidgetNotFoundException wnfe) {
- log.info("Report usage window didn't appear");
- }
- }
-
/**
* Selects textToSelect within Source Pane of editor with title editorTitle
* @param bot
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTOpenExt.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -25,6 +25,7 @@
import org.jboss.tools.ui.bot.ext.gen.IPerspective;
import org.jboss.tools.ui.bot.ext.gen.IPreference;
import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
* this class represents
@@ -150,7 +151,12 @@
}
SWTBotShell shell = bot.shell("Preferences");
shell.activate();
+ try{
selectTreeNode(pref);
+ }catch (WidgetNotFoundException wnfe){
+ shell.bot().button(IDELabel.Button.CANCEL).click();
+ throw wnfe;
+ }
return shell.bot();
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -69,7 +69,6 @@
public static int TIME_20S = Timing.time20S();
protected void setUp() throws Exception {
- // close Report Usage Window
- jbt.closeReportUsageWindowIfOpened(false);
+ super.setUp();
}
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -10393,7 +10393,19 @@
}
};
}
-
+ public static class AtlassianConnectorUsageData {
+ /**
+ * represents item : Atlassian Connector -> Usage Data
+ */
+ public static final IPreference LABEL = new IPreference() {
+ public String getName() { return "Usage Data";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("Atlassian Connector");
+ return l;
+ }
+ };
+ }
}
public static class ServerRuntime {
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-03
15:49:30 UTC (rev 37612)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-03
16:25:30 UTC (rev 37613)
@@ -195,6 +195,9 @@
public static final String CLEAN = "Clean";
public static final String SELECT_CLASS = "Select Class";
public static final String CREATING_COMPOSITE_COMPONENT = "Creating composite
component";
+ public static final String JBOSS_DEVELOPER_STUDIO_USAGE = "JBoss Developer Studio
Usage";
+ public static final String JBOSS_TOOLS_USAGE = "JBoss Tools Usage";
+ public static final String SUBCLIPSE_USAGE = "Subclipse Usage";
}
public class EntityGroup {
@@ -820,4 +823,11 @@
public static final String CLEAN_ALL_PROJECTS_RADIO = "Clean all
projects";
}
+
+ public static class SubclipseUsageDialog{
+
+ public static final String REPORT_USAGE_CHECK_BOX = "Report usage of Subclipse
to Subclipse team.";
+
+ }
+
}
Show replies by date