xref: /AOO41X/main/framework/qa/complex/ModuleManager/CheckXModuleManager.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir package complex.ModuleManager;
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir import com.sun.star.beans.*;
31*cdf0e10cSrcweir import com.sun.star.frame.*;
32*cdf0e10cSrcweir import com.sun.star.lang.*;
33*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
34*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
35*cdf0e10cSrcweir import com.sun.star.util.*;
36*cdf0e10cSrcweir import com.sun.star.container.*;
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir // ---------- junit imports -----------------
41*cdf0e10cSrcweir import org.junit.After;
42*cdf0e10cSrcweir import org.junit.AfterClass;
43*cdf0e10cSrcweir import org.junit.Before;
44*cdf0e10cSrcweir import org.junit.BeforeClass;
45*cdf0e10cSrcweir import org.junit.Test;
46*cdf0e10cSrcweir import org.openoffice.test.OfficeConnection;
47*cdf0e10cSrcweir import static org.junit.Assert.*;
48*cdf0e10cSrcweir // ------------------------------------------
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir //-----------------------------------------------
51*cdf0e10cSrcweir /** @short  todo document me
52*cdf0e10cSrcweir  */
53*cdf0e10cSrcweir public class CheckXModuleManager
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir     //-------------------------------------------
56*cdf0e10cSrcweir     // some const
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     //-------------------------------------------
59*cdf0e10cSrcweir     // member
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir     /** points to the global uno service manager. */
62*cdf0e10cSrcweir     private XMultiServiceFactory m_xSmgr = null;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir     /** the module manager for testing. */
65*cdf0e10cSrcweir     private XModuleManager m_xMM = null;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     /** a special frame used to load documents there. */
68*cdf0e10cSrcweir     private XComponentLoader m_xLoader = null;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     //-------------------------------------------
71*cdf0e10cSrcweir     // test environment
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     //-------------------------------------------
74*cdf0e10cSrcweir     /** @short  A function to tell the framework,
75*cdf0e10cSrcweir                 which test functions are available.
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir         @return All test methods.
78*cdf0e10cSrcweir         @todo   Think about selection of tests from outside ...
79*cdf0e10cSrcweir      */
80*cdf0e10cSrcweir //    public String[] getTestMethodNames()
81*cdf0e10cSrcweir //    {
82*cdf0e10cSrcweir //        return new String[]
83*cdf0e10cSrcweir //        {
84*cdf0e10cSrcweir //            "checkModuleIdentification"        ,
85*cdf0e10cSrcweir //            "checkModuleConfigurationReadable" ,
86*cdf0e10cSrcweir //            "checkModuleConfigurationWriteable",
87*cdf0e10cSrcweir //            "checkModuleConfigurationQueries"
88*cdf0e10cSrcweir //        };
89*cdf0e10cSrcweir //    }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     //-------------------------------------------
92*cdf0e10cSrcweir     /** @short  Create the environment for following tests.
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         @descr  Use either a component loader from desktop or
95*cdf0e10cSrcweir                 from frame
96*cdf0e10cSrcweir      */
97*cdf0e10cSrcweir     @Before public void before()
98*cdf0e10cSrcweir         throws java.lang.Exception
99*cdf0e10cSrcweir     {
100*cdf0e10cSrcweir         // get uno service manager from global test environment
101*cdf0e10cSrcweir         m_xSmgr = getMSF();
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir         // create module manager
104*cdf0e10cSrcweir         m_xMM = UnoRuntime.queryInterface(XModuleManager.class, m_xSmgr.createInstance("com.sun.star.frame.ModuleManager"));
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir         // create desktop instance to create a special frame to load documents there.
107*cdf0e10cSrcweir         XFrame xDesktop = UnoRuntime.queryInterface(XFrame.class, m_xSmgr.createInstance("com.sun.star.frame.Desktop"));
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir         m_xLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop.findFrame("_blank", 0));
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     //-------------------------------------------
113*cdf0e10cSrcweir     /** @short  close the environment.
114*cdf0e10cSrcweir      */
115*cdf0e10cSrcweir     @After public void after()
116*cdf0e10cSrcweir         throws java.lang.Exception
117*cdf0e10cSrcweir     {
118*cdf0e10cSrcweir         XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xLoader);
119*cdf0e10cSrcweir         xClose.close(false);
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir         m_xLoader = null;
122*cdf0e10cSrcweir         m_xMM     = null;
123*cdf0e10cSrcweir         m_xSmgr   = null;
124*cdf0e10cSrcweir     }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     //-------------------------------------------
127*cdf0e10cSrcweir     /** @todo document me
128*cdf0e10cSrcweir      */
129*cdf0e10cSrcweir     @Test public void checkModuleIdentification()
130*cdf0e10cSrcweir         throws java.lang.Exception
131*cdf0e10cSrcweir     {
132*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.text.TextDocument"                );
133*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.text.WebDocument"                 );
134*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.text.GlobalDocument"              );
135*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.formula.FormulaProperties"        );
136*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.sheet.SpreadsheetDocument"        );
137*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.drawing.DrawingDocument"          );
138*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.presentation.PresentationDocument");
139*cdf0e10cSrcweir         impl_identifyModulesBasedOnDocs("com.sun.star.sdb.OfficeDatabaseDocument"       );
140*cdf0e10cSrcweir         // TODO: fails
141*cdf0e10cSrcweir         // impl_identifyModulesBasedOnDocs("com.sun.star.chart.ChartDocument"              );
142*cdf0e10cSrcweir     }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     //-------------------------------------------
145*cdf0e10cSrcweir     /** @todo document me
146*cdf0e10cSrcweir      */
147*cdf0e10cSrcweir     @Test public void checkModuleConfigurationReadable()
148*cdf0e10cSrcweir         throws java.lang.Exception
149*cdf0e10cSrcweir     {
150*cdf0e10cSrcweir     }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     //-------------------------------------------
153*cdf0e10cSrcweir     /** @todo document me
154*cdf0e10cSrcweir      */
155*cdf0e10cSrcweir     @Test public void checkModuleConfigurationWriteable()
156*cdf0e10cSrcweir         throws java.lang.Exception
157*cdf0e10cSrcweir     {
158*cdf0e10cSrcweir         // modules supporting real documents
159*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.text.TextDocument"                );
160*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.text.WebDocument"                 );
161*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.text.GlobalDocument"              );
162*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.formula.FormulaProperties"        );
163*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sheet.SpreadsheetDocument"        );
164*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.drawing.DrawingDocument"          );
165*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.presentation.PresentationDocument");
166*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.OfficeDatabaseDocument"       );
167*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.chart.ChartDocument"              );
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         // other modules
170*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.FormDesign"       );
171*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.TextReportDesign" );
172*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.RelationDesign"   );
173*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.QueryDesign"      );
174*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.TableDesign"      );
175*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.sdb.DataSourceBrowser");
176*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.frame.Bibliography"   );
177*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.script.BasicIDE"      );
178*cdf0e10cSrcweir         impl_checkReadOnlyPropsOfModule("com.sun.star.frame.StartModule"    );
179*cdf0e10cSrcweir     }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir     //-------------------------------------------
182*cdf0e10cSrcweir     /** @todo document me
183*cdf0e10cSrcweir      */
184*cdf0e10cSrcweir     @Test public void checkModuleConfigurationQueries()
185*cdf0e10cSrcweir         throws java.lang.Exception
186*cdf0e10cSrcweir     {
187*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.text.TextDocument"                );
188*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.text.WebDocument"                 );
189*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.text.GlobalDocument"              );
190*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.formula.FormulaProperties"        );
191*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.sheet.SpreadsheetDocument"        );
192*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.drawing.DrawingDocument"          );
193*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.presentation.PresentationDocument");
194*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.sdb.OfficeDatabaseDocument"       );
195*cdf0e10cSrcweir         impl_searchModulesByDocumentService("com.sun.star.chart.ChartDocument"              );
196*cdf0e10cSrcweir     }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     //-------------------------------------------
199*cdf0e10cSrcweir     /** @todo document me
200*cdf0e10cSrcweir      */
201*cdf0e10cSrcweir     private void impl_searchModulesByDocumentService(String sDocumentService)
202*cdf0e10cSrcweir         throws java.lang.Exception
203*cdf0e10cSrcweir     {
204*cdf0e10cSrcweir         System.out.println("search modules matching document service '"+sDocumentService+"' ...");
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir         NamedValue[] lProps          = new NamedValue[1];
207*cdf0e10cSrcweir                      lProps[0]       = new NamedValue();
208*cdf0e10cSrcweir                      lProps[0].Name  = "ooSetupFactoryDocumentService";
209*cdf0e10cSrcweir                      lProps[0].Value = sDocumentService;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir         XContainerQuery xMM     = UnoRuntime.queryInterface(XContainerQuery.class, m_xMM);
212*cdf0e10cSrcweir         XEnumeration    xResult = xMM.createSubSetEnumerationByProperties(lProps);
213*cdf0e10cSrcweir         while(xResult.hasMoreElements())
214*cdf0e10cSrcweir         {
215*cdf0e10cSrcweir             PropertyValue[] lModuleProps      = (PropertyValue[])AnyConverter.toArray(xResult.nextElement());
216*cdf0e10cSrcweir             int             c                 = lModuleProps.length;
217*cdf0e10cSrcweir             int             i                 = 0;
218*cdf0e10cSrcweir             String          sFoundModule      = "";
219*cdf0e10cSrcweir             String          sFoundDocService  = "";
220*cdf0e10cSrcweir             for (i=0; i<c; ++i)
221*cdf0e10cSrcweir             {
222*cdf0e10cSrcweir                 if (lModuleProps[i].Name.equals("ooSetupFactoryModuleIdentifier"))
223*cdf0e10cSrcweir                 {
224*cdf0e10cSrcweir                     sFoundModule = AnyConverter.toString(lModuleProps[i].Value);
225*cdf0e10cSrcweir                 }
226*cdf0e10cSrcweir                 if (lModuleProps[i].Name.equals("ooSetupFactoryDocumentService"))
227*cdf0e10cSrcweir                 {
228*cdf0e10cSrcweir                     sFoundDocService = AnyConverter.toString(lModuleProps[i].Value);
229*cdf0e10cSrcweir                 }
230*cdf0e10cSrcweir             }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir             if (sFoundModule.length() < 1)
233*cdf0e10cSrcweir             {
234*cdf0e10cSrcweir                 fail("Miss module identifier in result set. Returned data are incomplete.");
235*cdf0e10cSrcweir             }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir             if ( ! sFoundDocService.equals(sDocumentService))
238*cdf0e10cSrcweir             {
239*cdf0e10cSrcweir                 fail("Query returned wrong module '" + sFoundModule + "' with DocumentService='" + sFoundDocService + "'.");
240*cdf0e10cSrcweir             }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir             System.out.println("Found module '"+sFoundModule+"'.");
243*cdf0e10cSrcweir         }
244*cdf0e10cSrcweir     }
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     //-------------------------------------------
247*cdf0e10cSrcweir     /** @todo document me
248*cdf0e10cSrcweir      */
249*cdf0e10cSrcweir     private void impl_identifyModulesBasedOnDocs(String sModule)
250*cdf0e10cSrcweir         throws java.lang.Exception
251*cdf0e10cSrcweir     {
252*cdf0e10cSrcweir         System.out.println("check identification of module '"+sModule+"' ...");
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir         XNameAccess     xMM          = UnoRuntime.queryInterface(XNameAccess.class, m_xMM);
255*cdf0e10cSrcweir         PropertyValue[] lModuleProps = (PropertyValue[])AnyConverter.toArray(xMM.getByName(sModule));
256*cdf0e10cSrcweir         int             c            = lModuleProps.length;
257*cdf0e10cSrcweir         int             i            = 0;
258*cdf0e10cSrcweir         String          sFactoryURL  = "";
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir         for (i=0; i<c; ++i)
261*cdf0e10cSrcweir         {
262*cdf0e10cSrcweir             if (lModuleProps[i].Name.equals("ooSetupFactoryEmptyDocumentURL"))
263*cdf0e10cSrcweir             {
264*cdf0e10cSrcweir                 sFactoryURL = AnyConverter.toString(lModuleProps[i].Value);
265*cdf0e10cSrcweir                 break;
266*cdf0e10cSrcweir             }
267*cdf0e10cSrcweir         }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         PropertyValue[] lArgs             = new PropertyValue[1];
270*cdf0e10cSrcweir                         lArgs[0]          = new PropertyValue();
271*cdf0e10cSrcweir                         lArgs[0].Name     = "Hidden";
272*cdf0e10cSrcweir                         lArgs[0].Value    = Boolean.TRUE;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir         XComponent      xModel            = m_xLoader.loadComponentFromURL(sFactoryURL, "_self", 0, lArgs);
275*cdf0e10cSrcweir         XFrame          xFrame            = UnoRuntime.queryInterface(XFrame.class, m_xLoader);
276*cdf0e10cSrcweir         XController     xController       = xFrame.getController();
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir         String          sModuleFrame      = m_xMM.identify(xFrame     );
279*cdf0e10cSrcweir         String          sModuleController = m_xMM.identify(xController);
280*cdf0e10cSrcweir         String          sModuleModel      = m_xMM.identify(xModel     );
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir         if ( ! sModuleFrame.equals(sModule))
283*cdf0e10cSrcweir         {
284*cdf0e10cSrcweir             fail("Identification of module '" + sModule + "' failed if frame was used as entry point.");
285*cdf0e10cSrcweir         }
286*cdf0e10cSrcweir         if ( ! sModuleController.equals(sModule))
287*cdf0e10cSrcweir         {
288*cdf0e10cSrcweir             fail("Identification of module '" + sModule + "' failed if controller was used as entry point.");
289*cdf0e10cSrcweir         }
290*cdf0e10cSrcweir         if ( ! sModuleModel.equals(sModule))
291*cdf0e10cSrcweir         {
292*cdf0e10cSrcweir             fail("Identification of module '" + sModule + "' failed if model was used as entry point.");
293*cdf0e10cSrcweir         }
294*cdf0e10cSrcweir     }
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir     //-------------------------------------------
297*cdf0e10cSrcweir     /** @todo document me
298*cdf0e10cSrcweir      */
299*cdf0e10cSrcweir     private void impl_checkReadOnlyPropsOfModule(String sModule)
300*cdf0e10cSrcweir         throws java.lang.Exception
301*cdf0e10cSrcweir     {
302*cdf0e10cSrcweir         XNameReplace xWrite = UnoRuntime.queryInterface(XNameReplace.class, m_xMM);
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         impl_checkReadOnlyPropOfModule(xWrite, sModule, "ooSetupFactoryDocumentService"     , "test");
305*cdf0e10cSrcweir         impl_checkReadOnlyPropOfModule(xWrite, sModule, "ooSetupFactoryActualFilter"        , "test");
306*cdf0e10cSrcweir         impl_checkReadOnlyPropOfModule(xWrite, sModule, "ooSetupFactoryActualTemplateFilter", "test");
307*cdf0e10cSrcweir         impl_checkReadOnlyPropOfModule(xWrite, sModule, "ooSetupFactoryEmptyDocumentURL"    , "test");
308*cdf0e10cSrcweir     }
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir     //-------------------------------------------
311*cdf0e10cSrcweir     /** @todo document me
312*cdf0e10cSrcweir      */
313*cdf0e10cSrcweir     private void impl_checkReadOnlyPropOfModule(XNameReplace xMM        ,
314*cdf0e10cSrcweir                                                 String       sModule    ,
315*cdf0e10cSrcweir                                                 String       sPropName  ,
316*cdf0e10cSrcweir                                                 Object       aPropValue )
317*cdf0e10cSrcweir         throws java.lang.Exception
318*cdf0e10cSrcweir     {
319*cdf0e10cSrcweir         PropertyValue[] lChanges          = new PropertyValue[1];
320*cdf0e10cSrcweir                         lChanges[0]       = new PropertyValue();
321*cdf0e10cSrcweir                         lChanges[0].Name  = sPropName;
322*cdf0e10cSrcweir                         lChanges[0].Value = aPropValue;
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir         // Note: Exception is expected !
325*cdf0e10cSrcweir         System.out.println("check readonly state of module '"+sModule+"' for property '"+sPropName+"' ...");
326*cdf0e10cSrcweir         try
327*cdf0e10cSrcweir         {
328*cdf0e10cSrcweir             xMM.replaceByName(sModule, lChanges);
329*cdf0e10cSrcweir             fail("Was able to write READONLY property '"+sPropName+"' of module '"+sModule+"' configuration.");
330*cdf0e10cSrcweir         }
331*cdf0e10cSrcweir         catch(Throwable ex)
332*cdf0e10cSrcweir             {}
333*cdf0e10cSrcweir     }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir     private XMultiServiceFactory getMSF()
338*cdf0e10cSrcweir     {
339*cdf0e10cSrcweir         final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
340*cdf0e10cSrcweir         return xMSF1;
341*cdf0e10cSrcweir     }
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir     // setup and close connections
344*cdf0e10cSrcweir     @BeforeClass public static void setUpConnection() throws Exception {
345*cdf0e10cSrcweir         System.out.println("setUpConnection()");
346*cdf0e10cSrcweir         connection.setUp();
347*cdf0e10cSrcweir     }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir     @AfterClass public static void tearDownConnection()
350*cdf0e10cSrcweir         throws InterruptedException, com.sun.star.uno.Exception
351*cdf0e10cSrcweir     {
352*cdf0e10cSrcweir         System.out.println("tearDownConnection()");
353*cdf0e10cSrcweir         connection.tearDown();
354*cdf0e10cSrcweir     }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir     private static final OfficeConnection connection = new OfficeConnection();
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir }
359