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 complex.imageManager;
25 
26 
27 
28 
29 import com.sun.star.lang.XInitialization;
30 import lib.TestParameters;
31 
32 /**
33 * Testing <code>com.sun.star.lang.XInitialization</code>
34 * interface methods. <p>
35 * This test needs the following object relations :
36 * <ul>
37 *  <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>):
38 *   (<b>Optional</b>) : argument for <code>initialize</code>
39 *   method. If ommitet zero length array is used. </li>
40 * <ul> <p>
41 * Test is multithread compilant. <p>
42 * Till the present time there was no need to recreate environment
43 * after this test completion.
44 */
45 public class _XInitialization {
46 
47 
48     TestParameters tEnv = null;
49     public static XInitialization oObj = null;
50 
_XInitialization(TestParameters tEnv, XInitialization oObj)51     public _XInitialization(TestParameters tEnv, XInitialization oObj) {
52 
53         this.tEnv = tEnv;
54         this.oObj = oObj;
55     }
56 
57     /**
58     * Test calls the method with 0 length array and checks that
59     * no exceptions were thrown. <p>
60     * Has <b> OK </b> status if no exceptions were thrown. <p>
61     */
_initialize()62     public boolean _initialize() {
63         boolean result = true ;
64 
65         try {
66             Object[] args = (Object[]) tEnv.get("XInitialization.args");
67             if (args==null) {
68                 oObj.initialize(new Object[0]);
69             } else {
70                 oObj.initialize(args);
71             }
72 
73         } catch (com.sun.star.uno.Exception e) {
74             System.out.println("Exception occured while method calling.") ;
75             result = false ;
76         }
77 
78         return  result ;
79     } // finished _initialize()
80 
81     /**
82     * Disposes object environment.
83     */
after()84     public void after() {
85 //        disposeEnvironment() ;
86     }
87 
88 } // finished class _XInitialization
89 
90 
91