1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski package complex.imageManager;
25*b1cdbd2cSJim Jagielski 
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski 
28*b1cdbd2cSJim Jagielski 
29*b1cdbd2cSJim Jagielski import com.sun.star.lang.XInitialization;
30*b1cdbd2cSJim Jagielski import lib.TestParameters;
31*b1cdbd2cSJim Jagielski 
32*b1cdbd2cSJim Jagielski /**
33*b1cdbd2cSJim Jagielski * Testing <code>com.sun.star.lang.XInitialization</code>
34*b1cdbd2cSJim Jagielski * interface methods. <p>
35*b1cdbd2cSJim Jagielski * This test needs the following object relations :
36*b1cdbd2cSJim Jagielski * <ul>
37*b1cdbd2cSJim Jagielski *  <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>):
38*b1cdbd2cSJim Jagielski *   (<b>Optional</b>) : argument for <code>initialize</code>
39*b1cdbd2cSJim Jagielski *   method. If ommitet zero length array is used. </li>
40*b1cdbd2cSJim Jagielski * <ul> <p>
41*b1cdbd2cSJim Jagielski * Test is multithread compilant. <p>
42*b1cdbd2cSJim Jagielski * Till the present time there was no need to recreate environment
43*b1cdbd2cSJim Jagielski * after this test completion.
44*b1cdbd2cSJim Jagielski */
45*b1cdbd2cSJim Jagielski public class _XInitialization {
46*b1cdbd2cSJim Jagielski 
47*b1cdbd2cSJim Jagielski 
48*b1cdbd2cSJim Jagielski     TestParameters tEnv = null;
49*b1cdbd2cSJim Jagielski     public static XInitialization oObj = null;
50*b1cdbd2cSJim Jagielski 
_XInitialization(TestParameters tEnv, XInitialization oObj)51*b1cdbd2cSJim Jagielski     public _XInitialization(TestParameters tEnv, XInitialization oObj) {
52*b1cdbd2cSJim Jagielski 
53*b1cdbd2cSJim Jagielski         this.tEnv = tEnv;
54*b1cdbd2cSJim Jagielski         this.oObj = oObj;
55*b1cdbd2cSJim Jagielski     }
56*b1cdbd2cSJim Jagielski 
57*b1cdbd2cSJim Jagielski     /**
58*b1cdbd2cSJim Jagielski     * Test calls the method with 0 length array and checks that
59*b1cdbd2cSJim Jagielski     * no exceptions were thrown. <p>
60*b1cdbd2cSJim Jagielski     * Has <b> OK </b> status if no exceptions were thrown. <p>
61*b1cdbd2cSJim Jagielski     */
_initialize()62*b1cdbd2cSJim Jagielski     public boolean _initialize() {
63*b1cdbd2cSJim Jagielski         boolean result = true ;
64*b1cdbd2cSJim Jagielski 
65*b1cdbd2cSJim Jagielski         try {
66*b1cdbd2cSJim Jagielski             Object[] args = (Object[]) tEnv.get("XInitialization.args");
67*b1cdbd2cSJim Jagielski             if (args==null) {
68*b1cdbd2cSJim Jagielski                 oObj.initialize(new Object[0]);
69*b1cdbd2cSJim Jagielski             } else {
70*b1cdbd2cSJim Jagielski                 oObj.initialize(args);
71*b1cdbd2cSJim Jagielski             }
72*b1cdbd2cSJim Jagielski 
73*b1cdbd2cSJim Jagielski         } catch (com.sun.star.uno.Exception e) {
74*b1cdbd2cSJim Jagielski             System.out.println("Exception occured while method calling.") ;
75*b1cdbd2cSJim Jagielski             result = false ;
76*b1cdbd2cSJim Jagielski         }
77*b1cdbd2cSJim Jagielski 
78*b1cdbd2cSJim Jagielski         return  result ;
79*b1cdbd2cSJim Jagielski     } // finished _initialize()
80*b1cdbd2cSJim Jagielski 
81*b1cdbd2cSJim Jagielski     /**
82*b1cdbd2cSJim Jagielski     * Disposes object environment.
83*b1cdbd2cSJim Jagielski     */
after()84*b1cdbd2cSJim Jagielski     public void after() {
85*b1cdbd2cSJim Jagielski //        disposeEnvironment() ;
86*b1cdbd2cSJim Jagielski     }
87*b1cdbd2cSJim Jagielski 
88*b1cdbd2cSJim Jagielski } // finished class _XInitialization
89*b1cdbd2cSJim Jagielski 
90*b1cdbd2cSJim Jagielski 
91