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._dbaccess; 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 34 import com.sun.star.lang.XMultiServiceFactory; 35 import com.sun.star.uno.XInterface; 36 37 /** 38 * Test for object which is represented by service 39 * <code>com.sun.star.sdb.DatasourceAdministrationDialog</code>. <p> 40 * 41 * Object implements the following interfaces : 42 * <ul> 43 * <li> <code>com::sun::star::lang::XInitialization</code></li> 44 * <li> <code>com::sun::star::ui::dialogs::XExecutableDialog</code></li> 45 * <li> <code>com::sun::star::sdb::DatasourceAdministrationDialog</code></li> 46 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 47 * </ul> <p> 48 * 49 * This object test <b> is NOT </b> designed to be run in several 50 * threads concurently. 51 * 52 * @see com.sun.star.lang.XInitialization 53 * @see com.sun.star.ui.dialogs.XExecutableDialog 54 * @see com.sun.star.sdb.DatasourceAdministrationDialog 55 * @see com.sun.star.beans.XPropertySet 56 * @see ifc.lang._XInitialization 57 * @see ifc.ui.dialogs._XExecutableDialog 58 * @see ifc.sdb._DatasourceAdministrationDialog 59 * @see ifc.beans._XPropertySet 60 */ 61 public class ODatasourceAdministrationDialog extends TestCase { 62 63 /** 64 * Creating a Testenvironment for the interfaces to be tested. 65 * Creates an instance of the service 66 * <code>com.sun.star.sdb.DatasourceAdministrationDialog</code>. 67 */ createTestEnvironment( TestParameters Param, PrintWriter log )68 public TestEnvironment createTestEnvironment( TestParameters Param, 69 PrintWriter log ) 70 throws StatusException { 71 XInterface oObj = null; 72 Object oInterface = null; 73 74 try { 75 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance 76 ("com.sun.star.sdb.DatasourceAdministrationDialog" ); 77 } catch( com.sun.star.uno.Exception e ) { 78 log.println("Service not available" ); 79 throw new StatusException("Service not available", e) ; 80 } 81 82 if (oInterface == null) { 83 log.println("Service wasn't created") ; 84 throw new StatusException(Status.failed("Service wasn't created")) ; 85 } 86 87 oObj = (XInterface) oInterface; 88 89 log.println( " creating a new environment for object" ); 90 TestEnvironment tEnv = new TestEnvironment( oObj ); 91 92 return tEnv; 93 } // finish method getTestEnvironment 94 95 } // finish class ODataSourceAdministrationDialog 96 97