incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1373752 - in /incubator/ooo/trunk/main/test: ./ testcommon/source/org/openoffice/test/ testgui/ testgui/.settings/ testuno/ testuno/.externalToolBuilders/
Date Thu, 16 Aug 2012 08:29:15 GMT
Author: liuzhe
Date: Thu Aug 16 08:29:15 2012
New Revision: 1373752

URL: http://svn.apache.org/viewvc?rev=1373752&view=rev
Log:
#120510# - Move ant scripts from testgui to test module root

Added:
    incubator/ooo/trunk/main/test/testgui/.settings/
    incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.core.prefs
    incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.launching.prefs
    incubator/ooo/trunk/main/test/testuno/.classpath_linux
    incubator/ooo/trunk/main/test/testuno/.classpath_win
    incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/
    incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/Classpath Builder.launch
    incubator/ooo/trunk/main/test/testuno/builder.xml
Removed:
    incubator/ooo/trunk/main/test/testuno/.classpath
Modified:
    incubator/ooo/trunk/main/test/build.xml
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java
    incubator/ooo/trunk/main/test/testgui/.classpath
    incubator/ooo/trunk/main/test/testuno/.project

Modified: incubator/ooo/trunk/main/test/build.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/build.xml?rev=1373752&r1=1373751&r2=1373752&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/build.xml (original)
+++ incubator/ooo/trunk/main/test/build.xml Thu Aug 16 08:29:15 2012
@@ -96,9 +96,8 @@
 	</target>
 
 	<target name="testuno.compile" depends="testuno.init, prepare.junit">
-		<property name="uno.jar.dir" location="${openoffice.home}/../" />
 		<path id="uno.classpath">
-			<fileset dir="${uno.jar.dir}" erroronmissingdir="false">
+			<fileset dir="${openoffice.home}" erroronmissingdir="false">
 				<include name="**/juh.jar" />
 				<include name="**/unoil.jar" />
 				<include name="**/ridl.jar" />
@@ -161,7 +160,12 @@
 			</or>
 		</condition>
 		<condition property="install.build.skip">
-			<isset property="openoffice.home" />
+			<or>
+				<isset property="openoffice.home" />
+                       	 	<not>
+					<isset property="openoffice.archive.dir" />
+				</not>
+			</or>
 		</condition>
 	</target>
 
@@ -208,7 +212,8 @@
 				<fileset dir="${openoffice.installation.dir}" includes="**/*/soffice.bin" followsymlinks="false"
/>
 			</path>
 		</pathconvert>
-		<dirname property="openoffice.home" file="${openoffice.bin}" />
+		<dirname property="openoffice.bin.parent" file="${openoffice.bin}" />
+		<property name="openoffice.home" location="${openoffice.bin.parent}/../" />
 		<fail unless="openoffice.home" />
 		<echo>Openoffice is installed to ${openoffice.home}</echo>
 	</target>
@@ -222,9 +227,7 @@
 		<mkdir dir="${test.result}" />
 		<mkdir dir="${test.report}" />
 		<mkdir dir="${test.output}/temp" />
-		<property file="${openoffice.home}/versionrc" prefix="version" />
-		<property file="${openoffice.home}/version.ini" />
-
+		
 		<junit fork="yes" forkmode="once" tempdir="${test.output}/temp" printsummary="yes" showoutput="false"
errorProperty="test.failed" failureProperty="test.failed" dir=".">
 			<sysproperty key="openoffice.home" value="${openoffice.home}" />
 			<sysproperty key="testspace" value="${testspace}" />

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java?rev=1373752&r1=1373751&r2=1373752&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java Thu
Aug 16 08:29:15 2012
@@ -23,6 +23,7 @@ package org.openoffice.test;
 
 import java.io.File;
 import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Properties;
 import java.util.UUID;
@@ -40,14 +41,27 @@ public class OpenOffice {
 	
 	private static Logger LOG = Logger.getLogger(OpenOffice.class.getName());
 	
+	private static final String[] DEFAULT_HOME = new String[] {
+		"C:/Program Files/OpenOffice.org 3",
+		"C:/Program Files (x86)/OpenOffice.org 3",
+		"/Applications/OpenOffice.org.app/Contents",
+		"/opt/openoffice.org3",
+	};
+	
+	private static final String USERHOME = System.getProperty("user.home");
+	private static final String BIN = SystemUtil.isWindows() ? "program/soffice.exe" : SystemUtil.isMac()
? "MacOS/soffice.bin": "program/soffice.bin"; 
+	private static final String SYSUSERCONFIG = SystemUtil.isWindows()? System.getenv("APPDATA")
: SystemUtil.isMac() ?  USERHOME + "/Library/Application Support" : USERHOME;
+
 	private static OpenOffice defaultInstance = null;
-	
+
 	private File userInstallation = null;
 
 	private File defaultUserInstallation = null;
 	
 	private File home = null;
 
+	private File bin = null;
+	
 	private ArrayList<String> args = new ArrayList<String>();
 
 	private ArrayList<String> registryModifications = new ArrayList<String>();
@@ -62,13 +76,13 @@ public class OpenOffice {
 	
 	private String id = "-"+UUID.randomUUID().toString().replace("-", "");
 	
+	
 	public OpenOffice() {
 		this(null);
 	}
 	
 	/**
-	 * Construct Process with the home path of OpenOffice. The home is the
-	 * directory which contains soffice.bin.
+	 * Construct Process with the home path of OpenOffice.
 	 * 
 	 * @param appHome
 	 */
@@ -78,47 +92,40 @@ public class OpenOffice {
 		if (appHome == null)
 			appHome = System.getenv("OPENOFFICE_HOME");
 		if (appHome == null) {
-			if (SystemUtil.isWindows()) {
-				appHome = "C:/Program Files/OpenOffice.org 3/program";
-				if (!new File(appHome).exists())
-					appHome = "C:/Program Files (x86)/OpenOffice.org 3/program";
-			} else if (SystemUtil.isMac()) {
-				appHome = "/Applications/OpenOffice.org.app/Contents/MacOS";
-			} else {
-				appHome = "/opt/openoffice.org3/program";
+			// Search in the classpath
+			try {
+				URL url = getClass().getClassLoader().getResource(BIN);
+				File file = new File(url.toURI());
+				if (file.exists()) 
+					appHome = file.getParentFile().getParentFile().getAbsolutePath();
+			} catch (Exception e) {
+				// ignore
 			}
 		}
+		
+		if (appHome == null) {
+			for (int i = 0; i < DEFAULT_HOME.length; i++) 
+				if (new File(DEFAULT_HOME[i]).exists()) 
+					appHome = DEFAULT_HOME[i];
+		}
 
 		home = new File(appHome);
-		
-		File bootstrapFile = new File(home, "bootstraprc");
+		bin = new File(appHome, BIN);
+		File binParent = bin.getParentFile();
+		File bootstrapFile = new File(binParent, "bootstraprc");
 		if (!bootstrapFile.exists())
-			bootstrapFile = new File(home, "bootstrap.ini");
+			bootstrapFile = new File(binParent, "bootstrap.ini");
 		if (!bootstrapFile.exists())
 			throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed.
" +
 					"Use system property openoffice.home to specify the correct location of OpenOffice.");
 
 		Properties props = FileUtil.loadProperties(bootstrapFile);
-		String defaultUserInstallationPath = props.getProperty("UserInstallation");
-		String sysUserConfig = null;
-		if (SystemUtil.isWindows()) {
-			sysUserConfig = System.getenv("APPDATA");
-		} else if (SystemUtil.isMac()) {
-			sysUserConfig = System.getProperty("user.home") + "/Library/Application Support";
-		} else {
-			sysUserConfig = System.getProperty("user.home");
-		}
-
-		defaultUserInstallationPath = defaultUserInstallationPath.replace("$ORIGIN", home.getAbsolutePath()).replace("$SYSUSERCONFIG",
sysUserConfig);
+		String defaultUserInstallationPath = props.getProperty("UserInstallation").replace("$ORIGIN",
binParent.getAbsolutePath()).replace("$SYSUSERCONFIG", SYSUSERCONFIG);
 		defaultUserInstallation = new File(defaultUserInstallationPath);
 		
-		File versionFile = new File(home, "versionrc");
+		File versionFile = new File(binParent, "versionrc");
 		if (!versionFile.exists())
-			versionFile = new File(home, "version.ini");
-		if (!versionFile.exists())
-			throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed.
" +
-					"Use system property openoffice.home to specify the correct location of OpenOffice.");
-		
+			versionFile = new File(binParent, "version.ini");
 		versionProps = FileUtil.loadProperties(versionFile);
 		addArgs(id);
 	}
@@ -258,9 +265,8 @@ public class OpenOffice {
 			return;
 		}
 		
-		String bin = home.getAbsolutePath() + File.separatorChar + (SystemUtil.isWindows() ? "soffice.exe"
: "soffice.bin");
 		ArrayList<String> cmds = new ArrayList<String>();
-		cmds.add(bin);
+		cmds.add(bin.getAbsolutePath());
 		if (automationPort > 0) {
 			cmds.add("-automationport=" + automationPort);
 			cmds.add("-enableautomation");

Modified: incubator/ooo/trunk/main/test/testgui/.classpath
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/.classpath?rev=1373752&r1=1373751&r2=1373752&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/.classpath (original)
+++ incubator/ooo/trunk/main/test/testgui/.classpath Thu Aug 16 08:29:15 2012
@@ -5,5 +5,7 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="var" path="openoffice.home"/>
+	<classpathentry kind="var" path="JRE_LIB"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Added: incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.core.prefs?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.core.prefs Thu Aug 16
08:29:15 2012
@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=warning

Added: incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.launching.prefs
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.launching.prefs?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.launching.prefs (added)
+++ incubator/ooo/trunk/main/test/testgui/.settings/org.eclipse.jdt.launching.prefs Thu Aug
16 08:29:15 2012
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning

Added: incubator/ooo/trunk/main/test/testuno/.classpath_linux
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/.classpath_linux?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/.classpath_linux (added)
+++ incubator/ooo/trunk/main/test/testuno/.classpath_linux Thu Aug 16 08:29:15 2012
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="source"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="var" path="openoffice.home"/>
+	<classpathentry kind="var" path="openoffice.home/basis-link/program/classes/unoil.jar"/>
+	<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/jurt.jar"/>
+	<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/juh.jar"/>
+	<classpathentry kind="var" path="openoffice.home/basis-link/ure-link/share/java/ridl.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: incubator/ooo/trunk/main/test/testuno/.classpath_win
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/.classpath_win?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/.classpath_win (added)
+++ incubator/ooo/trunk/main/test/testuno/.classpath_win Thu Aug 16 08:29:15 2012
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="source"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/testcommon"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="var" path="openoffice.home"/>
+	<classpathentry kind="var" path="openoffice.home/Basis/program/classes/unoil.jar"/>
+	<classpathentry kind="var" path="openoffice.home/URE/java/jurt.jar"/>
+	<classpathentry kind="var" path="openoffice.home/URE/java/juh.jar"/>
+	<classpathentry kind="var" path="openoffice.home/URE/java/ridl.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/Classpath Builder.launch
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/Classpath%20Builder.launch?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/Classpath Builder.launch (added)
+++ incubator/ooo/trunk/main/test/testuno/.externalToolBuilders/Classpath Builder.launch Thu
Aug 16 08:29:15 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
+<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
+<booleanAttribute key="org.eclipse.ant.uiSET_INPUTHANDLER" value="false"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
+<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="testuno"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/testuno/builder.xml}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+</launchConfiguration>

Modified: incubator/ooo/trunk/main/test/testuno/.project
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/.project?rev=1373752&r1=1373751&r2=1373752&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/.project (original)
+++ incubator/ooo/trunk/main/test/testuno/.project Thu Aug 16 08:29:15 2012
@@ -6,6 +6,20 @@
 	</projects>
 	<buildSpec>
 		<buildCommand>
+			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+			<triggers>auto,full,incremental,</triggers>
+			<arguments>
+				<dictionary>
+					<key>LaunchConfigHandle</key>
+					<value>&lt;project&gt;/.externalToolBuilders/Classpath Builder.launch</value>
+				</dictionary>
+				<dictionary>
+					<key>incclean</key>
+					<value>true</value>
+				</dictionary>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
 			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
 			</arguments>

Added: incubator/ooo/trunk/main/test/testuno/builder.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/builder.xml?rev=1373752&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/builder.xml (added)
+++ incubator/ooo/trunk/main/test/testuno/builder.xml Thu Aug 16 08:29:15 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--***********************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ ***********************************************************-->
+
+<project basedir="." default="config.classpath">
+	<target name="config.classpath">
+		<condition property="classpath.file" value=".classpath_win" else=".classpath_linux">
+			<os family="windows"/>
+		</condition>
+		<copy file="${classpath.file}" tofile=".classpath"/>
+	</target>
+</project>



Mime
View raw message