1*4b5ab84dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*4b5ab84dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*4b5ab84dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*4b5ab84dSAndrew Rist * distributed with this work for additional information 6*4b5ab84dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*4b5ab84dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*4b5ab84dSAndrew Rist * "License"); you may not use this file except in compliance 9*4b5ab84dSAndrew Rist * with the License. You may obtain a copy of the License at 10*4b5ab84dSAndrew Rist * 11*4b5ab84dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*4b5ab84dSAndrew Rist * 13*4b5ab84dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*4b5ab84dSAndrew Rist * software distributed under the License is distributed on an 15*4b5ab84dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*4b5ab84dSAndrew Rist * KIND, either express or implied. See the License for the 17*4b5ab84dSAndrew Rist * specific language governing permissions and limitations 18*4b5ab84dSAndrew Rist * under the License. 19*4b5ab84dSAndrew Rist * 20*4b5ab84dSAndrew Rist *************************************************************/ 21*4b5ab84dSAndrew Rist 22*4b5ab84dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package complex.ConfigItems; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.beans.NamedValue; 27cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 28cdf0e10cSrcweir import com.sun.star.task.XJob; 29cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir import org.junit.After; 33cdf0e10cSrcweir import org.junit.AfterClass; 34cdf0e10cSrcweir import org.junit.Before; 35cdf0e10cSrcweir import org.junit.BeforeClass; 36cdf0e10cSrcweir import org.junit.Test; 37cdf0e10cSrcweir import org.openoffice.test.OfficeConnection; 38cdf0e10cSrcweir // import static org.junit.Assert.*; 39cdf0e10cSrcweir 40cdf0e10cSrcweir //----------------------------------------------- 41cdf0e10cSrcweir /** @short todo document me 42cdf0e10cSrcweir * @deprecated this tests seems no longer work as expected. 43cdf0e10cSrcweir */ 44cdf0e10cSrcweir public class CheckConfigItems 45cdf0e10cSrcweir { 46cdf0e10cSrcweir //------------------------------------------- 47cdf0e10cSrcweir // some const 48cdf0e10cSrcweir 49cdf0e10cSrcweir //------------------------------------------- 50cdf0e10cSrcweir // member 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** points to the global uno service manager. */ 53cdf0e10cSrcweir private XMultiServiceFactory m_xSmgr = null; 54cdf0e10cSrcweir 55cdf0e10cSrcweir /** implements real config item tests in C++. */ 56cdf0e10cSrcweir private XJob m_xTest = null; 57cdf0e10cSrcweir 58cdf0e10cSrcweir //------------------------------------------- 59cdf0e10cSrcweir // test environment 60cdf0e10cSrcweir 61cdf0e10cSrcweir //------------------------------------------- 62cdf0e10cSrcweir /** @short A function to tell the framework, 63cdf0e10cSrcweir which test functions are available. 64cdf0e10cSrcweir 65cdf0e10cSrcweir @return All test methods. 66cdf0e10cSrcweir @todo Think about selection of tests from outside ... 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir // public String[] getTestMethodNames() 69cdf0e10cSrcweir // { 70cdf0e10cSrcweir // return new String[] 71cdf0e10cSrcweir // { 72cdf0e10cSrcweir // "checkPicklist", 73cdf0e10cSrcweir // "checkURLHistory", 74cdf0e10cSrcweir // "checkHelpBookmarks", 75cdf0e10cSrcweir // "checkPrintOptions", 76cdf0e10cSrcweir // "checkAccessibilityOptions", 77cdf0e10cSrcweir // "checkUserOptions" 78cdf0e10cSrcweir // }; 79cdf0e10cSrcweir // } 80cdf0e10cSrcweir 81cdf0e10cSrcweir //------------------------------------------- 82cdf0e10cSrcweir /** @short Create the environment for following tests. 83cdf0e10cSrcweir 84cdf0e10cSrcweir * @throws java.lang.Exception 85cdf0e10cSrcweir * @descr Use either a component loader from desktop or 86cdf0e10cSrcweir from frame 87cdf0e10cSrcweir */ before()88cdf0e10cSrcweir @Before public void before() 89cdf0e10cSrcweir throws java.lang.Exception 90cdf0e10cSrcweir { 91cdf0e10cSrcweir // get uno service manager from global test environment 92cdf0e10cSrcweir m_xSmgr = getMSF(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir // TODO register helper service 95cdf0e10cSrcweir 96cdf0e10cSrcweir // create module manager 97cdf0e10cSrcweir m_xTest = UnoRuntime.queryInterface(XJob.class, m_xSmgr.createInstance("com.sun.star.comp.svl.ConfigItemTest")); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir //------------------------------------------- 101cdf0e10cSrcweir /** 102cdf0e10cSrcweir * @throws java.lang.Exception 103cdf0e10cSrcweir * @short close the environment. 104cdf0e10cSrcweir */ after()105cdf0e10cSrcweir @After public void after() 106cdf0e10cSrcweir throws java.lang.Exception 107cdf0e10cSrcweir { 108cdf0e10cSrcweir // TODO deregister helper service 109cdf0e10cSrcweir 110cdf0e10cSrcweir m_xTest = null; 111cdf0e10cSrcweir m_xSmgr = null; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir //------------------------------------------- 115cdf0e10cSrcweir /** 116cdf0e10cSrcweir * @throws java.lang.Exception 117cdf0e10cSrcweir * @todo document me 118cdf0e10cSrcweir */ checkPicklist()119cdf0e10cSrcweir @Test public void checkPicklist() 120cdf0e10cSrcweir throws java.lang.Exception 121cdf0e10cSrcweir { 122cdf0e10cSrcweir impl_triggerTest("checkPicklist"); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir //------------------------------------------- 126cdf0e10cSrcweir /** 127cdf0e10cSrcweir * @throws java.lang.Exception 128cdf0e10cSrcweir * @todo document me 129cdf0e10cSrcweir */ checkURLHistory()130cdf0e10cSrcweir @Test public void checkURLHistory() 131cdf0e10cSrcweir throws java.lang.Exception 132cdf0e10cSrcweir { 133cdf0e10cSrcweir impl_triggerTest("checkURLHistory"); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir //------------------------------------------- 137cdf0e10cSrcweir /** 138cdf0e10cSrcweir * @throws java.lang.Exception 139cdf0e10cSrcweir * @todo document me 140cdf0e10cSrcweir */ checkHelpBookmarks()141cdf0e10cSrcweir @Test public void checkHelpBookmarks() 142cdf0e10cSrcweir throws java.lang.Exception 143cdf0e10cSrcweir { 144cdf0e10cSrcweir impl_triggerTest("checkHelpBookmarks"); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir //------------------------------------------- 148cdf0e10cSrcweir /** 149cdf0e10cSrcweir * @throws java.lang.Exception 150cdf0e10cSrcweir * @todo document me 151cdf0e10cSrcweir */ 152cdf0e10cSrcweir // @Test public void checkPrintOptions() 153cdf0e10cSrcweir // throws java.lang.Exception 154cdf0e10cSrcweir // { 155cdf0e10cSrcweir // impl_triggerTest("checkPrintOptions"); 156cdf0e10cSrcweir // } 157cdf0e10cSrcweir 158cdf0e10cSrcweir //------------------------------------------- 159cdf0e10cSrcweir /** 160cdf0e10cSrcweir * @throws java.lang.Exception 161cdf0e10cSrcweir * @todo document me 162cdf0e10cSrcweir */ checkAccessibilityOptions()163cdf0e10cSrcweir @Test public void checkAccessibilityOptions() 164cdf0e10cSrcweir throws java.lang.Exception 165cdf0e10cSrcweir { 166cdf0e10cSrcweir impl_triggerTest("checkAccessibilityOptions"); 167cdf0e10cSrcweir } 168cdf0e10cSrcweir 169cdf0e10cSrcweir //------------------------------------------- 170cdf0e10cSrcweir /** 171cdf0e10cSrcweir * @throws java.lang.Exception 172cdf0e10cSrcweir * @todo document me 173cdf0e10cSrcweir */ checkUserOptions()174cdf0e10cSrcweir @Test public void checkUserOptions() 175cdf0e10cSrcweir throws java.lang.Exception 176cdf0e10cSrcweir { 177cdf0e10cSrcweir impl_triggerTest("checkUserOptions"); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir //------------------------------------------- 181cdf0e10cSrcweir /** @todo document me 182cdf0e10cSrcweir */ impl_triggerTest(String sTest)183cdf0e10cSrcweir private void impl_triggerTest(String sTest) 184cdf0e10cSrcweir throws java.lang.Exception 185cdf0e10cSrcweir { 186cdf0e10cSrcweir NamedValue[] lArgs = new NamedValue[1]; 187cdf0e10cSrcweir lArgs[0] = new NamedValue(); 188cdf0e10cSrcweir lArgs[0].Name = "Test"; 189cdf0e10cSrcweir lArgs[0].Value = sTest; 190cdf0e10cSrcweir m_xTest.execute(lArgs); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir getMSF()194cdf0e10cSrcweir private XMultiServiceFactory getMSF() 195cdf0e10cSrcweir { 196cdf0e10cSrcweir final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); 197cdf0e10cSrcweir return xMSF1; 198cdf0e10cSrcweir } 199cdf0e10cSrcweir 200cdf0e10cSrcweir // setup and close connections setUpConnection()201cdf0e10cSrcweir @BeforeClass public static void setUpConnection() throws Exception { 202cdf0e10cSrcweir System.out.println("setUpConnection()"); 203cdf0e10cSrcweir connection.setUp(); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir tearDownConnection()206cdf0e10cSrcweir @AfterClass public static void tearDownConnection() 207cdf0e10cSrcweir throws InterruptedException, com.sun.star.uno.Exception 208cdf0e10cSrcweir { 209cdf0e10cSrcweir System.out.println("tearDownConnection()"); 210cdf0e10cSrcweir connection.tearDown(); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir private static final OfficeConnection connection = new OfficeConnection(); 214cdf0e10cSrcweir 215cdf0e10cSrcweir } 216