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.olesimplestorage; 24 25 import com.sun.star.lang.XMultiServiceFactory; 26 import com.sun.star.uno.UnoRuntime; 27 28 29 import org.junit.After; 30 import org.junit.AfterClass; 31 import org.junit.Before; 32 import org.junit.BeforeClass; 33 import org.junit.Test; 34 import org.openoffice.test.OfficeConnection; 35 import static org.junit.Assert.*; 36 37 /* Document. 38 */ 39 40 public class OLESimpleStorageUnitTest /* extends ComplexTestCase */ 41 { 42 private XMultiServiceFactory m_xMSF = null; 43 <<<<<<< HEAD 44 45 // public String[] getTestMethodNames() { 46 // return new String[] { 47 // "ExecuteTest01"}; 48 // } 49 // 50 // public String getTestObjectName() { 51 // return "OLESimpleStorageUnitTest"; 52 // } 53 ======= 54 >>>>>>> 3309286857 (pre-commit auto remove trailing whitespace from java files (#382)) 55 56 @Before public void before () { 57 System.out.println("before()"); 58 try { 59 m_xMSF = getMSF(); 60 } catch ( Exception e ){ 61 fail( "Cannot create service factory!" ); 62 } 63 if ( m_xMSF == null ) { 64 fail( "Cannot create service factory!" ); 65 } 66 } 67 68 @After public void after () { 69 System.out.println("after()"); 70 m_xMSF = null; 71 } 72 73 @Test public void ExecuteTest01() { 74 System.out.println("ExecuteTest01()"); 75 OLESimpleStorageTest aTest = new Test01( m_xMSF ); 76 assertTrue( "Test01 failed!", aTest.test() ); 77 } 78 79 80 81 private XMultiServiceFactory getMSF() 82 { 83 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 84 return xMSF1; 85 } 86 87 // setup and close connections 88 @BeforeClass public static void setUpConnection() throws Exception { 89 System.out.println("setUpConnection()"); 90 connection.setUp(); 91 } 92 93 @AfterClass public static void tearDownConnection() 94 throws InterruptedException, com.sun.star.uno.Exception 95 { 96 // try 97 // { 98 // Thread.sleep(5000); 99 // } 100 // catch (java.lang.InterruptedException e) 101 // { 102 // } 103 System.out.println("tearDownConnection()"); 104 connection.tearDown(); 105 } 106 107 private static final OfficeConnection connection = new OfficeConnection(); 108 109 }