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: FrameLoaderFactory.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 com
.sun
.star
.beans
.NamedValue
;
34 import java
.io
.PrintWriter
;
37 import lib
.StatusException
;
39 import lib
.TestEnvironment
;
40 import lib
.TestParameters
;
43 import com
.sun
.star
.container
.XNameAccess
;
44 import com
.sun
.star
.lang
.XMultiServiceFactory
;
45 import com
.sun
.star
.uno
.UnoRuntime
;
46 import com
.sun
.star
.uno
.XInterface
;
49 * Test for object which is represented by service
50 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
52 * Object implements the following interfaces :
54 * <li> <code>com::sun::star::container::XNameAccess</code></li>
55 * <li> <code>com::sun::star::container::XElementAccess</code></li>
56 * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
59 * @see com.sun.star.container.XNameAccess
60 * @see com.sun.star.container.XElementAccess
61 * @see com.sun.star.lang.XMultiServiceFactory
62 * @see ifc.container._XNameAccess
63 * @see ifc.container._XElementAccess
64 * @see ifc.lang._XMultiServiceFactory
66 public class FrameLoaderFactory
extends TestCase
{
69 * Creating a Testenvironment for the interfaces to be tested.
70 * Creates an instance of the service
71 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
73 protected TestEnvironment createTestEnvironment
74 (TestParameters Param
, PrintWriter log
) {
75 XInterface oObj
= null;
76 Object oInterface
= null ;
79 oInterface
= ((XMultiServiceFactory
)Param
.getMSF()).createInstance
80 ("com.sun.star.frame.FrameLoaderFactory") ;
81 } catch (com
.sun
.star
.uno
.Exception e
) {
82 log
.println("Couldn't get service");
83 e
.printStackTrace(log
);
84 throw new StatusException("Couldn't get FrameLoaderFactory", e
);
87 if (oInterface
== null) {
88 log
.println("Service wasn't created") ;
89 throw new StatusException(Status
.failed("Service wasn't created")) ;
92 oObj
= (XInterface
) oInterface
;
93 log
.println("ImplName: "+utils
.getImplName(oObj
));
95 log
.println( "creating a new environment for object" );
96 TestEnvironment tEnv
= new TestEnvironment( oObj
);
98 XNameAccess xNA
= (XNameAccess
) UnoRuntime
.queryInterface
99 (XNameAccess
.class, oObj
);
100 tEnv
.addObjRelation("XMSF.serviceNames", xNA
.getElementNames());
102 // com.sun.star.container.XContainerQuery
103 NamedValue
[] querySequenze
= new NamedValue
[1];
104 NamedValue query
= new NamedValue();
106 query
.Value
= "com.sun.star.frame.Bibliography";
107 querySequenze
[0] = query
;
109 tEnv
.addObjRelation("XContainerQuery.createSubSetEnumerationByProperties",
113 } // finish method getTestEnvironment