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._fwk;
25 import com.sun.star.beans.XPropertySet;
26 import com.sun.star.lang.XMultiServiceFactory;
27 import com.sun.star.uno.UnoRuntime;
28 import com.sun.star.uno.XComponentContext;
29 import com.sun.star.uno.XInterface;
30 import java.io.PrintWriter;
31 import lib.StatusException;
32 import lib.TestCase;
33 import lib.TestEnvironment;
34 import lib.TestParameters;
35 
36 /**
37  */
38 public class StatusBarControllerFactory extends TestCase {
39     XInterface oObj = null;
40 
createTestEnvironment(TestParameters tParam, PrintWriter log)41     protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
42         TestEnvironment tEnv = null;
43         XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF();
44         try {
45             oObj = (XInterface)xMSF.createInstance("com.sun.star.comp.framework.StatusBarControllerFactory");
46 
47             tEnv = new TestEnvironment(oObj);
48         }
49         catch(com.sun.star.uno.Exception e) {
50             throw new StatusException("Cannot create test object 'StatusBarControllerFactory'", e);
51         }
52         XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xMSF);
53         try {
54             Object o = xProp.getPropertyValue("DefaultContext");
55             XComponentContext xContext = (XComponentContext)UnoRuntime.queryInterface(XComponentContext.class, o);
56             tEnv.addObjRelation("DC", xContext);
57         }
58         catch(com.sun.star.beans.UnknownPropertyException e) {
59             log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test.");
60             e.printStackTrace(log);
61         }
62         catch(com.sun.star.lang.WrappedTargetException e) {
63             log.println("Cannot get the 'DefaultContext' for XMultiComponentFactory test.");
64             e.printStackTrace(log);
65         }
66         return tEnv;
67     }
68 }
69 
70 
71