openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@apache.org
Subject svn commit: r1409433 - /incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java
Date Wed, 14 Nov 2012 21:38:27 GMT
Author: arist
Date: Wed Nov 14 21:38:26 2012
New Revision: 1409433

URL: http://svn.apache.org/viewvc?rev=1409433&view=rev
Log:
writerfilter10_08_8fa034389cd1.patch
# HG changeset patch
# User Henning Brinkmann <hbrinkm@openoffice.org>
# Date 1297073361 -3600
# Node ID 8fa034389cd172207b7670b1d1c723f062eaf35c
# Parent  46adee0574e90597c1ea52e07272bf43a2c21e30
writerfilter10: make JUnitTest run


Modified:
    incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java

Modified: incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java?rev=1409433&r1=1409432&r2=1409433&view=diff
==============================================================================
--- incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java (original)
+++ incubator/ooo/branches/gbuild/main/writerfilter/qa/complex/ooxml/LoadDocuments.java Wed
Nov 14 21:38:26 2012
@@ -21,10 +21,20 @@
 
 
 package complex.ooxml;
+
+import com.sun.star.lang.XComponent;
 import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
 import complexlib.ComplexTestCase;
 import java.io.File;
-import com.sun.star.text.XTextDocument;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.Argument;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
 
 /*
  * To change this template, choose Tools | Templates
@@ -35,38 +45,54 @@ import com.sun.star.text.XTextDocument;
  *
  * @author hb137859
  */
-public class LoadDocuments extends ComplexTestCase {
-    private XMultiServiceFactory m_xMSF;
-
-    @Override
-    public String[] getTestMethodNames() {
-        return new String [] {
-            "test1"
-        };
-    }
-
-    public void before() throws Exception {
-        m_xMSF = (XMultiServiceFactory) param.getMSF();
-    }
-
-    public void test1() {
-        String testDocumentsPath = util.utils.getFullTestDocName("");
-        log.println("Test documents in:" + testDocumentsPath);
+public class LoadDocuments {
+    @Test public void test1() {
+        String testDocumentsPath = Argument.get("tdoc");
+        System.out.println("Test documents in:" + testDocumentsPath);
 
         File dir = new File(testDocumentsPath);
         String [] files = dir.list();
 
-        if (files != null) {
-            for (int i = 0; i < files.length; ++i) {
-                log.println(files[i]);
-                String url = util.utils.getFullTestURL(files[i]);
-                log.println(url);
-
-                XTextDocument xDoc = util.WriterTools.loadTextDoc(m_xMSF, url);
-                util.DesktopTools.closeDoc(xDoc);
+        try {            
+            if (files != null) {
+                for (int i = 0; i < files.length; ++i) {
+                    System.out.println(files[i]);
+                    String url = TestDocument.getUrl(files[i]);
+                    System.out.println(url);
+                    
+                    XComponent xDoc = util.DesktopTools.loadDoc(getMSF(), url, null);
+                    System.out.println("loaded.");
+                    util.DesktopTools.closeDoc(xDoc);
+                    System.out.println("done.");
+                }          
+            } else {
+                fail("Files not found");
             }
-        } else {
-            failed();
         }
+        catch (Exception e) {
+            System.out.println(e);
+            fail("failed");
+        }
+    }
+
+    private XMultiServiceFactory getMSF()
+    {
+        final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class,
connection.getComponentContext().getServiceManager());
+        return xMSF1;
+    }
+
+    // setup and close connections
+    @BeforeClass public static void setUpConnection() throws Exception
+    {
+        System.out.println("setUpConnection()");
+        connection.setUp();
+    }
+
+    @AfterClass public static void tearDownConnection()
+            throws InterruptedException, com.sun.star.uno.Exception
+    {
+        System.out.println("tearDownConnection()");
+        connection.tearDown();
     }
+    private static final OfficeConnection connection = new OfficeConnection();
 }



Mime
View raw message