You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/09/13 04:47:37 UTC
svn commit: r1384192 - in /incubator/ooo/trunk/test:
testcommon/source/org/openoffice/test/common/FileProvider.java
testuno/source/pvt/uno/Conversion.java
Author: liuzhe
Date: Thu Sep 13 02:47:36 2012
New Revision: 1384192
URL: http://svn.apache.org/viewvc?rev=1384192&view=rev
Log:
"PVT Scenario changed"
Modified:
incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/FileProvider.java
incubator/ooo/trunk/test/testuno/source/pvt/uno/Conversion.java
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=1384192&r1=1384191&r2=1384192&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 13 02:47:36 2012
@@ -100,6 +100,13 @@ public class FileProvider extends Suite
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public static @interface FileFilter {
+
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.FIELD)
+ public static @interface FileRepeat {
+
}
public FileProvider(Class<?> klass) throws Throwable {
@@ -107,6 +114,7 @@ public class FileProvider extends Suite
String repos = null;
String filter = null;
+ int repeat = 1;
Field fs[] = klass.getFields();
for (Field f : fs) {
Annotation a = f.getAnnotation(FileRepos.class);
@@ -125,6 +133,15 @@ public class FileProvider extends Suite
throw new InitializationError(String.format("Field annotated FileFilter '%s' must be String.", f.getName()));
filter = (String) v;
}
+
+ a = f.getAnnotation(FileRepeat.class);
+ if (a != null) {
+ Object v = f.get(null);
+ if (v != null && !(v instanceof Integer))
+ throw new InitializationError(String.format("Field annotated FileFilter '%s' must be String.", f.getName()));
+ repeat = (Integer) v;
+ }
+
}
File reposFile = new File(repos);
@@ -158,8 +175,10 @@ public class FileProvider extends Suite
for (int i = 0; i < list.size(); i++) {
Object[] t = list.get(i);
- TestClassRunnerForParameters runner = new TestClassRunnerForParameters(getTestClass().getJavaClass(), t, i);
- runners.add(runner);
+ for (int j = 0; j < repeat; j++) {
+ TestClassRunnerForParameters runner = new TestClassRunnerForParameters(getTestClass().getJavaClass(), t, i);
+ runners.add(runner);
+ }
}
}
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=1384192&r1=1384191&r2=1384192&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 13 02:47:36 2012
@@ -37,6 +37,7 @@ import org.junit.runner.RunWith;
import org.openoffice.test.OpenOffice;
import org.openoffice.test.common.FileProvider;
import org.openoffice.test.common.FileProvider.FileFilter;
+import org.openoffice.test.common.FileProvider.FileRepeat;
import org.openoffice.test.common.FileProvider.FileRepos;
import org.openoffice.test.common.FileUtil;
import org.openoffice.test.common.Logger;
@@ -60,7 +61,7 @@ public class Conversion {
public static String repos = getDataFile("pvt_conversion").getAbsolutePath();
@FileFilter
- public static String filter = "-f .*\\.((doc)|(dot)|(odt)|(ott))$ writer_pdf_Export pdf "
+ 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 "
+ "-f .*\\.((ppt)|(ppt)|(odp)|(otp))$ impress_pdf_Export pdf "
+ "-f .*\\.((doc)|(dot)|(docx)|(docm)|(dotx)|(dotm))$ writer8 odt "
@@ -68,12 +69,17 @@ public class Conversion {
+ "-f .*\\.((ppt)|(pot)|(pptx)|(pptm)|(potm)|(potx))$ impress8 odp "
+ "-f .*\\.((odt)|(ott))$ 'MS Word 97' doc "
+ "-f .*\\.((ods)|(ots))$ 'MS Excel 97' xls "
- + "-f .*\\.((odp)|(otp))$ 'MS PowerPoint 97' ppt";
+ + "-f .*\\.((odp)|(otp))$ 'MS PowerPoint 97' ppt");
+ @FileRepeat
+ public static int repeat = 8;
+
private static UnoApp app = new UnoApp();
private static PrintStream result;
+ private static int counter = 0;
+
@BeforeClass
public static void beforeClass() throws Exception {
//Disable automation
@@ -112,6 +118,7 @@ public class Conversion {
this.sourcePath = sourcePath;
this.targetFilterName = targetFilterName;
this.targetExtName = targetExtName;
+ counter++;
}
@Before
@@ -132,7 +139,7 @@ public class Conversion {
public void after() throws Exception{
result.println(sourceFileId + "," + scenario + "," + closeTime + "," + saveTime + "," + loadTime);
log.info("Result [After Closing: " + closeTime + "] [After Saving: " + saveTime + "] [After Loading: " + loadTime + "]");
- if (closeTime < 0) {
+ if (counter % 8 == 0) {
app.close();
}
}
@@ -163,4 +170,5 @@ public class Conversion {
xCloseable.close(true);
closeTime = System.currentTimeMillis() - start;
}
+
}