1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 package complex.olesimplestorage;
28 
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.uno.UnoRuntime;
31 
32 
33 import org.junit.After;
34 import org.junit.AfterClass;
35 import org.junit.Before;
36 import org.junit.BeforeClass;
37 import org.junit.Test;
38 import org.openoffice.test.OfficeConnection;
39 import static org.junit.Assert.*;
40 
41 /* Document.
42  */
43 
44 public class OLESimpleStorageUnitTest /* extends ComplexTestCase */
45 {
46     private XMultiServiceFactory m_xMSF = null;
47 
48 //    public String[] getTestMethodNames() {
49 //        return new String[] {
50 //            "ExecuteTest01"};
51 //    }
52 //
53 //    public String getTestObjectName() {
54 //        return "OLESimpleStorageUnitTest";
55 //    }
56 
57     @Before public void before () {
58         System.out.println("before()");
59         try {
60             m_xMSF = getMSF();
61         } catch ( Exception e ){
62             fail( "Cannot create service factory!" );
63         }
64         if ( m_xMSF == null ) {
65             fail( "Cannot create service factory!" );
66         }
67     }
68 
69     @After public void after () {
70         System.out.println("after()");
71         m_xMSF = null;
72     }
73 
74     @Test public void ExecuteTest01() {
75         System.out.println("ExecuteTest01()");
76         OLESimpleStorageTest aTest = new Test01( m_xMSF );
77         assertTrue( "Test01 failed!", aTest.test() );
78     }
79 
80 
81 
82     private XMultiServiceFactory getMSF()
83     {
84         final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
85         return xMSF1;
86     }
87 
88     // setup and close connections
89     @BeforeClass public static void setUpConnection() throws Exception {
90         System.out.println("setUpConnection()");
91         connection.setUp();
92     }
93 
94     @AfterClass public static void tearDownConnection()
95         throws InterruptedException, com.sun.star.uno.Exception
96     {
97 //        try
98 //        {
99 //            Thread.sleep(5000);
100 //        }
101 //        catch (java.lang.InterruptedException e)
102 //        {
103 //        }
104         System.out.println("tearDownConnection()");
105         connection.tearDown();
106     }
107 
108     private static final OfficeConnection connection = new OfficeConnection();
109 
110 }