bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _dbaccess / DBContentLoader.java
blob74ad256c00611d6691562c13b29b6ef46eaa928e
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._dbaccess;
21 import java.io.PrintWriter;
23 import lib.Status;
24 import lib.StatusException;
25 import lib.TestCase;
26 import lib.TestEnvironment;
27 import lib.TestParameters;
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.uno.XInterface;
32 /**
33 * Test for object which is represented by service
34 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
35 * Object implements the following interfaces :
36 * <ul>
37 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
38 * <li> <code>com::sun::star::frame::FrameLoader</code></li>
39 * <li> <code>com::sun::star::frame::XFrameLoader</code></li>
40 * <li> <code>com::sun::star::lang::XInitialization</code></li>
41 * </ul>
42 * This object test <b> is NOT </b> designed to be run in several
43 * threads concurently.
44 * @see com.sun.star.beans.XPropertySet
45 * @see com.sun.star.frame.FrameLoader
46 * @see com.sun.star.frame.XSynchronousFrameLoader
47 * @see com.sun.star.lang.XInitialization
48 * @see ifc.beans._XPropertySet
49 * @see ifc.frame._FrameLoader
50 * @see ifc.frame._XSynchronousFrameLoader
51 * @see ifc.lang._XInitialization
53 public class DBContentLoader extends TestCase {
55 /**
56 * Creating a Testenvironment for the interfaces to be tested.
57 * Creates an instance of the service
58 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
59 * Object relations created :
60 * <ul>
61 * <li> <code>'FrameLoader.URL"'</code> for
62 * {@link ifc.frame._XFrameLoader} </li>
63 * </ul>
65 public TestEnvironment createTestEnvironment( TestParameters Param,
66 PrintWriter log )
67 throws StatusException {
68 XInterface oObj = null;
69 Object oInterface = null ;
71 //now get the OButtonControl
72 try {
73 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance
74 ("com.sun.star.sdb.ContentLoader") ;
75 } catch (com.sun.star.uno.Exception e) {
76 log.println("Couldn't get service");
77 e.printStackTrace(log);
78 throw new StatusException("Couldn't get GridControl", e );
81 if (oInterface == null) {
82 log.println("Service wasn't created") ;
83 throw new StatusException(Status.failed("Service wasn't created")) ;
86 oObj = (XInterface) oInterface ;
88 log.println("ImplementationName " + util.utils.getImplName(oObj));
89 log.println( "creating a new environment for object" );
90 TestEnvironment tEnv = new TestEnvironment( oObj );
92 // adding relation for XFrameLoader
93 tEnv.addObjRelation("FrameLoader.URL",
94 ".component:DB/DataSourceBrowser") ;
97 return tEnv;
98 } // finish method getTestEnvironment