2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import com
.sun
.star
.beans
.NamedValue
;
22 import java
.io
.PrintWriter
;
25 import lib
.StatusException
;
27 import lib
.TestEnvironment
;
28 import lib
.TestParameters
;
31 import com
.sun
.star
.container
.XNameAccess
;
32 import com
.sun
.star
.uno
.UnoRuntime
;
33 import com
.sun
.star
.uno
.XInterface
;
36 * Test for object which is represented by service
37 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
39 * Object implements the following interfaces :
41 * <li> <code>com::sun::star::container::XNameAccess</code></li>
42 * <li> <code>com::sun::star::container::XElementAccess</code></li>
43 * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
46 * @see com.sun.star.container.XNameAccess
47 * @see com.sun.star.container.XElementAccess
48 * @see com.sun.star.lang.XMultiServiceFactory
49 * @see ifc.container._XNameAccess
50 * @see ifc.container._XElementAccess
51 * @see ifc.lang._XMultiServiceFactory
53 public class ContentHandlerFactory
extends TestCase
{
56 * Creating a Testenvironment for the interfaces to be tested.
57 * Creates an instance of the service
58 * <code>com.sun.star.frame.ContentHandlerFactory</code>. <p>
61 protected TestEnvironment createTestEnvironment
62 (TestParameters Param
, PrintWriter log
) {
63 XInterface oObj
= null;
64 Object oInterface
= null ;
66 //now get the OButtonControl
68 oInterface
= Param
.getMSF().createInstance
69 ("com.sun.star.frame.ContentHandlerFactory") ;
70 } catch (com
.sun
.star
.uno
.Exception e
) {
71 log
.println("Couldn't get service");
72 e
.printStackTrace(log
);
73 throw new StatusException("Couldn't get ContentHandlerFactory", e
);
76 if (oInterface
== null) {
77 log
.println("Service wasn't created") ;
78 throw new StatusException(Status
.failed("Service wasn't created")) ;
81 oObj
= (XInterface
) oInterface
;
82 log
.println("ImplName: "+utils
.getImplName(oObj
));
84 log
.println( "creating a new environment for object" );
85 TestEnvironment tEnv
= new TestEnvironment( oObj
);
87 XNameAccess xNA
= UnoRuntime
.queryInterface
88 (XNameAccess
.class, oObj
);
89 tEnv
.addObjRelation("XMSF.serviceNames", xNA
.getElementNames());
90 xNA
.getElementNames();
92 // com.sun.star.container.XContainerQuery
93 NamedValue
[] querySequenze
= new NamedValue
[1];
94 NamedValue query
= new NamedValue();
96 query
.Value
= "com.sun.star.comp.framework.SoundHandler";
97 querySequenze
[0] = query
;
99 tEnv
.addObjRelation("XContainerQuery.createSubSetEnumerationByProperties",
103 } // finish method getTestEnvironment