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._fwl;
25 
26 import java.io.PrintWriter;
27 
28 import lib.Status;
29 import lib.StatusException;
30 import lib.TestCase;
31 import lib.TestEnvironment;
32 import lib.TestParameters;
33 import util.utils;
34 
35 import com.sun.star.lang.XMultiServiceFactory;
36 import com.sun.star.uno.XInterface;
37 
38 /**
39  * Test for object which is represented by service
40  * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p>
41  *
42  * Object implements the following interfaces :
43  * <ul>
44  *  <li> <code>com::sun::star::container::XNameAccess</code></li>
45  *  <li> <code>com::sun::star::container::XElementAccess</code></li>
46  *  <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li>
47  * </ul> <p>
48  *
49  * @see com.sun.star.util.XStringSubstitution
50  * @see ifc.util._XStringSubstitution
51  */
52 public class SubstituteVariables extends TestCase {
53 
54     /**
55     * Creating a Testenvironment for the interfaces to be tested.
56     * Creates an instance of the service
57     * <code>com.sun.star.util.PathSubstitution</code>. <p>
58     */
createTestEnvironment(TestParameters Param, PrintWriter log)59     protected TestEnvironment createTestEnvironment
60             (TestParameters Param, PrintWriter log) {
61         XInterface oObj = null;
62         Object oInterface = null ;
63 
64         //now get the OButtonControl
65         try {
66             oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
67                 ("com.sun.star.util.PathSubstitution") ;
68         } catch (com.sun.star.uno.Exception e) {
69             log.println("Couldn't get service");
70             e.printStackTrace(log);
71             throw new StatusException("Couldn't get SubstituteVariables", e );
72         }
73 
74         if (oInterface == null) {
75             log.println("Service wasn't created") ;
76             throw new StatusException(Status.failed("Service wasn't created")) ;
77         }
78 
79         oObj = (XInterface) oInterface ;
80         log.println("ImplName: "+utils.getImplName(oObj));
81 
82         log.println( "creating a new environment for object" );
83         TestEnvironment tEnv = new TestEnvironment( oObj );
84 
85 
86         return tEnv;
87     } // finish method getTestEnvironment
88 
89 }
90 
91