1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AppDispatchProvider.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import java
.io
.PrintWriter
;
36 import lib
.StatusException
;
38 import lib
.TestEnvironment
;
39 import lib
.TestParameters
;
43 import com
.sun
.star
.lang
.XMultiServiceFactory
;
44 import com
.sun
.star
.uno
.XInterface
;
47 * Test for object which is represented by service
48 * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
49 * Object implements the following interfaces :
51 * <li> <code>com::sun::star::frame::XDispatchProvider</code></li>
52 * <li> <code>com::sun::star::lang::XInitialization</code></li>
54 * This object test <b> is NOT </b> designed to be run in several
55 * threads concurently.
56 * @see com.sun.star.frame.XDispatchProvider
57 * @see com.sun.star.lang.XInitialization
58 * @see ifc.frame._XDispatchProvider
59 * @see ifc.lang._XInitialization
61 public class AppDispatchProvider
extends TestCase
{
64 * Creating a Testenvironment for the interfaces to be tested.
65 * Creates an instance of the service
66 * <code>com.sun.star.comp.sfx2.SfxMacroLoader</code>. <p>
67 * Object relations created :
69 * <li> <code>'FrameLoader.URL"'</code> for
70 * {@link ifc.frame._XFrameLoader} </li>
73 protected TestEnvironment createTestEnvironment
74 (TestParameters Param
, PrintWriter log
) {
75 XInterface oObj
= null;
76 Object oInterface
= null ;
78 //now get the OButtonControl
80 oInterface
= ((XMultiServiceFactory
)Param
.getMSF()).createInstance
81 ("com.sun.star.comp.sfx2.AppDispatchProvider") ;
82 } catch (com
.sun
.star
.uno
.Exception e
) {
83 log
.println("Couldn't get service");
84 e
.printStackTrace(log
);
85 throw new StatusException("Couldn't get GridControl", e
);
88 if (oInterface
== null) {
89 log
.println("Service wasn't created") ;
90 throw new StatusException(Status
.failed("Service wasn't created")) ;
93 oObj
= (XInterface
) oInterface
;
94 System
.out
.println("ImplName: "+utils
.getImplName(oObj
));
95 dbg
.printInterfaces(oObj
);
97 log
.println( "creating a new environment for object" );
98 TestEnvironment tEnv
= new TestEnvironment( oObj
);
100 // adding relation for :XDispatchProvider
101 tEnv
.addObjRelation("XDispatchProvider.URL", ".uno:BibliographyComponent") ;
104 } // finish method getTestEnvironment