[jbosstools-commits] JBoss Tools SVN: r43551 - in trunk/tests: scripts/installation-updates and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 10 10:59:22 EDT 2012


Author: mickael_istria
Date: 2012-09-10 10:59:22 -0400 (Mon, 10 Sep 2012)
New Revision: 43551

Added:
   trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallFromCentralTest.java
Modified:
   trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
   trunk/tests/scripts/installation-updates/testInstall.sh
Log:
JBIDE-12508: Updated script + new Bot case for installation with Central

Added: trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallFromCentralTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallFromCentralTest.java	                        (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallFromCentralTest.java	2012-09-10 14:59:22 UTC (rev 43551)
@@ -0,0 +1,78 @@
+/******************************************************************************* 
+ * Copyright (c) 2012 Red Hat, Inc. 
+ * Distributed under license by Red Hat, Inc. All rights reserved. 
+ * This program is made available under the terms of the 
+ * Eclipse Public License v1.0 which accompanies this distribution, 
+ * and is available at http://www.eclipse.org/legal/epl-v10.html 
+ * 
+ * Contributors: 
+ *     Red Hat, Inc. - initial API and implementation 
+ ******************************************************************************/
+
+package org.jboss.tools.tests.installation;
+
+import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This is a bot scenario which performs install through JBoss Central.
+ * 
+ * @author Mickael Istria
+ */
+ at RunWith(SWTBotJunit4ClassRunner.class)
+public class InstallFromCentralTest extends SWTBotEclipseTestCase {
+	
+	@Test
+	public void testInstall() throws Exception {
+		bot.menu("Help").menu("JBoss Central").click();
+		SWTBotMultiPageEditor centralEditor = (SWTBotMultiPageEditor) bot.multipageEditorByTitle("JBoss Central");
+		centralEditor.show();
+		centralEditor.activatePage("Software/Update");
+		try {
+			int i = 0;
+			SWTBotCheckBox check = null;
+			while ((check = bot.checkBox(i)) != null) {
+				if (check.getText() == null || !check.getText().contains("Show Installed")) {
+					check.click();
+				}
+				i++;
+			}
+		} catch (WidgetNotFoundException ex) {
+			// last checkbox
+		} catch (IndexOutOfBoundsException ex ) {
+			// last checkbox
+		}
+		bot.button("Install").click();
+		this.bot.waitUntil(new ICondition() {
+			@Override
+			public boolean test() throws Exception {
+				return bot.activeShell().getText().equals("Install") || bot.activeShell().getText().equals("Problem Occured");
+			}
+			
+			@Override
+			public void init(SWTBot bot) {
+			}
+			
+			@Override
+			public String getFailureMessage() {
+				return "Blocking while calculating deps";
+			}
+		}, 10 * 60000); // 5 minutes timeout
+		if (bot.activeShell().getText().equals("Problem Occured")) {
+			String reason = bot.text().getText();
+			Assert.fail("Could not install Central content from " + System.getProperty("org.jboss.tools.central.discovery") + "\n" + reason);
+		}
+		bot.button("Next >").click();
+		InstallTest.continueInstall(bot);
+		
+	}
+
+}


Property changes on: trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallFromCentralTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java	2012-09-10 14:03:33 UTC (rev 43550)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java	2012-09-10 14:59:22 UTC (rev 43551)
@@ -14,6 +14,8 @@
 import junit.framework.Assert;
 
 import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
@@ -37,7 +39,7 @@
 	 * It the input of the scenario.
 	 */
 	public static final String UPDATE_SITE_PROPERTY = "UPDATE_SITE";
-
+	
 	@Test
 	public void testInstall() throws Exception {
 		String site = System.getProperty("UPDATE_SITE");
@@ -98,12 +100,16 @@
 				return "Blocking while calculating deps";
 			}
 		}, 10 * 60000); // 5 minutes timeout
-		this.bot.button("Next >").click();
-		this.bot.radio(0).click();
-		this.bot.button("Finish").click();
+		continueInstall(bot);
+	}
+
+	public static void continueInstall(final SWTWorkbenchBot bot) {
+		bot.button("Next >").click();
+		bot.radio(0).click();
+		bot.button("Finish").click();	
 		// wait for Security pop-up, or install finished.
-		final SWTBotShell shell = this.bot.shell("Installing Software");
-		this.bot.waitWhile(new ICondition() {
+		final SWTBotShell shell = bot.shell("Installing Software");
+		bot.waitWhile(new ICondition() {
 			
 			@Override
 			public boolean test() throws Exception {
@@ -119,10 +125,10 @@
 				return null;
 			}
 		}, 20 * 60000); // 20 minutes_tino
-		if (this.bot.activeShell().getText().equals("Security Warning")) {
-			this.bot.button("OK").click();
+		if (bot.activeShell().getText().equals("Security Warning")) {
+			bot.button("OK").click();
 			System.err.println("OK clicked");
-			this.bot.waitUntil(new ICondition() {
+			bot.waitUntil(new ICondition() {
 				@Override
 				public boolean test() throws Exception {
 					try {
@@ -146,7 +152,7 @@
 				}
 			}, 15 * 60000); // 15 more minutes
 		}
-		SWTBot restartShellBot = this.bot.shell("Software Updates").bot();
+		SWTBot restartShellBot = bot.shell("Software Updates").bot();
 		try {
 			// Eclipse 3.7.x => "Not now"
 			restartShellBot.button("Not Now").click(); // Don't restart in test, test executor will do it.

Modified: trunk/tests/scripts/installation-updates/testInstall.sh
===================================================================
--- trunk/tests/scripts/installation-updates/testInstall.sh	2012-09-10 14:03:33 UTC (rev 43550)
+++ trunk/tests/scripts/installation-updates/testInstall.sh	2012-09-10 14:59:22 UTC (rev 43551)
@@ -9,6 +9,20 @@
 	echo "   <repository_url>: URL of a p2 repo to install from"
 }
 
+
+# Takes a repo or a directory.xml URL single parameter
+install_url() {
+	repoName="$1"
+	echo "$repoName" | grep ".xml$"
+	if [ "$?" -eq 0 ]; then
+		#Found .xml suffix
+		install_central "$1"
+	else
+		install_repo "$1"
+	fi 
+}
+	
+
 # Takes repo URL as single parameter
 install_repo() {
 	echo "Installing content from " $1
@@ -36,10 +50,37 @@
 		fi
 }
 
+# Takes a Central directory.xml URL single parameter
+install_central() {
+	echo "Installing Central from " $1
+		report=TEST-install-$(date +%Y%m%d%H%M).xml
+			#Invoke tests
+		output=$(java \
+ -Djboss.discovery.directory.url=$1 \
+ -Dorg.eclipse.swtbot.search.timeout=10000 \
+ -Dusage_reporting_enabled=false \
+ -Xms256M -Xmx768M -XX:MaxPermSize=512M \
+ -jar plugins/org.eclipse.equinox.launcher_*.jar \
+ -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication \
+ -testApplication org.eclipse.ui.ide.workbench \
+ -product $productName \
+ -data workspace/ \
+ formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,$report \
+ formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter \
+ -testPluginName org.jboss.tools.tests.installation \
+ -className org.jboss.tools.tests.installation.InstallFromCentralTest \
+ -consoleLog -debug)
+		if [[ ! "$output" == *"Failures: 0, Errors: 0"* ]]; then
+			echo "Error while installing from " $site ". Read $report for details and see screenshots/"
+			popd
+			exit 1
+		fi
+}
+
 eclipse_home=$1
 shift
 
-if [ ! -d "$eclipse_home" -o ! -f "$eclipse_home/eclipse" ]; then
+if [ ! -d "$eclipse_home" -o ! -d "$eclipse_home/plugins" ]; then
 	usage
 	exit 2
 fi
@@ -58,18 +99,20 @@
 #install test framework
 java -jar plugins/org.eclipse.equinox.launcher_*.jar \
 -application org.eclipse.equinox.p2.director \
--repository http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site/,http://download.jboss.org/jbosstools/builds/staging/jbosstools-4.0_trunk.component--tests/all/repo/ \
+-repository http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site/,\
+file:/home/mistria/workspaceJBossTools/jboss-tools-eclipse-repository/tests/site/target/repository \
 -installIU org.jboss.tools.tests.installation \
 -installIU org.eclipse.swtbot.eclipse.test.junit4.feature.group \
 -consoleLog
+#http://download.jboss.org/jbosstools/builds/staging/jbosstools-4.0_trunk.component--tests/all/repo/ \
 
 while (($#)); do
 	if [ -f "$1" ]; then
 		for repoUrl in $(cat "$1"); do
-			install_repo "$repoUrl"
+			install_url "$repoUrl"
 		done
 	else
-		install_repo "$1"
+		install_url "$1"
 	fi
 	shift
 done



More information about the jbosstools-commits mailing list