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 mod._typemgr.uno; 25 26 import com.sun.star.beans.XPropertySet; 27 import com.sun.star.lang.XMultiServiceFactory; 28 import com.sun.star.uno.UnoRuntime; 29 import com.sun.star.uno.XComponentContext; 30 import com.sun.star.uno.XInterface; 31 import java.io.PrintWriter; 32 import lib.TestCase; 33 import lib.TestEnvironment; 34 import lib.TestParameters; 35 36 public class TypeDescriptionManager extends TestCase { 37 initialize( TestParameters Param, PrintWriter log)38 protected void initialize ( TestParameters Param, PrintWriter log) { 39 40 } 41 42 /** 43 * creating a Testenvironment for the interfaces to be tested 44 */ createTestEnvironment(TestParameters Param, PrintWriter log)45 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { 46 XInterface oObj = null; 47 Object oInterface = null; 48 49 try { 50 XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF(); 51 XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( 52 XPropertySet.class, xMSF); 53 // get context 54 XComponentContext xContext = (XComponentContext) 55 UnoRuntime.queryInterface(XComponentContext.class, 56 xProp.getPropertyValue("DefaultContext")); 57 // get the type description manager from context 58 oInterface = xContext.getValueByName("/singletons/" + 59 "com.sun.star.reflection.theTypeDescriptionManager"); 60 } 61 catch( Exception e ) { 62 log.println("Introspection Service not available" ); 63 } 64 oObj = (XInterface) oInterface; 65 66 67 68 log.println( " creating a new environment for Introspection object" ); 69 TestEnvironment tEnv = new TestEnvironment( oObj ); 70 71 // Object relation for XHierarchicalNameAccess ifc 72 // Name of the existing object 73 tEnv.addObjRelation("ElementName", "com.sun.star.container.XNameAccess") ; 74 tEnv.addObjRelation("SearchString", "com.sun.star.loader"); 75 76 return tEnv; 77 } // finish method getTestEnvironment 78 79 } // finish class TypeDescriptionManager 80 81