1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package mod._dbaccess; 29 30 import java.io.PrintWriter; 31 32 import lib.Status; 33 import lib.StatusException; 34 import lib.TestCase; 35 import lib.TestEnvironment; 36 import lib.TestParameters; 37 38 import com.sun.star.lang.XMultiServiceFactory; 39 import com.sun.star.uno.XInterface; 40 41 /** 42 * Test for object which is represented by service 43 * <code>com.sun.star.sdb.DatasourceAdministrationDialog</code>. <p> 44 * 45 * Object implements the following interfaces : 46 * <ul> 47 * <li> <code>com::sun::star::lang::XInitialization</code></li> 48 * <li> <code>com::sun::star::ui::dialogs::XExecutableDialog</code></li> 49 * <li> <code>com::sun::star::sdb::DatasourceAdministrationDialog</code></li> 50 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 51 * </ul> <p> 52 * 53 * This object test <b> is NOT </b> designed to be run in several 54 * threads concurently. 55 * 56 * @see com.sun.star.lang.XInitialization 57 * @see com.sun.star.ui.dialogs.XExecutableDialog 58 * @see com.sun.star.sdb.DatasourceAdministrationDialog 59 * @see com.sun.star.beans.XPropertySet 60 * @see ifc.lang._XInitialization 61 * @see ifc.ui.dialogs._XExecutableDialog 62 * @see ifc.sdb._DatasourceAdministrationDialog 63 * @see ifc.beans._XPropertySet 64 */ 65 public class ODatasourceAdministrationDialog extends TestCase { 66 67 /** 68 * Creating a Testenvironment for the interfaces to be tested. 69 * Creates an instance of the service 70 * <code>com.sun.star.sdb.DatasourceAdministrationDialog</code>. 71 */ 72 public TestEnvironment createTestEnvironment( TestParameters Param, 73 PrintWriter log ) 74 throws StatusException { 75 XInterface oObj = null; 76 Object oInterface = null; 77 78 try { 79 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance 80 ("com.sun.star.sdb.DatasourceAdministrationDialog" ); 81 } catch( com.sun.star.uno.Exception e ) { 82 log.println("Service not available" ); 83 throw new StatusException("Service not available", e) ; 84 } 85 86 if (oInterface == null) { 87 log.println("Service wasn't created") ; 88 throw new StatusException(Status.failed("Service wasn't created")) ; 89 } 90 91 oObj = (XInterface) oInterface; 92 93 log.println( " creating a new environment for object" ); 94 TestEnvironment tEnv = new TestEnvironment( oObj ); 95 96 return tEnv; 97 } // finish method getTestEnvironment 98 99 } // finish class ODataSourceAdministrationDialog 100 101