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.sfx2; 24 25 import com.sun.star.lang.XMultiServiceFactory; 26 import com.sun.star.uno.UnoRuntime; 27 import complex.sfx2.standalonedocinfo.StandaloneDocumentInfoTest; 28 import complex.sfx2.standalonedocinfo.Test01; 29 30 import org.junit.After; 31 import org.junit.AfterClass; 32 import org.junit.Before; 33 import org.junit.BeforeClass; 34 import org.junit.Test; 35 import org.openoffice.test.OfficeConnection; 36 import static org.junit.Assert.*; 37 38 /* Document here 39 */ 40 41 public class StandaloneDocumentInfo { 42 private XMultiServiceFactory m_xMSF = null; 43 before()44 @Before public void before() { 45 try { 46 m_xMSF = getMSF(); 47 } catch(Exception e) { 48 fail( "Failed to create service factory!" ); 49 } 50 if( m_xMSF ==null ) { 51 fail( "Failed to create service factory!" ); 52 } 53 } 54 after()55 @After public void after() { 56 m_xMSF = null; 57 } 58 ExecuteTest01()59 @Test public void ExecuteTest01() { 60 StandaloneDocumentInfoTest aTest = new Test01 (m_xMSF); 61 assertTrue( "Test01 failed!", aTest.test() ); 62 } 63 64 65 66 getMSF()67 private XMultiServiceFactory getMSF() 68 { 69 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 70 return xMSF1; 71 } 72 73 // setup and close connections setUpConnection()74 @BeforeClass public static void setUpConnection() throws Exception 75 { 76 System.out.println( "------------------------------------------------------------" ); 77 System.out.println( "starting class: " + StandaloneDocumentInfo.class.getName() ); 78 System.out.println( "------------------------------------------------------------" ); 79 connection.setUp(); 80 } 81 tearDownConnection()82 @AfterClass public static void tearDownConnection() 83 throws InterruptedException, com.sun.star.uno.Exception 84 { 85 System.out.println( "------------------------------------------------------------" ); 86 System.out.println( "finishing class: " + StandaloneDocumentInfo.class.getName() ); 87 System.out.println( "------------------------------------------------------------" ); 88 connection.tearDown(); 89 } 90 91 private static final OfficeConnection connection = new OfficeConnection(); 92 93 } 94 95 96