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 * To change this template, choose Tools | Templates 24 * and open the template in the editor. 25 */ 26 27 package complex.sfx2; 28 29 import org.openoffice.test.OfficeConnection; 30 import com.sun.star.uno.UnoRuntime; 31 import com.sun.star.lang.XMultiServiceFactory; 32 import com.sun.star.uno.XComponentContext; 33 import org.junit.AfterClass; 34 import org.junit.BeforeClass; 35 36 /** 37 * 38 * @author Frank 39 */ 40 public class JUnitBasedTest 41 { 42 // ----------------------------------------------------------------------------------------------------------------- getContext()43 protected XComponentContext getContext() 44 { 45 return m_connection.getComponentContext(); 46 } 47 48 // ----------------------------------------------------------------------------------------------------------------- getORB()49 protected XMultiServiceFactory getORB() 50 { 51 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface( 52 XMultiServiceFactory.class, getContext().getServiceManager() ); 53 return xMSF1; 54 } 55 56 // ----------------------------------------------------------------------------------------------------------------- 57 @BeforeClass setUpConnection()58 public static void setUpConnection() throws Exception 59 { 60 System.out.println( "--------------------------------------------------------------------------------" ); 61 System.out.println( "connecting ..." ); 62 m_connection.setUp(); 63 } 64 65 // ----------------------------------------------------------------------------------------------------------------- 66 @AfterClass tearDownConnection()67 public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception 68 { 69 System.out.println(); 70 System.out.println( "tearing down connection" ); 71 m_connection.tearDown(); 72 System.out.println( "--------------------------------------------------------------------------------" ); 73 } 74 75 private static final OfficeConnection m_connection = new OfficeConnection(); 76 } 77