1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package complex.ooxml;
24 import com.sun.star.lang.XMultiServiceFactory;
25 import complexlib.ComplexTestCase;
26 import java.io.File;
27 import com.sun.star.text.XTextDocument;
28 
29 /*
30  * To change this template, choose Tools | Templates
31  * and open the template in the editor.
32  */
33 
34 /**
35  *
36  * @author hb137859
37  */
38 public class LoadDocuments extends ComplexTestCase {
39     private XMultiServiceFactory m_xMSF;
40 
41     @Override
getTestMethodNames()42     public String[] getTestMethodNames() {
43         return new String [] {
44             "test1"
45         };
46     }
47 
before()48     public void before() throws Exception {
49         m_xMSF = (XMultiServiceFactory) param.getMSF();
50     }
51 
test1()52     public void test1() {
53         String testDocumentsPath = util.utils.getFullTestDocName("");
54         log.println("Test documents in:" + testDocumentsPath);
55 
56         File dir = new File(testDocumentsPath);
57         String [] files = dir.list();
58 
59         if (files != null) {
60             for (int i = 0; i < files.length; ++i) {
61                 log.println(files[i]);
62                 String url = util.utils.getFullTestURL(files[i]);
63                 log.println(url);
64 
65                 XTextDocument xDoc = util.WriterTools.loadTextDoc(m_xMSF, url);
66                 util.DesktopTools.closeDoc(xDoc);
67             }
68         } else {
69             failed();
70         }
71     }
72 }
73