incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1387890 - in /incubator/ooo/trunk/test: testcommon/source/org/openoffice/test/ testcommon/source/org/openoffice/test/common/ testuno/source/pvt/uno/
Date Thu, 20 Sep 2012 07:17:44 GMT
Author: liuzhe
Date: Thu Sep 20 07:17:44 2012
New Revision: 1387890

URL: http://svn.apache.org/viewvc?rev=1387890&view=rev
Log:
Add parameter into pvt.uno.Conversion to control how to kill openoffice.

Modified:
    incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/OpenOffice.java
    incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java
    incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java
    incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java

Modified: incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/OpenOffice.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/OpenOffice.java?rev=1387890&r1=1387889&r2=1387890&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/OpenOffice.java (original)
+++ incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/OpenOffice.java Thu Sep
20 07:17:44 2012
@@ -74,7 +74,7 @@ public class OpenOffice {
 
 	private Process process = null;
 	
-	private String unoUrl = "socket,host=localhost,port=2002;urp";
+	private String unoUrl = "socket,host=127.0.0.1,port=2002;urp";
 	
 	private Properties versionProps = null;
 	

Modified: incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java?rev=1387890&r1=1387889&r2=1387890&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java
(original)
+++ incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java
Thu Sep 20 07:17:44 2012
@@ -176,7 +176,7 @@ public class FileProvider extends Suite 
 		for (int i = 0; i < list.size(); i++) {
 			Object[] t = list.get(i);
 			for  (int j = 0; j < repeat; j++) {
-				TestClassRunnerForParameters runner = new TestClassRunnerForParameters(getTestClass().getJavaClass(),
t, i);
+				TestClassRunnerForParameters runner = new TestClassRunnerForParameters(getTestClass().getJavaClass(),
t, i * repeat + j);
 				runners.add(runner);
 			}
 		}

Modified: incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java?rev=1387890&r1=1387889&r2=1387890&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java (original)
+++ incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java Thu
Sep 20 07:17:44 2012
@@ -24,6 +24,7 @@
 package org.openoffice.test.common;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
@@ -132,6 +133,16 @@ public class Testspace {
 		}
 	}
 	
+	public static String getDataPath(String dataFilePath) {
+		File file = getDataFile(dataFilePath);
+		if (file == null)
+			return null;
+		try {
+			return file.getCanonicalPath();
+		} catch (IOException e) {
+			return null;
+		}
+	}
 	
 	public static boolean deleteFile(String path) {
 		return FileUtil.deleteFile(getPath(path));

Modified: incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java?rev=1387890&r1=1387889&r2=1387890&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java (original)
+++ incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java Thu Sep 20 07:17:44 2012
@@ -58,8 +58,7 @@ public class Conversion {
 	public Logger log = Logger.getLogger(this);
 
 	@FileRepos
-	public static String repos = getDataFile("pvt_conversion").getAbsolutePath();
-
+	public static String repos = System.getProperty("conversion.repos", getDataPath("conversion_pvt"));
 	@FileFilter
 	public static String filter = System.getProperty("conversion.filter", "-f .*\\.((doc)|(dot)|(odt)|(ott))$
writer_pdf_Export pdf " 
 			+ "-f .*\\.((xls)|(xlt)|(ods)|(ots))$ calc_pdf_Export pdf "
@@ -74,6 +73,8 @@ public class Conversion {
 	@FileRepeat
 	public static int repeat = Integer.parseInt(System.getProperty("conversion.repeat", "8"));
 	
+	public static String clean = System.getProperty("conversion.clean", "file");
+
 	private static UnoApp app = new UnoApp();
 	
 	private static PrintStream result;
@@ -89,7 +90,7 @@ public class Conversion {
 		File resultFile = Testspace.getFile("output/conversion.csv");
 		resultFile.getParentFile().mkdirs();
 		result = new PrintStream(new FileOutputStream(resultFile));
-		result.println("File,Scenario,After Close,After Save,After Load");
+		result.println("File,Scenario,File Size,Time Consumed After Closing,Time Consumed After
Saving,Time Consumed After Loading");
 	}
 	
 	@AfterClass
@@ -123,27 +124,30 @@ public class Conversion {
 	
 	@Before
 	public void before() throws Exception {
-		sourceFile = prepareDataFile(sourcePath);
+		sourceFile = new File(sourcePath);
 		sourceFileUrl = FileUtil.getUrl(this.sourceFile);
 		targetFile = getFile("classtemp/" + sourceFile.getName()+ "." + targetExtName);
 		targetFileUrl = FileUtil.getUrl(this.targetFile);
 		
 		scenario = FileUtil.getFileExtName(sourceFile.getName()).toLowerCase() + " to " + FileUtil.getFileExtName(targetFile.getName()).toLowerCase();
-		sourceFileId = sourceFile.getAbsolutePath().replace(new File(repos).getAbsolutePath(),
"").replace("\\", "/");
-		
+		String pathSource = sourceFile.getCanonicalPath().replace("\\", "/");
+		String pathRepos = new File(repos).getCanonicalPath().replace("\\", "/") + "/";
+		sourceFileId = pathSource.replace(pathRepos, "");
 		log.info("Start [File: " + sourceFileId + "] [Size: " + (sourceFile.length() / 1024) +
"KB] [Scenario: " + scenario + "]");
 		app.start();
 	}
 	
 	@After
 	public void after() throws Exception{
-		result.println(sourceFileId + "," + scenario + "," + closeTime + "," + saveTime + "," +
loadTime);
+		result.println(sourceFileId + "," + scenario + "," + sourceFile.length() + "," + closeTime
+ "," + saveTime + "," + loadTime);
 		log.info("Result [After Closing: " + closeTime + "] [After Saving: " + saveTime + "] [After
Loading: " + loadTime + "]");
-		if (counter % repeat == 0) {
+		if (closeTime < 0) {
+			app.close();
+		} else if ("file".equalsIgnoreCase(clean) && counter % repeat == 0) {
 			app.close();
 		}
 	}
-	
+
 	private PropertyValue propertyValue(String name, Object value) {
 		PropertyValue p = new PropertyValue();
 		p.Name = name;



Mime
View raw message