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 mod._sfx; 29 30 import java.io.PrintWriter; 31 32 import lib.Status; 33 import lib.StatusException; 34 import lib.TestCase; 35 import lib.TestEnvironment; 36 import lib.TestParameters; 37 import util.dbg; 38 import util.utils; 39 40 import com.sun.star.lang.XMultiServiceFactory; 41 import com.sun.star.uno.XInterface; 42 43 /** 44 * Test for object which is represented by service 45 * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p> 46 * Object implements the following interfaces : 47 * <ul> 48 * <li> <code>com::sun::star::frame::XDispatchProvider</code></li> 49 * <li> <code>com::sun::star::lang::XInitialization</code></li> 50 * </ul> 51 * This object test <b> is NOT </b> designed to be run in several 52 * threads concurently. 53 * @see com.sun.star.frame.XDispatchProvider 54 * @see com.sun.star.lang.XInitialization 55 * @see ifc.frame._XDispatchProvider 56 * @see ifc.lang._XInitialization 57 */ 58 public class AppDispatchProvider extends TestCase { 59 60 /** 61 * Creating a Testenvironment for the interfaces to be tested. 62 * Creates an instance of the service 63 * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p> 64 * Object relations created : 65 * <ul> 66 * <li> <code>'FrameLoader.URL"'</code> for 67 * {@link ifc.frame._XFrameLoader} </li> 68 * </ul> 69 */ 70 protected TestEnvironment createTestEnvironment 71 (TestParameters Param, PrintWriter log) { 72 XInterface oObj = null; 73 Object oInterface = null ; 74 75 //now get the OButtonControl 76 try { 77 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance 78 ("com.sun.star.comp.sfx2.AppDispatchProvider") ; 79 } catch (com.sun.star.uno.Exception e) { 80 log.println("Couldn't get service"); 81 e.printStackTrace(log); 82 throw new StatusException("Couldn't get GridControl", e ); 83 } 84 85 if (oInterface == null) { 86 log.println("Service wasn't created") ; 87 throw new StatusException(Status.failed("Service wasn't created")) ; 88 } 89 90 oObj = (XInterface) oInterface ; 91 System.out.println("ImplName: "+utils.getImplName(oObj)); 92 dbg.printInterfaces(oObj); 93 94 log.println( "creating a new environment for object" ); 95 TestEnvironment tEnv = new TestEnvironment( oObj ); 96 97 // adding relation for :XDispatchProvider 98 tEnv.addObjRelation("XDispatchProvider.URL", ".uno:BibliographyComponent") ; 99 100 return tEnv; 101 } // finish method getTestEnvironment 102 103 } 104 105