1*a4c7eb23SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a4c7eb23SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a4c7eb23SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a4c7eb23SAndrew Rist  * distributed with this work for additional information
6*a4c7eb23SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a4c7eb23SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a4c7eb23SAndrew Rist  * "License"); you may not use this file except in compliance
9*a4c7eb23SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a4c7eb23SAndrew Rist  *
11*a4c7eb23SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a4c7eb23SAndrew Rist  *
13*a4c7eb23SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a4c7eb23SAndrew Rist  * software distributed under the License is distributed on an
15*a4c7eb23SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a4c7eb23SAndrew Rist  * KIND, either express or implied.  See the License for the
17*a4c7eb23SAndrew Rist  * specific language governing permissions and limitations
18*a4c7eb23SAndrew Rist  * under the License.
19*a4c7eb23SAndrew Rist  *
20*a4c7eb23SAndrew Rist  *************************************************************/
21*a4c7eb23SAndrew Rist 
22*a4c7eb23SAndrew Rist 
23cdf0e10cSrcweir package complex.sfx2;
24cdf0e10cSrcweir 
25cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
26cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
27cdf0e10cSrcweir import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest;
28cdf0e10cSrcweir import complex.sfx2.standalonedocinfo.Test01;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir import org.junit.After;
31cdf0e10cSrcweir import org.junit.AfterClass;
32cdf0e10cSrcweir import org.junit.Before;
33cdf0e10cSrcweir import org.junit.BeforeClass;
34cdf0e10cSrcweir import org.junit.Test;
35cdf0e10cSrcweir import org.openoffice.test.OfficeConnection;
36cdf0e10cSrcweir import static org.junit.Assert.*;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir /* Document here
39cdf0e10cSrcweir */
40cdf0e10cSrcweir 
41cdf0e10cSrcweir public class StandaloneDocumentInfo {
42cdf0e10cSrcweir     private XMultiServiceFactory m_xMSF = null;
43cdf0e10cSrcweir 
before()44cdf0e10cSrcweir     @Before public void before() {
45cdf0e10cSrcweir         try {
46cdf0e10cSrcweir             m_xMSF = getMSF();
47cdf0e10cSrcweir         } catch(Exception e) {
48cdf0e10cSrcweir             fail( "Failed to create service factory!" );
49cdf0e10cSrcweir         }
50cdf0e10cSrcweir         if( m_xMSF ==null ) {
51cdf0e10cSrcweir             fail( "Failed to create service factory!" );
52cdf0e10cSrcweir         }
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir 
after()55cdf0e10cSrcweir     @After public void after() {
56cdf0e10cSrcweir         m_xMSF = null;
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir 
ExecuteTest01()59cdf0e10cSrcweir     @Test public void ExecuteTest01() {
60cdf0e10cSrcweir         StandaloneDocumentInfoTest aTest = new Test01 (m_xMSF);
61cdf0e10cSrcweir         assertTrue( "Test01 failed!", aTest.test() );
62cdf0e10cSrcweir     }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
getMSF()67cdf0e10cSrcweir       private XMultiServiceFactory getMSF()
68cdf0e10cSrcweir     {
69cdf0e10cSrcweir         final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
70cdf0e10cSrcweir         return xMSF1;
71cdf0e10cSrcweir     }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     // setup and close connections
setUpConnection()74cdf0e10cSrcweir     @BeforeClass public static void setUpConnection() throws Exception
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         System.out.println( "------------------------------------------------------------" );
77cdf0e10cSrcweir         System.out.println( "starting class: " + StandaloneDocumentInfo.class.getName() );
78cdf0e10cSrcweir         System.out.println( "------------------------------------------------------------" );
79cdf0e10cSrcweir         connection.setUp();
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir 
tearDownConnection()82cdf0e10cSrcweir     @AfterClass public static void tearDownConnection()
83cdf0e10cSrcweir         throws InterruptedException, com.sun.star.uno.Exception
84cdf0e10cSrcweir     {
85cdf0e10cSrcweir         System.out.println( "------------------------------------------------------------" );
86cdf0e10cSrcweir         System.out.println( "finishing class: " + StandaloneDocumentInfo.class.getName() );
87cdf0e10cSrcweir         System.out.println( "------------------------------------------------------------" );
88cdf0e10cSrcweir         connection.tearDown();
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     private static final OfficeConnection connection = new OfficeConnection();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96