merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _dbaccess / DBContentLoader.java
blob5c5803b4591d9a0a63fdb73408a7bb100f5b2d2f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DBContentLoader.java,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package mod._dbaccess;
33 import java.io.PrintWriter;
35 import lib.Status;
36 import lib.StatusException;
37 import lib.TestCase;
38 import lib.TestEnvironment;
39 import lib.TestParameters;
41 import com.sun.star.lang.XMultiServiceFactory;
42 import com.sun.star.uno.XInterface;
44 /**
45 * Test for object which is represented by service
46 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
47 * Object implements the following interfaces :
48 * <ul>
49 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
50 * <li> <code>com::sun::star::frame::FrameLoader</code></li>
51 * <li> <code>com::sun::star::frame::XFrameLoader</code></li>
52 * <li> <code>com::sun::star::lang::XInitialization</code></li>
53 * </ul>
54 * This object test <b> is NOT </b> designed to be run in several
55 * threads concurently.
56 * @see com.sun.star.beans.XPropertySet
57 * @see com.sun.star.frame.FrameLoader
58 * @see com.sun.star.frame.XSynchronousFrameLoader
59 * @see com.sun.star.lang.XInitialization
60 * @see ifc.beans._XPropertySet
61 * @see ifc.frame._FrameLoader
62 * @see ifc.frame._XSynchronousFrameLoader
63 * @see ifc.lang._XInitialization
65 public class DBContentLoader extends TestCase {
67 /**
68 * Creating a Testenvironment for the interfaces to be tested.
69 * Creates an instance of the service
70 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
71 * Object relations created :
72 * <ul>
73 * <li> <code>'FrameLoader.URL"'</code> for
74 * {@link ifc.frame._XFrameLoader} </li>
75 * </ul>
77 public TestEnvironment createTestEnvironment( TestParameters Param,
78 PrintWriter log )
79 throws StatusException {
80 XInterface oObj = null;
81 Object oInterface = null ;
83 //now get the OButtonControl
84 try {
85 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
86 ("com.sun.star.sdb.ContentLoader") ;
87 } catch (com.sun.star.uno.Exception e) {
88 log.println("Couldn't get service");
89 e.printStackTrace(log);
90 throw new StatusException("Couldn't get GridControl", e );
93 if (oInterface == null) {
94 log.println("Service wasn't created") ;
95 throw new StatusException(Status.failed("Service wasn't created")) ;
98 oObj = (XInterface) oInterface ;
100 log.println("ImplementationName " + util.utils.getImplName(oObj));
101 log.println( "creating a new environment for object" );
102 TestEnvironment tEnv = new TestEnvironment( oObj );
104 // adding relation for XFrameLoader
105 tEnv.addObjRelation("FrameLoader.URL",
106 ".component:DB/DataSourceBrowser") ;
109 return tEnv;
110 } // finish method getTestEnvironment