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.QueryDefinition</code>. <p> 44 * Object implements the following interfaces : 45 * <ul> 46 * <li> <code>com::sun::star::sdb::QueryDefinition</code></li> 47 * <li> <code>com::sun::star::beans::XPropertySet</code></li> 48 * </ul> 49 * This object test <b> can </b> be run in several 50 * threads concurently. 51 * @see com.sun.star.sdb.QueryDefinition 52 * @see com.sun.star.beans.XPropertySet 53 * @see ifc.sdb._QueryDefinition 54 * @see ifc.beans._XPropertySet 55 */ 56 public class OCommandDefinition extends TestCase { 57 58 /** 59 * Creating a Testenvironment for the interfaces to be tested. 60 * Creates service <code>com.sun.star.sdb.QueryDefinition</code>. 61 */ 62 public TestEnvironment createTestEnvironment( TestParameters Param, 63 PrintWriter log ) 64 throws StatusException { 65 XInterface oObj = null; 66 Object oInterface = null; 67 XMultiServiceFactory xMSF = null ; 68 69 try { 70 xMSF = (XMultiServiceFactory)Param.getMSF(); 71 oInterface = xMSF.createInstance( "com.sun.star.sdb.QueryDefinition" ); 72 } 73 catch( com.sun.star.uno.Exception e ) { 74 log.println("Service not available" ); 75 throw new StatusException("Service not available", e) ; 76 } 77 78 if (oInterface == null) { 79 log.println("Service wasn't created") ; 80 throw new StatusException(Status.failed("Service wasn't created")) ; 81 } 82 83 oObj = (XInterface) oInterface; 84 85 log.println( " creating a new environment for object" ); 86 TestEnvironment tEnv = new TestEnvironment( oObj ); 87 88 return tEnv; 89 } // finish method getTestEnvironment 90 } 91 92