Author: mickael_istria
Date: 2012-07-03 11:33:36 -0400 (Tue, 03 Jul 2012)
New Revision: 42346
Added:
trunk/tests/plugins/org.jboss.tools.tests.installation/
trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/
trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/MANIFEST.MF
trunk/tests/plugins/org.jboss.tools.tests.installation/build.properties
trunk/tests/plugins/org.jboss.tools.tests.installation/pom.xml
trunk/tests/plugins/org.jboss.tools.tests.installation/src/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
trunk/tests/scripts/
trunk/tests/scripts/installation-updates/
trunk/tests/scripts/installation-updates/assembly.xml
trunk/tests/scripts/installation-updates/pom.xml
trunk/tests/scripts/installation-updates/testInstall.sh
trunk/tests/scripts/pom.xml
Modified:
trunk/tests/features/org.jboss.tools.test.feature/feature.xml
trunk/tests/plugins/pom.xml
trunk/tests/pom.xml
Log:
JBIDE-11713: Moved scenario and script to tests/
Modified: trunk/tests/features/org.jboss.tools.test.feature/feature.xml
===================================================================
--- trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2012-07-03 15:27:38 UTC
(rev 42345)
+++ trunk/tests/features/org.jboss.tools.test.feature/feature.xml 2012-07-03 15:33:36 UTC
(rev 42346)
@@ -22,6 +22,12 @@
download-size="0"
install-size="0"
version="0.0.0"/>
+
+ <plugin
+ id="org.jboss.tools.tests.installation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
<plugin
id="org.jboss.tools.tests.test"
Added: trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/MANIFEST.MF 2012-07-03
15:33:36 UTC (rev 42346)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests for Installation and Updates
+Bundle-SymbolicName: org.jboss.tools.tests.installation
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: JBoss, by Red Hat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.5",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.5",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.5",
+ org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.0",
+ org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.5"
Property changes on:
trunk/tests/plugins/org.jboss.tools.tests.installation/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/tests/plugins/org.jboss.tools.tests.installation/build.properties
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/build.properties
(rev 0)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/build.properties 2012-07-03
15:33:36 UTC (rev 42346)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on:
trunk/tests/plugins/org.jboss.tools.tests.installation/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/tests/plugins/org.jboss.tools.tests.installation/pom.xml
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests.installation/pom.xml
(rev 0)
+++ trunk/tests/plugins/org.jboss.tools.tests.installation/pom.xml 2012-07-03 15:33:36 UTC
(rev 42346)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.tools.tests</groupId>
+ <artifactId>org.jboss.tools.tests.installation</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <parent>
+ <groupId>org.jboss.tools.tests</groupId>
+ <artifactId>plugins</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+</project>
+
Property changes on: trunk/tests/plugins/org.jboss.tools.tests.installation/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java 2012-07-03
15:33:36 UTC (rev 42346)
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * 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 junit.framework.Assert;
+
+import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+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.SWTBotShell;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This is a bot scenario which performs install through p2 UI.
+ * It takes as input a p2 repository URL configured in the UPDATE_SITE
+ * system property.
+ *
+ * @author Mickael Istria
+ */
+(a)RunWith(SWTBotJunit4ClassRunner.class)
+public class InstallTest extends SWTBotEclipseTestCase {
+
+ /**
+ * System property expected to receive URL of a p2 repo to install
+ * 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");
+ Assert.assertNotNull("No site specified, set UPDATE_SITE system property
first", site);
+
+ try {
+ installFromSite(site);
+ } catch (Exception ex) {
+ String installDesc = this.bot.text().getText();
+ if (installDesc == null || installDesc.isEmpty()) {
+ throw new RuntimeException("Internal error", ex);
+ }
+ StringBuilder message = new StringBuilder();
+ message.append("Could not install from: " + site);
+ message.append(installDesc);
+ System.err.println(message.toString());
+ Assert.fail(message.toString());
+ }
+ }
+
+ private void installFromSite(String site) {
+ this.bot.menu("Help").menu("Install New Software...").click();
+ this.bot.shell("Install").bot().button("Add...").click();
+ this.bot.shell("Add Repository").activate().setFocus();
+ this.bot.text(1).setText(site);
+ this.bot.button("OK").click();
+ this.bot.shell("Install").activate().setFocus();
+ this.bot.waitWhile(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return bot.tree().getAllItems()[0].getText().startsWith("Pending...");
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Could not see categories in tree";
+ }
+ });
+ this.bot.button("Select All").click();
+ this.bot.button("Next >").click();
+ this.bot.waitUntil(new ICondition() {
+ @Override
+ public boolean test() throws Exception {
+ return bot.button("Cancel").isEnabled();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ 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();
+ // wait for Security pop-up, or install finished.
+ final SWTBotShell shell = this.bot.shell("Installing Software");
+ this.bot.waitWhile(new ICondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return shell.isActive();
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }, 20 * 60000); // 20 minutes_tino
+ if (this.bot.activeShell().getText().equals("Security Warning")) {
+ this.bot.button("OK").click();
+ System.err.println("OK clicked");
+ this.bot.waitUntil(new ICondition() {
+ @Override
+ public boolean test() throws Exception {
+ try {
+ boolean stillOpen = bot.shell("Installing Software").isOpen();
+ System.err.println("still open? " + stillOpen);
+ return !stillOpen;
+ } catch (WidgetNotFoundException ex) {
+ System.err.println("no shell");
+ // Shell already closed
+ return true;
+ }
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }, 15 * 60000); // 15 more minutes
+ }
+ this.bot.shell("Software Updates").bot().button("Not Now").click();
// Don't restart in test, test executor will do it.
+ }
+
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.tests.installation/src/org/jboss/tools/tests/installation/InstallTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/pom.xml
===================================================================
--- trunk/tests/plugins/pom.xml 2012-07-03 15:27:38 UTC (rev 42345)
+++ trunk/tests/plugins/pom.xml 2012-07-03 15:33:36 UTC (rev 42346)
@@ -14,5 +14,6 @@
<modules>
<module>org.jboss.tools.tests</module>
<module>org.jboss.tools.ui.bot.ext</module>
+ <module>org.jboss.tools.tests.installation</module>
</modules>
</project>
Modified: trunk/tests/pom.xml
===================================================================
--- trunk/tests/pom.xml 2012-07-03 15:27:38 UTC (rev 42345)
+++ trunk/tests/pom.xml 2012-07-03 15:33:36 UTC (rev 42346)
@@ -17,5 +17,6 @@
<module>tests</module>
<module>features</module>
<module>site</module>
- </modules>
+ <module>scripts</module>
+ </modules>
</project>
Added: trunk/tests/scripts/installation-updates/assembly.xml
===================================================================
--- trunk/tests/scripts/installation-updates/assembly.xml (rev 0)
+++ trunk/tests/scripts/installation-updates/assembly.xml 2012-07-03 15:33:36 UTC (rev
42346)
@@ -0,0 +1,32 @@
+<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembl...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-p...
http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>delivery</id>
+ <formats>
+ <format>zip</format>
+ <format>dir</format>
+ </formats>
+ <baseDirectory>/</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ <fileMode>777</fileMode>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/scenarios</directory>
+ <outputDirectory>scenarios</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <fileMode>777</fileMode>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/repository</outputDirectory>
+ <unpack>true</unpack>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
Property changes on: trunk/tests/scripts/installation-updates/assembly.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/tests/scripts/installation-updates/pom.xml
===================================================================
--- trunk/tests/scripts/installation-updates/pom.xml (rev 0)
+++ trunk/tests/scripts/installation-updates/pom.xml 2012-07-03 15:33:36 UTC (rev 42346)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.tools.tests.scripts</groupId>
+ <artifactId>installation-updates</artifactId>
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.jboss.tools.tests</groupId>
+ <artifactId>scripts</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for inheritance merges
-->
+ <phase>package</phase> <!-- bind to the packaging phase -->
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
\ No newline at end of file
Property changes on: trunk/tests/scripts/installation-updates/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/tests/scripts/installation-updates/testInstall.sh
===================================================================
--- trunk/tests/scripts/installation-updates/testInstall.sh (rev
0)
+++ trunk/tests/scripts/installation-updates/testInstall.sh 2012-07-03 15:33:36 UTC (rev
42346)
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+usage() {
+ echo "Script to test installation"
+ echo "usage: $0 <eclipse_home>
<file_containing_list_of_sites|repository_url>*"
+ echo " <eclipse_home>: an eclipse installation will be performed on"
+ echo " <file_containing_list_of_sites> a file containing a list of
p2-friendly URLs of repositories"
+ echo " separated by spaces or line breaks"
+ echo " <repository_url>: URL of a p2 repo to install from"
+}
+
+# Takes repo URL as single parameter
+install_repo() {
+ echo "Installing content from " $1
+ report=TEST-install-$(date +%Y%m%d%H%M).xml
+ #Invoke tests
+ output=$(java \
+ -DUPDATE_SITE=$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.qa.install.tests \
+ -className org.jboss.tools.qa.install.tests.InstallTest \
+ -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
+ usage
+ exit 2
+fi
+if (( $# <= 0)); then
+ usage
+ exit 2
+fi
+
+echo "Preparing tests, installing framework"
+pushd $eclipse_home
+iniFile=$(ls -1 *.ini)
+productLineNumber=$(cat $iniFile | grep -n \\-product | cut -f 1 -d :)
+let "productLineNumber = $productLineNumber + 1"
+productName=$(sed -n ${productLineNumber}p $iniFile)
+
+#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-sit...
\
+ -installIU org.jboss.tools.tests.installation \
+ -consoleLog
+
+while (($#)); do
+ if [ -f "$1" ]; then
+ for repoUrl in $(cat "$1"); do
+ install_repo "$repoUrl"
+ done
+ else
+ install_repo "$1"
+ fi
+ shift
+done
+popd
+exit 0
Property changes on: trunk/tests/scripts/installation-updates/testInstall.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/scripts/pom.xml
===================================================================
--- trunk/tests/scripts/pom.xml (rev 0)
+++ trunk/tests/scripts/pom.xml 2012-07-03 15:33:36 UTC (rev 42346)
@@ -0,0 +1,19 @@
+<project
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
+
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ <artifactId>tests</artifactId>
+ </parent>
+ <groupId>org.jboss.tools.tests</groupId>
+ <artifactId>scripts</artifactId>
+ <name>Some helpful scripts to perfom tests</name>
+
+ <packaging>pom</packaging>
+ <modules>
+ <module>installation-updates</module>
+ </modules>
+</project>
+
Property changes on: trunk/tests/scripts/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain