summaryrefslogtreecommitdiff
path: root/sfx2/qa/complex/sfx2/JUnitBasedTest.java
blob: d4c3b1428b2bd33a8e4937bf8f8e71371f76b3ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package complex.sfx2;

import org.openoffice.test.OfficeConnection;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.XComponentContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;

public class JUnitBasedTest
{

    protected XComponentContext getContext()
    {
        return m_connection.getComponentContext();
    }


    protected XMultiServiceFactory getORB()
    {
        final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(
            XMultiServiceFactory.class, getContext().getServiceManager() );
        return xMSF1;
    }


    @BeforeClass
    public static void setUpConnection() throws Exception
    {
        System.out.println( "--------------------------------------------------------------------------------" );
        System.out.println( "connecting ..." );
        m_connection.setUp();
    }


    @AfterClass
    public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception
    {
        System.out.println();
        System.out.println( "tearing down connection" );
        m_connection.tearDown();
        System.out.println( "--------------------------------------------------------------------------------" );
    }

    private static final OfficeConnection   m_connection = new OfficeConnection();
}