bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _fwl / ContentHandlerFactory.java
blobee007bcaa6d03e70962c87ff459e72cc372e5f7a
1 /*
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 .
19 package mod._fwl;
21 import com.sun.star.beans.NamedValue;
22 import java.io.PrintWriter;
24 import lib.Status;
25 import lib.StatusException;
26 import lib.TestCase;
27 import lib.TestEnvironment;
28 import lib.TestParameters;
29 import util.utils;
31 import com.sun.star.container.XNameAccess;
32 import com.sun.star.lang.XMultiServiceFactory;
33 import com.sun.star.uno.UnoRuntime;
34 import com.sun.star.uno.XInterface;
36 /**
37 * Test for object which is represented by service
38 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
40 * Object implements the following interfaces :
41 * <ul>
42 * <li> <code>com::sun::star::container::XNameAccess</code></li>
43 * <li> <code>com::sun::star::container::XElementAccess</code></li>
44 * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
45 * </ul> <p>
47 * @see com.sun.star.container.XNameAccess
48 * @see com.sun.star.container.XElementAccess
49 * @see com.sun.star.lang.XMultiServiceFactory
50 * @see ifc.container._XNameAccess
51 * @see ifc.container._XElementAccess
52 * @see ifc.lang._XMultiServiceFactory
54 public class ContentHandlerFactory extends TestCase {
56 /**
57 * Creating a Testenvironment for the interfaces to be tested.
58 * Creates an instance of the service
59 * <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
67 try {
68 oInterface = ((XMultiServiceFactory)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();
95 query.Name = "Name";
96 query.Value = "com.sun.star.comp.framework.SoundHandler";
97 querySequenze[0] = query;
99 tEnv.addObjRelation("XContainerQuery.createSubSetEnumerationByProperties",
100 querySequenze);
102 return tEnv;
103 } // finish method getTestEnvironment