[jbosstools-commits] JBoss Tools SVN: r43919 - in trunk/tests/scripts/installation-updates: .settings and 4 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 21 05:37:03 EDT 2012


Author: mickael_istria
Date: 2012-09-21 05:37:03 -0400 (Fri, 21 Sep 2012)
New Revision: 43919

Added:
   trunk/tests/scripts/installation-updates/.classpath
   trunk/tests/scripts/installation-updates/.project
   trunk/tests/scripts/installation-updates/.settings/
   trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.core.prefs
   trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.groovy.core.prefs
   trunk/tests/scripts/installation-updates/.settings/org.eclipse.m2e.core.prefs
   trunk/tests/scripts/installation-updates/src/
   trunk/tests/scripts/installation-updates/src/main/
   trunk/tests/scripts/installation-updates/src/main/groovy/
   trunk/tests/scripts/installation-updates/src/main/groovy/testInstall.groovy
   trunk/tests/scripts/installation-updates/src/main/java/
   trunk/tests/scripts/installation-updates/src/main/resources/
   trunk/tests/scripts/installation-updates/src/test/
   trunk/tests/scripts/installation-updates/src/test/java/
Modified:
   trunk/tests/scripts/installation-updates/pom.xml
   trunk/tests/scripts/installation-updates/testInstall.sh
Log:
Groovy version for testInstall

Added: trunk/tests/scripts/installation-updates/.classpath
===================================================================
--- trunk/tests/scripts/installation-updates/.classpath	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/.classpath	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
+	<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="src/main/groovy"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>


Property changes on: trunk/tests/scripts/installation-updates/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/tests/scripts/installation-updates/.project
===================================================================
--- trunk/tests/scripts/installation-updates/.project	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/.project	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>installation-updates</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/tests/scripts/installation-updates/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.core.prefs	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5


Property changes on: trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.groovy.core.prefs
===================================================================
--- trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.groovy.core.prefs	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.groovy.core.prefs	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+groovy.script.filters=scripts/**/*.groovy,y,src/main/resources/**/*.groovy,y,src/test/resources/**/*.groovy,y


Property changes on: trunk/tests/scripts/installation-updates/.settings/org.eclipse.jdt.groovy.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/tests/scripts/installation-updates/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/tests/scripts/installation-updates/.settings/org.eclipse.m2e.core.prefs	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/.settings/org.eclipse.m2e.core.prefs	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=false
+version=1


Property changes on: trunk/tests/scripts/installation-updates/.settings/org.eclipse.m2e.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/tests/scripts/installation-updates/pom.xml
===================================================================
--- trunk/tests/scripts/installation-updates/pom.xml	2012-09-21 09:27:12 UTC (rev 43918)
+++ trunk/tests/scripts/installation-updates/pom.xml	2012-09-21 09:37:03 UTC (rev 43919)
@@ -4,15 +4,27 @@
 	<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.4.0-SNAPSHOT</version>
 		<relativePath>..</relativePath>
 	</parent>
-	
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.ant</groupId>
+			<artifactId>ant</artifactId>
+			<version>1.8.4</version>
+		</dependency>
+		<dependency>
+        	<groupId>org.codehaus.gmaven.runtime</groupId>
+        	<artifactId>gmaven-runtime-2.0</artifactId>
+        	<version>1.4</version>
+    	</dependency>
+	</dependencies>
+
 	<build>
 		<plugins>
 			<plugin>
@@ -34,8 +46,21 @@
 					</descriptors>
 				</configuration>
 			</plugin>
-		</plugins>
+		    <plugin>
+	            <groupId>org.codehaus.gmaven</groupId>
+	            <artifactId>gmaven-plugin</artifactId>
+	            <executions>
+	                <execution>
+	                    <goals>
+	                        <goal>generateStubs</goal>
+	                        <goal>compile</goal>
+	                        <goal>generateTestStubs</goal>
+	                        <goal>testCompile</goal>
+	                    </goals>
+	                </execution>
+	            </executions>
+	        </plugin>
+	    </plugins>
 	</build>
-	
+
 </project>
-	
\ No newline at end of file

Added: trunk/tests/scripts/installation-updates/src/main/groovy/testInstall.groovy
===================================================================
--- trunk/tests/scripts/installation-updates/src/main/groovy/testInstall.groovy	                        (rev 0)
+++ trunk/tests/scripts/installation-updates/src/main/groovy/testInstall.groovy	2012-09-21 09:37:03 UTC (rev 43919)
@@ -0,0 +1,128 @@
+import org.apache.tools.ant.taskdefs.Java;
+import java.text.SimpleDateFormat;
+
+void usage() {
+	println "Script to test installation";
+	println "usage: groovy.sh testInstall.groovy <eclipse_home> <file_containing_list_of_sites|repository_url|CHECK_FOR_UPDATES>*";
+	println "   <eclipse_home>: an eclipse installation will be performed on";
+	println "   <file_containing_list_of_sites> a file containing a list of p2-friendly URLs of repositories";
+	println "                                   separated by spaces or line breaks";
+	println "   <repository_url>: URL of a p2 repo to install from";
+	println "   CHECK_FOR_UPDATES: will trigger the check for updates";
+}
+
+
+// Takes a repo or a directory.xml URL single parameter
+void installUrl(String repoUrl, File eclipseHome, String product) {
+	if (repoUrl.endsWith(".xml")) {
+		installFromCentral(repoUrl, eclipseHome, product);
+	} else if (repoUrl.equals("CHECK_FOR_UPDATES")) {
+		checkForUpdates(eclipseHome, product);
+	} else {
+		installRepo(repoUrl, eclipseHome, product);
+	}
+}
+
+
+//Takes repo URL as single parameter
+void installRepo(String repoUrl, File eclipseHome, String productName) {
+	println("Installing content from " + repoUrl);
+	String additionalVMArgs = "-DUPDATE_SITE=" + repoUrl;
+	runSWTBotInstallRoutine(eclipseHome, productName, additionalVMArgs, "org.jboss.tools.tests.installation.InstallTest");
+}
+
+void runSWTBotInstallRoutine(File eclipseHome, String productName, String additionalVMArgs, String testClassName) {
+	String report = "TEST-install-" + new SimpleDateFormat("yyyyMMddh-hmm").format(new Date()) + ".xml";
+	File output = File.createTempFile("install", ".txt");
+	output.deleteOnExit();
+	// Invoke tests
+	Java proc = new org.apache.tools.ant.taskdefs.Java();
+	proc.setFork(true);
+	proc.setDir(eclipseHome);
+	proc.setOutput(output);
+	proc.setJvmargs(additionalVMArgs + " " +
+			"-Dorg.eclipse.swtbot.search.timeout=10000 " +
+			"-Dusage_reporting_enabled=false " +
+			"-Xms256M -Xmx768M -XX:MaxPermSize=512M");
+	proc.setJar(new File(eclipseHome, "plugins").listFiles().find {it.getName().startsWith("org.eclipse.equinox.launcher_") && it.getName().endsWith(".jar")} );
+	proc.setArgs("-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 " + testClassName + " " +
+			"-consoleLog -debug");
+	proc.init();
+	int returnCode = proc.executeJava();
+
+	output.eachLine { line ->
+		if (line.contains("Failures:")) {
+			if (line.contains("Failures: 0, Errors: 0")) {
+				return;
+			} else {
+				println("Error while installing. Read " + report + " for details and see screenshots/")
+			}
+		}
+	}
+}
+
+// Takes a Central directory.xml URL single parameter
+void installFromCentral(File eclipseHome, String productName) {
+		println("Installing content from " + repoUrl);
+	String report = "TEST-install-" + new SimpleDateFormat("yyyyMMddh-hmm").format(new Date()) + ".xml";
+	runSWTBotInstallRoutine(eclipseHome, productName, "", "org.jboss.tools.tests.installation.InstallFromCentralTest");
+}
+
+// Check for updates
+void checkForUpdates(File eclipseHome, String productName) {
+	println("Check for updates");
+	runSWTBotInstallRoutine(eclipseHome, productName, "", "org.jboss.tools.tests.installation.CheckForUpdatesTest");
+}
+
+if (args.length < 2) {
+	usage();
+	System.exit(2);
+}
+
+File eclipseHome = new File(args[0]);
+
+if (!eclipseHome.isDirectory()) {
+	usage();
+	System.exit(2);
+}
+
+println "Preparing tests, installing framework";
+
+// Install test framework
+Java proc = new org.apache.tools.ant.taskdefs.Java();
+proc.setDir(eclipseHome);
+proc.setFork(true);
+proc.setJar(new File(eclipseHome, "plugins").listFiles().find({it.getName().startsWith("org.eclipse.equinox.launcher_") && it.getName().endsWith(".jar")}).getAbsoluteFile());
+proc.setArgs("-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/ " +
+		"-installIU org.jboss.tools.tests.installation " +
+		"-installIU org.eclipse.swtbot.eclipse.test.junit4.feature.group " +
+		"-consolelog");
+proc.init();
+int returnCode = proc.executeJava();
+
+
+File iniFile = eclipseHome.listFiles().find({it.getName().endsWith(".ini")});
+iniLines = iniFile.readLines();
+targetIndex = iniLines.findIndexOf {line -> line.startsWith("-product") };
+String productName = iniLines[targetIndex + 1];
+println ("Product is: " + productName);
+
+args[1..-1].each {
+	if (new File(it).isFile()) {
+		new File(it).eachLine({ line ->
+			installUrl(line, eclipseHome, productName);
+		});
+	} else {
+		installUrl(it, eclipseHome, productName);
+	}
+}
+System.exit(0)

Modified: trunk/tests/scripts/installation-updates/testInstall.sh
===================================================================
--- trunk/tests/scripts/installation-updates/testInstall.sh	2012-09-21 09:27:12 UTC (rev 43918)
+++ trunk/tests/scripts/installation-updates/testInstall.sh	2012-09-21 09:37:03 UTC (rev 43919)
@@ -137,7 +137,6 @@
 -installIU org.eclipse.swtbot.eclipse.test.junit4.feature.group \
 -consoleLog
 
-
 while (($#)); do
 	if [ -f "$1" ]; then
 		for repoUrl in $(cat "$1"); do



More information about the jbosstools-commits mailing list