1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.ui;
25 
26 import com.sun.star.lang.XServiceInfo;
27 import com.sun.star.uno.UnoRuntime;
28 import com.sun.star.ui.XModuleUIConfigurationManagerSupplier;
29 import lib.MultiMethodTest;
30 
31 public class _XModuleUIConfigurationManagerSupplier extends MultiMethodTest {
32 
33     public XModuleUIConfigurationManagerSupplier oObj;
34 
_getUIConfigurationManager()35     public void _getUIConfigurationManager() {
36         String configManagerName = null;
37         String implementationName = null;
38         try {
39             configManagerName = (String)tEnv.getObjRelation("XModuleUIConfigurationManagerSupplier.ConfigurationManager");
40             implementationName = (String)tEnv.getObjRelation("XModuleUIConfigurationManagerSupplier.ConfigManagerImplementationName");
41 
42             // get a config manager for the StartModule
43             Object o = oObj.getUIConfigurationManager(configManagerName);
44             XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, o);
45             String impName = xServiceInfo.getImplementationName();
46             boolean result = impName.equals(implementationName);
47             if (!result) {
48                 log.println("Returned implementation was '" + impName +
49                     "' but should have been '" + implementationName + "'");
50             }
51             tRes.tested("getUIConfigurationManager()", result);
52             return;
53         }
54         catch(com.sun.star.container.NoSuchElementException e) {
55             log.println("Could not get a configuration manager called '" + configManagerName + "'");
56             e.printStackTrace(log);
57         }
58         tRes.tested("getUIConfigurationManager()", false);
59     }
60 }