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