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.ConfigItems; 29 30 import com.sun.star.beans.NamedValue; 31 import com.sun.star.lang.XMultiServiceFactory; 32 import com.sun.star.task.XJob; 33 import com.sun.star.uno.UnoRuntime; 34 35 36 import org.junit.After; 37 import org.junit.AfterClass; 38 import org.junit.Before; 39 import org.junit.BeforeClass; 40 import org.junit.Test; 41 import org.openoffice.test.OfficeConnection; 42 // import static org.junit.Assert.*; 43 44 //----------------------------------------------- 45 /** @short todo document me 46 * @deprecated this tests seems no longer work as expected. 47 */ 48 public class CheckConfigItems 49 { 50 //------------------------------------------- 51 // some const 52 53 //------------------------------------------- 54 // member 55 56 /** points to the global uno service manager. */ 57 private XMultiServiceFactory m_xSmgr = null; 58 59 /** implements real config item tests in C++. */ 60 private XJob m_xTest = null; 61 62 //------------------------------------------- 63 // test environment 64 65 //------------------------------------------- 66 /** @short A function to tell the framework, 67 which test functions are available. 68 69 @return All test methods. 70 @todo Think about selection of tests from outside ... 71 */ 72 // public String[] getTestMethodNames() 73 // { 74 // return new String[] 75 // { 76 // "checkPicklist", 77 // "checkURLHistory", 78 // "checkHelpBookmarks", 79 // "checkPrintOptions", 80 // "checkAccessibilityOptions", 81 // "checkUserOptions" 82 // }; 83 // } 84 85 //------------------------------------------- 86 /** @short Create the environment for following tests. 87 88 * @throws java.lang.Exception 89 * @descr Use either a component loader from desktop or 90 from frame 91 */ 92 @Before public void before() 93 throws java.lang.Exception 94 { 95 // get uno service manager from global test environment 96 m_xSmgr = getMSF(); 97 98 // TODO register helper service 99 100 // create module manager 101 m_xTest = UnoRuntime.queryInterface(XJob.class, m_xSmgr.createInstance("com.sun.star.comp.svl.ConfigItemTest")); 102 } 103 104 //------------------------------------------- 105 /** 106 * @throws java.lang.Exception 107 * @short close the environment. 108 */ 109 @After public void after() 110 throws java.lang.Exception 111 { 112 // TODO deregister helper service 113 114 m_xTest = null; 115 m_xSmgr = null; 116 } 117 118 //------------------------------------------- 119 /** 120 * @throws java.lang.Exception 121 * @todo document me 122 */ 123 @Test public void checkPicklist() 124 throws java.lang.Exception 125 { 126 impl_triggerTest("checkPicklist"); 127 } 128 129 //------------------------------------------- 130 /** 131 * @throws java.lang.Exception 132 * @todo document me 133 */ 134 @Test public void checkURLHistory() 135 throws java.lang.Exception 136 { 137 impl_triggerTest("checkURLHistory"); 138 } 139 140 //------------------------------------------- 141 /** 142 * @throws java.lang.Exception 143 * @todo document me 144 */ 145 @Test public void checkHelpBookmarks() 146 throws java.lang.Exception 147 { 148 impl_triggerTest("checkHelpBookmarks"); 149 } 150 151 //------------------------------------------- 152 /** 153 * @throws java.lang.Exception 154 * @todo document me 155 */ 156 // @Test public void checkPrintOptions() 157 // throws java.lang.Exception 158 // { 159 // impl_triggerTest("checkPrintOptions"); 160 // } 161 162 //------------------------------------------- 163 /** 164 * @throws java.lang.Exception 165 * @todo document me 166 */ 167 @Test public void checkAccessibilityOptions() 168 throws java.lang.Exception 169 { 170 impl_triggerTest("checkAccessibilityOptions"); 171 } 172 173 //------------------------------------------- 174 /** 175 * @throws java.lang.Exception 176 * @todo document me 177 */ 178 @Test public void checkUserOptions() 179 throws java.lang.Exception 180 { 181 impl_triggerTest("checkUserOptions"); 182 } 183 184 //------------------------------------------- 185 /** @todo document me 186 */ 187 private void impl_triggerTest(String sTest) 188 throws java.lang.Exception 189 { 190 NamedValue[] lArgs = new NamedValue[1]; 191 lArgs[0] = new NamedValue(); 192 lArgs[0].Name = "Test"; 193 lArgs[0].Value = sTest; 194 m_xTest.execute(lArgs); 195 } 196 197 198 private XMultiServiceFactory getMSF() 199 { 200 final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 201 return xMSF1; 202 } 203 204 // setup and close connections 205 @BeforeClass public static void setUpConnection() throws Exception { 206 System.out.println("setUpConnection()"); 207 connection.setUp(); 208 } 209 210 @AfterClass public static void tearDownConnection() 211 throws InterruptedException, com.sun.star.uno.Exception 212 { 213 System.out.println("tearDownConnection()"); 214 connection.tearDown(); 215 } 216 217 private static final OfficeConnection connection = new OfficeConnection(); 218 219 } 220