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 28 package complex.passwordcontainer; 29 30 import com.sun.star.lang.XMultiServiceFactory; 31 import com.sun.star.uno.UnoRuntime; 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 public class PasswordContainerUnitTest { 42 private XMultiServiceFactory m_xMSF = null; 43 44 //// public String[] getTestMethodNames() { 45 //// return new String[] { 46 //// "ExecuteTest01", 47 //// "ExecuteTest02", 48 //// "ExecuteTest03"}; 49 //// } 50 // public String getTestObjectName() { 51 // return "PasswordContainerUnitTest"; 52 // } 53 54 @Before public void before() { 55 try { 56 m_xMSF = getMSF(); 57 } catch (Exception e) { 58 fail ("Cannot create service factory!"); 59 } 60 if (m_xMSF == null) { 61 fail ("Cannot create service factory!"); 62 } 63 } 64 65 @After public void after() { 66 m_xMSF = null; 67 } 68 69 @Test public void ExecuteTest01() 70 { 71 PasswordContainerTest aTest = new Test01(m_xMSF); 72 assertTrue("Test01 failed!", aTest.test()); 73 } 74 @Test public void ExecuteTest02() { 75 PasswordContainerTest aTest = new Test02(m_xMSF); 76 assertTrue("Test02 failed!", aTest.test()); 77 } 78 @Test public void ExecuteTest03() { 79 PasswordContainerTest aTest = new Test03(m_xMSF); 80 assertTrue("Test03 failed!", aTest.test()); 81 } 82 83 private XMultiServiceFactory getMSF() 84 { 85 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 86 return xMSF1; 87 } 88 89 // setup and close connections 90 @BeforeClass public static void setUpConnection() throws Exception { 91 System.out.println("setUpConnection()"); 92 connection.setUp(); 93 } 94 95 @AfterClass public static void tearDownConnection() 96 throws InterruptedException, com.sun.star.uno.Exception 97 { 98 System.out.println("tearDownConnection()"); 99 connection.tearDown(); 100 } 101 102 private static final OfficeConnection connection = new OfficeConnection(); 103 104 } 105